/nopr
*get,_nops,active,,prkey
*get,_mnu,active,,menu
*if,_mnu,eq,0,then
_dely=0
*else
_dely=0
*endif
*get,_arout,active,,rout
*if,_arout,ne,31,then
*msg,warn
Enter Post1 before issuing this command macro
/wait,_dely
_ok=1
*else
_dummy=1
mmf=
/out,scratch
/out
*get,_unit,active,,solu,emunit
*get,_mu,active,,solu,muzro
*get,_dimn,active,,solu,dimn
*if,_unit,gt,2,then
*msg,error
Invalid units option specified, please reissue command macro
/wait,_dely
_ok=1
*endif
*get,_nc,path,,node,count
*if,_nc,eq,0,then
*msg,error
The path for calculating the mmf must be defined first
_ok=1
*endif
*if,_ok,eq,0,then
*get,_sysr,active,,rsys
*get,_sysd,active,,dsys
*get,_sysc,active,,csys
_afun=atan(1)
*if,_afun,gt,1,then
*afun,rad
*endif
_pi4=16*atan(1)
/NOPR
RSYS,0
CSYS,0
PDEF,HX,H,X,noav
PDEF,HY,H,Y,noav
PDEF,HZ,H,Z,noav
*if,_mnu,ne,0,then
DSYS,0
/PBC,PATH,1
NPLOT
*endif
PVECT,TANG,TX,TY,TZ
PDOT,D,HX,HY,HZ,TX,TY,TZ
PCALC,INTG,MMF,D,S
*GET,mmf,PATH,,LAST,MMF
*IF,_unit,EQ,2,THEN
mmf=mmf/_pi4
*ENDIF
/out,mmf,out
*msg,info
%/***** ANSYS MMF command macro results *****
/wait,_dely/2
*msg,info
%/** Note: MMF macro is only valid when the path is completely&
contained within a material.
/wait,_dely/2
*msg,info
If a path node exists at a material interface, select (ESEL)&
only desired material elements before calling the macro.
/wait,_dely/2
*if,_unit,le,1,then
*msg,info,mmf
%/MMF = %G Ampere %/
/WAIT,_dely
*elseif,_unit,eq,2,then
*msg,info,mmf
%/MMF = %G AbAmpere %/
/WAIT,_dely
*endif
*msg,info
Issue "status" to review calculated parameter "MMF" %/
/wait,_dely/2
*MSG,INFO
*msg,info
The path item D stores the H tangential along the path.
*msg,info
The path item MMF stores the accumulated MMF along the path
*msg,info
These items can be plotted as a line graph or superimposed on the&
geometry
/out
rsys,_sysr
dsys,_sysd
csys,_sysc
/pbc,path,0
*if,_afun,gt,1,then
*afun,deg
*endif
_afun=
*endif
_sysr=
_sysd=
_sysc=
_pi4=
_dummy=
_unit=
_dimn=
_mu=
_nc=
*endif
*if,_arout,eq,31,then
*if,_ok,ne,1,then
*list,mmf,out
*if,_mnu,ne,0,then
*uilist,mmf,out
*endif
*endif
*endif
_arout=
_mnu=
_ok=
_dely=
*if,_nops,eq,0,then
/nopr
_nops=
*else
_nops=
/go
*endif