Compile-belt
To be patrolled, yet
(and to be converted from Markdown to Wikitext)
## Belt initialization
1. Clone the belt repository from the Gitlab of the university `git clone https://git.uni-due.de/agkuiper/belt` using your university credentials.
2. Enter dependencies folder and unpack petsc-3.1-p8.tar with `tar -xvf petsc-3.1-p8.tar`.
3. Open the file PETSc compile.sh and copy the command for "Rolfs MacBook Pro". Enter petsc-3.1-p8 and execute the copied statement with python2 in the command line to compile PETSc.
4. Follow the instructions in the terminal to complete the setup.
5. Exit the dependencies folder and enter the tests44 folder and open the `makefile_user_machinedefs` file. In this file we need to adjust the paths so that the code knows where the dependencies are. You find an example of the needed settings here:
```plaintext
################
## ##
## Compiler ##
## ##
################
CC = /home/your_name/Documents/belt/dependencies/petsc-3.1-p8/externalpackages/mpich2-1.0.8/bin/mpicc
FC = gfortran
############
## ##
## belt ##
## ##
############
BELT_DIR = /home/your_name/Documents/belt
#############
## ##
## PETSc ##
## ##
#############
PETSC_DIR = /home/your_name/Documents/belt/dependencies/petsc-3.1-p8
PETSC_ARCH = linux-gnu-c-opt
PETSC_HYPRE = YES
PETSC_ML = NO
PETSC_LAPACK = flapack
PETSC_BLAS = fblas
################
## ##
## gfortran ##
## ##
################
GFORTRAN = YES
GFORTRAN_LIB_DIR = /usr/lib64
GFORTRAN_LIB = gfortran
###########
## ##
## GSL ##
## ##
###########
GSL = NO
GSL_DIR = /Applications/Science/gsl/gsl-2.1-install
GSL_LIB = gsl
```
These could be different for your machine, please double check! Make sure that there are no spaces at the end of each line, the code won't compile if there are. GSL is not needed and you don't have to change anything there.
5. Choose a test setup, for example Grids/Spherical3D, enter the folder and create a folder "bin" as well as "data".
6. Open the file `makefile_user_CFLAGS_FFLAGS_LDFLAGS` and comment out the LDFlags line: `#LDFLAGS +="-Wl,-no_compact_unwind"`. Instead write `LDFLAGS += -ldl`. Beware of the spaces.
7. Now we are ready to run the first test. Type `make -j 8`, where the -j 8 gives the number of cores to compile on. Note that there are individual setups (BonnerEbert-Sphere 1D) that don't work in parallel yet. The number can not be higher than the physical number of cores.
8. Run the code with `./belt` on a single core and with e.g. `/home/your_name/Documents/belt/dependencies/petsc-3.1-p8/externalpackages/mpich2-1.0.8/bin/mpiexec -n 8 ./belt` depending on your path and the number of cores.
### Additional stuff:
- Check the file in the log folder to see the progress of your code. Here you find the current step the calculation is at, as well as the normalization units to convert the outputs from code units to cgs. When the run is finished the file also contains the total runtime at the bottom.
- If you stop the code while executing you can restart it using the last output to continue from, e.g. `./belt -restart 191`.