/uis,msgpop,3
/gopr
*get,_nops,active,,prkey
*get,_mnu,active,,menu
*get,_arout,active,,rout
/out,mvpsol,out
/nerr,0,1e7,-1
finish
/solu
*if,_mg1,eq,1,then
/gst,off
*endif
antyp,static
*get,_unit,active,,solu,emunit
*get,_mu,active,,solu,muzro
*get,_dimn,active,,solu,dimn
*stat
*if,arg2,eq,0,then
arg2=2
*endif
*if,arg3,eq,0,then
arg3=1e-2
*endif
*if,arg4,eq,0,then
arg4=1e-3
*endif
*if,arg5,eq,0,then
arg5=25
*endif
arg6=1
*if,_dimn,eq,3,then
*if,no_curr,eq,1,then
esel,none
esel,,ename,,36
cm,uce_36,elem
*elseif,no_curr,eq,2,then
esel,r,ename,,36
cm,ce_36,elem
esel,,ename,,36
cmsel,u,ce_36
cm,uce_36,elem
cmdel,ce_36
*endif
*endif
*if,arg1,eq,0,then
esel,none
esel,,ename,,96
*get,ecnt96,elem,,count
*if,ecnt96,gt,0,then
arg1=2
*endif
esel,none
esel,,ename,,36
*get,ecnt36,elem,,count
*if,ecnt36,gt,0,then
arg1=3
*endif
esel,none
esel,,ename,,97
*get,ecnt97,elem,,count
*if,ecnt96*ecnt97,gt,0,then
arg1=1
*endif
*if,ecnt96,eq,0,then
*if,ecnt97,ne,0,then
arg1=0
*endif
*endif
*if,_dimn,ne,3,then
arg1=0
*endif
*endif
*msg,info,arg1
solution type: %i
*if,_mg1,eq,0,then
alls
sfedel,all,all,all
bfdel,all,mvdi
esel,,mat,,5
cm,s_iron,elem
esel,,mat,,2,3
_smg1=_mg1
_mg1=1
cm,r_iron,elem
fmagbx,'r_iron'
esel,,mat,,5,6
cm,s_force,elem
fmagbc,'s_force'
_mg1=_smg1
/out,mvpsol,out,,append
*endif
nsel,all
esel,all
*if,runlinr,eq,0,then
*get,_elec,elem,,count
*set,_matm
*dim,_matm,,_elec
/uis,msgpop,3
*do,_nmat,1,_elec
*get,_mxelem,elem,,num,max
*if,_mxelem,eq,0,exit
*get,_matm(_nmat),elem,_mxelem,attr,mat
_nonlin=1
*get,_bht,bh,_matm(_nmat),type
*if,_bht,gt,0,exit
_nonlin=0
esel,u,mat,,_matm(_nmat)
*enddo
_nmat=_nmat-1
*else
tbdel,bh,all
_nonlin=0
*endif
esel,all
nsel,all
*stat,_nonlin
/uis,msgpop
/uis,msgpop,3
*if,_dimn,ne,3,then
*if,_nonlin,eq,0,then
outres,all,last
solve
*else
*if,arg2,ne,-1,then
nsubs,arg2
kbc,0
neqit,1
outres,all,none
solve
kbc,1
cnvtol,csg,,arg3
neqit,arg5
nsubs,1
outres,all,last
solve
*else
kbc,1
cnvtol,csg,,arg3
neqit,arg5
nsubs,1
outres,all,last
solve
*endif
*endif
*endif
*if,_dimn,eq,3,then
*if,arg1,eq,0,then
*if,_nonlin,eq,0,then
outres,all,last
solve
*else
*if,arg2,ne,-1,then
nsubs,arg2
kbc,0
neqit,1
outres,all,none
solve
kbc,1
cnvtol,csg,,arg3
cnvtol,amps,-1
neqit,arg5
nsubs,1
outres,all,last
solve
*else
kbc,1
cnvtol,csg,,arg3
cnvtol,amps,-1
neqit,arg5
nsubs,1
outres,all,last
solve
*endif
*endif
*endif
*endif
*if,_dimn,eq,3,then
*if,arg1,eq,1,then
*if,arg6,eq,1,then
*if,no_curr,gt,0,then
cmsel,u,uce_36
*endif
biot,new
*endif
*if,_nonlin,eq,0,then
outres,all,last
solve
*else
*if,arg2,ne,-1,then
nsubs,arg2
kbc,0
neqit,1
outres,all,none
solve
kbc,1
cnvtol,csg,,arg3
cnvtol,amps,-1
cnvtol,flux,,arg4
neqit,arg5
nsubs,1
outres,all,last
solve
*else
kbc,1
cnvtol,csg,,arg3
cnvtol,amps,-1
cnvtol,flux,,arg4
neqit,arg5
nsubs,1
outres,all,last
solve
*endif
*endif
*endif
*endif
*if,_dimn,eq,3,then
*if,arg1,eq,2,then
*if,arg6,eq,1,then
*if,no_curr,gt,0,then
cmsel,u,uce_36
*endif
biot,new
*endif
*if,s_jcg,eq,1,then
eqslv,jcg
*elseif,s_spar,eq,1,then
eqslv,sparse
*elseif,s_pcg,eq,1,then
eqslv,pcg
*endif
*if,ll_matrix,eq,1,then
eqslv,frontal
*endif
*if,_nonlin,eq,0,then
outres,all,last
magopt,0
solve
*else
outres,all,last
cnvtol,flux,,arg4
neqit,arg5
magopt,0
nropt,full,,on
solve
*endif
*endif
*endif
_val=abs(_dimn-3)+abs(arg1-3)
*if,_val,lt,.001,then
*if,arg6,eq,1,then
*if,no_curr,gt,0,then
cmsel,u,uce_36
*endif
biot,new
*endif
*if,s_jcg,eq,1,then
eqslv,jcg
*elseif,s_spar,eq,1,then
eqslv,sparse
*elseif,s_pcg,eq,1,then
eqslv,pcg
*endif
*if,_nonlin,eq,0,then
magopt,2
outres,all,none
solve
magopt,3
outres,all,last
solve
*else
magopt,2
outres,all,none
solve
magopt,3
cnvtol,flux,,arg4
outres,all,last
neqit,arg5
nropt,full,,on
solve
*endif
*endif
_val=abs(_dimn-3)+abs(arg1-4)
*if,_val,lt,.001,then
*if,arg6,eq,1,then
*if,no_curr,gt,0,then
cmsel,u,uce_36
*endif
biot,new
*endif
*if,s_jcg,eq,1,then
eqslv,jcg
*elseif,s_spar,eq,1,then
eqslv,sparse
*elseif,s_pcg,eq,1,then
eqslv,pcg
*endif
*if,_nonlin,eq,0,then
outres,all,none
magopt,1
solve
magopt,2
outres,all,none
solve
magopt,3
outres,all,last
solve
*else
cnvtol,flux,,arg4
outres,all,none
neqit,arg5
nropt,full,,on
magopt,1
solve
magopt,2
outres,all,none
solve
magopt,3
cnvtol,flux,,arg4
outres,all,last
neqit,arg5
nropt,full,,on
solve
*endif
*endif
*get,_cumls,active,,solu,ncmls
*get,_cumit,active,,solu,ncmit
*get,_cnvv,active,,solu,cscv
*get,_cnvs,active,,solu,mfcv
/nopr
*if,_ok,ne,1,then
/out,magsolv,out
*msg,info
%/___________ MAGNETICS SOLUTION SUMMARY ______________
*if,arg1,lt,1,then
*msg,info
%/Formulation option: MVP
*elseif,arg1,eq,1,then
*msg,info
%/Formulation option: MVP-RSP
*elseif,arg1,eq,2,then
*msg,info
%/Formulation option: RSP
*elseif,arg1,eq,3,then
*msg,info
%/Formulation option: DSP
*elseif,arg1,eq,4,then
*msg,info
%/Formulation option: GSP
*endif
*msg,info,_cumls
%/Solution data load step number = %g
*msg,info,_cumit
%/Solution cumulative iteration number = %g
*if,_nonlin,eq,1,then
*if,arg1,le,1,then
*msg,info,_cnvv
%/Current segment convergence value = %g
*msg,info,arg3
Current segment convergence tolerance = %g
*else
*msg,info,_cnvs
%/Magnetic flux convergence value = %g
*msg,info,arg4
Magnetic flux convergence tolerance = %g
*endif
*endif
*if,arg6,eq,1,then
*msg,info
%/Biot Savart Integration calculation performed
*endif
*msg,info
%/_____________________________________________________
/out,mvpsol,out,,append
*endif
*if,_ok,ne,1,then
*list,magsolv,out
*if,_mnu,ne,0,then
*if,_nomsg,eq,0,then
*uilist,magsolv,out
*endif
*endif
*endif
_unit=
_dimn=
_mu=
_cumls=
_cumit=
_cnvv=
_cnvs=
_nonlin=
_matm=
_nmat=
_mxelem=
_bht=
_elec=
_mnu=
_arout=
_ok=
_tr_cal=0
*if,_mg1,eq,1,then
/gst,on
*endif
*if,_nops,eq,0,then
/nopr
_nops=
*else
_nops=
/go
*endif
/out
/gopr