/out,mv_rotor,out
*if,arg1,eq,1,then
mv_rotor=0
*endif
*if,mv_rotor,eq,0,then
fini
_frac=arg1
esel,,mat,,2,3
nsle
csys,1
*get,_rdmx,node,,mxloc,x
esel,,mat,,5
nsle
*get,_rdmn,node,,mnloc,x
csys
_dgap=_rdmn-_rdmx
_err=0
*if,_frac,le,0,then
_err=1
/nerr
/out
*msg,error,_dr
The input fraction must be > 0 and < .95 of radial gap-no action
/out,mv_rotor,out,,append
/nerr,0,1e5
*endif
*if,_frac,gt,.95,then
_err=1
/nerr
/out
*msg,error,_dr
The input fraction is too close to the radial gap of machine-no action
/out,mv_rotor,out,,append
/nerr,0,1e5
*endif
*if,_err,eq,1,:end
/prep7
esel,all
*get,_elmx,elem,,num,max
*set,_etyp
*dim,_etyp,,_elmx,2
*do,_i1,1,100
_elmx=0
*get,_elmx,elem,,num,max
*if,_elmx,eq,0,exit
*get,_etyp(_i1,1),elem,_elmx,attr,type
esel,u,type,,_etyp(_i1,1)
*get,_etyp(_i1,2),etyp,_etyp(_i1,1),attr,enam
*if,_etyp(_i1,2),eq,13,then
et,_etyp(_i1,1),42
*else
et,_etyp(_i1,1),82
*endif
*enddo
n_type=_i1
alls
cedel,all,all
numc,cp
cmsel,,rotor
csys,1
*get,rdmx,node,,mxloc,x
nsel,r,ext
nsel,r,loc,x,rdmx-.0001,rdmx+1
cm,ce_node,node
cmsel,,stator
esel,r,mat,,1
cmsel,,ce_node
ceintf
mp,ex,1,1e5
rp7,,1
cmsel,,stator
esel,r,mat,,5,6
nsle
d,all,all
cmsel,,rotor
esel,r,mat,,2,3
nsle
d,all,ux,_frac*_dgap
/sol
alls
solve
fini
/prep7
upcoords,1
cedel,all,all
mv_rotor=1
save,mv_rotor,db
*endif
*if,arg1,eq,1,then
mv_rotor=1
*endif
*if,mv_rotor,eq,1,then
*do,_i1,1,n_type
et,_etyp(_i1,1),_etyp(_i1,2)
*enddo
cmsel,,stator
esel,r,mat,,1
cmsel,,ce_node
ceintf
alls
mvpsol
fini
/post1
fmagsum,'r_iron'
*endif
:end
/out