!
!   TITLE:  ea_sol.mac
!
!   Read in Ansys DB file "ea_assy.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/16/00
!


!*go,:skip

FINISH
/clear,start
resume,ea_assy,db
!
/out,ea_sol,out

/prep7

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

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

! Constrain the torquer bearing journal in all directions
asel,s,area,,169,172
da,all,all,0,1
alls


! Constrain band drive journal to rotate only
csys,CSm_res1
nsel,s,loc,z,0.1,1
nsel,r,loc,x,1

nrot,all
d,all,ux
alls

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

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

ksel,s,loc,x,1
ksel,r,z,.532,7.873-7.125

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

FINISH
/config,fsplit,250

/solu

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

solve

*get,stopw,active,0,time,wall
*get,stopc,active,0,time,cpu
*msg,info,(stopw-startw)*60
The wall clock time duration was %G minutes.
*msg,info,(stopc-startc)*60
The CPU time duration was %G minutes.

finish
/post1

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

:skip
! 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,.577
nsel,r,loc,x,1

*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)

vsum
*get,xcg,volu,0,cent,x
*get,ycg,volu,0,cent,y
/out,ea_sol,sum
*msg,info,bTorque
Applied torque:                %g in-lbf

*msg,info,ycg
CG horiz. distance from rotation axis:  %g
*msg,info,sqrt(ycg^2+rcg^2)
CG total distance from rotation axis:   %g

*msg,info

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

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

/out
*uilist,ea_sol,sum

/out

/title,Mirror Support - No Additional Cuts (K = %kt_% in-lb/rad)