Input files
|
MagLev.MIN, MagLev.NIN, MagLev.SCR, nelson_force.cfg, MagLevLoop.pl, MagLevForceVersusH.png
Auto_Op_Perl.zip
|
Description
|
The example shows how to set up automated calculations using a Perl program to control multiple field solutions and how to record the results. The sample calculation is described in the example Magnetic levitation equilibrium. The annotated program MagLevLoop.pl illustrates several useful Perl techniques:
- Opening a text output file and writing formatted results.
- A do loop to run multiple instances of Mesh and Nelson.
- Opening Field Precision programs in background runs, with and without pass parameters.
- Opening a data file for input.
- Searching for a line with a specified string.
- Extracting a single value from a data line with multiple entries.
|
Results
|
The output of the run is a file MagLev.txt with a formatted listing of force as function of plate elevation that can easily be imported into a plotting program (figure below) or used as tabular function in a numerical analysis:
2.00 4.373911E+00
2.50 4.073426E+00
3.00 3.791977E+00
3.50 3.528418E+00
...
21.00 1.518951E-01
21.50 1.326664E-01
22.00 1.150200E-01
22.50 9.884813E-02
|
Comments
|
The Nelson calculation requires the completed Mesh output file MagLev.MOU and the analysis controlled by MagLev.SRC requires the Nelson output file MagLev.NOU. Fortunately, the Perl system command has the useful property that operation is suspended until the subtask is complete. Hence, there is no problem with synchronization.
|