SFEMaNS  version 4.1 (work in progress) Reference documentation for SFEMaNS
Mesh Interpolation and restart files

The code SFEMaNS allows to interpolate restart files (from the Navier-Stokes equations, the temperature equation and the Maxwell equations) on a different finite element mesh. It is done with an executable called i.exe and a shell script called mesh_interpol. To interpolate restart files, the following files are required:

1. make.inc that defines environment variable (path to PETSc, FFTW, ARPACK) and compilation options.
2. my_make_mesh_interpol that allows to generate a file called makefile.
3. main_mesh_interpol.f90, mesh_interpolation.f90 and tools_interpol.f90. They are the fortran files that generate the executable i.exe.
4. mesh_interpolation is a shell script. It allows to turn restart files on a finite element mesh M1 into restart files on a finite element mesh M2.
5. data_interpol that gives various informations on the interpolation to do.
6. the suite files to interpol on a different finite element mesh.
7. the mesh_part file associated to the suite files. It contains information on how the meridian section has been partitionned for parallel computing.

Templates of each of the above files (modulo the suite and mesh_part files) are available in the following directory: $SFEMaNS_DIR/MESH_INTERPOLATION. A template of the file make.inc is available in the following directory:$SFEMaNS_DIR/TEMPLATE. We note that only the files mesh_interpol and data_interpol require modifications.

The following describes how to generate the executable i.exe and modify the files mesh_interpol and data_interpol.

Generation of the executable i.exe

First create a copy of the directory $SFEMaNS_DIR/MESH_INTERPOLATION in the directory where you plan to do the interpolation. It can be done as follows: cp -rf$SFEMaNS_DIR/MESH_INTERPOLATION MESH MY_MESH_INTERPOL

Then generate the executable i.exe as follows.

1. Go into the directory MY_MESH_INTERPOL.
cd MY_MESH_INTERPOL
2. Copy the make.inc template in your directory as follows:
cp \$SFEMaNS_DIR/TEMPLATE/make.inc_template make.inc
3. Edit the file make.inc. We refer to the section Check Installation for more details. We note that you can use the make.inc used to generate the executable a.exe.
4. Generate a makefile with the command:
./my_make_mesh_interpol
5. Compile the executable i.exe with the command:
make i.exe -j 4
The option -j 4 means 4 processors are used to do the compilation. It can be removed or used with a different number of processors.

Remark: the shell debug_SFEMaNS_template, used to check the correct intallation of the code, generates an executable i.exe. Indeed by following the instructions of this section, an executable i.exe is available in the following directory: MY_APPLICATIONS_SFEMaNS_v4.1/CHECK_INSTALLATION/INTERPOLATION_MESH. It can be used here to avoid generating a new executable i.exe.

Interpollation of restart files

The shell mesh_interpolation

Edit the shell mesh_interpolation as follows.

1. Uncomment the following line.
#export MY_MPIRUN=mpirun
2. Define the variable MY_MPIRUN depending of your work environment (mpirun, mpiexec, etc.).

The file data_interpol

Edit the file data_interpol as follows.

