Source a supported version of OpenFOAM, then download, build and test solids4foam-v2.1:
git clone --branch v2.1 https://github.com/solids4foam/solids4foam.git
cd solids4foam && ./Allwmake -j && cd tutorials && ./Alltest
The -j
flag instructs Allwmake
to use all available cores. For the latest nightly build, specify the development
branch instead of v2.1
. For a detailed installation guide, see below.
solids4foam requires a working version of OpenFOAM or foam-extend. Currently, the following OpenFOAM versions are supported:
solids4foam version | OpenFOAM/foam version |
---|---|
solids4foam-v1.* | foam-extend-4.0 |
foam-extend-4.1 | |
OpenFOAM-v1812 | |
OpenFOAM-v1912 | |
OpenFOAM-7 | |
solids4foam-v2.0 | foam-extend-4.1 |
OpenFOAM-v2012 | |
OpenFOAM-9 | |
solids4foam-v2.1 | foam-extend-4.1 |
OpenFOAM-v2012 -> OpenFOAM-v2312 | |
OpenFOAM-9 |
The solids4foam Allwmake
script will ask you to fix files in the main OpenFOAM/foam installation. If you do not want to (or cannot) make these changes, please set the environmental variable S4F_NO_FILE_FIXES=1
before running the Allwmake script when building solids4foam, e.g.
> export S4F_NO_FILE_FIXES=1 && ./Allwmake -j
To make these fixes, follow the instructions from the Allwmake
script when building solids4foam.
See the page on Optional Fixes for further details on these optional changes.
These dependencies are optional. You can skip them if you want to get up and running quickly.
Beyond a working version of OpenFOAM or foam-extend, solids4foam does not have any mandatory dependencies; however, several optional dependencies are required to use the complete set of functionalities:
Dependency | Functionality Provided |
---|---|
Eigen | Block-coupled cell-centred and vertex-centred solid models |
linear solvers. | |
PETSc | Block-coupled vertex-centred solid models linear solvers. |
gfortran | Abaqus UMAT mechanical law interface. |
cfmesh | Some tutorials use cfmesh for creating the meshes. |
gnuplot | Some tutorials use Gnuplot to generate graphs after running the |
solver. |
Note that, for running the tests, the OpenFOAM or foam-extend tutorials are also required. If preCICE is installed, this will enable additional tests.
Before building solids4foam, the EIGEN_DIR
environment variable can be set to the local Eigen installation location. If EIGEN_DIR
is not set, then solids4foam will download a local copy of Eigen.
If you would like solids4foam not to use Eigen (e.g. due to version conflicts when using preCICE), set the S4F_NO_USE_EIGEN
environment variable, e.g. add the following to your bashrc
> export S4F_NO_USE_EIGEN=1
The binaries for PETSc can be installed on Ubuntu with
> sudo apt install petsc-dev
Or, on macOS with
> brew install petsc
Alternatively, and more generally, PETSc can be installed following the instructions at https://petsc.org/release/.
Once PETSC has been installed, the PETSC_DIR
environment variable should be set to the installation location; this allows solids4foam to use it. If the PETSC_DIR
environment variable is not set, then solids4foam will not use PETSc and functionalities that require PETSc will be disabled. For example, on Ubuntu you can do this with:
export PETSC_DIR=/lib/petsc
Or, if using homebrew, on macOS (you may need to update the version number)
export PETSC_DIR=/opt/homebrew/Cellar/petsc/3.17.2
Add the export PETSC_DIR statement to your ~/.bashrc file to set this variable for new terminal sessions automatically.
gfortran can be installed on Ubuntu with:
> sudo apt-get install gfortran
Or, on macOS with
> brew install gcc
If the GCC compilers were used to compile OpenFOAM or foam-extend, then a compatible version of gfortran should be installed. For example, gfortran-7 should be used with gcc-7.
solids4foam will use gfortran if the gfortran
executable is found in the $PATH
; if not, solids4foam will disable functionalities that require gfortran.
A small number of tutorials require the cartesianMesh
utility from cfmesh. If the cartesianMesh
executable is not found within the $PATH
then the Allrun
script within these tutorials will exit.
gnuplot can be installed on Ubuntu with:
> sudo apt-get install gnuplot
Or, on macOS with
> brew install gnuplot
The solids4foam directory can be downloaded to any reasonable location on your computer; we suggest placing it in $FOAM_RUN/..
.
solids4foam-v2.1 can be downloaded as an archive file:
> unzip v2.1.tar.gz
> tar xzf unzip v2.1.tar.gz
solids4foam-v2.1
can be downloaded using
> git clone --branch v2.1 https://github.com/solids4foam/solids4foam.git
The latest nightly build development branch can be downloaded with
> git clone --branch development git@github.com:solids4foam/solids4foam.git
Before building solids4foam, a compatible version of OpenFOAM or foam-extend should be sourced: see the table above. To build solids4foam, enter the solids4foam directory and execute the included Allwmake script, e.g.
> cd solids4foam
> ./Allwmake -j 2>&1 | tee log.Allwmake
Depending on your hardware, you can expect this build to last about 5 minutes.
If solids4foam is built successfully, you will be presented with the following message:
There were no build errors: enjoy solids4foam!
To test the installation, run:
> cd tutorials && ./Alltest
If the build encounters errors, you will receive the following message:
** BUILD ERROR **"
There were build errors in the following logs:
<LIST OF COMPILATION ERRORS>
Please examine these logs for additional details
You can examine the source of the errors in the log.Allwmake
file within the solids4foam parent directory. Additionally, please search https://www.cfd-online.com/Forums/openfoam-cc-toolkits-fluid-structure-interaction/ for similar errors. If you cannot find a resolution, please create a new thread at https://www.cfd-online.com/Forums/openfoam-cc-toolkits-fluid-structure-interaction/. Alternatively, if you believe you have encountered a bug, please create a new issue at https://github.com/solids4foam/solids4foam/issues.
As instructed, after a successful build, you can test the tutorials using the following commands, executed from the solids4foam parent directory.
> cd tutorials && ./Alltest
You can expect these tests to last a few minutes.
If the tests pass, you will receive the message:
All tests passed: enjoy solids4foam.
This means your solids4foam installation is working as expected.
If any of the tests fail, you will receive the message:
The solids4Foam solver failed in the following cases:
<LIST OF FAILING TUTORIALS>
or if the errors do not come from the solids4foam calls but elsewhere
The following commands failed:
<LIST OF FAILING COMMANDS AND TUTORIALS>
Please see the tutorial guide.