Difference between revisions of "OpenFOAM"

From UFRC
Jump to navigation Jump to search
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=Using OpenFOAM=
+
__NOTOC__
 +
__NOEDITSECTION__
 +
[[Category:Software]][[Category:Fluid Dynamics]]
 +
{|<!--Main settings - REQUIRED-->
 +
|{{#vardefine:app|OpenFoam}}
 +
|{{#vardefine:url|http://www.openfoam.org}}
 +
|{{#vardefine:exe|}} <!--Present manual instructions for running the software -->
 +
|{{#vardefine:conf|}} <!--Enable config wiki page link - {{#vardefine:conf|1}} = ON/conf|}} = OFF-->
 +
|{{#vardefine:pbs|}} <!--Enable PBS script wiki page link-->
 +
|{{#vardefine:slurm|}} <!--Enable SLURM script wiki page link-->
 +
|{{#vardefine:policy|}} <!--Enable policy section -->
 +
|{{#vardefine:testing|}} <!--Enable performance testing/profiling section -->
 +
|{{#vardefine:faq|}} <!--Enable FAQ section -->
 +
|{{#vardefine:citation|}} <!--Enable Reference/Citation section -->
 +
|}
 +
<!-- ########  Template Body ######## -->
 +
<!--Description-->
 +
{{#if: {{#var: url}}|
 +
{{App_Description|app={{#var:app}}|url={{#var:url}}|name={{#var:app}}}}|}}
  
Before using OpenFOAM, you will need to set up your environment for it.   This can be easily down with the following commands
+
OpenFOAM is a free, open source CFD software package produced by a commercial company, OpenCFD Ltd. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics and electromagnetic.
  
# source /apps/OpenFOAM/OpenFOAM-1.7.1/etc/bashrc
+
<!--Modules-->
# export PATH=/apps/OpenFOAM/tools/bin:$PATH
+
==Required Modules==
# export LD_LIBRARY_PATH=/apps/OpenFOAM/tools/lib64:$LD_LIBRARY_PATH
+
[[Modules|modules documentation]]
 
+
*intel/2018
To use the ParaView-based visualization tools, you will need to
+
*openmpi/3.0.0
 
+
*openfoam/5.0
# Run an X server on your local display
 
# Use X11 forwarding with ssh.  For example,
 
## mylaptop$ ssh -Y submit.hpc.ufl.edu
 
## submit1$ ssh -Y test04
 
## source /apps/OpenFOAM/OpenFOAM-1.7.1/etc/bashrc
 
## export PATH=/apps/OpenFOAM/tools/bin:$PATH
 
## export LD_LIBRARY_PATH=/apps/OpenFOAM/tools/lib64:$LD_LIBRARY_PATH
 
 
 
You should then be able to run OpenFOAM visualization commands and view the results on your local display.
 
 
 
=Building/Installing OpenFoam=
 
 
 
These are just some notes for whatever poor soul may have to build or install this mass of software on a not quite up-to-date CentOS distro (5.3 in our case).
 
 
 
== Version 1.7.1 ==
 
 
 
Needs to be built with gcc 4.4.4 or newer.  Gcc 4.4.4, in turn, requires a bunch of stuff so we have the following (in the order in which they should be built).
 
 
 
=== gmp-5.0.1 ===
 
<pre>
 
./configure --prefix=/apps/openfoam/tools
 
make -j 4
 
make install
 
</pre>
 
 
 
=== ppl-0.10.2 ===
 
 
 
There is an error in the configure script due to a change in GMP fixed as below.
 
 
 
<pre>
 
diff -u configure.orig configure
 
--- configure.orig 2011-02-11 12:29:38.000000000 -0500
 
+++ configure 2011-02-10 13:34:14.000000000 -0500
 
@@ -16473,7 +16473,7 @@
 
      || GMP_LIMB_BITS != mp_bits_per_limb) {
 
    std::cerr
 
      << "GMP header (gmp.h) and library (ligmp.*) bits-per-limb mismatch:\n"
 
-      << "header gives " << __GMP_BITS_PER_MP_LIMB << ";\n"
 
+      << "header gives " << GMP_LIMB_BITS << ";\n"
 
      << "library gives " << mp_bits_per_limb << ".\n"
 
      << "This probably means you are on a bi-arch system and\n"
 
      << "you are compiling with the wrong header or linking with\n"
 
 
 
</pre>
 
  
 
<pre>
 
<pre>
./configure --prefix=/apps/openfoam/tools \
+
$ module load intel/2018  openmpi/3.0.0 openfoam/5.0
            --with-libgmp-prefix=/apps/openfoam/tools \
 
            --with-libgmpxx-prefix=/apps/openfoam/tools \
 
            --enable-cxx
 
make -j4
 
make install
 
 
</pre>
 
</pre>
  
=== mpfr-2.4.2 ===
+
==System Variables==
 
+
{|cellpadding="10"
<pre>
+
|-style="vertical-align:top;"
./configure --prefix=/apps/openfoam/tools \
+
|
            --with-gmp=/apps/openfoam/tools
+
=== OpenFOAM variables ===
make -j 4
+
* FOAM_INST_DIR - installation base directory
make install
+
* FOAM_APPBIN - executable program directory
</pre>
+
* FOAM_LIB - library directory
 
+
* FOAM_SRC - source directory
=== cloog-ppl (0.15.9) ===
+
* FOAM_EXT_LIBBIN - ThirdParty library directory
 
+
* PV_PLUGIN_PATH - ParaView library directory
<pre>
+
* FOAM_TUTORIALS - tutorial directory
./configure --prefix=/apps/openfoam/tools \
+
||
            --with-gmp=/apps/openfoam/tools \
+
=== Wmake variables ===
            --with-ppl=/apps/openfoam/tools 
+
These are the wmake parameters used in building OpenFOAM and could be used for compiling the third-party OpenFOAM applications using wmake.
make -j 4
 
make install
 
</pre>
 
 
 
=== gcc (4.4.4) ===
 
 
 
<pre>
 
../configure --prefix=/apps/openfoam/tools
 
            --with-gmp=/apps/openfoam/tools \
 
            --with-mpfr=/apps/openfoam/tools \
 
            --with-ppl=/apps/openfoam/tools \
 
            --with-cloog=/apps/openfoam/tools
 
make -j 8
 
make install
 
</pre>
 
 
 
== OpenFOAM: Build Notes ==
 
 
 
# Be wary of changing their default directory structure.  Although it appears easy to do in the "etc/bashrc" file, there are places in the wmake build system that seem to be hardwired for the "$WM_PROJECT-$WM_PROJECT_VERSION" structure and parts of the build will fail.
 
# When building the support software (ppl, gmp, etc.), it is probably best to specify "--libdir=<prefix>/lib64" to the configure script.  Gcc will build both 32 and 64 bit libraries so you will end up with a mix of 32 and 64-bit libraries in your <prefix>/lib dir if you aren't specific.
 
# The default OpenFOAM installation denies access to most of the files and directories to "other".  If others are to use the install, the permissions on many files have to be changed from 750 -> 755, 740 -> 744, and 640 -> 644.
 
 
 
==ParaView (3.8.0)==
 
 
 
Rather than building ParaView and all its associated dependencies from source, I did the following.
 
 
 
# cd /var/tmp
 
# wget  http://www.paraview.org/files/v3.8/ParaView-3.8.1-Linux-x86_64.tar.gz
 
# tar xvf ParaView-3.8.1-Linux-x86_64.tar.gz
 
# cd /apps/OpenFOAM/ThirdParty-1.7.1/platforms/linux64Gcc
 
# mkdir paraview-3.8.1
 
# ln -s paraview-3.8.1 paraview-3.8.0
 
# paraview-3.8.1
 
# (cd /var/tmp/ParaView-3.8.1-Linux-x86_64/; tar cf - *) | tar xvf -
 
  
This just puts the downloaded version of ParaView (and all the support libraries) in the location expected by OpenFOAM - no need to update PATH and LD_LIBRARY_PATH with new entries for paraview.  They are already included in the paths set by the OpenFOAM bashrc file. 
+
* WM_PROJECT_INST_DIR - wmake installation base directory
 +
* WM_PROJECT_VERSION - wmake project version
 +
* WM_PROJECT - wmake project name (OpenFOAM in this case)
 +
* WM_PROJECT_DIR - wmake project directory
 +
* WM_DIR - directory where "wmake" executable is
 +
* WM_ARCH - architecture type
 +
* WM_COMPILER - compiler name
 +
* WM_COMPILE_OPTION - compiler option
 +
* WM_LINK_LANGUAGE - compiler for linking
 +
* WM_PRECISION_OPTION - precision type
 +
|}
  
Yes, there is a minor version difference but as long as it works, we won't quibble over the details.
+
<!--Additional-->
 +
{{#if: {{#var: exe}}|==Additional Information==
 +
WRITE INSTRUCTIONS ON RUNNING THE ACTUAL BINARY|}}
 +
{{#if: {{#var: conf}}|==Configuration==
 +
See the [[{{PAGENAME}}_Configuration]] page for {{#var: app}} configuration details.|}}
 +
{{#if: {{#var: pbs}}|==PBS Script Examples==
 +
See the [[{{PAGENAME}}_PBS]] page for {{#var: app}} PBS script examples.|}}
 +
{{#if: {{#var: slurm}}|==SLURM Script Examples==
 +
See the [[{{PAGENAME}}_SLURM]] page for {{#var: app}} SLURM script examples.|}}
 +
{{#if: {{#var: policy}}|==Usage Policy==
 +
WRITE USAGE POLICY HERE (perhaps templates for a couple of main licensing schemes can be used)|}}
 +
{{#if: {{#var: testing}}|==Performance==
 +
WRITE PERFORMANCE TESTING RESULTS HERE|}}
 +
{{#if: {{#var: faq}}|==FAQ==
 +
*'''Q:''' **'''A:'''|}}
 +
{{#if: {{#var: citation}}|==Citation==
 +
If you publish research that uses {{{app}}} you have to cite it as follows:
 +
WRITE CITATION HERE
 +
|}}

Latest revision as of 14:20, 15 December 2022

Description

OpenFoam website  

OpenFOAM is a free, open source CFD software package produced by a commercial company, OpenCFD Ltd. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics and electromagnetic.

Required Modules

modules documentation

  • intel/2018
  • openmpi/3.0.0
  • openfoam/5.0
$ module load intel/2018  openmpi/3.0.0 openfoam/5.0

System Variables

OpenFOAM variables

  • FOAM_INST_DIR - installation base directory
  • FOAM_APPBIN - executable program directory
  • FOAM_LIB - library directory
  • FOAM_SRC - source directory
  • FOAM_EXT_LIBBIN - ThirdParty library directory
  • PV_PLUGIN_PATH - ParaView library directory
  • FOAM_TUTORIALS - tutorial directory

Wmake variables

These are the wmake parameters used in building OpenFOAM and could be used for compiling the third-party OpenFOAM applications using wmake.

  • WM_PROJECT_INST_DIR - wmake installation base directory
  • WM_PROJECT_VERSION - wmake project version
  • WM_PROJECT - wmake project name (OpenFOAM in this case)
  • WM_PROJECT_DIR - wmake project directory
  • WM_DIR - directory where "wmake" executable is
  • WM_ARCH - architecture type
  • WM_COMPILER - compiler name
  • WM_COMPILE_OPTION - compiler option
  • WM_LINK_LANGUAGE - compiler for linking
  • WM_PRECISION_OPTION - precision type