ElmerFoamFSI  2.0
ElmerFoamFSI is fluid-solid interaction simulation application built up from OpenFOAM CFD and Elmer CSM coupled through the IMPACT multiphysics software integration infrastructure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Groups Pages
Manual Installation

The general quick-start steps for installing ElmerFoamFSI are as follows:

Note
The instructions presented herein require a Linux terminal. As such, the commands are as general as possible and are not shell specific. For these reasons, instructions that require setting paths are deliberately left vague. Users should set path variables using the form dictated by their shell environment. The general forms for bash and csh are given here for ease-of-use. Note the syntax; it is very important!
You can determine your current shell environment using SHELL:

echo $SHELL
/bin/bash: export USR_VAR="/path/to/user/location/"
../bin/csh: setenv USR_VAR /path/to/user/location

Warning
  • Users will need to modify one critical file before building OpenFOAM. These changes enable options that are used to build other components of the ElmerFoamFSI package. If you do not follow this step, OpenFOAM will need to be rebuilt after enabling these options.
  • According to the Elmer forum, Elmer uses gfortran of versions 4.8 or later. Be sure to start with v-4.8+, or you will have rebuild the system from scratch. A consistent toolchain is mandatory for proper installation of the ElmerFoamFSI application!

1. Install OpenFOAM extend from OpenFOAM-extend

  • Review the native OpenFOAM build instructions: ~/foam/foam-extend-<version>/doc/buildInstructions
  • Install system packages (optional, but recommended)
  • Modify the %build section of the spec file associated with the appropriate version of openmpi (e.g., openmpi-1.6.5.spec)
    (Note: this will likely install the latest version, but you should ensure after building that your machine used the spec file that you edited by checking the output from the OpenFOAM build to see which openmpi package was used)

    cd ~/foam/foam-extend-<version>
    cd ./ThirdParty/rpmBuild/SPECS
    ls openmpi*
    open associated spec file using editor of choice (e.g., vi or emacs)

    In the section labeled "export WM settings in a form that GNU configure recognizes," add the "-fPIC" option flag to the CC and CXX lines:

    [ -n "$WM_CC" ] && export CC="$WM_CC -fPIC"
    [ -n "$WM_CXX" ] && export CXX="$WM_CXX -fPIC"

    Just below this same section, add two export statements before "unset mpiWith":

    export FC="gfortran -fPIC"
    export F90="gfortran -fPIC"
    unset mpiWith

    Slightly farther down in the ./configure section, delete the following lines:

    --disable-mpi-f77
    --disable-mpi-f90
    --disable-mpi-cxx

  • Modify the appropriate shell script by navigating to $ELMERFOAMTOP/foam/foam-extend-<version>/etc and opening the cshrc or bashrc file (depending on if you are using Cshell or Bash, respectively) Within the file, every instance of "$HOME" should be replaced with "$ElmerFoamTop" (Note: either manually enter the full path to the top level ElmerFoamFSI directory for $ElmerFoamTop or set an environment variable equal to that path)
  • Source the appropriate shell script (bash or csh)
  • Build with (or without) ParaView (user choice)
  • Review the build output to make sure that the 5 stages of OpenFOAM were built properly

    cd ~/foam/foam-extend*
    source etc/cshrc
    ./Allwmake.firstInstall | tee build_firstInstall.out
    grep "Done" build_firstInstall.out

2. Set up the proper user build environment for the rest of the toolchain

  • (Re-)source the appropriate shell script (bash or csh)

    source ~/foam/foam-extend-<version>/etc/cshrc

  • Set the CC, CXX, and FC environment variables

    CC = mpicc
    CXX = mpicxx
    FC = mpif90

  • Ensure that the correct version of compiler wrappers are being used. The system should return an OpenFOAM path to MPI and the system version of the compiler to which the wrapper points:

    which mpicc
    mpicc --version
    which mpicxx
    mpicxx --version
    which mpif90
    mpif90 --version

  • If you receive a system error, it is likely associated with missing modifications to the openmpi spec file.

3. Install IMPACT and IRAD infrastructures

The IMPACT and IRAD infrastructures are used as support libraries, and the following build scenario is recommended.

Note
These support libraries should be built out-of-source but installed in the same place.
  • Install IMPACT and include IRAD and HDF4 dependencies

    sudo yum install hdf4 hdf4-devel
    cd $ELMERFOAMTOP/IMPACT
    mkdir build
    cd build
    cmake .. -DCMAKE_INSTALL_PREFIX=$ELMERFOAMTOP/support_install
    make
    make install

4. Build the OpenFoamFSI module

  • Set environment variable IRMULTIPHYSICS to install location of $ELMERFOAMTOP/support_install
  • Check the definition of MPI_HOME that specifies the location of the desired openmpi libraries:
    The system should return some path containing "$ELMERFOAMTOP/foam/foam-extend-<version>/ThirdParty/packages/..."
    The path will look similar to the location of the spec file edited in Step 1:

    echo $MPI_HOME

  • Create the OpenFoamFSI library that will be automatically copied into the library directory of the unaltered OpenFOAM:

    cd $ELMERFOAMTOP/Third_Party_Modules/OpenFoamFSI/native/
    wmake libso .

5. Update (patch) Elmer and build (the ElmerFSI module)

cd $ELMERFOAMTOP/elmerfem/fem/src
cp -r $ELMERFOAMTOP/Third_Party_Modules/ElmerFSI/trunk/native ElmerModule

  • Patch the Elmer source:

    patch < ElmerModule/ElmerPatch

  • Build Elmer and its module for interfacing with IMPACT:

    cd $ELMERFOAMTOP/elmerfem
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=$ELMERFOAMTOP/support_install ..
    make
    make install

  • Link the Elmer libraries to a more convenient location:

    ln -s $ELMERFOAMTOP/suppport_install/share/elmersolver/lib/* $ELMERFOAMTOP/support_install/lib/.

  • Set the LD library path to the location of the Elmer native libraries:

    LD_LIBRARY_PATH = $ELMERFOAMTOP/support_install/lib:$LD_LIBRARY_PATH

Warning
After completing Steps 1 - 5, users should have the following installed components:

~/foam (+ module)
~/elmer (+ module)
~/fsiSupport (IMPACT + IRAD)

If, for whatever reason, one or more of these directories does not exist, start over at the appropriate step!
If one or more of these directories does not appear to be correct, remove the attempted build of the associated component, and start over at the appropriate step! O_o
If everything looks good, the last step in building ElmerFoamFSI can be completed! ^_^

6. Install ElmerFoamFSI orchestrator (OpenFOAM-Elmer system driver for FSI problems)

  • Build and test the ElmerFoamFSI driver (as tests are added, the time required for the build to complete is extended):

    cd $ELMERFOAMTOP
    mkdir build
    cd build
    cmake .. -DCMAKE_PREFIX_PATH=$ELMERFOAMTOP/ElmerFoamSupport/install
    make
    make docs
    make test