ParMooN – Compilation Work Flow ( Explained )

ParMooN – Compilation Work Flow Explained

While solving the PDE with any package , The basic change will be on the workflow using which we will provide the necessary information to the package to compute our simulations. In this section, we will look at the work flow for ParMooN , regarding when and where we need to provide the information related to our PDE model into the code. Some of the basic information that we need to provide to Solve a PDE using any package are as follows

FEM/PDE/Solver Parameters

  1. Type of Equation to be Solved ( Either Navier Stokes, Convection Diffusion etc)
  2. Dimension of the Problem ( 2D/3D )
  3. Type of Finite Elements to be used ( Q1, Q2, Conforming/ Non Conforming etc)
  4. Type of Parallelisation to be used ( MPI, OpenMP, CUDA ).
  5. Compiler and libraries to be used
  6. Type of Solver ( Direct / Iterative / AMG etc)
  7. Type of FE Discretisation ( Galerkin/SDFEM etc)

Boundary Conditions and PDE Constants

  1. What type of boundary condition needs to be provided on what surfaces/edges ( Dirichlet/Neumann/ Neumann/Slip with Friction / Robin )
  2. Boundary Values (Solution values in case of Dirichlet, Traction values for Neumann )
  3. Bilinear Coefficients of the PDE ( like Reynolds number etc )

Mesh and Time Stepping Parameters

  1. Type of Mesh to be used ( Structured / Unstructured )
  2. Mesh File
  3. Time Discretisation Method ( Crank Nicholson/ Backward Euler / Frac Step Theta )
  4. Time Stepping Parameters ( Start/End time, Time step length )

These are the main Parameters what the user needs to provide before solving for a PDE. Now we will look at in which stages or in which part of the file in the ParMooN environment we need to provide these details

3 Phases of Passing Input Parameters to ParMooN ( For basic Execution )

There are three main places where the user needs to provide the above mentioned parameters into ParMooN for solving a Basic PDE.

UserConfig.cmake : before BUILD ( Before running cmake )

Example File (.h file) : For Boundary Conditions and values

*.dat (param file ) : for all addditional user defined Parameters


Following Details should be provided in the UserConfig.cmake file before running the cmake process

  • Dimension of the Problem : 2D/ 3D
  • Type of PDE : Stationary/In-stationary , Convection Diffusion / Navier Stokes Equation
  • Output Directory : The directory in which the executable needs to be saved
  • Machine Type : Type of C Compiler and OS type
  • Parallelisation Type : OpenMP, MPI, CUDA
# selection of dimension (2D 3D)
set(AParMooN_GEO "2D" CACHE STRING "Change AParMooN_GEO, to select the Dimensio of the problem")

# select this line accordingly to include your main program
set(AParMooN_MODEL "${PROJECT_SOURCE_DIR}/2DPrograms/CD2D_ParMooN.C" CACHE STRING "Enter to select the Main file of the model") 

# selection of architect type (LINUX64 MAC64 INTEL64 TYRONE64 CRAY64)
set(AParMooN_ARCH "INTEL64" CACHE STRING "select the machine type")

#  selection of program type (SEQUENTIAL SMPI MPI OMPONLY HYBRID SCUDA)
set(AParMooN_PARALLEL_TYPE "SEQUENTIAL" CACHE STRING "select the parallel type")

#  selection of program type (MPICH OPENMPI INTELMPI CRAYMPI MACMPI)
set(AParMooN_MPI_IMPLEMENTATION "INTELMPI" CACHE STRING "select the MPI Implementation type")
# set the path to save the exe file ....................................................................................
set(AParMooN_OUTPUT_DIR_PATH "${CMAKE_SOURCE_DIR}/../ParMooN_Output/CD2D" CACHE STRING "select the model")

Note : The Values that each parameter will accept is given in the comment above each line.${CMAKE_SOURCE_DIR} is theBUILD folder. The paths can either be provided as relative paths or as Absolute Paths

Boundary Conditions – Example File

All the Boundary conditions/values and the Bilinear coefficients will be included inside the example files. The example file will be included as a header file in the Main Executable file.

