!   TITLE:  mirror.mac
!
!---------------------------------------------------------------------------
!       Rev -   03/14/2000  J. Rinaldi
!       Rev A   01/17/2002  D. Edwards
!---------------------------------------------------------------------------
!
!   This is a macro that builds the AAAV mirror.  It is current for ANSYS
!   5.6.  The model is built off of a set of local coordinate systems:
!
!   CSm0:       Cartesian Mirror Coordinate System
!   CSm1:       Cylindrical Mirror Coordinate System
!   CSm2:       Spherical Mirror Coordinate System
!
!
!******************************* TABLE OF CONTENTS **************************
!
!      Model Assembly Preparation
!
!   1. Model Coordinate System
!   2. Material and Element Type
!   3. Parameter List
!   4. Solid Model
!       4.1  Create Center Boss Volume
!           4.1.1  Create Boss Area Profile
!       4.2  Create Center Section
!           4.2.1  Create Center Section Area Profile
!       4.3  Create Outer Mirror Volumes
!       4.4  Volume Symmetry Reflection
!
!
!************************** Model Assembly Preparation **********************
!
mod_assemb_prep,arg1,arg2,arg3          ! prepare database for assembly
!
!<<<<<<<<<<<<<<<<<<<<<<<< 1.  Parameter List >>>>>>>>>>>>>>>>>>>>>>>>>>
!
!
mirror.parm             ! name of parameter file
!
!
!<<<<<<<<<<<<<<<<<<<< 2.  Model Coordinate Systems >>>>>>>>>>>>>>>>>>>>
!
mod_coord_system,acs,xc,yc,zc,rotxyc,rotyzc,rotzxc
!
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 3. Solid Model >>>>>>>>>>>>>>>>>>>>>>>>>
!
!
!----------------- 3.1  Create Center Boss Volume -----------------
!
!
!----------------- 3.1.1  Create Boss Area Profile ----------------
!
csys,CSm1
!
wpcsys,-1
!
*if,f_mesh_,eq,1,then
    cyl4,0,0,adap_d3/2,0,dboss/2,90,l1
    cyl4,0,0,0,0,adap_d3/2,90,l1        ! Split hub to match adapter_ring hole
*else
    cyl4,0,0,0,0,dboss/2,90,l1          ! Solid hub
*endif
!
asel,selv,loc,z,l1
cm,na2,area
!
init_entity_num
!
lplot
!
!-------------------- 3.2  Create Center Section --------------------
!
!
!------------- 3.2.1  Create Center Section Area Profile ------------
!
csys,CSm0
!
k,,l2,0,l1
k,,l2,h1,l1
k,,0,h1,l1
k,,0,0,l1
!
create_area
!
asba,am,na2,,delete,keep
!
init_entity_num
!
asel,selv,loc,z,l1
!
extrude_aset,l3
!
init_entity_num
!
lplot
!
!------------------ 3.3  Create Outer Mirror Volumes ----------------
!
csys,CSm0
!
k,,l4/2,0,(l1+l3)
k,,l4/2,0,(l1+l3-l5)
!
k,,l4/2,h2/2,(l1+l3)
k,,l4/2,h2/2,(l1+l3-l5)
!
k,,0,h2/2,(l1+l3)
k,,0,h2/2,(l1+l3-l5)
!
init_entity_num
!
lstr,km-5,km-4
lstr,km-3,km-2
lstr,km-1,km
lstr,km-5,km-3
lstr,km-3,km-1
!
lstr,km-4,km-2
lstr,km-2,km
lstr,km-4,kp(l2,0,l1)
lstr,km,kp(0,h1,l1)
lstr,km-2,kp(l2,h1,l1)
!
lstr,km-5,kp(l2,0,(l1+l3))
lstr,km-3,kp(l2,h1,(l1+l3))
lstr,km-1,kp(0,h1,(l1+l3))
!
p1=kp(l2,0,(l1+l3))
p2=kp(l2,h1,(l1+l3))
p3=kp(0,h1,(l1+l3))
!
p4=kp(l2,0,l1)
p5=kp(l2,h1,l1)
p6=kp(0,h1,l1)
!
v,km-5,km-4,km-2,km-3,p1,p4,p5,p2
v,km-3,km-2,km,km-1,p2,p5,p6,p3
!
k,,l4/2,(h2/2)-h3,1.2*(l1+l3)
k,,l4/2,(h2/2)-h3,0
k,,(l4/2)-l6,(h2/2),0
k,,(l4/2)-l6,(h2/2),1.2*(l1+l3)
!
init_entity_num
!
a,km-3,km-2,km-1,km
!
init_entity_num
!
vsel,selv,volu,,vm-1,vm,1
!
vol_part_area,am
!
init_entity_num
!
vdele,vm-3,vm-1,2,1
!
init_entity_num
!
lplot
!
!------------------ 3.4  Volume Symmetry Reflection -----------------
!
csys,CSm0
!
vsymm,x,all,,,,1,0
vsymm,y,all,,,,1,0
!
init_entity_num
!
lplot

!
!----------------------------- 4  Meshing ---------------------------------
!
*if,f_mesh_,eq,1,then

/USER, 1
/VIEW, 1,  0.360298590907    ,  0.789010142612    , -0.497642361787
/ANG,  1,   102.891877336
/REPLO

nummrg,kp

init_entity_num

! Map mesh the areas that interface to adapter_ring
csys,CSm0
asel,selv,loc,z,l1
csys,CSm1
asel,r,loc,x,adap_d3/2,dboss/2
msh_standrd,3,1,0,,1,2,.2,.2,al6061

csys,CSm0
asel,selv,loc,z,l1
csys,CSm1
asel,u,loc,x,adap_d3/2,dboss/2
msh_standrd,3,0,0,,1,2,.2,.2,al6061,,-1

asel,selv,loc,z,l7
asel,u,loc,x,-l2,l2

!           1 2 34 5 6 7  8  9    10 11
msh_standrd,3,0,0,,1,2,.5,.5,al6061,,-1

alls

*endif

finalize_model

:skip