/uis,msgpop,3
/out,mvrotor,out
alls
csys,1
cmsel,,stator
*get,thmn,node,,mnloc,y
*get,thmx,node,,mxloc,y
_mod_ang=thmx-thmn
*get,_mnu,active,,menu
*if,_mnu,ne,0,then
*if,arg9,eq,1,then
*if,abs(thmx-thmn),lt,200,then
*ask,_arg1,Enter the Angle of Position for the Rotor,0
*else
*ask,_arg1,Enter the Angle Increment for the Rotor,0
*endif
arg1=_arg1
*endif
*endif
fini
_evod=1
/prep7
immed,0
_ierror=0
_appsti=arg2
*msg,info,arg1
move to angle: %g
*if,(thmx-thmn),gt,200,then
a_rg1=arg1
_thtinc=arg1
cmsel,,rotor
*get,cur_a,node,mrk_nod,loc,y
_cthtmn=cur_a
csys,1
ngen,2,,all,,,0,a_rg1
cmsel,,rotor
nsel,r,ext
*get,rdmx,node,,mxloc,x
nsel,r,loc,x,rdmx-.00001,rdmx+1
*get,_ncount,node,,count
cm,ce_n,node
cmsel,,stator
esel,r,mat,,1
cmsel,,ce_n
cedel,all,,,any
numc,ce
ceintf,.1
*else
*if,arg2,ne,0,then
cmsel,,stator
csys,1
nsel,r,ext
*get,_rmin,node,,mnloc,x
*get,_rmax,node,,mxloc,x
_rave=(_rmin+_rmax)/2
*get,_thtmax,node,,mxloc,y
_perndr=node(_rave,_thtmax,0)
*get,_cpmx,active,,cp
*get,_cemx,active,,ce
nsel,,,,_perndr
nsel,r,cp,,1,_cpmx
*get,_ncpnd,node,,count
nsel,,,,_perndr
nsel,r,ce,,1,_cemx
*get,_ncend,node,,count
*if,_ncpnd,ne,0,then
_evod=2
*endif
*if,_ncend+_ncpnd,eq,0,then
_appsti=0
_ierror=1
*endif
*endif
cmsel,,rotor
csys,1
*get,_cthtmx,node,,mxloc,y
*get,_cthtmn,node,,mnloc,y
g_mark
/out,mvrotor,out,,append
_cthtmn=rot_thet
cmsel,,rotor
_thtinc=arg1-_cthtmn
_cthtmx=_cthtmn+_mod_ang
nsle
*if,_ierror,eq,0,then
ngen,2,,all,,,0,_thtinc
*if,_appsti,eq,1,then
stitch6,arg3
cmsel,,_cerotor
*get,_ncount,node,,count
*endif
*get,_cpmx,active,,cp
*get,_cemx,active,,ce
*set,_pernd
*dim,_pernd,,4,4
_pernd(1,3)=10,1,10,1
_pernd(1,4)=1,-1,1,1
*set,_cpce
*dim,_cpce,char,2
*set,_invr
*dim,_invr,table,4
_invr(1,0)=-1e8,-.1,.1,1e8
_invr(1,1)=0,1,1,0
_cpce(1)='ce','cp'
csys,1
cmsel,,stator
*get,_rmin,node,,mnloc,x
*get,_thtmax,node,,mxloc,y
*get,_thtmin,node,,mnloc,y
_pernd(1,1)=node(_rmin,_thtmax,0)
_pernd(2,1)=node(_rmin,_thtmin,0)
nsel,,,,_pernd(1,1)
nsel,a,,,_pernd(2,1)
esln
nsle
nsel,u,,,_pernd(1,1)
nsel,u,,,_pernd(2,1)
*get,_rmax,node,,mxloc,x
_pernd(3,1)=node(_rmax,_thtmax,0)
_pernd(4,1)=node(_rmax,_thtmin,0)
_cpcemx=_cpmx+_cemx
alls
_cemx=_cemx+1
ce,_cemx,0,_pernd(1,1),az,1,_pernd(2,1),az,_pernd(_evod,4)
_cemx=_cemx+1
ce,_cemx,0,_pernd(3,1),az,1,_pernd(4,1),az,_pernd(_evod,4)
*endif
*endif
cmsel,,rotor
*get,_ecnt,elem,,count
_idmag=0
_do_mag=10
*if,_ierror,eq,0,then
*set,_magno
*dim,_magno,,_ecnt
*if,rad_mag,eq,0,then
*do,_ifdmag,1,_ecnt
/gopr
*get,_mxelem,elem,,num,max
*if,_mxelem,eq,0,exit
*get,_matno,elem,_mxelem,attr,mat
*get,_mgxx,mgxx,_matno,,,const,1
*get,_mgyy,mgyy,_matno,,,const,1
*if,abs(_mgxx)+abs(_mgyy),ne,0,then
_do_mag=0
_mxelem=0
_idmag=_idmag+1
_magno(_idmag)=_matno
*endif
esel,u,mat,,_matno
*enddo
*endif
_nummag=0
*set,_esyflg
*dim,_esyflg,,10000
*if,rad_mag+_do_mag,eq,0,then
*do,_jfdmag,1,_idmag
/gopr
*msg,info,_jfdmag
outer loop: _jfdmag
_matno=_magno(_jfdmag)
cmsel,,rotor
esel,r,mat,,_matno
*get,_ecnt,elem,,count
cm,_curmod,elem
*do,_ishmag,1,_ecnt
/gopr
*msg,info,_ishmag
inner loop: _ishmag %i
*get,_mxelem,elem,,num,max
*if,_mxelem,eq,0,exit
*get,_curesy,elem,_mxelem,attr,esys
*if,_esyflg(_curesy),eq,0,then
esel,,,,_mxelem
nsle
*get,_mxnode,node,,num,max
csys,_curesy
nrot,all
*get,_cesysa,node,_mxnode,ang,xy
_newang=_cesysa+_thtinc
local,_curesy,0,0,0,0,_newang
csys
nrot,all
cmsel,,_curmod
esel,u,esys,,_curesy
cm,_curmod,elem
_mxelem=0
_nummag=_nummag+1
_esyflg(_curesy)=1
*else
_nummag=_nummag+1
cmsel,,_curmod
esel,u,esys,,_curesy
cm,_curmod,elem
*endif
*enddo
*enddo
_ishmag=_ishmag-1
*endif
*endif
*set,_styno
*dim,_styno,char,2
_styno(1)='No','Yes'
alls
*set,_esyflg
/out
/nopr
/out,mvrotor,sum
*msg,info
>________________MOVEMENT OF THE ROTOR_________________<
*if,_ierror,eq,0,then
*if,(thmx-thmn),lt,180,then
*msg,info,_cthtmn
OLD angle of the lower edge of the rotor:__________ %g
*msg,info,arg1
NEW angle of lower edge of the rotor:______________ %g
*else
*msg,info,arg1
Increment of Rotation of rotor(D):_________________ %g
*endif
*msg,info,_ncount
Number of nodes in rotor:__________________________ %i
*if,rad_mag,eq,0,then
*msg,info,_nummag
Number of magnet coordinate systems moved:_________ %i
*endif
*endif
*msg,info,_styno(_appsti+1)
Was the Rotor "Stitched" to the Stator ?:__________ %c
*if,_ierror,eq,1,then
*msg,info
THE MODEL DID not HAVE NOT ANY PERIODIC CONDITIONS
*msg,info
THE STATOR COULD not BE CONNECTED TO THE ROTOR.
*msg,info
USE THE <EVEN_BC> TO APPLY THE PERIODIC CONDITIONS.
*endif
*msg,info
>______________________________________________________<
/out
*list,mvrotor,sum
*if,_nomsg,eq,0,then
*uilist,mvrotor,sum
/uis,msgpop
dsys
/pbc,cp,1
/pbc,ce,1
*get,_dist,graph,1,dist
/dist,,_dist
_dist=
/pbc,all
/pbc,ce,1
immed,1
*endif
/gopr