!   TITLE:  gimb_therm_up_az_bearing.mac (AAAV)
!
!-----------------------------------------------------------------------
!       Rev -       04/03/2001      J. Rinaldi
!-----------------------------------------------------------------------
!
!   This macro creates the 2D thermal model of the gimbal upper azimuth
!   bearing assembly for AAAV.
!
!   CSgim0: Cartesian Gimbal Coordinate System
!   CSgim1: Cylindrical Gimbal Coordinate System
!   CSgim2: Spherical Gimbal Coordinate System
!
!
!************************** TABLE OF CONTENTS *************************
!
!       Model Assembly Preparation
!
!   1.0  Parameter List
!   2.0  Model Coordinate System
!   3.0  Solid Model
!       3.1  Center Section
!       3.2  Wing Sections
!       3.3  Screw Holes
!       3.4  Bearing Sleeve
!       3.5  Stress Relief Cuts
!       3.6  Bearing Outer Race
!       3.7  FE Model
!   4.0  Apply Constraints & Coupling
!       4.1  Apply Coupling
!       4.2  Apply Constraints
!   5.0  Solve
!   6.0  Process Thermal Results
!
!
!********************* Model Assembly Preparation **********************
!
!
mod_assemb_prep             ! prepare database for assembly

tstart


/title,AAAV Gimbal Upper Azimuth Bearing Thermal Analysis
!
!
/units,bin                  ! British/inch units
!
!
!<<<<<<<<<<<<<<<<<<<<<<<< 1.  Parameter List >>>>>>>>>>>>>>>>>>>>>>>>>>
!
!
gimb_therm_up_az_bearing.parm       ! name of parameter file
!
!
!<<<<<<<<<<<<<<<<<<<< 2.  Model Coordinate Systems >>>>>>>>>>>>>>>>>>>>
!
!
mod_coord_system,0,0,0,0,0,0,0
!
!
!<<<<<<<<<<<<<<<<<<<<<<<<<<<< 3. Solid Model >>>>>>>>>>>>>>>>>>>>>>>>>>

/VIEW, 1 ,,,1
/ANG, 1

!
!
!------------------------- 3.1  Center Section ----------------------
!
csys,CSgim0
!
create_circle,dhubo/2
!
create_area-lines
!
lplot
!
!------------------------- 3.2  Wing Sections -----------------------
!
csys,CSgim0
!
k,,-(pcnt_act/100)*(l11-l7),-(l6-(l9+l10)),0
k,,(pcnt_act/100)*(l5-(l11-l7)),-(l6-(l9+l10)),0
k,,(pcnt_act/100)*(l5-(l11-l7)),(l9+l10),0
k,,-(pcnt_act/100)*(l11-l7),(l9+l10),0
!
create_area
!
asba,am,am-1,,delete,keep
!
aglue,all
!
init_entity_num
!
create_circle,r_gbor
!
create_area-lines
!
*if,pcnt_act,ge,106,then
    asba,am-3,am,,delete,delete
*else
    asba,am-5,am,,delete,delete
*endif
!
init_entity_num
!
k,,0,-2*r_gbor,0
k,,0,2*r_gbor,0
!
create_lines,,1
!
ara_part_line,lm
!
asel,s,loc,x,0,-10
!
adele,all,,,1
!
init_entity_num
cm,aset1,area
!
lplot
!
!------------------------- 3.3  Screw Holes -------------------------
!
csys,CSgim1
!
hole_pattern,CSgim1,rscrwpat,0,,ainc,astart,2*abs(astart),2*rscrwh
!
asel,s,area,,am-8,am,1
cm,aset2,area
!
init_entity_num
!
asba,aset1,aset2,,delete,keep
!
init_entity_num
!
k,,1.5*r_gbor,-90
k,,1.5*r_gbor,90
!
create_lines,,1
!
ara_part_line,lm
!
asel,s,loc,y,90,270
!
adele,all,,,1
!
init_entity_num
!
lplot
!
!------------------------ 3.4  Bearing Sleeve -----------------------
!
csys,CSgim1
!
create_circle,rslvo
!
create_area-lines
!
create_circle,rslvi                 ! bearing sleeve inner radius
!
create_area-lines
!
asba,am-1,am,,delete,delete
!
init_entity_num
!
k,,1.5*r_gbor,-90
k,,1.5*r_gbor,90
!
create_lines,,1
!
ara_part_line,lm
!
asel,s,loc,y,90,270
!
adele,all,,,1
!
init_entity_num
!
radial_asel,'u',CSgim1,rslvi,r_gbor,-90,90
cm,aset1,area
!
init_entity_num
!
lplot
!
!---------------------- 3.5  Stress Relief Cuts ---------------------
!
csys,CSgim1
!
x=acos(((rscrwh+r_cut+t_wall)**2-r_gbor**2-rscrwpat**2)/(-2*r_gbor*rscrwpat))
phi=x*dconv
!
hole_pattern,CSgim1,r_gbor,0,2,,270+phi,ainc-2*phi,2*r_cut
!
asel,s,area,,am-1,am
!
cir_ara_pattern,8,,180-ainc
!
cmsel,u,aset1
radial_asel,'u',CSgim1,rslvi,r_gbor,-90,90
cm,aset2,area
!
init_entity_num
!
asba,aset1,aset2,,delete,delete
!
init_entity_num
!
aglue,all
!
init_entity_num
!
radial_asel,'s',CSgim1,rslvi,r_gbor,-90,90
cm,aset1,area
!
atran,CSgim1,all,,,,1,0
!
adele,aset1,,,1
!
init_entity_num
!
lplot
!
!---------------------- 3.6  Bearing Outer Race ---------------------
!
csys,CSgim1
!
create_circle,rraceo
!
create_area-lines
!
create_circle,rracei            ! bearing outer race inner radius
!
create_area-lines
!
asba,am-1,am,,delete,delete
!
init_entity_num
!
k,,1.5*r_gbor,-90
k,,1.5*r_gbor,90
!
create_lines,,1
!
ara_part_line,lm
!
asel,s,loc,y,90,270
!
adele,all,,,1
!
init_entity_num
!
lplot
!
!--------------------------- 3.7  FE Model --------------------------
!
!
!            (1)     (2)     (3)   (4)    (5)    (6)    (7)  (8)   (9)
! MSH_AREA, mstyp, mshdens, etpa, elmnl, elmxl, lszmsh, mat, real, ecs
!
csys,CSgim1
!
radial_asel,'s',CSgim1,rracei,dhubo/2,-90,90
asel,r,loc,x,rscrwpat
!
msh_area,0,0,1,0.02,0.02,,c416              ! mesh screw holes
!
!
radial_asel,'s',CSgim1,rracei,rraceo,-90,90
!
msh_area,0,0,1,0.02,0.02,,c440c             ! mesh bearing race
!
!
radial_asel,'s',CSgim1,rslvi,rslvo,-90,90
!
msh_area,0,0,1,0.02,0.02,,c416              ! mesh sleeve
!
!
radial_asel,'s',CSgim1,r_gbor,dhubo/2,-90,90
!
msh_area,0,1,1,0.02,0.02,,alum              ! mesh gimbal bore
!
!
radial_asel,'u',CSgim1,rracei,dhubo/2,-90,90
!
msh_area,0,1,1,7*0.02,7*0.02,,alum          ! mesh gimbal wing section
!
lplot
!
!----------------- 4.0  Apply Constraints & Coupling ------------------
!
!
!----------------------- 4.1  Apply Coupling ------------------------
!

