!   TITLE:  bearing_compliance.mac (PART_LIB)
!
!
!   This macro creates a bearing section to analyze the compliance
!   of a bearing in the radial direction.  It uses Hertzian contact
!   equations to initiate the model.
!
!       ctbcs:      Cartesian Bearing Coordinate System
!       cylbcs:     Cylindrical Bearing Coordinate System
!       sphbcs:     Spherical Bearing Coordinate System
!
!******************************* TABLE OF CONTENTS **************************
!
!       Model Assembly Preparation
!
!   1.  Parameter List
!   2.  Model Coordinate System
!   2.  Material and Element Type
!   4.  Solid Model
!       4.1  Bearing Race Cross Sections
!           4.1.1  Inner/Outer Race Profiles
!           4.1.2  Circular Cross Section Cut
!           4.1.3  Relocate Race Profiles
!
!************************** Model Assembly Preparation **********************
!
mod_assemb_prep     ! prepare database for assembly
!
/dev,font,1,charter,bold,r,26,,,,,
!
/title,Bearing Compliance Analysis
!
/view,1,1,1,1
/auto,1
/replot
!
/units,bin      ! British/inch units
/prep7
!
!**************************** End Model Preparation *************************
!
!
!
!<<<<<<<<<<<<<<<<<<<<<<<< 1.  Parameter List >>>>>>>>>>>>>>>>>>>>>>>>>>

        name='bearing'  ! part name selection variable
                ! (must be 8 characters or less)


        ct_name='ctbcs'     ! cartesian
        cyl_name='cylbcs'   ! cylindrical
        sph_name='sphbcs'   ! spherical

            ! (all names must be 8 characters or less)

        rconv=pi/180       ! radian conversion constant
        dconv=180/pi       ! degree conversion constant
        rtangle=(pi/2)*dconv

        rin=2.00
        rout=2.50
        h=0.5
        chmf=.05
        wgap=0.1

        dball=0.28
        rrace=0.15
        dbc=rin+((rout-rin)/2)
        dcl=(2*rrace)-dball
        w=wgap+dcl

!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
!
!
!
!<<<<<<<<<<<<<<<<<<<< 2.  Model Coordinate Systems >>>>>>>>>>>>>>>>>>>>
!
!acs=0      ! active coordinate system (c.s.) locating model c.s.
!
!
xc=1.00     ! x (r) coordinate center
yc=2.00     ! y (theta) coordinate center
zc=3.00     ! z (z or phi) coordinate center
!
!
rotxy=0     ! 1st rotation angle (+x to +y)
rotyz=0     ! 2nd rotation angle (+y to +z)
rotzx=0     ! 3rd rotation angle (+z to +x)
!
!
*if,csn,eq,0,then
    csn=10      ! initialize local c.s. numbers
*endif
!
csn=csn+1
%ct_name%=csn       ! cartesian model c.s. number
!
csn=csn+1
%cyl_name%=csn      ! cylindrical model c.s. number
!
csn=csn+1
%sph_name%=csn      ! spherical model c.s. number
!
csys,acs
clocal,%ct_name%,0,xc,yc,zc,rotxy,rotyz,rotzx
!
csys,acs
clocal,%cyl_name%,1,xc,yc,zc,rotxy,rotyz,rotzx
!
csys,acs
clocal,%sph_name%,2,xc,yc,zc,rotxy,rotyz,rotzx
!
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
!
!
!
!<<<<<<<<<<<<<<<<<<<< 3.  Material and Element Type >>>>>>>>>>>>>>>>>>>
!
*if,assemble,eq,0,then
!
!
UIMP,1,EX, , ,10.3E6,       ! Material:  Aluminum
UIMP,1,DENS, , ,.097/386.4,
UIMP,1,NUXY, , ,0.33,
!
!
!
!
ET,1,shell93
ET,2,solid95
!
!
*endif
!
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
!
!
!
!<<<<<<<<<<<<<<<<<<<<<<<<<<< 4.  Solid Model >>>>>>>>>>>>>>>>>>>>>>>>>>
!
!
!
!
!
csys,ctbcs
!
k,,0,0,0
k,,0,1,0
!
init_entity_num
!
axp1=km-1
axp2=km
!
k,,rin-dcl/2+chmf,0,0
k,,dbc-(w/2),0,0
k,,dbc-(w/2),h,0
k,,rin-dcl/2+chmf,h,0
k,,rin-dcl/2,h-chmf,0
!
k,,rin-dcl/2,chmf,0
!
init_entity_num
!
a,km-5,km-4,km-3,km-2,km-1,km
!
k,,dbc+(w/2),0,0
k,,rout+dcl/2-chmf,0,0
k,,rout+dcl/2,chmf,0
k,,rout+dcl/2,h-chmf,0
k,,rout+dcl/2-chmf,h,0
!
k,,dbc+(w/2),h,0
!
init_entity_num
!
a,km-5,km-4,km-3,km-2,km-1,km
!
lplot
!
!
csys,ctbcs
!
csn=csn+1
bcs=csn
clocal,bcs,1,dbc,h/2,0,0,0,0
!
*do,i,0,3*rtangle,rtangle
    k,,rrace,i,0
*enddo
!
init_entity_num
!
a,km-3,km-2,km-1,km
!
init_entity_num
!
asba,am-2,am,,delete,keep
asba,am-1,am,,delete,delete
!
init_entity_num
!
lplot
!
!
csys,ctbcs
csn=csn+1
outrcs1=csn
clocal,outrcs1,0,dbc+w/2,0,0,0,0,0
!
csys,ctbcs
csn=csn+1
inrcs1=csn
clocal,inrcs1,0,dbc-w/2,0,0,0,0,0
!
csn=csn+1
inrcs2=csn
clocal,inrcs2,0,dcl/2,0,0,0,0,0
!
csys,outrcs1
csn=csn+1
outrcs2=csn
clocal,outrcs2,0,-dcl/2,0,0,0,0,0
!
csys,ctbcs
asel,selv,loc,x,rin-dcl/2,dbc
!
csys,inrcs1
atran,inrcs2,all,,,,1,1
!
init_entity_num
!
csys,ctbcs
asel,selv,loc,x,dbc,rout+dcl/2
!
csys,outrcs1
atran,outrcs2,all,,,,0,1
!
init_entity_num
!
lplot
!






*go,:skip1

csys,bcs
*do,i,0,3*rtangle,rtangle
    k,,dball/2,i,0
*enddo
!
init_entity_num
!
a,km-3,km-2,km-1,km
!

:skip1


!*go,:skip2

vrotat,all,,,,,,axp1,axp2,360,4

!:skip2



*go,:skip3

csys,bcs
!
k,,0,0,0
*do,i,0,rtangle,rtangle
    k,,dball/2,i,0
*enddo
!
init_entity_num
!
a,km-2,km-1,km
!
sphrp1=km-2
sphrp2=km
!
asel,selv,loc,r,0,dball/2
asel,r,loc,y,0,rtangle
!
vrotat,all,,,,,,sphrp1,sphrp2,360,4
!
init_entity_num
!
csn=csn+1
clocal,csn,0,0,0,0,0,0,0
!
vsel,selv,loc,y,0,dball/2
vsel,r,loc,x,-dball/2,dball/2
!
vsymm,y,all,,,,1,0
!
init_entity_num
!
aplot

:skip3

finalize_model_data