!   TITLE:  scr.mac (BLACKHAWK)
!
!---------------------------------------------------------------------------
!       Rev -   02/28/2002      D. Edwards
!       Rev A   07/02/2003      D. Edwards
!               Added corner raddi at gap
!---------------------------------------------------------------------------
!
!   This macro creates the slip-clutch ring component used in the Blackhawk
!   project.
!
!   CSscr0:     Cartesian Slip-Clutch Ring Coordinate System
!   CSscr1:     Cylindrical Slip-Clutch Ring Coordinate System
!   CSscr2:     Spherical Slip-Clutch Ring Coordinate System
!
!
!************************** TABLE OF CONTENTS **************************
!
!       Model Assembly Preparation
!
!   1.  Parameter List
!   2.  Model Coordinate System
!   3.  Solid Model
!   4.  Meshing
!   5.  Constraints
!   6.  Solution
!   7.  Post Processing
!
!********************* Model Assembly Preparation **********************
!
mod_assemb_prep,arg1,arg2,arg3
!
!<<<<<<<<<<<<<<<<<<<<<<<< 1.  Parameter List >>>>>>>>>>>>>>>>>>>>>>>>>>
!
!slip_clutch_ring.parm
scr.parm
!
!<<<<<<<<<<<<<<<<<<<< 2.  Model Coordinate System >>>>>>>>>>>>>>>>>>>>>
!
mod_coord_system,acs,xc,yc,zc,rotxyc,rotyzc,rotzxc
!
!<<<<<<<<<<<<<<<<<<<<<<<<<<< 3.  Solid Model >>>>>>>>>>>>>>>>>>>>>>>>>>
!
!-------------------------- 3.1  Ring Model --------------------------------
!
csys,CSscr0
!
view,'f'
!
cyl4,0,0,IDring/2,-90,,90       ! Make eccectric ID/OD to each other
cyl4,0,ecc,ODring/2,-90,,90

init_entity_num

asba, am,am-1,,delete,delete

rectng,0,gap/2,0,ODring         ! Cut slot

init_entity_num

asba, am,am-1,,delete,delete

init_entity_num

lplot

!
! Radius corners at gap
!
adele,all

init_entity_num

! Outer corner
ln_sel_end, 'l1',gap/2,ODring/2,0,1
ln_sel_end, 'l2',gap/2,ODring/2,0,2
lfillt,l1,l2,r1

! Inner corner
ln_sel_end, 'l1',gap/2,IDring/2,0,1
ln_sel_end, 'l2',gap/2,IDring/2,0,2
lfillt,l1,l2,r2

al,all

init_entity_num

!
!----------------------------- 4.  Meshing ---------------------------------
!
!            (1)     (2)     (3)   (4)    (5)    (6)    (7)  (8)   (9)
! MSH_AREA, mstyp, mshdens, etpa, elmnl, elmxl, lszmsh, mat, real, ecs
!
msh_area,,,,0.005,0.005
!msh_area,,,,0.080,0.080

!
!----------------------------- 5. Constraints ------------------------------
!

csys,CSscr1
nsel,s,loc,x,IDring/2-.001,IDring/2
nrotat,all                              ! Rotate nodal CSs into polor orientation
cm,ring_set,node

! Set symmetry conditions
csys,CSscr0
nsel,s,loc,x,0
nsel,r,loc,y,-ODring,-IDring/2-.00001
d,all,ux
!
nsel,s,loc,x,0
nsel,r,loc,y,-IDring/2-.00001
d,all,uy

! Set the contact element spring rate based on the number of nodes
! THETA, KN, INTF, START, KS, REDFACT
csys,CSscr1
cmsel,s,ring_set
*GET,Ncontac,NODE,0,count
!r,2,,KN2/Ncontac,INTF2,START2
r,2,KN2/Ncontac,-INTF2

noffset=0.01        ! For visual clarity, offset nodes for contact elems.
ngen,2,nm+1,all,,,-noffset

mat,2
type,2
real,2

!EINTF, TOLER, K, TLAB, KCN, DX, DY, DZ, KNONROT
eintf,,,high,CSscr1,noffset,,,0
nsel,s,loc,x,IDring/2-noffset
cmsel,u,ring_set
d,all,all

init_entity_num,1

fini

!
!----------------------------- 6. Solution ---------------------------------
!
/solu

antype,static

solcontrol,on,on

solve

fini

/post1

csys,CSscr1
nsel,s,loc,x,IDring/2-noffset
rsys,csscr1


/out,rad_force,lst
    prrsol,f
/out

! Plot the normal force on the inner edge verses angular position going from the 
! bottom of the model to the top
mkdat=1
rplot_nodal,CSscr1,'y','rf','fx'   ! Uses nodal CS

!/pbc,nfor,,1
!nplot