Salome HOME
Updated environment files
[tools/solverlab.git] / README.md
1 SOLVERLAB
2 ======
3
4 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 originates from [CDMATH](http://cdmath.jimdo.com), a collaborative workgroup with the same name. It 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. 
5
6 SOLVERLAB includes PDE systems
7 arising from the modeling of nuclear reactor cores which involves fluid dynamics, heat and neutron diffusion as well as solid elasticity. It
8 is a simple environment meant at students and researchers for teachind and promote new numerical
9 methods on general geometries with unstructured meshes.  
10 The main research objectives of SOLVERLAB are the study of
11
12 - Numerical schemes for compressible flows at low Mach numbers on general meshes
13 - Well balanced schemes for stiff source terms (heat source, phase change, pressure losses)
14 - Numerical handling of flow inversion, phase disappearance and counter-currents in two phase flows
15 - Numerical handling of stiff porosity or cross section functions
16 - Schemes that preserve the phasic volume fraction α ∈ [0, 1]
17 - Convergence of finite volume methods
18 - New preconditioners for implicit methods for two phase flows
19 - The coupling of fluid models or multiphysics coupling (eg thermal hydraulics and neutronics or thermal hydraulics and solid thermics)
20
21 The library is currently developed for linux distributions and is maintained on Ubuntu 16.04 LTS and 18.04 LTS, as well as on Fedora 24, 26, 28, 30 and 32.
22
23 Examples of use
24 ---------------
25 - [Examples of stable numerical methods for the 1D linear transport equation](CDMATH/tests/doc/1DTransportEquation/RegularGrid/TransportEquation1D_RegularGrid.ipynb)
26 - [Shock formation and numerical capture issues for the 1D Burgers' equations](tests/doc/1DBurgersEquation/BurgersEquation1D.ipynb)
27 - [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)
28 - [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)
29 - [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)
30 - [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)
31 - [Finite elements for the Poisson problem on a cube in 3D (by S. Kameni Ngwamou, PhD student)](CDMATH/tests/doc/3DPoissonEF/FiniteElements3DPoisson_CUBE.ipynb)
32 - [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)
33 - [Surface Finite elements for the Poisson-Beltrami problem on a sphere in 3D (by M. Nguemfouo, PhD student)](CDMATH/tests/doc/3DPoissonSphereEF/SynthesisConvergenceFESphere.pdf)
34 - [Surface Finite elements for the Poisson-Beltrami problem on a torus in 3D (by M. Nguemfouo, PhD student)](CDMATH/tests/doc/3DPoissonTorusEF/SynthesisConvergenceFETorus.pdf)
35
36 Download SOLVERLAB sources to compile
37 ----------------------------------
38
39 Create your source directory. For instance:
40 * `mkdir ~/workspace/SOLVERLAB`
41 * `cd ~/workspace/SOLVERLAB`
42
43 Download from GitHub
44 * click on the following link : `https://github.com/ndjinga/SOLVERLAB/archive/master.zip`, then unzip the file in a directory SOLVERLAB-master
45 * 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
46 * or clone the git repository to a folder SOLVERLAB-master:  `git clone https://github.com/ndjinga/SOLVERLAB.git SOLVERLAB-master`
47
48
49 Set the environment for the compilation of SOLVERLAB
50 ---------------------------------------------
51 Dependencies. The following package list is sufficient on Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04 :
52
53  - `cmake3` (mandatory)
54  - `g++` or another C++ compiler (mandatory)
55  - `python-dev`, `python-numpy` and `swig3`for python scripts (mandatory)
56  - `python-matplotlib` and `paraview` for postprocessing tools such as plotting curves (matplotlib) or generating 3D view images (paraview) (mandatory)
57  - `doxygen`, `graphviz` and `mscgen`, if you want to generate a nice source code documentation in `~/workspace/SOLVERLAB/SOLVERLAB_install/doc/`. Use the compilation option `-DSOLVERLAB_WITH_DOCUMENTATION=ON` (optional).
58  - `libcppunit-dev`, if you want to generate unit tests. Use the compilation option `-DSOLVERLAB_WITH_TESTS=ON` (optional).
59  - `rpm`, if you want to generate RPM installation packages. Use the compilation option `-DSOLVERLAB_WITH_PACKAGE=ON` (optional).
60
61 Directories. Create the suggested build and installation folders:
62 * `cd ~/workspace/SOLVERLAB`
63 * `mkdir SOLVERLAB_build`
64 * `mkdir SOLVERLAB_install`
65 * `cd SOLVERLAB_build`
66
67
68 Compile and install SOLVERLAB
69 --------------------------
70 Simpler build for a minimum version:
71 * `cmake ../SOLVERLAB-master/ -DCMAKE_INSTALL_PREFIX=../SOLVERLAB_install -DCMAKE_BUILD_TYPE=Release `  
72 > This will download and build the following dependencies
73 > - PETSc from http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.13.5.tar.gz
74 > - SLEPc from https://slepc.upv.es/download/distrib/slepc-3.13.4.tar.gz
75 > - F2CBLASLAPACK from http://ftp.mcs.anl.gov/pub/petsc/externalpackages/f2cblaslapack-3.4.2.q4.tar.gz
76 > - HDF5 https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.3/src/hdf5-1.10.3.tar.gz
77 > - MEDFILE from http://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz
78 > - MEDCOUPLING from http://files.salome-platform.org/Salome/other/medCoupling-9.4.0.tar.gz
79
80 If you already have an installation of PETSC, MED and MEDCoupling, you may save computational time and memory by using the advanced build version:
81 * `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}`  
82 > This assumes that you have an existing 
83 > - install of PETSc (with submodules SLEPC and HDF5) at the location given by the environment variable PETSC_DIR and the architecture variable PETSC_ARCH  
84 > See the instructions given in [the official documentation](http://www.mcs.anl.gov/petsc/documentation/installation.html)
85 > - install of MED                                    at the location given by the environment variable MEDFILE_ROOT_DIR
86 > - install of MEDCOUPLING                            at the location given by the environment variable MEDCOUPLING_ROOT_DIR
87
88 The 3 dependencies PETSC, MED and MEDCOUPLING should have been compiled with the same version of HDF5  
89 Warning : the linux package libhdf5-dev is generally not compatible with the libraries MED and MEDCoupling  
90 Compile and install:
91 * `make`
92 * `make doc install`
93
94 Run unit and example tests:
95 * make example
96
97 Run validation tests:
98 * make validation
99
100 Use of SOLVERLAB
101 -------------
102
103 To use SOLVERLAB with your Python code, you can load the SOLVERLAB environment in your terminal using the command
104  * source `~/workspace/SOLVERLAB/SOLVERLAB_install/env_SOLVERLAB.sh`
105 Then in your terminal simply type
106 - `python main.py `
107
108 If performance or parallelism is an issue for your simulations, you can use SOLVERLAB librairies with your C++ code :
109  * C++ libraries: `export LD_LIBRARY_PATH=~/workspace/SOLVERLAB/SOLVERLAB_install/lib`
110  * 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`.
111
112 The SOLVERLAB environment variables consist in :
113  * SOLVERLAB C++ library path: `~/workspace/SOLVERLAB/SOLVERLAB_install/lib`
114  * SOLVERLAB Python library paths: `~/workspace/SOLVERLAB/SOLVERLAB_install/lib/SOLVERLAB:~/workspace/SOLVERLAB/SOLVERLAB_install/bin/SOLVERLAB`
115  * PETSc, SLEPc and HDF5 library path: `${PETSC_DIR}/${PETSC_ARCH}/lib`
116  * MED library path: `${MEDFILE_ROOT_DIR}/lib`
117  * MEDCOUPLING library path: `${MEDCOUPLING_ROOT_DIR}/lib`
118