/gopr
/out,mtorqc2d,out
cmsel,,stator
csys,1
*get,_rmn,node,,mnloc,x
*if,arg1,lt,_rmn,then
cmsel,,rotor
*endif
esel,r,mat,,1
cm,_elm,elem
cm,_nod,node
_ok=0
*if,_mg1,ne,1,then
_mg1=0
*endif
*get,_nops,active,,prkey
*get,_mnu,active,,menu
*get,_arout,active,,rout
*if,_arout,ne,31,then
*msg,warn
Enter Post1 before issuing this command macro
/wait,_dely
_ok=1
*else
torque=
/gsave,sasigrph
*get,_sysr,active,,rsys
*get,_sysd,active,,dsys
*get,_sysc,active,,csys
*get,_unit,active,,solu,emunit
*get,_mu,active,,solu,muzro
*get,_dimn,active,,solu,dimn
*get,_antyp,active,,anty
*if,_dimn,eq,3,then
esel,,ename,,13,53,40
*get,_num2d,elem,,count
*if,_num2d,gt,0,then
_dimn=2
*else
_dimn=3
*endif
cmsel,s,_elm
_num2d=
*endif
*if,_dimn,eq,3,then
*msg,warn
Command macro TORQC2D may not be valid for 3-d analysis
/wait,_dely
_ok=0
*endif
*if,_dimn,eq,1,then
*msg,error
Command macro TORQC2D is not available for axisymmetric analysis
/wait,dely
_ok=1
*else
_afun=atan(1)
*if,_afun,gt,1,then
*afun,rad
*endif
_pi=4*atan(1)
*if,arg1,eq,0,then
*msg,error
Radius for torque evaluation is required, reissue command macro
/wait,_dely
_ok=1
*endif
*if,arg2,eq,0,then
arg2=18
*endif
*if,_unit,gt,2,then
*msg,error
Invalid units option specified, please reissue command macro
_ok=1
*endif
*if,_unit,le,2,then
*if,arg3,eq,0,then
_tcsys=99
local,_tcsys,1
*elseif,arg3,eq,1,then
_tcsys=99
local,_tcsys,1
*msg,info
Local c.s. (csys=1) changed to 99 (csys=99)
*else
_tcsys=arg3
csys,_tcsys
*endif
nsle
*get,_endang,node,,mxloc,y
*get,_staang,node,,mnloc,y
_partcir=1
cscir,_tcsys,1
*get,_endang1,node,,mxloc,y
*get,_staang1,node,,mnloc,y
cscir,_tcsys
_hat=
*dim,_hat,array,2
_phist = _pi*_staang/180
_phien = _pi*_endang/180
_xbeg = arg1*cos(_phist)
_ybeg = arg1*sin(_phist)
_xend = arg1*cos(_phien)
_yend = arg1*sin(_phien)
*get,_lsno2,active,,set,lstp
*if,_lsno2,eq,0,then
*msg,error
Read in desired load step data (see SET command)
_ok=1
*endif
_de_a1=_endang1-_staang1
_de_a2=_endang-_staang
_partcir=1
*if,_de_a2,gt,180,then
*if,_de_a1,gt,180,then
_partcir=0
*endif
*endif
*msg,info,_partcir
_partcir flag: %g
_strad=0
*if,_partcir,eq,1,then
*if,_endang*_staang,lt,0,then
_strad=1
*afun,deg
_xbeg = arg1*cos(_staang1)
_ybeg = arg1*sin(_staang1)
_xend = arg1*cos(_endang1)
_yend = arg1*sin(_endang1)
_sendang=_endang
_endang=_endang1
*afun,rad
*endif
*endif
*if,_partcir,eq,0,then
cscir,_tcsys,0
path,_torq,2,,arg2*48
ppath,1,,-arg1,-1.e-6,,_tcsys
ppath,2,,-arg1,0,,_tcsys
*elseif,_partcir,ne,0,then
*if,_staang,gt,180,then
cscir,_tcsys,1
path,_torq,2,,arg2*48
ppath,1,,_xbeg,_ybeg
ppath,2,,_xend,_yend
*elseif,_endang,ge,180,then
path,_torq,3,,arg2*24
ppath,1,,_xbeg,_ybeg
ppath,2,,-arg1,arg1*1.e-4
cscir,_tcsys,1
ppath,3,,_xend,_yend
*else
cscir,_tcsys,0
path,_torq,2,,arg2*48
ppath,1,,_xbeg,_ybeg
ppath,2,,_xend,_yend
*endif
*endif
rsys
csys
*if,_antyp,ne,3,then
pdef,_bax1,b,x
pdef,_bay1,b,y
rsys,1
pdef,bradial,b,x
pdef,btanget,b,y
rsys
pvect,norm,nx,ny,nz
pdot,pv02,_bax1,_bay1,_bay1,nx,ny,nz
pcalc,mult,pv03,xg,_bay1
pcalc,mult,pv04,yg,_bax1
pcalc,add,pv03,pv03,pv04,,-1
pcalc,mult,pv02,pv02,pv03
pcalc,intg,torq,pv02,s,1/_mu
*get,_hat(1),path,,last,torq
torque = _hat(1)
*else
*do,_i,1,2
set,_lsno2,1,,_i-1
*if,_i,eq,1,then
pdef,_bax1,b,x
pdef,_bay1,b,y
*else
pdef,_bax2,b,x
pdef,_bay2,b,y
*endif
*enddo
pvect,norm,nx,ny,nz
pdot,pv02,_bax1,_bay1,_bay1,nx,ny,nz
pcalc,mult,pv03,xg,_bay1
pcalc,mult,pv04,yg,_bax1
pcalc,add,pv03,pv03,pv04,,-1
pcalc,mult,pv02,pv02,pv03
pcalc,intg,torq,pv02,s,1/_mu
*get,_hat(1),path,,last,torq
pdot,pv02,_bax2,_bay2,_bay2,nx,ny,nz
pcalc,mult,pv03,xg,_bay2
pcalc,mult,pv04,yg,_bax2
pcalc,add,pv03,pv03,pv04,,-1
pcalc,mult,pv02,pv02,pv03
pcalc,intg,torq,pv02,s,1/_mu
*get,_hat(2),path,,last,torq
torque = 0.5*(_hat(1)+_hat(2))
*endif
*if,_mnu*(1-_mg1),ne,0,then
/auto
dsys,0
/pbc,path,1
nplot
/pbc,path,0
*endif
*endif
*if,_unit,eq,2,then
torque=torque/(16*atan(1))
*endif
/out,mtorqc2d,sum
*msg,info
________________SUMMARY OF CIRCULAR TORQUE CALCULATIONS______________
*if,_partcir,eq,0,then
*msg,info
%/Torque Evaluation is based on a full circle
*if,_unit,le,1,then
*msg,info,arg1,torque
%/Torque at radius ( %g ) is : %g N*m/m
*elseif,_unit,eq,2,then
*msg,info,arg1,torque
%/Torque at radius ( %g ) is : %g Dyne*cm/cm
/wait,_dely
*endif
*else
*msg,info,(_endang-_staang)
%/Torque Evaluation is based on an arc of %g deg.
*msg,info,_staang
Starting Angle of Evaluation : %g
*msg,info,_endang
Ending Angle of Evaluation : %g
*if,_unit,le,1,then
*msg,info,arg1,torque
%/Torque at radius ( %g ) is : %g N*m/m
*elseif,_unit,eq,2,then
*msg,info,arg1,torque
%/Torque at radius ( %g ) is : %g Dyne*cm/cm
*endif
*msg,info
%/Parameter defined for the torque: TORQUE
*endif
*msg,info
_____________________________________________________________________
/out,mtorqc2d,out,,append
/nopr
arn= $_bfac= $_bmax= $bmin= $_btax= $_btin= $_delang= $_difflas=
_endang= $_ierror= $_iexec= $ind1_= $ind2_= $_nnmax= $de=
_nnstar= $_nodnag= $_npath= $_nrem= $_partcir= $_nmax1=
pfac= $_pi= $pmax= $pmin= $_rintdiv= $_rrem= $_rres= $_staang=
_tcsys= $_tfac= $tmin= $_tmax= $_torq= $_ylast= $_ynexlas=
_arg1= $_rres= $_rrem=
_nnsav=
_phist= $_phien= $_xbeg= $_ybeg= $_xend= $_yend=
_hat= $_bax1= $_bay1= $_bax2= $_bay2= $_hator= $_antyp= $_lsno2=
*endif
_mu=
*endif
_npathn=
_nnode=
rsys,_sysr
dsys,_sysd
csys,_sysc
_sysr=
_sysd=
_sysc=
_unit=
_mu=
_dimn=
*if,_afun,gt,1,then
*afun,deg
*endif
_afun=
/out,mtorqc2d,out,,append
/gresume,sasigrph
dummy=
_dely=
/out,mtorqc2d,out,,append
/out
*if,_arout*(_ok+1),eq,31,then
*list,mtorqc2d,sum
*if,_mnu*(1-_mg1),ne,0,then
*uilist,mtorqc2d,sum
*endif
*endif
_arout=
_mnu=
_ok=
/uis,msgpop
cmsel,s,_elm
cmsel,s,_nod
cmdele,_elm
cmdele,_nod
/out
_unit=
*if,_nops,eq,0,then
/nopr
_nops=
*else
_nops=
/go
*endif