![]() |
v0.15.0 |
We recommend using the scripts provided below to install either the user version or the developer version of MoFEM, using Spack as the package manager.
Although we suggest using these scripts for simplicity and consistency, you can also explore other installation methods by visiting Installation with Spack.
The user version of MoFEM installs only binary files (not source code) and allows you to run analyses immediately. This includes compiled versions of the Basic User Module and the Fracture Module.
To install the user version, follow these steps:
installation_ubuntu.sh
This tutorial explains how to compile MoFEM. It assumes that you have installed the developer version of MoFEM, either using the instructions in Installation with Docker - JupyterHub or the installation script described in Installation with Spack (Scripts).
After installation, you should have the source code and corresponding binary build directories located as follows:
$HOME/mofem_install/mofem-cephas/
Release
build type): $HOME/mofem_install/mofem-cephas/build-*/core-*
The asterisk
*
in the build path stands for the hash of the particular build, e.g.build-5sehreo/core-Release-5sehreo
.
You need to recompile the Core Library whenever you change any source files located in:
There are two main ways to compile: using Spack’s automated process, or manually after the CMake configuration step.
If you want Spack to handle the entire compilation process:
This approach detects what needs to be rebuilt and compiles it.
If you prefer to run the build process manually after configuration:
Then change to the appropriate build directory and run:
The -j4
flag means to use four processor threads; you can adjust this depending on your hardware. The ctest -VV
command runs the test suite in verbose mode.
Note: If you have several builds of the Core Library (for example, both
Debug
andRelease
), make sure to replace the asterisk*
in the path with the actual hash corresponding to the build you want to compile. All build directories are located under:$HOME/mofem_install/mofem-cephas/
This tutorial assumes that you have installed the developer version of MoFEM using either the instructions in Installation with Docker - JupyterHub or the script provided in Installation with Spack (Scripts). You should have the source and binary files (e.g. for the Release
build type) for the Core Library and User Modules as follows:
$HOME/mofem_install/mofem-cephas/
$HOME/mofem_install/mofem-cephas/core-build-Release-*
In build directories described above, symbol
*
stands for the hash of the particular build, e.g.5sehreo
.
To add a MoFEM module that already exists, for example the Basic Finite Elements, follow these steps:
If you have multiple builds (e.g.
Debug
andRelease
), replace the asterisk*
with the correct hash for the build you want to recompile.
If everything was successful, the paths for the MoFEM Solid Shell Module should be:
$HOME/mofem_install/mofem-cephas/mofem/users_modules/basic_finite_elements
$HOME/mofem_install/mofem-cephas/build-*/core-*/mofem/users_modules/basic_finite_elements
To create your own module, the simplest way is to replicate an existing one and modify it. For example, copy the Solid Shell Module and then:
CMakeLists.txt
and InstalledAddModule.cmake
to reflect your new module name and structure.If you have trouble creating a module, feel free to contact us via MoFEM Q&A.
To add a new program within an existing module, the simplest approach is to copy an existing program and modify it. For example, copy the vec-0
tutorial:
vec-0
program and rename it.CMakeLists.txt
file to ensure it matches the new program's structure.If you have difficulty creating a program, please contact us at MoFEM Q&A.