How to export multiple field calculator results into one file

  • Last Post 22 November 2019
HendrikChristiaens posted this 22 November 2019


I'm simulating multiple design variations of an axial flux machine in ANSYS maxwell 2D, i want to export a lot off different data from each simulation (I need the magnitude of the B field in +- 50 specific points). With the field calculator i can only export one result at a time, in one single file. Is there a way of exporting multiple results into 1 file? otherwise this would result in exporting a few thousand files during my design process. 

Order By: Standard | Newest | Votes
pblarsen posted this 22 November 2019

If you have many specific points that you want to access one field quantity (mag B), then you can use the Export option in the Field calculator with the .pts file.  The .pts file is a tab-delimited list of X,Y,Z coordinates (if 2DXY then Z=0; if 2DRZ then Y=0), with respect to the global coordinate system in units of meters.  The output of the Export command will be another tab-delimited .fld file that contains the B-field in units of Tesla evaluated at each point (and optionally contains the XYZ coordinate data).

Of course, the steps need to be done in the Field Calculator sequence and are written here:
Quantity > B
Vector > Mag

This can be scripted.  Try recording a script (menu Tools > Record Script to File, and Stop Script Recording after performing the steps), and you will see how this can be performed for many variations/designs.

HendrikChristiaens posted this 22 November 2019

Thank you for your quick and extensive reply! 

I'm already using scripts but at the moment,but i have to combine multiple result files into one file after doing the FEM analysis so i can use it for post-processing in Matlab. 

I still a have a few questions:

When I'm running an optimetric analysis i can only export the results of the latest design variation, is it possible to export the results of every variation into one file? (or even seperate files but still every variation in the optimetric analysis)

Also, when doing calculations in the field reporter I have to export every result into a separate file, is it possible to export multiple field calculator results into a single file? 

thank you in advance!

pblarsen posted this 22 November 2019

An alternate option is to define the point selection in the results.  You would just need to use the Results window with the default MagB value, and no further field calculator interaction.  You can choose points in the following way:

Menu: Results > Create Fields Report > Data Table
In the upper left, change Geometry to choose a Point
The Calculator Expressions will now show any default scalar quantities, including Bmag.
Click New Report.
Change the Geometry to choose another Point, then click Add Trace and repeat.

This also can be scripted for adding 50 Traces to a result table.  The benefit of this is that the results will update automatically when the solution finishes.  It will also show up for any saved fields times (in a transient run) within one table, and/or can include multiple variations.  It is also easily exported to .csv file by right-click > Export.

HendrikChristiaens posted this 22 November 2019

Ah, I can try it like that. I'll try it out, thank you!