/gopr
/uis,msgpop,3
/out,mvrot3ds,out
/nerr,0,1e4,-1
alls
csys,1
esel,,mat,,5
nsle
*get,thmn,node,,mnloc,y
*get,thmx,node,,mxloc,y
*get,_mnu,active,,menu
*if,_nomsg,eq,0,then
*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
*endif
fini
_evod=1
/prep7
nsel,all
immed,0
_ierror=0
_appsti=arg2
*msg,info,arg1
move to angle: %g
*get,_ac_ce,active,,ce
*if,_ac_ce,gt,0,then
cedel,all,,,any
/nerr,0,1e5
numc,ce
*endif
*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
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
nsel,r,loc,y,_thtmax-.0001,_thtmax+.001
_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
_thtinc=arg1-_cthtmn
nsle
*if,_ierror,eq,0,then
ngen,2,,all,,,0,_thtinc
*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
esel,,mat,,2
nsle
csys,1
*get,_naxial,node,,count
*get,_ncpu1,active,,time,cpu
*set,_nnodz
*dim,_nnodz,,_naxial
*do,_inx1,1,_naxial
/gopr
/out,mvrot3ds,out,,append
*msg,info,_inx1
cycle in _inx1: %i
*get,_ndmx,node,,num,max
*if,_ndmx,eq,0,exit
*get,_nnodz(_inx1),node,,mnloc,z
nsel,u,loc,z,_nnodz(_inx1)-.0001,_nnodz(_inx1)+.0001
*enddo
_naxial=_inx1-1
*get,_ncpu2,active,,time,cpu
_ndcpu=_ncpu2-_ncpu1
*stat,_nnodz,1,_naxial
*if,_appsti,eq,1,then
*do,_i3d1,1,_naxial
/gopr
*msg,info,_i3d1
cycle in _i3d1: %i
*msg,info,_i3d1,_nnodz(_i3d1)
cycle= %i and current Z plane: %g
stitch3d,_nnodz(_i3d1)
/out,mvrot3ds,out,,append
cmsel,,_cerotor
*get,_ncount,node,,count
cmsel,,stator
nsel,r,loc,z,_nnodz(_i3d1)-.0001,_nnodz(_i3d1)+.0001
_c_z=_nnodz(_i3d1)
_pernd(1,1)=node(_rmin,_thtmax,_c_z)
_pernd(2,1)=node(_rmin,_thtmin,_c_z)
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,_c_z)
_pernd(4,1)=node(_rmax,_thtmin,_c_z)
_cpcemx=_cpmx+_cemx
cmsel,,stator
_cemx=_cemx+1
*msg,info,_i3d1,_nnodz(_i3d1)
remaining CEs for cycle= %i and current Z plane: %g
_cemx=_cemx+1
*enddo
*endif
*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
csys
*set,_esyflg
/out
/nopr
/out,mvrot3ds,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,mvrot3ds,sum
*if,_nomsg,eq,0,then
*uilist,mvrot3ds,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
:end
/out