! Couple the Outer Race to the Sleeve
csys,CSgim1             ! Rotate all radial coupled nodes
nsel,s,loc,x,rraceo
nrotat,all
cpintf,ux

! Couple the Sleeve to the gimbal
csys,CSgim1             ! Rotate all radial coupled nodes
nsel,s,loc,x,r_gbor
nrotat,all
cpintf,ux


!---------------------- 4.2  Apply Constraints ----------------------
!
! NOTE:  The above nodal cs roatations put the x-axis vertical on the
!        plane of symmetry.  The symmetry constraint must be applied
!        in the uy direction.
!
! Constrain vertical line of symmetry in the hoiz. direction
csys,CSgim0
nsel,s,loc,x,0

csys,CSgim1
nrotat,all              ! Make all nodal CS's on symm plane the same!

csys,CSgim0
d,all,uy                ! Contrain in horizontal direction

! Constrain the bottom corner on the plane of symm.
csys.CSgim0
nsel,s,loc,x,0
nsel,r,loc,y,-dhubo/2,-(1.1*dhubo/2)
d,all,ux
!
!---------------------------- 5.0  Solve ----------------------------
!
alls

save,gimb_therm_up_az_bearing,db    ! Save DB file for use in tc_stiff.mac

fini

! Perform an initial solve to get dicplacement of race center
/solu
antype,0
tunif,Ttest
tref,Troom
solv
fini


! Store thermal movement of center in y
/post1
/out,yoffset,out
csys,CSgim0
nsel,s,loc,y,0
*get,nmx_,node,0,mnloc,x
nm_=node(nmx_,0,0)
*get,uy0,node,nm_,u,y
/out
alls
fini


! Delete lower BC's and reapply with displacement uy0
/prep7
csys,CSgim0
nsel,s,loc,y,-dhubo/2,-(1.1*dhubo/2)
ddele,all,ux
d,all,ux,uy0
alls
fini

! Solve again with compensated initial displacement
/solu
antype,0
tunif,Ttest
tref,Troom
solv
fini

!
!-------------------- 6.0  Process Thermal Results ------------------
!

! Show a displacement dither plot
/post1
rsys,CSgim1     ! Use cylindrical coordinates to get radial displacements
/dscale,1,10    ! Set the deflection scale
/eface,1
avprin,0,0
plnsol,U,X,2,1  ! Show radial displacements

! Get statistics on radial displacement of the inner radius
/out,yoffset,out,,append
rsys,CSgim1
csys,CSgim1
nsel,s,loc,x,rracei
nsort,u,x,1,0                   ! Needed for following *get's
*get,uxmax,sort,0,max
*get,uxmin,sort,0,min
offset=rracei*ALPX440C*(Ttest-Troom)
uxmax=uxmax-offset
uxmin=uxmin-offset
/out

alls


! Collect data for plotting
!*msg,,n,r_cut,dpth_cut,astart,ainc,uxmax,uxmin,trace
!%i %g  %g  %g  %g %g %g %g
/nopr
/out,ux_config,out,,append
*msg,,n,2*r_cut,astart,ainc,uxmax,uxmin
%i %g %g %g %g %g
/out
/gopr

*if,arg1,eq,0,then
    *uilist,ux_config,out
*endif

tstop