SFEMaNS  version 4.1 (work in progress) Reference documentation for SFEMaNS
Installation Instructions

# Installation of required software

## PETSc for parallel computing (required)

SFEMaNS uses the sofware PETSc to do the linear algebra in parallel. The following documentation describes the procedure to install PETSc. We refer to https://www.mcs.anl.gov/petsc/download/index.html for more information about PETSc. Since it is more efficient to use the native PETSc of your cluster, you may want to ask your root administrator to install it for you. If you do so, you need to specify that you want the version petsc-3.7.2 and that it needs to include blaslapack, hypre, mumps, scalapack, metis, parmetis and blacs.

Here is the procedure to install PETSc by yourself:

1. First go to the directory where you want to install petsc and dowload it with the command:
wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.7.2.tar.gz
2. Untar the file with the following command:
tar -xvf petsc-3.7.2.tar.gz
This creates a directory named petsc-3.7.2.
3. Go into the directory petsc-3.7.2 and defined the following environnement variable:
cd petsc-3.7.2

## Check Installation

The code SFEMaNS presents more than 30 tests that mainly involve manufactured solutions. They have been implemented so one can check the correct installation of the code. It also allows developpers to check the consistency of the new features they implement. To run these test, follows the intructions below:

1. Create a directory for your applications with SFEMaNS. For instance, type the command:
mkdir MY_APPLICATIONS_SFEMaNS_v4.1
2. Go into this directory and type the following command:
cp -rf $SFEMaNS_DIR/TEMPLATE CHECK_INSTALLATION 3. Go in the directory CHECK_INSTALLATION. cd CHECK_INSTALLATION 4. If ARPACK is not installed, comment the following lines in the file main.f90: 1. CALL solver_arpack_mhd(comm_one_d,H_mesh,phi_mesh,& inputs%dt,list_mode,mu_H_field) 5. Rename the file make.in_template and my_make_template as follows: mv make.inc_template make.inc mv my_make_template my_make 6. Edit the file make.inc. 1. Set RACINE_FFTW. It is the directory that contains include/fftw3.h. To know this path, type the following command: locate fftw3.h The result is RACINE_FFTW/include/fftw3.h. 2. Set LIB_FFTW. It is the result of the command: locate libfftw3.so 3. Set PETSC_DIR (see compilation of PETSc). 4. Set PETSC_ARCH (see compilation of PETSc). 5. Set the preprocessor option: PREPROC. 6. Set the compilation option OPT (-O3, -C, etc.). 7. If ARPACK is installed, set PA_LIB as follows: PA_LIB= path_to_arpack/parpack_MPI-SUN4.a path_to_arpack/libarpack_SUN4.a Note that the the name of the files parpack_MPI-SUN4.a and libarpack_SUN4.a needs to be change for system other than sun4. 8. All the other variables should not require any modification. 7. Generate a makefile with the command: ./my_make 8. Compile the executable a.exe with the command: make a.exe -j 8 The option -j 8 means 8 processors are used to do the compilation. It can be removed or used with a different number of processors. 9. Edit the shell debug_SFEMaNS_template as follows: 1. Set the first and last test numbers to check with the variables iter_beg and iter_end. As SFEMaNS_v4.1 presents 33 tests, we have $$1 \leq \text{iter_beg} \leq \text{iter_end} \leq 33$$. In order to check all the tests, set iter_beg to 1 and iter_end to 33. 2. Define the program used to run MPI program (mpirun, mpiexec). It is done by setting the variable MY_MPIRUN as follows: export MY_MPIRUN=mpirun 10. Run the shell debug_SFEMaNS_template with the following command: ./debug_SFEMaNS_template For each test, a "OK" should be displayed. It means the test is performed correctly. If ARPACK is disabled in the main.f90, the test 14 can't be sucessfull as it uses ARPACK. The ouput of each test, which can be found in the files called fort.10_T*, are compared with reference values. These reference values are at the end of the files$SFEMaNS_DIR/MHD_DATA_TEST_CONV_PETSC/debug_data_* where * is the number of the test considered. The output of the test 14 are written in the first two lines of two files named fort.10_T14 and fort.11.