This is an optional module that enables Chrono to use the MUMPS linear solver.
Read the introduction to modules for a technical background on the modularity of the Chrono project.
Chrono usually relies on its built-in solvers, whose good perfomance are guaranteed by leveraging the internal data structure. In fact, for a wide range of applications, these suffice.
However, for higher accuracy results, a direct solver could still be needed.
This module provides an interface to the third-party MUMPS solver.
Features
The Chrono::Mumps module allows to plug the MUMPS solver into Chrono and provides two interface:
- an interface for Chrono - namely chrono::ChSolverMumps<> - that is not intended to be used directly by the user.
This is the interface that the user should plug into the Chrono environment. - an interface for the end-user - namely chrono::ChMumpsEngine - that allows to directly operate with MUMPS using the Chrono data classes (if the user would ever have this need).
The demo_MUMPS_MumpsEngine.cpp shows its usage, but the average usare should not be interested in it.
Look at the API section of this module for a more in-depth discussion.
Building and installing prerequisistes
The Chrono::Mumps module requires the MUMPS library. Mumps does not provide a CMake-based installation system. To address this issue, we provide (with the Chrono source code) a set of utility scripts which download the Mumps sources, build all necessary libraries, and install them in a user-specified location.
These scripts (buildMUMPS.bat
, buildMUMPS.sh
, and buildMUMPS_Mac.sh, for Windows, Linux, and MacOS, respectively) are available in the contrib/build-scripts/mumps
directory of the Chrono repository.
- Copy the appropriate script and place in an arbitrary temporary directory.
- Edit the script copy to:
- Force a download of the source codes.
- Specify the install directory (set the variable
MUMPS_INSTALL_DIR
). - Decide whether to build shared or static libraries and whether to also build debug libraries.
- Run the script (
.\buildMUMPS.bat
orsh buildMUMPS.sh
, as appropriate) from the location of the script copy. This will create a temporary directory where all source repositories will be cloned and a set of directories where the individual VSG dependencies are built. - The install directory will contain (under
MUMPS_INSTALL_DIR/cmake/
) all CMake project configuration scripts required to configure Chrono with the Chrono::Mumps module enabled.
Building instructions
- Install the MUMPS library (see above)
- Repeat the instructions for the full installation.
- Set
CH_ENABLE_MODULE_MUMPS
to 'on'. - Set the CMake variable
MUMPS_DIR
to point to the directory containing the MUMPS CMake project configration script (for example,C:/Packages/mumps/cmake
). - Press 'Configure' again, then 'Generate', and proceed as usual in the installation instructions.
How to use it
- Simply add this snippet anywhere in your code, before running the main simulation loop.
This will inform Chrono to use the interface to the MUMPS solver.auto mumps_solver = chrono_types::make_shared<ChSolverMumps>();my_system.SetSolver(mumps_solver); - (Optional) Turn on the sparsity pattern lock (see chrono::ChSolverMumps and chrono::ChDirectSolverLS for further details) auto mumps_solver = chrono_types::make_shared<ChSolverMumps>();mumps_solver->SetSparsityPatternLock(true);my_system.SetSolver(mumps_solver);
- By default, this solver uses the sparsity pattern learner (see chrono::ChDirectSolverLS) to infer the sparsity pattern before actually loading the non-zero elements. To disable the use of the sparsity pattern learner, call mumps_solver->UseSparsityPatternLearner(false);
- Look at the API section of this module for documentation about classes and functions.