AndrewSpotlight
Mechanical
- Jul 5, 2011
- 8
Hi,
I am modeling a 2D Magnet in ANSYS and I want to export the results of the magnetic flux intensity around the magnet to some .txt or .xl file, so that I can use them in Matlab for further analysis. I tried to export the ANSYS results into some array but keep getting warning "Requested data is not stored for node" and "*GET command is ignored". Has anybody encountered the same problem before? Or any suggestion on how to export specific results from ANSYS?
I put my ANSYS command below. Hopefully someone can help! Thanks!
!********************************************
permanent magnet(use infin9)
!********************************************
/TITLE, Test for Permanent Magnet
*go,:start
:start ! Ask Ansys to read file optionally
!JPGPRF,500,100,1 ! MACRO TO SET PREFS FOR JPEG PLOTS
/PREP7
emunit,mks ! Set Unit: µ0=4 Pi e-7 henries/meter
!********************************************
! Define Element Type
!********************************************
ET,53,PLANE53 ! Define PLANE 53 as element type
ET,9,INFIN9 ! Use infi9
!********************************************
! Define Material
!********************************************
MP,MURX,1,1 ! Define material properties (permeability) !Air=1
HC=895000 ! Coercive force
TB,BH,2,,30
TBPT,, 130.000000 , 0.100000000
TBPT,, 170.000000 , 0.200000000
TBPT,, 197.000000 , 0.300000000
TBPT,, 218.000000 , 0.400000000
TBPT,, 250.000000 , 0.500000000
TBPT,, 290.000000 , 0.600000000
TBPT,, 338.000000 , 0.700000000
TBPT,, 400.000000 , 0.800000000
TBPT,, 472.000000 , 0.900000000
TBPT,, 570.000000 , 1.00000000
TBPT,, 682.000000 , 1.10000000
TBPT,, 810.000000 , 1.20000000
TBPT,, 975.000000 , 1.30000000
TBPT,, 1600.00000 , 1.40000000
TBPT,, 2520.00000 , 1.50000000
TBPT,, 3520.00000 , 1.60000000
TBPT,, 4760.00000 , 1.70000000
TBPT,, 8300.00000 , 1.80000000
TBPT,, 12000.0000 , 1.90000000
TBPT,, 17000.0000 , 2.00000000
TBPT,, 23000.0000 , 2.10000000
TBPT,, 32000.0000 , 2.20000000
TBPT,, 42500.0000 , 2.30000000
TBPT,, 44500.0000 , 2.32000000
TBPT,, 48200.0000 , 2.35000000
TBPT,, 52200.0000 , 2.37000000
TBPLOT,BH,2,,,
/IMAGE,SAVE,BH2,JPEG ! Save B-H curve of material 2 as bh2.jpg
mp,mgxx,2,hc ! Set mgxx (or mgyy) for permanent magnet
mp,mgyy,2,0
!********************************************
! Build Model
!********************************************
/PNUM,AREA,1 ! Define display mode
wall=20
hall=10
w1=4
h1=2
!x1=(wall-w1)/2
!x2=x1+w1
!y1=(hall-h1)/2
!y2=y1+h1
!rectng,0,wall,0,hall
!rectng,x1,x2,y1,y2
rectng,-wall/2,wall/2,-hall/2,hall/2
rectng,-w1/2,w1/2,-h1/2,h1/2
aovlap,all
numcmp,area ! Re-numbering area
/PNUM,AREA,1 !Turns area numbering on
aplot
!/eof ! In accordance with "start" command
!********************************************
! Define Material Attribute
!********************************************
asel,s,area,,1 ! Select permanent magnet
aatt,2
asel,s,area,,2 ! Select air
aatt,1
!********************************************
! Meshing
!********************************************
asel,all
type,53
lsel,s,line,,1,4 ! Select all infinite boundary
type,9 ! set as infin9
lesize,all,,,30 ! mesh to 30 parts
lmesh,all ! start meshing
lsel,s,line,,5,8
lesize,all,,,20 !mesh the boundary of magnet into 20 parts
asel,all
amesh,all
!********************************************
! Define load
!********************************************
ESEL,ALL
NSEL,EXT
D,ALL,AZ,0
!********************************************
! Solve & Postproc & Export
!********************************************
asel,s,area,,1
nsla,s,1
cm,outnodes,node
/sol
outres,all,all ! compute results for all entities
allsel ! select all entities
magsolve
/post1
nsel,s,node,,outnodes ! select the output nodes!
set,last ! read it the last results set (for example)
*get,nmin,node,,num,min !defining minimum node number on area
*get,ncount,node,,count !counted all nodes on area
*dim,results,array,ncount,2 !dimensioned results array
*do,row,1,ncount !interating column for all nodes on area
*get,results(row,1),node,nmin,B,Y
*get,results(row,2),node,nmin,loc,X
nmin=ndnext(nmin)
*enddo
*mwrite,results,'c:\Result\magresults',dat
(3F10.6)
I am modeling a 2D Magnet in ANSYS and I want to export the results of the magnetic flux intensity around the magnet to some .txt or .xl file, so that I can use them in Matlab for further analysis. I tried to export the ANSYS results into some array but keep getting warning "Requested data is not stored for node" and "*GET command is ignored". Has anybody encountered the same problem before? Or any suggestion on how to export specific results from ANSYS?
I put my ANSYS command below. Hopefully someone can help! Thanks!
!********************************************
permanent magnet(use infin9)
!********************************************
/TITLE, Test for Permanent Magnet
*go,:start
:start ! Ask Ansys to read file optionally
!JPGPRF,500,100,1 ! MACRO TO SET PREFS FOR JPEG PLOTS
/PREP7
emunit,mks ! Set Unit: µ0=4 Pi e-7 henries/meter
!********************************************
! Define Element Type
!********************************************
ET,53,PLANE53 ! Define PLANE 53 as element type
ET,9,INFIN9 ! Use infi9
!********************************************
! Define Material
!********************************************
MP,MURX,1,1 ! Define material properties (permeability) !Air=1
HC=895000 ! Coercive force
TB,BH,2,,30
TBPT,, 130.000000 , 0.100000000
TBPT,, 170.000000 , 0.200000000
TBPT,, 197.000000 , 0.300000000
TBPT,, 218.000000 , 0.400000000
TBPT,, 250.000000 , 0.500000000
TBPT,, 290.000000 , 0.600000000
TBPT,, 338.000000 , 0.700000000
TBPT,, 400.000000 , 0.800000000
TBPT,, 472.000000 , 0.900000000
TBPT,, 570.000000 , 1.00000000
TBPT,, 682.000000 , 1.10000000
TBPT,, 810.000000 , 1.20000000
TBPT,, 975.000000 , 1.30000000
TBPT,, 1600.00000 , 1.40000000
TBPT,, 2520.00000 , 1.50000000
TBPT,, 3520.00000 , 1.60000000
TBPT,, 4760.00000 , 1.70000000
TBPT,, 8300.00000 , 1.80000000
TBPT,, 12000.0000 , 1.90000000
TBPT,, 17000.0000 , 2.00000000
TBPT,, 23000.0000 , 2.10000000
TBPT,, 32000.0000 , 2.20000000
TBPT,, 42500.0000 , 2.30000000
TBPT,, 44500.0000 , 2.32000000
TBPT,, 48200.0000 , 2.35000000
TBPT,, 52200.0000 , 2.37000000
TBPLOT,BH,2,,,
/IMAGE,SAVE,BH2,JPEG ! Save B-H curve of material 2 as bh2.jpg
mp,mgxx,2,hc ! Set mgxx (or mgyy) for permanent magnet
mp,mgyy,2,0
!********************************************
! Build Model
!********************************************
/PNUM,AREA,1 ! Define display mode
wall=20
hall=10
w1=4
h1=2
!x1=(wall-w1)/2
!x2=x1+w1
!y1=(hall-h1)/2
!y2=y1+h1
!rectng,0,wall,0,hall
!rectng,x1,x2,y1,y2
rectng,-wall/2,wall/2,-hall/2,hall/2
rectng,-w1/2,w1/2,-h1/2,h1/2
aovlap,all
numcmp,area ! Re-numbering area
/PNUM,AREA,1 !Turns area numbering on
aplot
!/eof ! In accordance with "start" command
!********************************************
! Define Material Attribute
!********************************************
asel,s,area,,1 ! Select permanent magnet
aatt,2
asel,s,area,,2 ! Select air
aatt,1
!********************************************
! Meshing
!********************************************
asel,all
type,53
lsel,s,line,,1,4 ! Select all infinite boundary
type,9 ! set as infin9
lesize,all,,,30 ! mesh to 30 parts
lmesh,all ! start meshing
lsel,s,line,,5,8
lesize,all,,,20 !mesh the boundary of magnet into 20 parts
asel,all
amesh,all
!********************************************
! Define load
!********************************************
ESEL,ALL
NSEL,EXT
D,ALL,AZ,0
!********************************************
! Solve & Postproc & Export
!********************************************
asel,s,area,,1
nsla,s,1
cm,outnodes,node
/sol
outres,all,all ! compute results for all entities
allsel ! select all entities
magsolve
/post1
nsel,s,node,,outnodes ! select the output nodes!
set,last ! read it the last results set (for example)
*get,nmin,node,,num,min !defining minimum node number on area
*get,ncount,node,,count !counted all nodes on area
*dim,results,array,ncount,2 !dimensioned results array
*do,row,1,ncount !interating column for all nodes on area
*get,results(row,1),node,nmin,B,Y
*get,results(row,2),node,nmin,loc,X
nmin=ndnext(nmin)
*enddo
*mwrite,results,'c:\Result\magresults',dat
(3F10.6)