!
!   TITLE:  ms_cut_sol.mac
!
!   Read in Ansys DB file "ms_cut_mesh.db", apply boundary conditions
!   and perform a static analysis.
!
!   The applied boundary conditions are for determining the torsional
!   stiffness about the axis of rotation.
!
!   D. Edwards 10/31/00
!

FINISH
/clear,start
resume,ms_cut_mesh,db

!
/out,ms_cut_sol,out

/prep7

! Get the time
*get,startw,active,0,time,wall

/pbc,all, ,0        ! Turn off symbols until after nrotat command

! Constrain the torquer bearing journal in all directions
csys,CSm_trq1

parm_val,'mir_supt','EXTD5','extd5'
parm_val,'mir_supt','L18','l18'
parm_val,'mir_supt','D1','d1'
asel,s,loc,z,1.05*extd5,.95*(l18+extd5)
asel,r,loc,x,0,d1/2
da,all,all,0,1
alls


! Constrain band drive journal to rotate only
csys,CSm_res1

parm_val,'mir_supt','EXTD4','extd4'
parm_val,'mir_supt','TSIDE','tside'
parm_val,'mir_supt','DOS','bRadius'
bRadius=bRadius/2       ! [in]    Radius of band drive journal

nsel,s,loc,z,tside,tside+extd4
nsel,r,loc,x,bRadius

nrot,all
d,all,ux
alls

! Apply force-moment couple to band drive journal
bTorque=1.0     ! [in-lb] Applied torque

! [lb]    Force value for each of the four tangential forces
bforce=.25*bTorque/bRadius

csys,CSm_res1
ksel,s,loc,x,bRadius
ksel,r,loc,z,extd4,tside+1.05*extd4

fk,all,FY,bforce
alls

*get,ncnt,node,0,count
*msg,info,ncnt,ncnt*3
There are %G nodes and %G degrees of freedom in this model

/pbc,all, ,1
aplot

vsum
*get,xcg,volu,0,cent,x
*get,ycg,volu,0,cent,y

!*go,:skip

finish
/config,fsplit,250

/solu

!******************************
!*** Powerdynamics - PCG Solve
!******************************
antype,0
eqslv,pcg,1E-6

solve

*get,stopw,active,0,time,wall
*msg,info,(stopw-startw)*60
The solve time was %G minutes.


finish
/post1

rsys,CSm_res1
/eface,2
avprin,0,0,
plnsol,u,y,0,1

! Get the results
! Obtain the average rotation of all the nodes on the edge where the 
! force moment couple is applied on the band drive journal.

! Select the circular edge
csys,CSm_res1
nsel,s,loc,z,tside+extd4
nsel,r,loc,x,bRadius

*get,nstart,node,,num,min
*get,ncnt,node,,count
*dim,thetab,array,ncnt


*vget,thetab(1),node,nstart,u,y

sum=0
*do,i,1,ncnt
    sum=sum+thetab(i)
*enddo

ave=sum/ncnt
ktorsion=bTorque/ave
kt_=nint(ktorsion)

alls

/out,ms_cut_sol,sum
*msg,info
   *** Results Summary of Cut Mirror Support ***

*msg,info

*msg,info
Macros: mirror_support_cut, ms_cut_mesh, ms_cut_sol

*msg,info

*msg,info,bTorque
Applied torque:                %g in-lbf

*msg,info,(xcg**2+ycg**2)**.5
Total distance from axis of rotation to CG: %g

*msg,info

*msg,info,ave*180/pi,ave
Average twist at band drive: %g deg (%g rad)

*msg,info,ktorsion
*** Spring rate:  %G (in-lb)/rad

/out
*uilist,ms_cut_sol,sum

/out

/title,Mirror Support - Cut (K = %kt_% in-lb/rad)

:skip