1. Give information on the initial restart and mesh_part files.
1. Set the number of processors used in meridian section.
===Number of processors in meridian section (Input)
1
2. Set the initial problem type approximated.
===Problem type (Input): (nst, mxw, mhd, fhd)
'nst'
3. Set if the temperature equation was approximated. It informs the code of the presence of restart files for the temperature field.
===Is there an input temperature field?
.t.
4. The path and the name of the initial mesh are specified with the two following lines:
===Directory and name of input mesh file
'.' 'SOLID_FLUID_10.FEM'
5. Set the format of the initial mesh.
===Is input mesh file formatted (true/false)?
.t.
2. Give information on the interpolated restart and mesh_part files.
1. Set the desired number of processors in meridian section.
===Number of processors in meridian section (Output)
5
2. The interpolated restart files are going to be used on which problem type.
===Problem type (Output): (nst, mxw, mhd, fhd)
'nst'
3. Set if restart files of the temperatured field are generated.
===Is there an output temperature field?
.t.
4. The path and the name of the new mesh are specified with the two following lines:
===Directory and name of output mesh file
'.' 'SOLID_FLUID_20.FEM'
5. Set the format of the new mesh.
===Is output mesh file formatted (true/false)?
.t.
3. Give information of the interpolation process.
1. Set if the initial datas are interpolated on a new mesh.
===Should data be interpolated on new mesh? (True/False)
.t.
2. Set the number of time steps where the files are interpolated.
===How many files (times steps) should be converted?
1
3. Set the index of the first time step.
===What is the starting index? (suite*_I*index.mesh*), index is an integer in [1,999]
1
4. Set the number of Fourier modes present in the initial restart files.
===Number of Fourier modes
3
If the initial restart file are defined on a specific list of Fourier modes, add the following lines.
1. Set if a specific list of Fourier is used.
===Select Fourier modes? (true/false)
2. Give the list of Fourier modes considered.
===List of Fourier modes (if select_mode=.TRUE.)
4. Set periodic condition (if any).
1. Set the number of pair of boundaries that are periodic.
===How many pieces of periodic boundary?
1
2. Give the label of the boundaries and the vector that lead to the first boundary to the second one.
===Indices of periodic boundaries and corresponding vectors
4 2 .0d0 1.d0
We note that we need as much as lines as the number of pairs of boundaries with periodic condition.
5. Give information on the Navier-Stokes mesh (if any).
1. Set the number of domains and their label where the code approximates the Navier-Stokes equations.
===Number of subdomains in Navier-Stokes mesh
1
===List of subdomains for Navier-Stokes mesh
2
2. Set if there is a level (for multiphase problem).
===Is there a level set?
.f.
3. If a level set is present, set the number of fluids considered.
===How many fluids?
2
6. Give information on the temperature mesh (if any).
1. Set the number of domains and their label where the code approximates the temperature equation.
===Number of subdomains in temperature mesh
2
===List of subdomains for temperature mesh
1 2
2. Set the number of interface between the temperature and the velocity field domains and give their respective labels.
===Number of interfaces between velocity and temperature only domains (for nst applications)
1
===List of interfaces between velocity and temperature only domains (for nst applications)
3
It is only used when there is no magnetic field domain.
7. Give information on the magnetic field mesh (if the Maxwell equations are involved).
1. Set the number of domains and their label where the code approximates the Maxwell equations with the magnetic field.
===Number of subdomains in magnetic field (H) mesh
0
===List of subdomains for magnetic field (H) mesh
1
2. Set the number of interface in H_mesh and give their respective labels.
===Number of interfaces in H mesh
0
===List of interfaces in H mesh
0
Such interfaces represent interfaces with discontinuities in magnetic permeability or interfaces between the magnetic field mesh and the temperature or the velocity field meshes.
3. Set the type of finite element used to approximate the magnetic field.
===Type of finite element for magnetic field
2
8. Give information on the scalar potential mesh (if the Maxwell equations are involved).
1. Set the number of domains and their label where the code approximates the Maxwell equations with the scalar potential.
===Number of subdomains in magnetic potential (phi) mesh
0
===List of subdomains for magnetic potential (phi) mesh
2
2. Set the number of interface between the magnetic field and the scalar potential and give their respective labels.
===Number of interfaces between H and phi
1
===List of interfaces between H and phi
5
3. Set the type of finite element used to approximate the scalar potential.
===Type of finite element for scalar potential
2
9. You can generate files to check the correctness of the interpolation.
===Check construction with plotmtv? (True/False)
.f.
These files have the extension ".plt" and can be open with plotmtv.

Generation of interpolated restart files

To interpolate your restart files on the new mesh, you need to copy the following files in your directory:

1. The restart files.
2. The file mesh_part associated to the restart files. This file contains information on how the initial mesh has been partitionned for parallel computing. It depends of the number of processors used per meridian section.

Then type the following command:

It generates restart files on the new finite element mesh and a mesh_part file associated to these interpolated restart files. We note that to use these files to restart a computation on this new mesh, the number of the iteration of the restart files (_I001, _I002, etc.) has to be removed.

Remark: the initial restart files are erased during the interpolation process. So always keep a copy of them in an other directory.