# Documentation du code de simulation numérique SUNFLUIDH

## Web LIMSI

sunfluidh:numerical_methods_examples

## Some examples illustrating how to use the relevant namelists to set the numerical methods for solving the equations

### Context : Heat driven incompressible flow

• Numerical scheme for solving the governing equations of velocity and temperature
• Time discretization : semi-implicit formulation with the 2nd order Backward Differentiation formula (BDF2)
• Viscous and conduction fluxes (2nd order centered scheme selected by default with BDF2)
• convective flux for momentum equation : 2nd order centered scheme, conservative form
• advective flux for temperature equation : 2nd order centered scheme, conservative form
• Solving Poisson's equation : see the following examples

### Example 1 : Partial diagonalization method

Only one namelist is required : “Numerical_Methods”. You first find the old version and then the new one. The both versions are strictly equivalent.
The old version :

    &Numerical_Methods  Numerical_Scheme= 1,
Convective_Flux_Discretization_Type            = 1 ,
Numerical_Method_Poisson_Equation   = 3    /


The corresponding new version :

  &Numerical_Methods  NS_NumericalMethod= "BDF2-SchemeO2",
MomentumConvection_Scheme="Centered-O2-Conservative" ,
Poisson_NumericalMethod="Home-PartialDiagonalization"  /



### Example 2 : An iterative method coupled with a multigrid procedure using a "in-house" development

Suitable setting :

• A SOR solver with a relaxation coefficient of 1.7, using a red-black alogorithm in a MPI-parallel context.
• The nV-cycle multigrid procedure is composed of 5 grid levels, with a maximum number of cycles n= 10.
• The number of SOR iterations is :
• 5 on the restriction step (going from finnest to the coarsest grid)
• 20 on the coarsest grid
• 15 on the prolongation step (going from coarsest to the finnest grid)
• The stopping criterion based on the residu of the computation is 1E-08

As the fluid is incompressible, the matrix coefficients of the Poisson's equation are constant.
As a “homemade” method is used, two ways are possible :

• Using the namelist “Numerical_Methods” only (old version).
• Using the namelists “Numerical_Methods” and “HomeData_PoissonSolver” (new version)

#### Using the namelist "Numerical_Methods" only (old version)



&Numerical_Methods  Numerical_Scheme= 1,
Convective_Flux_Discretization_Type            = 1 ,

Numerical_Method_Poisson_Equation   = 1
Iterative_Method_Selection          = 3   ,
Number_max_Grid = 5                         ,
Number_max_Cycle= 10                      ,
Number_Iteration= 15,
Number_Iteration_FineToCoarseGrid= 5,
Number_Iteration_CoarsestGrid    = 15,
Number_Iteration_CoarseToFineGrid= 10,
Relaxation_Coefficient           = 1.70 ,
Convergence_Criterion            = 1.D-08 /


#### Using the namelists "Numerical_Methods" and "HomeData_PoissonSolver" (new version)

    &Numerical_Methods  NS_NumericalMethod= "BDF2-SchemeO2",
MomentumConvection_Scheme="Centered-O2-Conservative" ,
Poisson_NumericalMethod="Home-SORMultigrid-ConstantMatrixCoef"/

&HomeData_PoissonSolver   SolverName="SOR",
Number_max_Grid = 5                         ,
Number_max_Cycle= 10                      ,
Number_Iteration= 15,
Number_Iteration_FineToCoarseGrid= 5,
Number_Iteration_CoarsestGrid    = 15,
Number_Iteration_CoarseToFineGrid= 10,
Relaxation_Coefficient           = 1.70 ,
Convergence_Criterion            = 1.D-08 /        

### Example 3 : An iterative method coupled with a multigrid procedure using the HYPRE library

Suitable setting :

• Selection of the PFMG method using a SOR relaxation method for non symmetrical matrix (even though the Poisson's operator could be symmetric in this context)
• The number of iterations is :
• The maximum iteration number is 20
• 5 relaxation sweeps before coarse-grid correction
• 10 relaxation sweeps after coarse-grid correction
• The tolerance convergence is 1E-08

#### Using the namelists "Numerical_Methods" and "HypreData_PoissonSolver" (new version only)



&Numerical_Methods  NS_NumericalMethod= "BDF2-SchemeO2",
MomentumConvection_Scheme="Centered-O2-Conservative" ,