Salome HOME
Updated the documentation
[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 Windows-10.
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 for compilation
45 ----------------------------------
46 The easiest way to use SOLVERLAB is to download the SALOME binary file corresponding to your operating system [here](https://www.salome-platform.org/downloads/current-version).
47 However the binary file can be very large (up to 5GB). Compilation of SOLVERLAB from source files can provide a better alternative using less disk and memory space.
48
49 To compile SOLVERLAB source, first create a source directory, for instance with:
50 * `mkdir ~/workspace/SOLVERLAB`
51 * `cd ~/workspace/SOLVERLAB`
52
53 Download SOLVERLAB source from GitHub
54 * click on the following link : `https://github.com/ndjinga/SOLVERLAB/archive/master.zip`, then unzip the file in a directory SOLVERLAB-master
55 * 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
56 * or clone the git repository to a folder SOLVERLAB-master:  `git clone https://github.com/ndjinga/SOLVERLAB.git SOLVERLAB-master`
57
58
59 Set the environment for the compilation of SOLVERLAB
60 ---------------------------------------------
61 Dependencies. The following package list is sufficient on Ubuntu 20.04 :
62
63  - `cmake3` (mandatory)
64  - `g++` or another C++ compiler (mandatory)
65  - `python3-dev`, `python3-numpy` and `swig3`for python scripts (mandatory)
66  - `pyqt5-dev-tools` to generate the Graphical User Interface (optional)
67  - `python3-matplotlib`, `paraview-dev`, `libnetcdf-dev` (on Ubuntu 20.04) and `python3-paraview` for postprocessing tools such as plotting curves (matplotlib) or generating 3D view images (paraview) (optional)
68  - `ffmpeg` and `ffmpeg-devel` to generate an animation from a set of curves (optional)
69  - `python3-sphinx` for the GUI documentation, and `doxygen`, `graphviz` and `mscgen` to generate a developper documentation. Use the compilation option `-DSOLVERLAB_WITH_DOCUMENTATION=ON` (optional).
70  - `libcppunit-dev`, if you want to generate unit tests. Use the compilation option `-DSOLVERLAB_WITH_TESTS=ON` (optional).
71  - `rpm`, if you want to generate RPM installation packages. Use the compilation option `-DSOLVERLAB_WITH_PACKAGE=ON` (optional).
72
73 Directories. Create the suggested build and installation folders:
74 * `cd ~/workspace/SOLVERLAB`
75 * `mkdir SOLVERLAB_build`
76 * `mkdir SOLVERLAB_install`
77 * `cd SOLVERLAB_build`
78
79
80 Compile and install SOLVERLAB
81 --------------------------
82 Simpler build for a minimum version:
83 * `cmake ../SOLVERLAB-master/ -DCMAKE_INSTALL_PREFIX=../SOLVERLAB_install -DCMAKE_BUILD_TYPE=Release -DSOLVERLAB_WITH_GUI=ON -DSOLVERLAB_WITH_DOCUMENTATION=ON `  
84 > This will download and build the following dependencies
85 > - PETSc from http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.16.0.tar.gz
86 > - SLEPc from https://slepc.upv.es/download/distrib/slepc-3.16.0.tar.gz
87 > - F2CBLASLAPACK from http://ftp.mcs.anl.gov/pub/petsc/externalpackages/f2cblaslapack-3.4.2.q4.tar.gz
88 > - HDF5 https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.3/src/hdf5-1.10.3.tar.gz
89 > - MEDFILE from http://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz
90 > - MEDCOUPLING from http://files.salome-platform.org/Salome/other/medCoupling-9.7.0.tar.gz
91
92 If you already have an installation of PETSC, MED and MEDCoupling, you may save computational time and memory by using the following cmake instruction:
93 * `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`  
94 > This assumes that you have an existing 
95 > - installation of PETSc (with submodules SLEPC and HDF5) at the location given by the environment variable PETSC_DIR and the architecture variable PETSC_ARCH  
96 > See the instructions given in [the official documentation](http://www.mcs.anl.gov/petsc/documentation/installation.html)
97 > - installation of MED                                    at the location given by the environment variable MEDFILE_ROOT_DIR
98 > - installation of MEDCOUPLING                            at the location given by the environment variable MEDCOUPLING_ROOT_DIR
99
100 The 3 dependencies PETSC, MED and MEDCOUPLING should have been compiled with the same version of HDF5  
101 Warning : the linux package libhdf5-dev is generally not compatible with the libraries MED and MEDCoupling  
102 Compile and install:
103 * `make`
104 * `make install`
105
106 Run unit and example tests:
107 * make examples
108
109 Run validation tests:
110 * make validation
111
112 Generate documentation of CDMATH module
113 * make docCDMATH
114
115 Generate documentation of CoreFlows module
116 * make docCoreFlows
117
118 Use of SOLVERLAB
119 -------------
120
121 To use SOLVERLAB in your Python code `main.py `, you can load the SOLVERLAB environment in your terminal using the command
122  * source `~/workspace/SOLVERLAB/SOLVERLAB_install/env_SOLVERLAB.sh`
123 Then in your terminal simply type
124 - `python3 main.py `
125
126 To use the Graphical User Interface of SOLVERLAB, you can load the SOLVERLAB environment in your terminal using the command
127  * source `~/workspace/SOLVERLAB/SOLVERLAB_install/env_SOLVERLAB.sh`
128 Then in your terminal simply type
129 - `python3 $SOLVERLABGUI `
130
131 If performance or parallelism is an issue for your simulations, you can use SOLVERLAB librairies with your C++ code :
132  * C++ libraries: `export LD_LIBRARY_PATH=~/workspace/SOLVERLAB/SOLVERLAB_install/lib`
133  * 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`.
134
135 The SOLVERLAB environment variables consist in :
136  * SOLVERLAB C++ library path: `~/workspace/SOLVERLAB/SOLVERLAB_install/lib`
137  * SOLVERLAB Python library paths: `~/workspace/SOLVERLAB/SOLVERLAB_install/lib/SOLVERLAB:~/workspace/SOLVERLAB/SOLVERLAB_install/bin/SOLVERLAB`
138  * PETSc, SLEPc and HDF5 library path: `${PETSC_DIR}/${PETSC_ARCH}/lib`
139  * MED library path: `${MEDFILE_ROOT_DIR}/lib`
140  * MEDCOUPLING library path: `${MEDCOUPLING_ROOT_DIR}/lib`
141