KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
|
The LinearSolversApplication is a thin wrapper for the Eigen linear algebra library.
The application provides the following direct sparse solvers:
Python class | solver_type | Matrix kind | Domain | Dependencies |
---|---|---|---|---|
SparseLUSolver | sparse_lu | Square | Real | None |
SparseQRSolver | sparse_qr | Rectangular | Real | None |
SparseCGSolver | sparse_cg | SPD* | Real | None |
PardisoLLTSolver | pardiso_llt | SPD* | Real | Intel® MKL |
PardisoLDLTSolver | pardiso_ldlt | SPD* | Real | Intel® MKL |
PardisoLUSolver | pardiso_lu | Square | Real | Intel® MKL |
ComplexSparseLUSolver | sparse_lu_complex | Square | Complex | None |
ComplexPardisoLLTSolver | pardiso_llt_complex | SPD* | Complex | Intel® MKL |
ComplexPardisoLDLTSolver | pardiso_ldlt_complex | SPD* | Complex | Intel® MKL |
ComplexPardisoLUSolver | pardiso_lu_complex | Square | Complex | Intel® MKL |
*SPD = Symmetric Positive Definite
Example:
The application provides the following direct solvers for dense systems of equations:
Python class | solver_type | Matrix requirements | Domain | Dependencies |
---|---|---|---|---|
DenseColPivHouseholderQRSolver** | dense_col_piv_householder_qr | None | Real | None |
DenseHouseholderQRSolver** | dense_householder_qr | None | Real | None |
DenseLLTSolver** | dense_llt | SPD* | Real | None |
DensePartialPivLUSolver** | dense_partial_piv_lu | Invertible | Real | None |
ComplexDenseColPivHouseholderQRSolver | complex_dense_col_piv_householder_qr | None | Complex | None |
ComplexDenseHouseholderQRSolver | complex_dense_householder_qr | None | Complex | None |
ComplexDensePartialPivLUSolver | complex_dense_partial_piv_lu | Invertible | Complex | None |
*SPD = Symmetric Positive Definite
**Can also be used to solve equation systems with multiple right hand sides.
The application provides the following generalized eigensystem Ax=λBx
solver for sparse matrices.
Python class | solver_type | Matrix kind A | Matrix kind B | Domain | Dependencies |
---|---|---|---|---|---|
EigensystemSolver | eigen_eigensystem | Symmetric | SPD* | Real | None |
SpectraSymGEigsShiftSolver | spectra_sym_g_eigs_shift | Symmetric | SPD* | Real | None |
FEASTGeneralEigensystemSolver** | feast | General | General | Real | Intel® MKL |
ComplexFEASTGeneralEigensystemSolver** | feast_complex | General | General | Complex | Intel® MKL |
*SPD = Symmetric Positive Definite **A special version for symmetric matrices can be triggered in the solver settings.
EigensystemSolver
and SpectraSymGEigsShiftSolver
compute the smallest eigenvalues and corresponding eigenvectors of the system. MKL routines are used automatically if they are available.
SpectraSymGEigsShiftSolver
interfaces a solver from the Spectra library, and has a shift mode that can be used to compute the smallest eigenvalues > shift
.
Example:
If the application is compiled with MKL, FEAST 4.0 can be used to solve the generalized eigenvalue problem for real and complex systems (symmetric or unsymmetric). The cmake switch USE_EIGEN_FEAST
must be set to ON
with
Example:
Set the required definitions for cmake
As any other app:
Windows: in configure.bat
```batch set KRATOS_APPLICATIONS=KRATOS_APPLICATIONS%KRATOS_APP_DIR%\LinearSolversApplication; ```
Linux: in configure.sh
```bash add_app ${KRATOS_APP_DIR}/LinearSolversApplication ```
Setup the ProjectParameters.json
```json "linear_solver_settings": { "solver_type" : "LinearSolversApplication.sparse_lu" } ```
In case you have installed MKL (see below), you can also use the Pardiso solvers.
Run the MKL setup script before building Kratos:
Windows:
```batch call "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\env\vars.bat" intel64 lp64 ```
Linux:
```bash source /opt/intel/oneapi/setvars.sh intel64 ```
Add the following flag to CMake to your configure script:
Windows:
```batch -DUSE_EIGEN_MKL=ON ^ ```
Linux:
```bash -DUSE_EIGEN_MKL=ON \ ```
Usage:
Windows:
```batch call "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\env\vars.bat" intel64 lp64 ```
Linux:
Set the environment before using MKL
```bash source /opt/intel/oneapi/setvars.sh intel64 ```
Intel MKL can be installed with apt on Ubuntu. A guide can be found in here. For example to install the MKL 2022 version
To enable the MKL environment (needs to be done before build/run) use