The Example file will have 5 main functions ( may vary for complex problems )

  1. BoundCondition ( To set the type of Boundary condition )
  2. BoundValue ( To provide Boundary Values )
  3. BilinearCoeffs ( To provide the bilinear Coefficient values )
  4. ExactSolution (To calculate the error with FE solution ) – Optional
  5. InitialCondition ( For non Stationary Problems to provide Solution at t=0 )

I, BoundCondition 

  1. The Boundary Conditions have to be applied on Edges(2D) or on Surfaces(3D).
  2. The Boundary Id’s needs to be set in the meshing software itself. The id will be used to apply the appropriate Bound Condition and Boundary Values.
  3. The available boundary conditions are Dirichlet,Neumann, SlipWithFriction, Robin etc
void BoundValue(int BdComp, double Param, double &value)
  static double eps=1/TDatabase::ParamDB->PE_NR;

    value = -eps*Pi*sin(Pi*Param);
    value = 0;

2, BoundValue 

  1. The function will apply the appropriate boundary value based on the bdId’s of boundary Surfaces/Edges for 3D/2D domain
  2. For 2D , all The domain length will be parameterized. i.e, whatever the length of the domain may be it will be converted to a length from 0 to 1. So for a domain which stretches from x = 10 to 50 ( param val 0 = 10 0.5 is 30 )
void BoundValue(int BdComp, double Param, double &value)
  static double eps=1/TDatabase::ParamDB->PE_NR;

    value = -eps*Pi*sin(Pi*Param);
    value = 0;

3, BilinearCoeffs

The coefficients related to the PDE will be provided within this function . This will differ from PDE to PDE. For CD2D equation the parameters will be as follows.
coeff[0] = Diffusion Parameter ( Epsilon )
coeff[1] = Convection Parameter ( b1 ) ( in x direction )
coeff[2] = Convection Parameter ( b2 ) ( in y direction )
coeff[3] = Reaction Parameter ( c )
coeff[4] = source term (f)

4, Exact Solution

Here we enter the exact/analytical solution to the porblem , whose analytical solution is known. This is used to obtain the order of convergence of a particular numerical scheme and to perform error analysis of the particular method. The below array represents the exact solution, Derivative of exact solution in x-direction , derivative of solution in y direction

void Exact(double x, double y, double *values)
  values[0] = sin(Pi*x)*sin(Pi*y);
  values[1] = Pi*cos(Pi*x)*sin(Pi*y);
  values[2] = Pi*sin(Pi*x)*cos(Pi*y);
  values[3] = -2*Pi*Pi*sin(Pi*x)*sin(Pi*y);

5, Initial Condition

This function is used for providing the initial condition to the non stationary Parabolic/Hyperbolic PDE’s

void InitialCondition(double x, double y, double *values)
  double t;

  t = TDatabase::TimeDB->CURRENTTIME;
  values[0] = exp(t)*(sin(2*Pi*x)*sin(2*Pi*y));

Param File – .dat File

These are parameters that can be used by the user to pass values into the ParMooN. The below are the few examples for values which can be passed into the system

GEO_FILEGEO file for Internal Mesh Generation
BNDFILEBNDFILE PRM file for Input Mesh Generation
UNIFORM STEPSLevels of Refinement to be performed on Unit Mesh
ANSATZ ORDERFinite Element order
PE NRPeclet number eps=1/PE NR
TIME_DISCType of Time Discretisation
# 0 – Forward Euler
# 1 – backward Euler
# 2 – Crank Nicholson
# 3 – Fractional Step Theta Scheme
STARTTIMEStart Time of TIme Dependent Problem
ENDTIMEEnd Time of TIme Dependent Problem
STEPS PER IMAGENumber of Time Steps per which a VTK file will be generated
VELOCITY SPACEFinite element order for velocity in NSE
RE NRReynolds Number
DISCTYPE 1 – Galerkin
3 – Upwind
9 – VMS
NSTYPENavier Stokes Type ( Explained in NSE Problem)
LAPLACETYPELaplacian Tensor form Type ( Explained in NSE Slides)
SOLVER TYPEType of Direct Solver to be Used
Min Residual for Non Linear Iteration
SC NONLIN MAXIT SADDLEMaximum no of Non Linear Iterations