Difference between revisions of "Options for Running Calculations"

From OSUPDOCS
Jump to navigation Jump to search
 
(49 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page has information on running [[NairnFEA]] finite element calculations and [[OSParticulas]] or [[NairnMPM]] material point method calculations. If you just compiled the code, it includes information on doing test calculations.
This page has information on running [[NairnFEA]] finite element calculations and [[NairnMPM]] material point method calculations. If you just compiled the code, it includes information on doing test calculations.


== Running Using [[NairnFEAMPM]] (Macintosh OS X only) ==
== Running Using NairnFEAMPM (Macintosh OS X only) ==


If you are using a Mac, you can go to the [http://oregonstate.edu/~nairnj/NairnFEAMPM/index.html <b>NairnFEAMPM</b> web site] and download a complete package that lets you create input files using a command language or raw <tt>XML</tt> commands, run calculations, and visualize the results. This package only works in MacOS X and does not include the code engines' source code. If you are working directly with the source code, you can still run calculations using [[NairnFEAMPM]], but first you have to configure it to use to new compiled code engines in place of the embedded code engines. To make that change consult to "Code Engine Development" topic in the help window.
If you are using a Mac, you can go to the [[NairnFEAMPM|<tt>NairnFEAMPM</tt> page]] and download a complete package that lets you create input files using a scripting language or raw <tt>XML</tt> commands, run calculations, and visualize the results. If you are working directly with the source code, you can still run calculations using [[NairnFEAMPM]], but first you have to configure it to use to new compiled code engines in place of the embedded code engines. To make that change consult the "Code Engine Development" topic in the help window.


To do a test calculation, choose the "New &rarr; FEA Example" or "New &rarr; MPM Example" command, and then choose the "Analyze &rarr; Run FEA/MPM Analysis" command. The text output will stream to a window. When it is done you can use built-in tools to visualize the results. For all the details on running calculations and on visualizing results, you can consult the help window within [[NairnFEAMPM]].
To do a test calculation, choose the "FEA Commands File", "MPM Commands File" and any example options in the "File &rarr; New" submenu. Save the input commands to a folder on your computer and then choose the "Analyze &rarr; Run FEA/MPM Analysis" menu command. The text output will stream to a window. When it is done you can use built-in tools to visualize the results. For all the details on running calculations and on visualizing results, you can consult the help window within [[NairnFEAMPM]].


== Running Using [[NairnFEAMPMViz]] Java Application (any platform) ==
== Running Using NairnFEAMPMViz Java Application (any platform) ==


You can run and visualize [[NairnFEA]],  [[OSParticulas]], and [[NairnMPM]] calculations on any platform using the [[NairnFEAMPMViz]] Java application. [[NairnFEAMPMViz]] started out only as a visualization tool, but now it lets you create and edit input <tt>XML</tt> files, run calculation, and visualize the results. ('''Note''': if you are using a Mac [[NairnFEAMPMViz]] will work, but the recommendation is to use [[NairnFEAMPM]] because it faster and has more features).  
If you are using Windows, you can go to the [[NairnFEAMPMViz|<tt>NairnFEAMPMViz</tt> page]] and download a complete package that lets you create input files using a scripting language or raw <tt>XML</tt> commands, run calculations, and visualize the results. This stand-alone package works without needed to download and compile and code engines to third-party software tools. If you later decide to work directly with the source code, you can still run calculations using [[NairnFEAMPMViz]], but first you have to configure it to use your newly compiled code engines in place of the bundled code engines in the package. To make that change consult the "Running Calculations" section in the help window.


<p><b>NairnFEAMPMViz</b> is a Java application and therefore to run it, you need it's jar file. This file is not included in the <code>Nairn-MPM-FEA</code> package. You have two options:</p>
In Linux, Mac, or Windows, you can alternatively run the <tt>NairnFEAMPMViz.jar</tt> Java app in the downloaded package. It runs directly in Java (which must be installed on your computer) and will need be configured to run your compiled code engines. For more details consult the "Running Calculations" section in the help window. Note that Mac users should use [[NairnFEAMPM]] instead because it has more features than the [[NairnFEAMPMViz]] Java application.


<ol>
To do a test calculation, choose the "New FEA Commands Document", "New MPM Commands Document" or pick any option from the "Examples" submenu in the "File" menu. Save the input commands file to a folder on your computer and then choose the "Analyze &rarr; Run FEA/MPM Analysis" menu command. The text output will stream to a window. When it is done you can use built-in tools to visualize the results. For all the details on running calculations and on visualizing results, you can consult the help window within [[NairnFEAMPMViz]].
<li>Compile the <b>NairnFEAMPMViz</b> source code. Click <a href="../startup/nairnviz.html#compiling">here</a> for details on this approach.</li>
 
<li>Download the jar from the the <a href="http://code.google.com/p/nairn-mpm-fea/downloads/list"><code>nairn-mpm-fea</code> project downloads</a> page. Compiling the source code will always get you the latest version, but the download might be good enough (and is easier if you just want to verify with a test run).</li>
 
</ol>
 
<p>Once the <b>NairnFEAMPMViz</b> jar file is ready, you need to launch it using a method to make sure it gets enough memory. The method is described <a href="../startup/nairnviz.html#runningViz">here</a>. Once the application is started, do a test run as follows:
 
<ul>
 
<li>The first time you run <b>NairnFEAMPMViz</b>, you have to tell the application the location of the <code>NairnFEA</code> and <code>OSParticulas</code> (or <code>NairnMPM</code>) code engines and of a Unix shell. The steps are
<ol class="alpha">
<li>Choose &quot;Preferences...&quot; menu command or click the &quot;Prefs&quot; icon</li>
<li>Click the &quot;Code&quot; tab</li>
<li>Click the first five &quot;Change...&quot; buttons and locate the <code>OSParticulas</code> (or <code>NairnMPM</code>) executable, the <code>NairnMPM.dtd</code> file, the <code>NairnFEA</code> executable, the <code>NairnFEA.dtd</code> file, and the <code>bash</code> shell command, respectively. In Windows, the <code>bash</code> command will be in the <code>bin</code> folder of the root <code>cygwin</code> folder; in other systems, it will be in the <code>/bin</code> folder.</li>
<li>Optionally click the last &quot;Change...&quot; button and select a work space directory. When a directory is selected, <b>NairnFEAMPMViz</b> will default to this directory when opening and saving files.
</ol>
</li>
 
<li>To do a test calculation, choose the &quot;File &rarr; New FEA Commands&quot; or &quot;File &rarr; New MPM Commands&quot; menu commands (or click their icons). These will open a file with sample <code>XML</code> commands. Save the new commands to a new file with extension <code>.fmcmd</code>.
</li>
 
<li>To run an analysis, choose the &quot;Analyze &rarr; Run FEA/MPM Analysis&quot; command (or click the run arrow icon). You will asked to decide where to save the results (as an <code>.fea</code> or <code>.mpm</code> file). Once you select a name, the calculations will run. When the calculations are done, the results file will open for visualization.</li>
 
<li>See the <b>NairnFEAMPMViz</b> application help information for more details on running calculations and on visualizing results.
</li>
 
</ul>


== Command-Line Execution ==
== Command-Line Execution ==


=== Running [[NairnFEA]] ===
You can run calculations on any platform using a command line window in Mac or Linux. If Windows when [[Compiling in Windows#Using Visual Studio|compiled using Visual Studio]], you can use these same methods (substituting Window's file paths as needed) in a DOS command window. The following sections give brief instructions.
 
<p>
You can run <code>NairnFEA</code> from a Unix or Linux command line using:
</p>
 
<pre>
NairnFEA [options] input > output
</pre>
 
<p>where</p>
 
<dl>
<dt>[options]</dt>
<dd>The options may be one or more of the following:
 
<dl>
 
<dt>-v</dt>
<dd>Validate the input <code>XML</code> using the <code>DTD</code> file specified in the <code>!DOCTYPE</code> line in the preamble of the input file. If the specified <code>DTD</code> can not be found, the code will exit with an error message. If the input file has no <code>!DOCTYPE</code>, the validation will be skipped. The required <code>DTD</code> file can be found in the <code>input</code> directory of the <a href="../startup/organize.html">source files</a>.</dd>
 
<dt>-a</dt>
<dd>Read the input file, set up the mesh and all boundary conditions and then abort before any calculations. This option is useful to check that all commands have created the mesh and boundary conditions correctly before actually doing the analysis in a subsequent run.</dd>
 
<dt>-w</dt>
<dd>When this option is not used, relative file names for output files and for input of bmp files are resolved as being relatve to the input file. When this option is used, the file names are resolved instead to the current working directory.</dd>
 
<dt>-H</dt>
<dd>Display brief help message and then exit.</dd>
 
</dl>
 
Multiple options can use separate options, such as <code>-v -r</code> , or combine them in one option, such as <code>-vr</code>.
</dd>
 
<dt>input</dt>
<dd>The path name of the input <code>XML</code> file. The preferred extension for the input files is &quot;<code>.fmcmd</code>&quot;.</dd>
 
<dt>output</dt>
<dd>The name of the output text file. The output of NairnFEA is to standard output and redirection should be used to save the output to a file. The preferred extension for the output file is &quot;<code>.fea</code>&quot;.</dd>
 
</dl>
 
 
<a name="trialFEA"></a><h2>Trial FEA Run</h2>
 
<p>After <a href="../startup/index.html">compiling</a> the code, you can do a trial run with the following commands:
</p>
 
<pre>
cd nairn-mpm-fea/NairnFEA/input
./NairnFEA Cantilever.fmcmd > output.fea
</pre>
 
<p>The sample FEA calculation of an end-loaded cantilever beam will finish quickly. The file <code>output.fea</code> will have the text output results.
</p>
 
<p>To verify the results requires visualization tools. See the <a href="../startup/nairnviz.html">visualization options</a> section for the possible tools. The image below shows plot of stress in the <code>x</code>-direction for this sample problem.
</p>
<center>
<img src = "beam.jpg" alt = "beam example" align="center"/>
</center>
 
=== Running [[OSParticulas]] [[NairnMPM]] ===
 
<p>
You can run OSParticulas (or NairnMPM) from a Unix or Linux command line using:
</p>
 
<pre>
OSParticulas [options] input > output
NairnMPM [options] input > output
</pre>
 
<p>where</p>
 
<dl>
<dt>[options]</dt>
<dd>The options may be one or more of the following:
 
<dl>
 
<dt>-v</dt>
<dd>Validate the input <code>XML</code> using the <code>DTD</code> file specified in the <code>!DOCTYPE</code> line in the preamble of the file. If the specified <code>DTD</code> can not be found, the code will exit with an error message. If the input file has no <code>!DOCTYPE</code>, the validation will be skipped. The required <code>DTD</code> file can be found in the <code>input</code> directory of the <a href="../startup/organize.html">source files</a>.</dd>
 
<dt>-r</dt>
<dd>Reverse the bytes when writing results to  archive files. This option can be useful when you are running calculations on one computer, but visualizing them on a different computer which uses a different byte order. For example. Macintosh computers and computers with Intel chips use opposite byte orders. This option can be omitted if you analyze on the same computer where you run the calculations or if you have analysis software that works with any byte order (such as all provided <a href="../startup/nairnviz.html">visualization options</a>).</dd>


<dt>-a</dt>
=== Running NairnFEA ===
<dd>Start the analysis, archive the initial conditions, and then abort the calculations. This option is useful to check that all commands have created the mesh, assigned material points, and created boundary conditions correctly before actually doing the analysis in a subsequent run.</dd>


<dt>-w</dt>
You can run [[NairnFEA]] from a Unix or Linux or DOS command line using:
<dd>When this option is not used, relative file names for output files and for input of bmp files are resolved as being relatve to the input file. When this option is used, the file names are resolved instead to the current working directory.</dd>


<dt>-H</dt>
NairnFEA [options] input > output
<dd>display brief help message and then exit.</dd>


</dl>
where


Multiple options can use separate options, such as <code>-v -r</code> , or combine them in one option, such as <code>-vr</code>.
* <tt>[options]</tt> are the options may be one or more of the following:
</dd>
*; -v :Validate the input <tt>XML</tt> using the <tt>DTD</tt> file specified in the <tt>!DOCTYPE</tt> line in the preamble of the input file. If the specified <tt>DTD</tt> cannot be found, the code will exit with an error message. If the input file has no <tt>!DOCTYPE</tt>, the validation will be skipped. The required <tt>DTD</tt> file can be found in the <tt>NairnFEA/input</tt>  and <tt>NairnMPM/input</tt> directories of the <tt>nairn-mpm-fea</tt> project. As explained below, this option should always be used when running from a command line.
*; -np 4 : Set the number of processors to use for parallel execution (required compilation of the parallel version of [[NairnFEA]].
*; -a : Read the input file, set up the mesh and all boundary conditions and then abort before any calculations. This option is useful to check that all commands have created the mesh and boundary conditions correctly before actually doing the analysis in a subsequent run.
*; -w : When this option is not used, relative file names for output files and for input of BMP files are resolved as being relative to the input file. When this option is used, relative file names are resolved instead to the current working directory.
*; -H (or -h): Display brief help message and then exit.
* <tt>input</tt> is the path name of the input <tt>XML</tt> file. The preferred extension for the input files is <tt>.fmcmd</tt>.
* <tt>output</tt> is the name of the output text file. The output of [[NairnFEA]] is to standard output and redirection should be used to save the output to a file. The preferred extension for the output file is <tt>.fea</tt>.


   
Note that [[NairnFEA]] checks many command options, but not all. Most commonly, a typo in an <tt>XML</tt> command name or attribute or use of an invalid attribute may or may not trigger an error. If you have such errors, the resulting FEA analysis may be very different than the one you expected. For this reason, when using command-line execution, you should always include the <tt>-v</tt> option to validate the input file.  
<dt>input</dt>
<dd>The path name of the input <code>XML</code> file. The preferred extension for the input files is &quot;<code>.fmcmd</code>&quot;.</dd>


<dt>output</dt>
See the [[Sample FEA Input Command File#Trial Run with XML FEA Input|sample FEA input <tt>XML</tt> file]] for a method to do a trial command line execution for FEA calculations.
<dd>The name of the output text file. The output of OSParticulas (or NairnMPM) is to standard output and redirection should be used to save the output to a file. The output file should be saved in the current working directory to insure correct relative paths between the output file and the archive files. The preferred extension for the output file is &quot;<code>.mpm</code>&quot;.</dd>


</dl>
=== Running NairnMPM ===


<a name="trialMPM"></a><h2>Trial MPM Run</h2>
You can run [[NairnMPM]] from a Unix or Linux or DOS command line using:


<p>After <a href="../startup/index.html">compiling</a> the code, you can do a trial run with the following commands:
NairnMPM [options] input > output
</p>
   
<pre>
cd nairn-mpm-fea/NairnMPM/input
./OSParticulas TwoDisks.fmcmd > output.mpm
</pre>


<p>or</p>
where


<pre>
* <tt>[options]</tt> are the options may be one or more of the following:
cd nairn-mpm-fea/NairnMPM/input
*; -v :Validate the input <tt>XML</tt> using the <tt>DTD</tt> file specified in the <tt>!DOCTYPE</tt> line in the preamble of the input file. If the specified <tt>DTD</tt> cannot be found, the code will exit with an error message. If the input file has no <tt>!DOCTYPE</tt>, the validation will be skipped. The required <tt>DTD</tt> file can be found in the <tt>NairnMPM/input</tt> directory of the <tt>nairn-mpm-fea</tt> project. As explained below, this option should always be used when running from a command line.
./NairnMPM TwoDisks.fmcmd > output.mpm
*; -np 4 : Set the number of processors to use for parallel execution (requires compilation of the parallel version of code engine).
</pre>
*; -r : Reverse the bytes when writing results to  archive files. This option can be useful when you are running calculations on one computer, but visualizing them on a different computer which uses a different byte order. For example. old Macintosh computers and computers with Intel chips use opposite byte orders. This option can be omitted if you analyze on the same computer where you run the calculations or if you have analysis software that works with any byte order (such as [[NairnFEAMPM]] and [[NairnFEAMPMViz]]
*; -a : Start the analysis, archive the initial conditions, and then abort the calculations. This option is useful to check that all commands have created the mesh, assigned material points, and created boundary conditions correctly before actually doing the analysis in a subsequent run.
*; -w : When this option is not used, relative file names for output files and for input of bmp files are resolved as being relative to the input file. When this option is used, relative file names are resolved instead to the current working directory.
*; -H (or -h): Display brief help message and then exit.
* <tt>input</tt> is the path name of the input <tt>XML</tt> file. The preferred extension for the input files is <tt>.fmcmd</tt>.
* <tt>output</tt> is the name of the output text file. The output of [[NairnMPM]] is to standard output and redirection should be used to save the output to a file. To insure correct relative paths between the output file and the archive files, the output file should be saved in the same folder as the input file or if option <tt>-w</tt> is used, it should be saved in the current working directory. The preferred extension for the output file is <code>.mpm</code>.


<p>The sample MPM calculation of two disks colliding should finish in a few seconds. The file <code>output.mpm</code> will have the text output results. The archive files should be in a folder created in that directory called <code>TwoDisks</code>.
Note that  [[NairnMPM]] checks many command options, but not all. Most commonly, a typo in an <tt>XML</tt> command name or attribute or use of an invalid attribute may or may not trigger an error. If you have such errors, the resulting MPM simulation may be very different than the one you expected. For this reason, when using command-line execution, you should always include the <tt>-v</tt> option to validate the input file.  
</p>


<p>To verify the results requires visualization tools. See the <a href="../startup/nairnviz.html">visualization options</a> section for the possible tools. The image below shows plot of stress in the <code>x</code>-direction at three different times. Click <a href="disks.mov">here</a> to see a short movie of the same stress.
See the [[Sample MPM Input Command File#Trial Run with XML MPM Input|sample MPM input <tt>XML</tt> file]] for a method to do a trial command line execution for MPM calculations.
</p>
<center>
<img src = "diskframes.jpg" alt = "two disks example" align="center"/>
</center>

Latest revision as of 14:20, 28 November 2023

This page has information on running NairnFEA finite element calculations and NairnMPM material point method calculations. If you just compiled the code, it includes information on doing test calculations.

Running Using NairnFEAMPM (Macintosh OS X only)

If you are using a Mac, you can go to the NairnFEAMPM page and download a complete package that lets you create input files using a scripting language or raw XML commands, run calculations, and visualize the results. If you are working directly with the source code, you can still run calculations using NairnFEAMPM, but first you have to configure it to use to new compiled code engines in place of the embedded code engines. To make that change consult the "Code Engine Development" topic in the help window.

To do a test calculation, choose the "FEA Commands File", "MPM Commands File" and any example options in the "File → New" submenu. Save the input commands to a folder on your computer and then choose the "Analyze → Run FEA/MPM Analysis" menu command. The text output will stream to a window. When it is done you can use built-in tools to visualize the results. For all the details on running calculations and on visualizing results, you can consult the help window within NairnFEAMPM.

Running Using NairnFEAMPMViz Java Application (any platform)

If you are using Windows, you can go to the NairnFEAMPMViz page and download a complete package that lets you create input files using a scripting language or raw XML commands, run calculations, and visualize the results. This stand-alone package works without needed to download and compile and code engines to third-party software tools. If you later decide to work directly with the source code, you can still run calculations using NairnFEAMPMViz, but first you have to configure it to use your newly compiled code engines in place of the bundled code engines in the package. To make that change consult the "Running Calculations" section in the help window.

In Linux, Mac, or Windows, you can alternatively run the NairnFEAMPMViz.jar Java app in the downloaded package. It runs directly in Java (which must be installed on your computer) and will need be configured to run your compiled code engines. For more details consult the "Running Calculations" section in the help window. Note that Mac users should use NairnFEAMPM instead because it has more features than the NairnFEAMPMViz Java application.

To do a test calculation, choose the "New FEA Commands Document", "New MPM Commands Document" or pick any option from the "Examples" submenu in the "File" menu. Save the input commands file to a folder on your computer and then choose the "Analyze → Run FEA/MPM Analysis" menu command. The text output will stream to a window. When it is done you can use built-in tools to visualize the results. For all the details on running calculations and on visualizing results, you can consult the help window within NairnFEAMPMViz.

Command-Line Execution

You can run calculations on any platform using a command line window in Mac or Linux. If Windows when compiled using Visual Studio, you can use these same methods (substituting Window's file paths as needed) in a DOS command window. The following sections give brief instructions.

Running NairnFEA

You can run NairnFEA from a Unix or Linux or DOS command line using:

NairnFEA [options] input > output

where

  • [options] are the options may be one or more of the following:
    -v
    Validate the input XML using the DTD file specified in the !DOCTYPE line in the preamble of the input file. If the specified DTD cannot be found, the code will exit with an error message. If the input file has no !DOCTYPE, the validation will be skipped. The required DTD file can be found in the NairnFEA/input and NairnMPM/input directories of the nairn-mpm-fea project. As explained below, this option should always be used when running from a command line.
    -np 4
    Set the number of processors to use for parallel execution (required compilation of the parallel version of NairnFEA.
    -a
    Read the input file, set up the mesh and all boundary conditions and then abort before any calculations. This option is useful to check that all commands have created the mesh and boundary conditions correctly before actually doing the analysis in a subsequent run.
    -w
    When this option is not used, relative file names for output files and for input of BMP files are resolved as being relative to the input file. When this option is used, relative file names are resolved instead to the current working directory.
    -H (or -h)
    Display brief help message and then exit.
  • input is the path name of the input XML file. The preferred extension for the input files is .fmcmd.
  • output is the name of the output text file. The output of NairnFEA is to standard output and redirection should be used to save the output to a file. The preferred extension for the output file is .fea.

Note that NairnFEA checks many command options, but not all. Most commonly, a typo in an XML command name or attribute or use of an invalid attribute may or may not trigger an error. If you have such errors, the resulting FEA analysis may be very different than the one you expected. For this reason, when using command-line execution, you should always include the -v option to validate the input file.

See the sample FEA input XML file for a method to do a trial command line execution for FEA calculations.

Running NairnMPM

You can run NairnMPM from a Unix or Linux or DOS command line using:

NairnMPM [options] input > output

where

  • [options] are the options may be one or more of the following:
    -v
    Validate the input XML using the DTD file specified in the !DOCTYPE line in the preamble of the input file. If the specified DTD cannot be found, the code will exit with an error message. If the input file has no !DOCTYPE, the validation will be skipped. The required DTD file can be found in the NairnMPM/input directory of the nairn-mpm-fea project. As explained below, this option should always be used when running from a command line.
    -np 4
    Set the number of processors to use for parallel execution (requires compilation of the parallel version of code engine).
    -r
    Reverse the bytes when writing results to archive files. This option can be useful when you are running calculations on one computer, but visualizing them on a different computer which uses a different byte order. For example. old Macintosh computers and computers with Intel chips use opposite byte orders. This option can be omitted if you analyze on the same computer where you run the calculations or if you have analysis software that works with any byte order (such as NairnFEAMPM and NairnFEAMPMViz
    -a
    Start the analysis, archive the initial conditions, and then abort the calculations. This option is useful to check that all commands have created the mesh, assigned material points, and created boundary conditions correctly before actually doing the analysis in a subsequent run.
    -w
    When this option is not used, relative file names for output files and for input of bmp files are resolved as being relative to the input file. When this option is used, relative file names are resolved instead to the current working directory.
    -H (or -h)
    Display brief help message and then exit.
  • input is the path name of the input XML file. The preferred extension for the input files is .fmcmd.
  • output is the name of the output text file. The output of NairnMPM is to standard output and redirection should be used to save the output to a file. To insure correct relative paths between the output file and the archive files, the output file should be saved in the same folder as the input file or if option -w is used, it should be saved in the current working directory. The preferred extension for the output file is .mpm.

Note that NairnMPM checks many command options, but not all. Most commonly, a typo in an XML command name or attribute or use of an invalid attribute may or may not trigger an error. If you have such errors, the resulting MPM simulation may be very different than the one you expected. For this reason, when using command-line execution, you should always include the -v option to validate the input file.

See the sample MPM input XML file for a method to do a trial command line execution for MPM calculations.