Difference between revisions of "NairnFEAMPMViz"

From OSUPDOCS
Jump to navigation Jump to search
 
(140 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''NairnFEAMPMViz''' is a Java application to create simulations, run them, and visualize them. This page has brief instruction on its use and on compiling it if you need to change the source code.
<tt>NairnFEAMPMViz</tt> is a Java application to create simulations, run them, and visualize them. This page has brief instruction on its use and on compiling it if you want to enhance the source code to create new visualization options.


== Introduction ==
== Introduction ==


The <tt>nairn-mpm-fea</tt> project includes source code for a Java application called <b>NairnFEAMPMViz</b> that lets you create input files, run calculations, and visualize results for both [[NairnMPM]] and [[NairnFEA]]. The <tt>nairn-mpm-fea</tt> checkout also has a <tt>NairnFEAMPMViz.jar</tt> file for this application that is ready to run. Note that <b>NairnFEAMPMViz</b> requires a system with Java 1.7.0 (<i>a.k.a</i> Java 7) or newer installed.
The <tt>nairn-mpm-fea</tt> project includes a Java application called <tt>NairnFEAMPMViz.jar</tt> that lets you create input files, run calculations, and visualize results for both [[NairnMPM]] and [[NairnFEA]]. On this page, you can [[#NairnFEAMPMViz Packages|download a complete package]] for Windows that bundles the <tt>jarM</tt> files into a Windows <tt>exe</tt> application that includes everything needed to start running calculations without any additional installations. Once a package is downloaded, launch the application by the documented platform-dependent methods. Instructions for using <tt>NairnFEAMPMViz</tt> are included in the its help window. This page also has some [[#Using NairnFEAMPMViz|quick-start suggestions]].


If you want to make changes to the code, you will need to see the instruction on [[#Compiling NairnFEAMPMViz Java Application|compiling <b>NairnFEAMPMViz</b>]] to learn how to create a new jar file from the altered source code.
If you want to make changes to the <tt>NairnFEAMPMViz.jar</tt> Java application, its entire source is included in the <tt>nairn-mpm-fea</tt> project. See the instructions on [[#Compiling the NairnFEAMPMViz Java Application|compiling <tt>NairnFEAMPMViz.jar</tt>]] to learn how to create a new jar file from altered source code.


== Running <b>NairnFEAMPMViz</b> ==
== NairnFEAMPMViz Packages ==


You can start a Java application as a jar file by double clicking on the jar file. Although this works on most computers, the application will start with the default amount of memory for the Java Virtual Machine. The default memory is enough to open small calculations, but not enough for larger calculations. To start <b>NairnFEAMPMViz</b> with more memory, you should launch the Java application from a command line using:
The following downloads provide packages that contain the <tt>NairnFEAMPMViz</tt> application. They are full-featured versions of <tt>NairnFEAMPMViz</tt> and the download folder contains compiled binaries for finite element analysis and for material point method analysis along with libraries needed to run the application.


  java -Xmx512m -jar NairnFEAMPMViz.jar
{| class="wikitable"
|-
! NairnFEAMPM Download !! Size (MB) !! Updated
|-
| width="450"|[http://www.cof.orst.edu/cof/wse/faculty/Nairn/apps/NairnFEAMPMViz.zip NairnFEAMPMViz 12.0 for Windows] - A complete package for use on Windows computers. This package contains and all the needed <tt>exe</tt> and <tt>dll</tt> files to run run NairnMPM (18) and NairnFEA (8) calculations. It also contains a Java run time environment (which is the reason for the large size). || align="center" width="65"|44.0 || align="center" width="85"|22 APR 2024
|-
| width="450"|<b>NairnFEAMPMViz 12.0</b> for Windows without Java - Rather than provide a separate download without Java, if you have Java 8 or newer installed (also known as Java 1.8.0), you can download the previous version and then delete the <tt>Resources\jre</tt> folder in the extracted files. || || align="center" width="85"|22 APR 2024
|-
| Mac download removed due to MacOS-dependent C++ library challenges. See below if you really want to [[#Running in MacOS|run <tt>NairnFEAMPMViz.jar</tt> on a Mac]]. A better approach for Macs is to download and use [[NairnFEAMPM]] || ||
|-
| No Linux package it provided. See below for [[#Running on a Linux Server|running remotely on a Linux server]]. || ||
|}


The <tt>-Xmx</tt> option allocates the desired memory (where &quot;m&quot; means in megabytes). The <tt>-jar</tt> option gives a path to the compiled jar file (the above assumes you are in the same folder as the jar file).
If the above packages do not work, you can build your own java app, binaries, and libraries by [[Download Source Code|checking out the <tt>nairn-mpm-fea</tt> project]] and compiling the [[#Compiling the NairnFEAMPMViz Java Application|source code to the NairnFEAMPMViz java app]].


When running in Windows, you can launch from a Windows command prompt and you will need to include the path to the <tt>java</tt> command in your <tt>PATH</tt> environment variable. The path to Java executables in Windows will be something like:
=== Running in Windows ===


C:\Program Files\Java\jdk1.7.0_80\bin
Start <tt>NairnFEAMPMViz</tt> by double clicking the <tt>NairnFEAMPMViz.exe</tt> application in the downloaded folder. This application must remain in the same folder as the provided "Resources" folder. For convenience, the recommended installation is to move the expanded "NairnFEAMPMViz" folder to the standard Windows "Program Files" folder. If desired, you can create a short cut to the <tt>NairnFEAMPM.exe</tt> application in the folder and place that short cut on your desktop.


Installation of java may add this path to your Windows environment for you; if not you will have to edit the system environment variables and add it.
=== Running in MacOS ===


=== Creating a Windows Shortcut to <b>NairnFEAMPMViz</b> ===
The preferred approach in MacOS is to download and use the [[NairnFEAMPM]] application. If you want to use <tt>NairnFEAMPMViz.jar</tt>, you will first have to [[Download Source Code|check out]] and [[Compiling in MacOS X|compile the source code]] (including the <tt>xerces</tt> library). Once that is down, start the Java application provided in the download as a jar file by opening the Terminal app and use the command


The preferred method to launch <b>NairnFEAMPMViz</b> correctly in Windows  is to use a simple batch file. The process is:
java -Xmx512m -jar NairnFEAMPMViz.jar


<ul>
The <tt>-Xmx</tt> option allocates the desired memory (where &quot;m&quot; means in megabytes). The command runs with 512 MB of memory. You can alter it to change this amount if needed. The Terminal window that will stay open while <tt>NairnFEAMPMViz</tt> is running. That window is also a console for the Java app and will display some messages that might provide useful information.


<li>Copy the file <tt>Visualization/build/NairnFEAMPMVIz.bat</tt> to the folder containing the jar file you want to run.
The first time you run <tt>NairnFEAMPMViz</tt>, you have to configure it to use the binaries you compiled. This configuration is done in the "Code" pane of the app preferences.
This file contains:


<pre>
Note that double clicking the jar file will open it differently and may not allocate enough memory for large calculations, It might even block you from opening any files. The latter is Apple's way of telling you that you are not smart enough to run jar files that open other files. Launching as above might fix the problem. To use double clicking (with this or any other jar files), you have to change security and preferences for the Mac Java Launcher app. Apparently, if you know these secret steps, Apple will think you are smart enough to run jar files:
java -Xmx512m -jar NairnFEAMPMViz.jar
</pre>


The batch file line assumes your Windows environment includes the path to the <tt>java</tt> command. If not, you can replace <tt>java</tt> by the full path to the <tt>java</tt> executable. The <tt>-Xmx512m</tt> set the amount of memory used to run <tt>NairnFEAMPMViz.jar</tt> in MB. You can decrease or increase as needed.</li>
# Open System preferences and click on the "Security and Preferences" panel.
# Click the "Privacy" tab, choose "Full Disk Access", and click lock to enable changes.
# Click the + icon and add <tt>/System/Library/CoreServices/Jar Launcher.app</tt>.


<li>Next create a short cut to the moved batch file (and give it any desired name). Right click on the new shortcut and select &quot;Properties&quot;. In the properties window:
=== Running on a Linux Server ===
<ol>
<li>Make sure "Target" and "Start in" refer to the batch file, it's folder, and the <tt>NairnFEAMPMViz.jar</tt> file is in that folder too.</li>
<li>Choose "Minimized" from the "Run:" menu.</li>
<li>Click "Change Icon..." and "Browse..." for the <tt>NairnFEAMPMViz.ico</tt> file (in the <tt>Visualization/build</tt> folder).</li>
</ol>
</li>


<li>Finally, move the short cut to your desktop (or to any other folder). You can double click the shortcut to launch <b>NairnFEAMPMViz</b> ready for calculations and/or visualization and with the desired amount of available memory. If you ever run out of memory for large calculation visualization, edit the batch file and increase the number in the <tt>-Xmx</tt> argument.
As a java app, <tt>NairnFEAMPMViz</tt> works fine in Linux, but no stand-alone package is currently provided. When using Linux, you will have to [[Main Page#Getting Started|check out the <tt>nairn-mpm-fea</tt> project]] and build all needed code engines and libraries. Once they are created,
</li>
you have to log onto the Linux server using <tt>X11</tt> terminal software and enable &quot;trusted <tt>X11</tt> forwarding.&quot; The command line to connect is
 
</ul>
 
== Running <b>NairnFEAMPMViz</b> on a Remote Computer ==
 
To run <b>NairnFEAMPMViz</b> remotely (such as running from a terminal connected to a Linux cluster that has your code and calculation results), you have to log onto the remote computer using <tt>X11</tt> terminal software and enable &quot;trusted <tt>X11</tt> forwarding.&quot; The command line is


  ssh -Y -l username servername
  ssh -Y -l username servername


Once connected, start <b>NairnFEAMPMViz</b> using the <tt>java</tt> command line method described in the [[#Running NairnFEAMPMViz|previous section]].
or


Running on a Linux machine using an <tt>X11</tt> terminal is significantly slower, especially when any window with graphics is open. You will want to avoid this option, unless it is the only option available (<i>i.e.</i>, when your only access to the data is through a remote login). The differences are caused by the system dependent Java virtual machines and between <tt>X11</tt> and non-<tt>X11</tt> uses by Java.
  ssh -Y username@servername


== <b>NairnFEAMPMViz</b> Setup ==
Once connected, start <tt>NairnFEAMPMViz.jar</tt> application provided in the checkout by using the <tt>java</tt> command line:


The first time you run [[NairnFEAMPMViz]], it will assume that the [[NairnFEA]] and [[NairnMPM]] code engines are in a [[#Special "bundle" Folder|special "bundle" folder]] that is located in the same folder as the <tt>NairnFEAMPMViz.jar</tt> file. You can run with these setting by [[#Special "bundle" Folder|creating that folder]] and moving [[NairnFEA]] and [[NairnMPM]] code engines to that folder. Alternatively, you can tell <b>NairnFEAMPMViz</b> a different location for the [[NairnFEA]] and [[NairnMPM]] code engines and of a Unix shell. The steps (which are also described in the app's "Help" window) are
java -Xmx512m -jar (path/to/NairnFEAMPMViz.jar)


# Choose "Preferences..." menu command or click the "Prefs" icon
and <tt>NairnFEAMPMViz</tt> will run in a graphical user interface. The <tt>-Xmx512m</tt> argument runs the jar file with 512 MB of memory. You can run with more or less if desired. For instructions on using <tt>NairnFEAMPMViz</tt>, including how to tell it where you saved the code engines, use the &quot;Help&quot; menu command in the application.  
# Click the "Code" tab
# Click the first four "Change..." buttons and locate the [[NairnMPM]] (or [[OSParticulas]] if you are using it) executable, the <tt>NairnMPM.dtd</tt> file, the [[NairnFEA]] executable, and the <tt>NairnFEA.dtd</tt> file (note that in Windows, you must put a copy of <tt>xerces-c_3_1.dll</tt> (numbers may vary) in the same folders as the selected code binaries).
# The <tt>bash</tt> shell command usage depends on system being used. The default setting is <tt>$(windows)</tt> which assumes the code will run using a DOS command line and that the code engines were [[Compiling in Windows|compiled using Visual Studio]]. In Mac or Linux, the <tt>bash</tt> shell is usually at <tt>/bin/bash</tt>, but the shell is only needed when running jobs in background. If using <tt>cygwin</tt> in Windows (which is no longer recommended), the <tt>bash.exe</tt> command will be in the <tt>bin</tt> folder of the root <tt>cygwin</tt> or <tt>cygwin64</tt> folder.
# Optionally click the last "Change..." button and select a work space directory. When a directory is selected, [[NairnFEAMPMViz]] will default to this directory when opening and saving files.


To do a test calculation, choose the "File &rarr; New FEA Commands" or File &rarr; New MPM Commands" menu commands (or click their icons). These will open a file with sample scripted input commands. Save the new commands to a new file with extension <tt>.fmcmd</tt> and the calculations. When the calculations are done, the results file will open for visualization.
To use this method to connect from a Mac or a Windows PC, you will need a terminal application that supports X11 connections. A good choice for Macs is [https://www.xquartz.org/ XQuartz]. A good choice for Windows is [https://mobaxterm.mobatek.net/ MobaXterm] (this app has free and paid versions, but free version should be enough). If running while directly connected to a Linux box, hopefully your installation will have some built-in X11 connection method to allow running of <tt>NairnFEAMPMViz</tt> in a graphical interface.


If nothing happens when running in Windows, you probably do not have the <tt>xerces-c_3_4.dll</tt> file available (and unfortunately a missing <tt>dll</tt> does not send an error message to the Java app that launched the command). You need to put a copy of <tt>xerces-c_3_1.dll</tt> (numbers may vary) in the same folder as the <tt>NairnFEA.exe</tt> and <tt>NairnMPM.exe</tt> file you selected in step 3 above. For running on a different Windows computer, it is better to use a [[#Special "bundle" Folder|special "bundle" folder]] and it will need some additional <tt>dll</tt>s.
== Using NairnFEAMPMViz ==


=== Special "bundle" Folder ===
The first time <tt>NairnFEAMPMViz</tt> is run, you may need to do some setup (as explained in the help). Once set up, a quick-start explanation about typical use is as follows:


To make code engines for calculations more portable to different computers, the <b>NairnFEAMPMViz</b> app looks for a special folder called "bundle" located in the same folder as the <tt>NairnFEAMPMViz.jar</tt> file. The folder should contain:
# You can create "New" input commands files (or open saved ones with "Open" command or by clicking the "Folder" icon) and edit them in a text editing window. To try out a commands file immediately, you can open one of the sample files in "Examples" submenu. Save the example file and the proceed to the next step.
 
<ol>
<li><tt>NairnFEA</tt> and <tt>NairnMPM</tt> code binaries (or <tt>NairnFEA.exe</tt> and <tt>NairnMPM.exe</tt> in Windows).</li>
<li><tt>NairnFEA.dtd</tt> and <tt>NairnMPM.dtd</tt> files to allow validation of input <tt>XML</tt> files.</li>
<li>On windows, the folder must contain the <tt>xerces-c_3_1.dll</tt> (numbers may change depending on <tt>xerces</tt> version).</li>
<li>If you will run calculations on a separate Windows computer that does not have Visual Studio installed, you must additionally add <tt>vcruntime140.dll</tt>, <tt>msvcp140.dll</tt>, and <tt>vcomp140.dll</tt> to the folder. These can be found on your Visual Studio installation computer (they are redistributable libraries).</li>
</ol>
 
You can now copy a folder containing <tt>NairnFEAMPMViz.jar</tt> file and this special  "bundle" folder to another computer and run calculations without needing to checkout and compile any code on that computer. Of course, the other computer must be compatible with the code (''e.g.'', engines compiled for that platform and installed Java 7 or newer (or whatever current <tt>NairnFEAMPMViz.jar</tt> requires)).
 
== <b>NairnFEAMPMViz</b> Usage ==
 
For many details on use of <b>NairnFEAMPM</b>, click the &quot;Help&quot; button in the application. The follow tasks provide a quick-start explanation about typical use of <b>NairnFEAMPMViz</b>:
 
# You can create "New" input commands files (or open saved ones with "Open" command or by clicking the "Folder" icon) and edit them in a text editing window.
# To run an analysis, choose the "Analyze &rarr; Run FEA/MPM Analysis" command (or click the run arrow icon). You will asked to decide where to save the results (as an <tt>.fea</tt> or <tt>.mpm</tt> file). Once you select a name, the calculations will run.
# To run an analysis, choose the "Analyze &rarr; Run FEA/MPM Analysis" command (or click the run arrow icon). You will asked to decide where to save the results (as an <tt>.fea</tt> or <tt>.mpm</tt> file). Once you select a name, the calculations will run.
# When the calculations are done, the results file will open for visualization. The text results will appear in the top two sections of a new window. A control panel for visualizing results will appear in the bottom section.
# When the calculations are done, the results file will open for visualization. The text results will appear in the top two sections of a new window. A control panel for visualizing results will appear in the bottom section.
Line 97: Line 76:
# To open saved results for visualization use the "Open..." menu command or click the "Folder" icon. Note that "calculation results" are in the file of output text sent by [[NairnMPM]] or [[NairnFEA]] to standard output, and <i>not</i> one of the associated files written by those calculations. Once opened, the text results will appear as described above after running calculations.
# To open saved results for visualization use the "Open..." menu command or click the "Folder" icon. Note that "calculation results" are in the file of output text sent by [[NairnMPM]] or [[NairnFEA]] to standard output, and <i>not</i> one of the associated files written by those calculations. Once opened, the text results will appear as described above after running calculations.


== Compiling <b>NairnFEAMPMViz</b> Java Application ==
One limitation of the [[#NairnFEAMPMViz Packages|<tt>NairnFEAMPMViz</tt> pacakages]] is that the embedded binaries may not be the latest versions from the [[Main Page|<tt>nairn-mpm-fea</tt> project]]. To use the latest versions of the code, you should:


One option for creating new visualization tools, is to edit the <b>NairnFEAMPMViz</b> source code and create them. After editing, you will need to recompile the code as explained in this section.
# [[Download Source Code]] (<i>i.e.</i>, check out the <tt>nairn-mpm-fea</tt> project).
# [[Compile the Code Engines]] for [[NairnMPM]] and [[NairnFEA]].
# Either copy the compiled binaries into the package folders (replacing the original versions) or configure <tt>NairnFEAMPMViz</tt> to run the code engines created by the project tools. See <tt>NairnFEAMPMViz</tt>'s help window for information on configuring it to run new code engines.
 
== Compiling the NairnFEAMPMViz Java Application ==
 
The <tt>nairn-mpm-fea</tt> project contains the complete source code for <tt>NairnFEAMPMViz</tt>. One option for creating new visualization tools, therefore, is to edit the <tt>NairnFEAMPMViz</tt> source code and create them. After editing, you will need to recompile the code as explained in this section.


=== Compiling Using Eclipse ===
=== Compiling Using Eclipse ===


[https://www.eclipse.org Eclipse] is an open-source and free development system (IDE) for Java (and for other languages). This section explains how to import the '''NairnFEAMPMViz''' code into an <tt>Eclipse</tt> project. This method was done using <tt>Eclipse</tt> Mars (4.5), which is available free for Windows, Mac, and other platforms. These steps will probably work for other versions too, possible with minor modifications.
[https://www.eclipse.org Eclipse] is an open-source and free development system (IDE) for Java (and for other languages). This section explains how to import the <tt>NairnFEAMPMViz</tt> code into an <tt>Eclipse</tt> project. This method was done using <tt>Eclipse</tt> Mars (4.5), which is available free for Windows, Mac, and other platforms. These steps will probably work for other versions too, possibly with minor modifications.


Assuming you have the [https://www.eclipse.org/ide/ Eclipse IDE for Java development] installed, you can import a project for editing <b>NairnFEAMPMViz</b> as follows:
Assuming you have the [https://www.eclipse.org/ide/ Eclipse IDE for Java development] installed, you can import a project for editing <tt>NairnFEAMPMViz</tt> as follows:


<ol>
<ol>
Line 111: Line 96:
<li>Start Eclipse</li>
<li>Start Eclipse</li>
<li>Choose Import... menu command and select "Existing Projects into Workspace" in the "General" section.</li>
<li>Choose Import... menu command and select "Existing Projects into Workspace" in the "General" section.</li>
<li>On next screen, choose <tt>Visualization/src</tt> folder in the cloned <tt>nairn-mpm-fea</tt> project.</li>
<li>On next screen, choose <tt>Visualization/src</tt> folder in the cloned <tt>nairn-mpm-fea</tt> project. A "NairnFEAMPMViz" project should show up.</li>
<li>The "NairnFEAMPMViz" project should show up. Select it and then finish the import (you can copy files to you Eclipse work space or leave them in the project checkout).</li>
<li>You can select "Copy projects into workspace" or leave it unchecked. When checked, all files are copied to your Eclipse workspace and the files in the code check out remain in place. If not checked, the Eclipse project will directly use (and edit) the files in your check out.</li>
<li>Click "Finish" to import the project.</li>


</ol>
</ol>
Line 125: Line 111:
<li>Click on "Arguments" tab</li>
<li>Click on "Arguments" tab</li>
<li>Enter "-Xmx512m" into the VM Arguments field
<li>Enter "-Xmx512m" into the VM Arguments field
(this command tells the Java machine to allocate 512 MB for running <b>NairnFEAMPMViz</b>.
(this command tells the Java machine to allocate 512 MB for running <tt>NairnFEAMPMViz</tt>.
You can increase or decrease the memory as needed).</li>
You can increase or decrease the memory as needed).</li>
<li>Click "Apply"</li>
<li>Click "Apply"</li>
<li>Click "Run" to run <b>NairnFEAMPMViz</b></li>
<li>Click "Run" to run <tt>NairnFEAMPMViz</tt></li>
<li>In the future, you can run using the  "NairnFEAMPMViz with Memory" item in the Run History menu</li>
<li>In the future, you can run using the  "NairnFEAMPMViz with Memory" item in the Run History menu</li>
</ol>
</ol>


The above process will let you compile and run <b>NairnFEAMPMViz</b> within <tt>Eclipse</tt>. You can also use <tt>Eclipse</tt> to create a jar file, which can be run outside of <tt>Eclipse</tt>. The process is:
The above process will let you compile and run <tt>NairnFEAMPMViz</tt> within <tt>Eclipse</tt>. You can also use <tt>Eclipse</tt> to create a jar file, which can be run outside of <tt>Eclipse</tt>. The process is:


<ol>
<ol>
<li>Choose menu command "Export..." and then select "Runable Jar File" in the "Java" section. Click "Next".</li>
<li>Choose menu command "Export..." and then select "Runable Jar File" in the "Java" section. Click "Next".</li>
<li>Choose the <b>NairnFEAMPMViz</b> launch configuration (such as the "NairnFEAMPMViz with Memory" one created above), choose export destination (which by default is <tt>(project)/lib/NairnFEAMPMViz.jar</tt>, where <tt>(project)</tt> is the name you gave this project in your workspace), and select to "Extract required libraries into generated JAR".</li>
<li>Choose the <tt>NairnFEAMPMViz</tt> launch configuration (such as the "NairnFEAMPMViz with Memory" one created above), choose export destination (which by default is <tt>(project)/lib/NairnFEAMPMViz.jar</tt>, where <tt>(project)</tt> is the name you gave this project in your workspace), and select to "Extract required libraries into generated JAR".</li>
<li>Click "Finish" to generate the jar file.</li>
<li>Click "Finish" to generate the jar file.</li>
<li>See [[#Running NairnFEAMPMViz|above]] to run the new jar with sufficient memory.
<li>If desired, you can save the jar file to a [[#NairnFEAMPMViz Packages|downloaded package]] to update that package to use your recompiled jar file.</li>
</li>
</li>
</ol>
</ol>
Line 144: Line 130:
==== Compiling a Checked Out Copy - OSParticulas Only ====
==== Compiling a Checked Out Copy - OSParticulas Only ====


When using OSPartculas, you can alternatively check out the '''NairnFEAMPMViz''' code directly from the repository using SVN. These steps need tools for subversion installed in Eclipse as described [[Compiling Using Eclipse IDE|here]]. Be sure to do the optional step for Java development (or just download Eclipse for Java development). You are now ready to manage <tt>Eclipse</tt> projects using SVN. To get started with a <b>NairnFEAMPMViz</b> project, do the following:
When using OSPartculas, you can alternatively check out the <tt>NairnFEAMPMViz</tt> code directly from the repository using SVN. These steps need tools for subversion installed in Eclipse as follows:
 
<ol>
<li>Install tools for subversion (this step and the next). Choose "Install New Software..." menu command (in the "Help" menu) choose download site to "work with." Once site data are loaded, choose "Subversive SVN Team Provider" in the "Collaboration" section and proceed to installation. Note that the group developing the SVN plug in dropped out of Eclipse Project after version Eclipse Oxygene. To install the SVN tools after this version, you have to adding the mirror site http://download.eclipse.org/technology/subversive/4.0/update-site/ (this approached works through Eclipse 2021-06. Future version might need to update this link such as to change "4.0" to latest version. To check for new options, look for "Directory Contents" at http://download.eclipse.org/technology/subversive/). After installation, restart <tt>Eclipse</tt>.
</li>
 
<li>Use of subversion also needs a "connector," which can be done using Eclipse&rarr;Preferences&rarr;Version Control (Team)&rarr;SVN and opening the connectors tab. You should then "Get Connectors..." and select the one you want. Select a connector that is compatible with your version of subversion (to check your version, use "<tt>svn --version</tt>" in your command-line tool). After installation, restart <tt>Eclipse</tt>. If no connectors show up, you can try to manually install them using the "Install New Software..." command and adding the site https://community.polarion.com/projects/subversive/download/eclipse/6.0/update-site/.
</li>
</ol>
 
You are now ready to manage <tt>Eclipse</tt> projects using SVN. To get started with a <tt>NairnFEAMPMViz</tt> project, do the following:


<ol>
<ol>
Line 152: Line 148:
<li>You will be asked to select an SVN repository. Enter the following settings followed by clicking "Next":
<li>You will be asked to select an SVN repository. Enter the following settings followed by clicking "Next":
<ul>
<ul>
<li>URL: <tt>http://(OSParticulas Server)/svn/OSParticulas/trunkVisualization/src</tt></li>
<li>URL: <tt>(http_OSParticulas_Server)/svn/OSParticulas/trunk/Visualization/src</tt></li>
<li>User: enter your username and password for the OSParticulas svn repository.</li>
<li>User: enter your username and password for the OSParticulas svn repository.</li>
</ul>
</ul>
Line 159: Line 155:
<li>Choose "Head Revision" for latest version or use date or revision options for older versions and then click "Next" (or "Finish" is "Next" is not available).</li>
<li>Choose "Head Revision" for latest version or use date or revision options for older versions and then click "Next" (or "Finish" is "Next" is not available).</li>


<li>Select "Check out as project with the name specified" and specify <b>NairnFEAMPMViz</b>. Click "Finish" and the project will be created. It should automatically build and be ready to run.</li>
<li>Select "Check out as project with the name specified" and specify <tt>NairnFEAMPMViz</tt>. Click "Finish" and the project will be created. It should automatically build and be ready to run.</li>


<li>See above for how create a running option with sufficient memory.</li>
<li>See above for how create a running option with sufficient memory.</li>
</ol>
</ol>


The above process will create a project in your <tt>Eclipse</tt> workspace that will have a copy of the files needed for the <b>NairnFEAMPMViz</b> project. You can update to the latest version by right clicking (or control clicking on Mac) the project name and selecting "Update" from the "Team" submenu. If you are certified as a project committer, you can save your changes by right clicking (or control clicking on Mac) on the project name and choosing "Team &rarr; Commit..." (be sure to enter message described the changes being committed).
The above process will create a project in your <tt>Eclipse</tt> workspace that will have a copy of the files needed for the <tt>NairnFEAMPMViz</tt> project. You can update to the latest version by right clicking (or control clicking on Mac) the project name and selecting "Update" from the "Team" submenu. If you are certified as a project committer, you can save your changes by right clicking (or control clicking on Mac) on the project name and choosing "Team &rarr; Commit..." (be sure to enter message described the changes being committed).


=== Command Line Compile ===
=== Command Line Compile ===


You can compile the code and create the jar file on a Unix/Linux command line by running the
'''Warning''': This compile method is not routinely checked. It may be out of sync with current version of the code.
 
You can alternatively compile the code and create the jar file on a Unix/Linux command line by running the
script called <tt>makejar</tt> that is located at:
script called <tt>makejar</tt> that is located at:


Line 177: Line 175:


To run this script, you need the <tt>javac</tt> compiler and <tt>jar</tt> utility
To run this script, you need the <tt>javac</tt> compiler and <tt>jar</tt> utility
installed on your computer. Compilation requires Java 1.6.0 or newer. It is available free on
installed on your computer. Compilation requires Java 1.7.0 or newer. It is available free on
various platforms as part of the
various platforms as part of the
standard Java Development Kit (JDK) installation.
standard Java Development Kit (JDK) installation.


If the required <tt>javac</tt> and <tt>jar</tt> tools are not in the default path, you
If the required <tt>javac</tt> and <tt>jar</tt> tools are not in the default path, you
can edit the <tt>makejar</tt> file and enter the full path to each command (or add their paths to your <tt>$PATH</tt> environment variable). When using <tt>cygwin</tt> in Windows, the path to the java binaries will be something like:
can edit the <tt>makejar</tt> file and enter the full path to each command (or add their paths to your <tt>$PATH</tt> environment variable).
 
/cygdrive/c/Program Files/Java/jdk1.6.0_03/bin

Latest revision as of 12:59, 24 April 2024

NairnFEAMPMViz is a Java application to create simulations, run them, and visualize them. This page has brief instruction on its use and on compiling it if you want to enhance the source code to create new visualization options.

Introduction

The nairn-mpm-fea project includes a Java application called NairnFEAMPMViz.jar that lets you create input files, run calculations, and visualize results for both NairnMPM and NairnFEA. On this page, you can download a complete package for Windows that bundles the jarM files into a Windows exe application that includes everything needed to start running calculations without any additional installations. Once a package is downloaded, launch the application by the documented platform-dependent methods. Instructions for using NairnFEAMPMViz are included in the its help window. This page also has some quick-start suggestions.

If you want to make changes to the NairnFEAMPMViz.jar Java application, its entire source is included in the nairn-mpm-fea project. See the instructions on compiling NairnFEAMPMViz.jar to learn how to create a new jar file from altered source code.

NairnFEAMPMViz Packages

The following downloads provide packages that contain the NairnFEAMPMViz application. They are full-featured versions of NairnFEAMPMViz and the download folder contains compiled binaries for finite element analysis and for material point method analysis along with libraries needed to run the application.

NairnFEAMPM Download Size (MB) Updated
NairnFEAMPMViz 12.0 for Windows - A complete package for use on Windows computers. This package contains and all the needed exe and dll files to run run NairnMPM (18) and NairnFEA (8) calculations. It also contains a Java run time environment (which is the reason for the large size). 44.0 22 APR 2024
NairnFEAMPMViz 12.0 for Windows without Java - Rather than provide a separate download without Java, if you have Java 8 or newer installed (also known as Java 1.8.0), you can download the previous version and then delete the Resources\jre folder in the extracted files. 22 APR 2024
Mac download removed due to MacOS-dependent C++ library challenges. See below if you really want to run NairnFEAMPMViz.jar on a Mac. A better approach for Macs is to download and use NairnFEAMPM
No Linux package it provided. See below for running remotely on a Linux server.

If the above packages do not work, you can build your own java app, binaries, and libraries by checking out the nairn-mpm-fea project and compiling the source code to the NairnFEAMPMViz java app.

Running in Windows

Start NairnFEAMPMViz by double clicking the NairnFEAMPMViz.exe application in the downloaded folder. This application must remain in the same folder as the provided "Resources" folder. For convenience, the recommended installation is to move the expanded "NairnFEAMPMViz" folder to the standard Windows "Program Files" folder. If desired, you can create a short cut to the NairnFEAMPM.exe application in the folder and place that short cut on your desktop.

Running in MacOS

The preferred approach in MacOS is to download and use the NairnFEAMPM application. If you want to use NairnFEAMPMViz.jar, you will first have to check out and compile the source code (including the xerces library). Once that is down, start the Java application provided in the download as a jar file by opening the Terminal app and use the command

java -Xmx512m -jar NairnFEAMPMViz.jar

The -Xmx option allocates the desired memory (where "m" means in megabytes). The command runs with 512 MB of memory. You can alter it to change this amount if needed. The Terminal window that will stay open while NairnFEAMPMViz is running. That window is also a console for the Java app and will display some messages that might provide useful information.

The first time you run NairnFEAMPMViz, you have to configure it to use the binaries you compiled. This configuration is done in the "Code" pane of the app preferences.

Note that double clicking the jar file will open it differently and may not allocate enough memory for large calculations, It might even block you from opening any files. The latter is Apple's way of telling you that you are not smart enough to run jar files that open other files. Launching as above might fix the problem. To use double clicking (with this or any other jar files), you have to change security and preferences for the Mac Java Launcher app. Apparently, if you know these secret steps, Apple will think you are smart enough to run jar files:

  1. Open System preferences and click on the "Security and Preferences" panel.
  2. Click the "Privacy" tab, choose "Full Disk Access", and click lock to enable changes.
  3. Click the + icon and add /System/Library/CoreServices/Jar Launcher.app.

Running on a Linux Server

As a java app, NairnFEAMPMViz works fine in Linux, but no stand-alone package is currently provided. When using Linux, you will have to check out the nairn-mpm-fea project and build all needed code engines and libraries. Once they are created, you have to log onto the Linux server using X11 terminal software and enable "trusted X11 forwarding." The command line to connect is

ssh -Y -l username servername

or

 ssh -Y username@servername

Once connected, start NairnFEAMPMViz.jar application provided in the checkout by using the java command line:

java -Xmx512m -jar (path/to/NairnFEAMPMViz.jar)

and NairnFEAMPMViz will run in a graphical user interface. The -Xmx512m argument runs the jar file with 512 MB of memory. You can run with more or less if desired. For instructions on using NairnFEAMPMViz, including how to tell it where you saved the code engines, use the "Help" menu command in the application.

To use this method to connect from a Mac or a Windows PC, you will need a terminal application that supports X11 connections. A good choice for Macs is XQuartz. A good choice for Windows is MobaXterm (this app has free and paid versions, but free version should be enough). If running while directly connected to a Linux box, hopefully your installation will have some built-in X11 connection method to allow running of NairnFEAMPMViz in a graphical interface.

Using NairnFEAMPMViz

The first time NairnFEAMPMViz is run, you may need to do some setup (as explained in the help). Once set up, a quick-start explanation about typical use is as follows:

  1. You can create "New" input commands files (or open saved ones with "Open" command or by clicking the "Folder" icon) and edit them in a text editing window. To try out a commands file immediately, you can open one of the sample files in "Examples" submenu. Save the example file and the proceed to the next step.
  2. To run an analysis, choose the "Analyze → Run FEA/MPM Analysis" command (or click the run arrow icon). You will asked to decide where to save the results (as an .fea or .mpm file). Once you select a name, the calculations will run.
  3. When the calculations are done, the results file will open for visualization. The text results will appear in the top two sections of a new window. A control panel for visualizing results will appear in the bottom section.
    • To plot results, select a plot type in the control panel area and then follow the blue line to select all available options for that type of plot.
    • Finally, click the "Plot" button to get the plot in a new window. To plot different results, select new options and click the "Plot" button again (which may have changed to "Replot" or "Add Plot").
  4. To open saved results for visualization use the "Open..." menu command or click the "Folder" icon. Note that "calculation results" are in the file of output text sent by NairnMPM or NairnFEA to standard output, and not one of the associated files written by those calculations. Once opened, the text results will appear as described above after running calculations.

One limitation of the NairnFEAMPMViz pacakages is that the embedded binaries may not be the latest versions from the nairn-mpm-fea project. To use the latest versions of the code, you should:

  1. Download Source Code (i.e., check out the nairn-mpm-fea project).
  2. Compile the Code Engines for NairnMPM and NairnFEA.
  3. Either copy the compiled binaries into the package folders (replacing the original versions) or configure NairnFEAMPMViz to run the code engines created by the project tools. See NairnFEAMPMViz's help window for information on configuring it to run new code engines.

Compiling the NairnFEAMPMViz Java Application

The nairn-mpm-fea project contains the complete source code for NairnFEAMPMViz. One option for creating new visualization tools, therefore, is to edit the NairnFEAMPMViz source code and create them. After editing, you will need to recompile the code as explained in this section.

Compiling Using Eclipse

Eclipse is an open-source and free development system (IDE) for Java (and for other languages). This section explains how to import the NairnFEAMPMViz code into an Eclipse project. This method was done using Eclipse Mars (4.5), which is available free for Windows, Mac, and other platforms. These steps will probably work for other versions too, possibly with minor modifications.

Assuming you have the Eclipse IDE for Java development installed, you can import a project for editing NairnFEAMPMViz as follows:

  1. Start Eclipse
  2. Choose Import... menu command and select "Existing Projects into Workspace" in the "General" section.
  3. On next screen, choose Visualization/src folder in the cloned nairn-mpm-fea project. A "NairnFEAMPMViz" project should show up.
  4. You can select "Copy projects into workspace" or leave it unchecked. When checked, all files are copied to your Eclipse workspace and the files in the code check out remain in place. If not checked, the Eclipse project will directly use (and edit) the files in your check out.
  5. Click "Finish" to import the project.

The imported project should compile fine. To create a running option with sufficient memory, choose the "Run Configurations..." menu command

  1. Select "Java Application" and click the "New" icon to create a new runnable
  2. Enter any name such as "NairnFEAMPMViz with Memory".
  3. Enter "NairnFEAMPMViz" (or browse for it) into the Project field
  4. Enter "NairnFEAMPMViz" (or browse for it) into the Main class field
  5. Click on "Arguments" tab
  6. Enter "-Xmx512m" into the VM Arguments field (this command tells the Java machine to allocate 512 MB for running NairnFEAMPMViz. You can increase or decrease the memory as needed).
  7. Click "Apply"
  8. Click "Run" to run NairnFEAMPMViz
  9. In the future, you can run using the "NairnFEAMPMViz with Memory" item in the Run History menu

The above process will let you compile and run NairnFEAMPMViz within Eclipse. You can also use Eclipse to create a jar file, which can be run outside of Eclipse. The process is:

  1. Choose menu command "Export..." and then select "Runable Jar File" in the "Java" section. Click "Next".
  2. Choose the NairnFEAMPMViz launch configuration (such as the "NairnFEAMPMViz with Memory" one created above), choose export destination (which by default is (project)/lib/NairnFEAMPMViz.jar, where (project) is the name you gave this project in your workspace), and select to "Extract required libraries into generated JAR".
  3. Click "Finish" to generate the jar file.
  4. If desired, you can save the jar file to a downloaded package to update that package to use your recompiled jar file.

Compiling a Checked Out Copy - OSParticulas Only

When using OSPartculas, you can alternatively check out the NairnFEAMPMViz code directly from the repository using SVN. These steps need tools for subversion installed in Eclipse as follows:

  1. Install tools for subversion (this step and the next). Choose "Install New Software..." menu command (in the "Help" menu) choose download site to "work with." Once site data are loaded, choose "Subversive SVN Team Provider" in the "Collaboration" section and proceed to installation. Note that the group developing the SVN plug in dropped out of Eclipse Project after version Eclipse Oxygene. To install the SVN tools after this version, you have to adding the mirror site http://download.eclipse.org/technology/subversive/4.0/update-site/ (this approached works through Eclipse 2021-06. Future version might need to update this link such as to change "4.0" to latest version. To check for new options, look for "Directory Contents" at http://download.eclipse.org/technology/subversive/). After installation, restart Eclipse.
  2. Use of subversion also needs a "connector," which can be done using Eclipse→Preferences→Version Control (Team)→SVN and opening the connectors tab. You should then "Get Connectors..." and select the one you want. Select a connector that is compatible with your version of subversion (to check your version, use "svn --version" in your command-line tool). After installation, restart Eclipse. If no connectors show up, you can try to manually install them using the "Install New Software..." command and adding the site https://community.polarion.com/projects/subversive/download/eclipse/6.0/update-site/.

You are now ready to manage Eclipse projects using SVN. To get started with a NairnFEAMPMViz project, do the following:

  1. Choose menu command "New → Project...", expand the "SVN" section, choose "Project from SVN" and click "Next".
  2. You will be asked to select an SVN repository. Enter the following settings followed by clicking "Next":
    • URL: (http_OSParticulas_Server)/svn/OSParticulas/trunk/Visualization/src
    • User: enter your username and password for the OSParticulas svn repository.
  3. Choose "Head Revision" for latest version or use date or revision options for older versions and then click "Next" (or "Finish" is "Next" is not available).
  4. Select "Check out as project with the name specified" and specify NairnFEAMPMViz. Click "Finish" and the project will be created. It should automatically build and be ready to run.
  5. See above for how create a running option with sufficient memory.

The above process will create a project in your Eclipse workspace that will have a copy of the files needed for the NairnFEAMPMViz project. You can update to the latest version by right clicking (or control clicking on Mac) the project name and selecting "Update" from the "Team" submenu. If you are certified as a project committer, you can save your changes by right clicking (or control clicking on Mac) on the project name and choosing "Team → Commit..." (be sure to enter message described the changes being committed).

Command Line Compile

Warning: This compile method is not routinely checked. It may be out of sync with current version of the code.

You can alternatively compile the code and create the jar file on a Unix/Linux command line by running the script called makejar that is located at:

nairn-mpm-fea/Visualization/build/makejar

When you run this script, it will compile the Java source code and create a self-contained jar file in that same directory. By default this script assumes compilation on Windows. To compile on Mac uses makejar -m. To compile on Linux, use makejar -l.

To run this script, you need the javac compiler and jar utility installed on your computer. Compilation requires Java 1.7.0 or newer. It is available free on various platforms as part of the standard Java Development Kit (JDK) installation.

If the required javac and jar tools are not in the default path, you can edit the makejar file and enter the full path to each command (or add their paths to your $PATH environment variable).