Salome HOME
Updated default PETSc version to 3.16
[tools/solverlab.git] / README.md
1 </center>
2
3 | ![logo](logoSOLVERLAB.png) |
4 |:--:|
5 | *SOLVERLAB* |
6
7 </center>
8
9 Introduction
10 ------------
11 SOLVERLAB is a geometrical and numerical C++/Python library designed for numerical analysts who work on the discretisation of partial differential equations on general shapes and meshes and would rather focus on high-level scripting. The goal is to provide simple MATLAB style functions for the generation and manipulation of meshes, fields and matrices. The library is based on the [MEDcoupling](https://docs.salome-platform.org/latest/dev/MEDCoupling/tutorial/index.html) C++/python library of the [SALOME](http://www.salome-platform.org/) project for the handling of meshes and fields, and on the C++ library [PETSC](https://www.mcs.anl.gov/petsc/) for the handling of matrices and linear solvers. 
12
13 SOLVERLAB includes PDE systems
14 arising from the modeling of nuclear reactor cores which involves fluid dynamics, heat and neutron diffusion as well as solid elasticity. It
15 is a simple environment meant at students and researchers for teachind and promote new numerical
16 methods on general geometries with unstructured meshes.  
17 The main research objectives of SOLVERLAB are the study of
18
19 - Numerical schemes for compressible flows at low Mach numbers on general meshes
20 - Well balanced schemes for stiff source terms (heat source, phase change, pressure losses)
21 - Numerical handling of flow inversion, phase disappearance and counter-currents in two phase flows
22 - Numerical handling of stiff porosity or cross section functions
23 - Schemes that preserve the phasic volume fraction α ∈ [0, 1]
24 - Convergence of finite volume methods
25 - New preconditioners for implicit methods for two phase flows
26 - The coupling of fluid models or multiphysics coupling (eg thermal hydraulics and neutronics or thermal hydraulics and solid thermics)
27
28 The library is currently maintained and distributed by the SALOME developpement team on various linux distributions (Ubuntu, CentOS, Fedora, Debian) and on Windows10.
29 The corresponding binary files can be found  [here](https://www.salome-platform.org/downloads/current-version).
30
31 Examples of use
32 ---------------
33 - [Examples of stable numerical methods for the 1D linear transport equation](CDMATH/tests/doc/1DTransportEquation/RegularGrid/TransportEquation1D_RegularGrid.ipynb)
34 - [Shock formation and numerical capture issues for the 1D Burgers' equations](CDMATH/tests/doc/1DBurgersEquation/BurgersEquation1D.ipynb)
35 - [Influence of the mesh on the convergence and low Mach precision for the UPWIND finite volume method applied to the 2D wave system](CDMATH/tests/doc/2DWaveSystemVF_stationary/Convergence_WaveSystem_Upwind_SQUARE.ipynb)
36 - [Influence of the mesh on the convergence and low Mach precision  for the CENTERED finite volume method applied to the 2D wave system](CDMATH/tests/doc/2DWaveSystemVF_stationary/Convergence_WaveSystem_Centered_SQUARE.ipynb)
37 - [Influence of the mesh on the convergence and low Mach precision  for the STAGGERED finite volume method applied to the 2D wave system](CDMATH/tests/doc/2DWaveSystemVF_stationary/Convergence_WaveSystem_Staggered_SQUARE_squares.ipynb)
38 - [Influence of the mesh on the convergence and low Mach precision  for the PSEUDO-STAGGERED (colocated) finite volume method applied to the 2D wave system](CDMATH/tests/doc/2DWaveSystemVF_stationary/Convergence_WaveSystem_PStag_SQUARE.ipynb)
39 - [Finite elements for the Poisson problem on a cube in 3D (by S. Kameni Ngwamou, PhD student)](CDMATH/tests/doc/3DPoissonEF/FiniteElements3DPoisson_CUBE.ipynb)
40 - [Finite elements for the stationary diffusion of the temperature in a 3D room. Influence of the radiator position (by S. Kameni Ngwamou, PhD student)](CDMATH/tests/doc/3DRoomCoolingEF/3DRoomCoolingEF.ipynb)
41 - [Surface Finite elements for the Poisson-Beltrami problem on a sphere in 3D (by M. Nguemfouo, PhD student)](CDMATH/tests/doc/3DPoissonSphereEF/SynthesisConvergenceFESphere.pdf)
42 - [Surface Finite elements for the Poisson-Beltrami problem on a torus in 3D (by M. Nguemfouo, PhD student)](CDMATH/tests/doc/3DPoissonTorusEF/SynthesisConvergenceFETorus.pdf)
43
44 Download SOLVERLAB sources to compile
45 ----------------------------------
46
47 Create your source directory. For instance:
48 * `mkdir ~/workspace/SOLVERLAB`
49 * `cd ~/workspace/SOLVERLAB`
50
51 Download from GitHub
52 * click on the following link : `https://github.com/ndjinga/SOLVERLAB/archive/master.zip`, then unzip the file in a directory SOLVERLAB-master
53 * or type the following in a terminal : `wget https://github.com/ndjinga/SOLVERLAB/archive/master.zip`, then unzip the file in a directory SOLVERLAB-master
54 * or clone the git repository to a folder SOLVERLAB-master:  `git clone https://github.com/ndjinga/SOLVERLAB.git SOLVERLAB-master`
55
56
57 Set the environment for the compilation of SOLVERLAB
58 ---------------------------------------------
59 Dependencies. The following package list is sufficient on Ubuntu 14.04, 16.04, 18.04 and 20.04 :
60
61  - `cmake3` (mandatory)
62  - `g++` or another C++ compiler (mandatory)
63  - `python-dev`, `python-numpy` and `swig3`for python scripts (mandatory)
64  - `pyqt5-dev-tools` to generate the Graphical User Interface (optional)
65  - `python-matplotlib` and `paraview-devel` for postprocessing tools such as plotting curves (matplotlib) or generating 3D view images (paraview) (optional)
66  - `ffmpeg` and `ffmpeg-devel` to generate an animation from a set of curves (optional)
67  - `doxygen`, `graphviz` and `mscgen`, if you want to generate a nice source code documentation in `~/workspace/SOLVERLAB/SOLVERLAB_install/share/doc/`. Use the compilation option `-DSOLVERLAB_WITH_DOCUMENTATION=ON` (optional).
68  - `libcppunit-dev`, if you want to generate unit tests. Use the compilation option `-DSOLVERLAB_WITH_TESTS=ON` (optional).
69  - `rpm`, if you want to generate RPM installation packages. Use the compilation option `-DSOLVERLAB_WITH_PACKAGE=ON` (optional).
70
71 Directories. Create the suggested build and installation folders:
72 * `cd ~/workspace/SOLVERLAB`
73 * `mkdir SOLVERLAB_build`
74 * `mkdir SOLVERLAB_install`
75 * `cd SOLVERLAB_build`
76
77
78 Compile and install SOLVERLAB
79 --------------------------
80 Simpler build for a minimum version:
81 * `cmake ../SOLVERLAB-master/ -DCMAKE_INSTALL_PREFIX=../SOLVERLAB_install -DCMAKE_BUILD_TYPE=Release `  
82 > This will download and build the following dependencies
83 > - PETSc from http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.16.0.tar.gz
84 > - SLEPc from https://slepc.upv.es/download/distrib/slepc-3.16.0.tar.gz
85 > - F2CBLASLAPACK from http://ftp.mcs.anl.gov/pub/petsc/externalpackages/f2cblaslapack-3.4.2.q4.tar.gz
86 > - HDF5 https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.3/src/hdf5-1.10.3.tar.gz
87 > - MEDFILE from http://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz
88 > - MEDCOUPLING from http://files.salome-platform.org/Salome/other/medCoupling-9.7.0.tar.gz
89
90 If you already have an installation of PETSC, MED and MEDCoupling, you may save computational time and memory by using the following cmake instruction:
91 * `cmake ../SOLVERLAB-master -DCMAKE_INSTALL_PREFIX=../SOLVERLAB_install -DCMAKE_BUILD_TYPE=Release -G"Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION=4.3 -DSOLVERLAB_WITH_DOCUMENTATION=ON -DPETSC_DIR=${PETSC_DIR} -DPETSC_ARCH=${PETSC_ARCH} -DMEDFILE_ROOT_DIR=${MEDFILE_ROOT_DIR} -DMEDCOUPLING_ROOT_DIR=${MEDCOUPLING_ROOT_DIR}  -DSOLVERLAB_WITH_GUI=ON`  
92 > This assumes that you have an existing 
93 > - install of PETSc (with submodules SLEPC and HDF5) at the location given by the environment variable PETSC_DIR and the architecture variable PETSC_ARCH  
94 > See the instructions given in [the official documentation](http://www.mcs.anl.gov/petsc/documentation/installation.html)
95 > - install of MED                                    at the location given by the environment variable MEDFILE_ROOT_DIR
96 > - install of MEDCOUPLING                            at the location given by the environment variable MEDCOUPLING_ROOT_DIR
97
98 The 3 dependencies PETSC, MED and MEDCOUPLING should have been compiled with the same version of HDF5  
99 Warning : the linux package libhdf5-dev is generally not compatible with the libraries MED and MEDCoupling  
100 Compile and install:
101 * `make`
102 * `make install`
103
104 Run unit and example tests:
105 * make examples
106
107 Run validation tests:
108 * make validation
109
110 Generate documentation of CDMATH module
111 * make docCDMATH
112
113 Generate documentation of CoreFlows module
114 * make docCoreFlows
115
116 Use of SOLVERLAB
117 -------------
118
119 To use SOLVERLAB in your Python code `main.py `, you can load the SOLVERLAB environment in your terminal using the command
120  * source `~/workspace/SOLVERLAB/SOLVERLAB_install/env_SOLVERLAB.sh`
121 Then in your terminal simply type
122 - `python3 main.py `
123
124 To use the Graphical User Interface of SOLVERLAB, you can load the SOLVERLAB environment in your terminal using the command
125  * source `~/workspace/SOLVERLAB/SOLVERLAB_install/env_SOLVERLAB.sh`
126 Then in your terminal simply type
127 - `python3 $SOLVERLABGUI `
128
129 If performance or parallelism is an issue for your simulations, you can use SOLVERLAB librairies with your C++ code :
130  * C++ libraries: `export LD_LIBRARY_PATH=~/workspace/SOLVERLAB/SOLVERLAB_install/lib`
131  * To know how to include the right libraries for compilation, see the makefiles of the examples. They include the list ` -lmedC -lmedloader -lmedcoupling -lbase -lmesh -llinearsolver`.
132
133 The SOLVERLAB environment variables consist in :
134  * SOLVERLAB C++ library path: `~/workspace/SOLVERLAB/SOLVERLAB_install/lib`
135  * SOLVERLAB Python library paths: `~/workspace/SOLVERLAB/SOLVERLAB_install/lib/SOLVERLAB:~/workspace/SOLVERLAB/SOLVERLAB_install/bin/SOLVERLAB`
136  * PETSc, SLEPc and HDF5 library path: `${PETSC_DIR}/${PETSC_ARCH}/lib`
137  * MED library path: `${MEDFILE_ROOT_DIR}/lib`
138  * MEDCOUPLING library path: `${MEDCOUPLING_ROOT_DIR}/lib`
139