0% found this document useful (0 votes)
70 views45 pages

HORSES3D User Manual

This document is a user manual for HORSES3D, a high-order spectral element solver. It describes how to compile the code, set up input and output files, run simulations using control files, specify boundary and initial conditions, choose physics models and solvers, adaptively refine meshes, use immersed boundary methods, monitor simulations, post-process results, and develop customized problem files. The manual provides guidance on performing simulations of compressible and incompressible flows, multiphase flows, particle dynamics, and other applications using HORSES3D.

Uploaded by

yangdw1998
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views45 pages

HORSES3D User Manual

This document is a user manual for HORSES3D, a high-order spectral element solver. It describes how to compile the code, set up input and output files, run simulations using control files, specify boundary and initial conditions, choose physics models and solvers, adaptively refine meshes, use immersed boundary methods, monitor simulations, post-process results, and develop customized problem files. The manual provides guidance on performing simulations of compressible and incompressible flows, multiphase flows, particle dynamics, and other applications using HORSES3D.

Uploaded by

yangdw1998
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

HORSES3D

A High-Order (DG) Spectral Element Solver


User Manual

Numath group

March 8, 2024
Contents

1 Compiling the code 3

2 Input and Output Files 5


2.1 Input Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Output Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Running a Simulation 6
3.1 Control File (*.control) - Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

4 Spatial Discretization 9

5 Restarting a Case 11

6 Physics related keyword 12


6.1 Compressible flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.1.1 Shock-capturing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.1.2 Acoustic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.2 Incompressible Navier-Stokes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.3 Multiphase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.4 Particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.5 Complementary Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.5.1 Wall Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.5.2 Tripping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

7 Implicit Solvers with Newton linearisation 23


7.1 General Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.2 Keywords for the BDF Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.3 Keywords for the Rosenbrock-Type Implicit Runge-Kutta Methods . . . . . . . . . . . . . . . . . 24
7.4 Jacobian Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

8 Explicit Solvers 26

9 Nonlinear p-Multigrid solver (FAS) 27

10 p-Adaptation Methods 29
10.1 Truncation Error p-Adaptation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
10.2 Reinforcement Learning p-Adaptation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
10.3 Multiple truncation error estimations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

11 Immersed boundary method 32


11.0.1 STL file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
11.0.2 Computing forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
11.0.3 Moving bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

1
12 Monitors 35
12.1 Residual Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
12.2 Statistics Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
12.3 Probes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
12.4 Surface Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
12.5 Volume Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
12.6 Load Balancing Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

13 Advanced User Setup 38


13.1 Routines of the Problem File: ProblemFile.f90 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
13.2 Compiling the Problem File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

14 Postprocessing 39
14.1 Visualization with Tecplot Format: horses2plt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
14.1.1 Solution Files (*.hsol) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
14.1.2 Statistics Files (*.stats.hsol) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
14.2 Extract geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
14.3 Merge statistics tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
14.4 Mapping result to different mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
14.5 Generate OpenFOAM mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
14.6 Generate HORSES3D solution file from OpenFOAM result . . . . . . . . . . . . . . . . . . . . . 41

2
Chapter 1

Compiling the code

• Clone the git repository or copy the source code into a desired folder.
• Go to the folder Solver.
• Run configure script.
$ ./ configure

• Install using the Makefile:


$ make a l l <<Options>>

with the desired options (bold are default):

– MODE=DEBUG/HPC/RELEASE
– COMPILER=ifort/gfortran
– COMM=PARALLEL/SEQUENTIAL
– ENABLE THREADS=NO/YES
– WITH PETSC=YES/NO
– WITH METIS=YES/NO
– WITH HDF5=YES/NO
– WITH MKL=YES/NO

For example:
$ make a l l COMPILER= i f o r t COMM=PARALLEL

• MODE=DEBUG/HPC/RELEASE flag enables various compiler flags for different levels of code opti-
mization. Furthermore, MODE=HPC disables residual file writing to improve performance.
• The ENABLE THREADS=YES flag enables shared memory simulations using OpenMP.
• The COM=PARALLEL flag enables distributed memory simulations using MPI.
• The WITH METIS=YES flag activates METIS linking. To compile the code linking it with METIS (that
is an option for creating the mesh partitions of MPI runs), it is needed that before compilation and
running, an environment variable called METIS DIR is found. This variable must contain the path to the
METIS installation folder (it must have been compiled with the same compiler as HORSES3D).
• The WITH HDF5=YES flag activates HDF5 linking. To compile the code linking it with HDF5 (necessary
for reading HOPR meshes), it is needed that before compilation and running, an environment variable
called HDF5 DIR is found. This variable must contain the path to the HDF5 installation folder (it must
have been compiled with the same compiler as HORSES3D). In addition, the lib folder must be added to
the environment variable LD LIBRARY PATH.
• The WITH PETSC=YES flag activates PETSC linking. To compile the code linking it with PETSC, it is
needed that before compilation and running, an environment variable called PETSC DIR is found. This
variable must contain the path to the PETSC installation folder.
3
• If you use environment modules, it is advised to use the HORSES3D module file:

$ export MODULEPATH=$HORSES DIR/ u t i l s / m o d u l e f i l e :$MODULEPATH

where $HORSES DIR is the installation directory.


• It is advised to run the make clean or make allclean command if some options of the compilation rutine
needs to be changed and it has been compiled before.

4
Chapter 2

Input and Output Files

DONT USE TABS!

2.1 Input Files


• Control file (*.control)
• Mesh file (*.mesh / *.h5 / *.msh)
• Polynomial order file (*.omesh)

• Problem File (ProblemFile.f90)

Notes on the GMSH format (*.msh) and general workflow using GMSH.
• Curved geometry supported up to polynomial order 5.
• Curved geometry should be generated using following options: tools -¿ options -¿ mesh -¿ general -¿ element order.
• HORSES3D can read mesh format 4.1 and 2.2 (legacy format).
• The solution to most of the problems mesh reading is to load it in GMSH and export to format 2.2 to have a clean
ASCII file.

2.2 Output Files


• Solution file (*.hsol)
• Horses mesh file (*.hmesh)
• Boundary information (*.bmesh)

• Partition file (*.pmesh)


• Polynomial order file (*.omesh)
• Monitor files (*.volume / *.surface / *.residuals)

5
Chapter 3

Running a Simulation

3.1 Control File (*.control) - Overview


The control file is the main file for running a simulation. A list of all the mandatory keywords for running a
simulation and some basic optional keywords is presented in Table 3.1. The specific keywords are listed in the
other chapters.

Table 3.1: General keywords for running a case.

Keyword Description Default value


solution file name CHARACTER: Path and name of the output file. The name of Mandatory
this file is used for naming other output files. keyword
simulation type CHARACTER: Specifies if HORSES3D must perform a ’steady- ’steady-state’
state’ or a ’time-accurate’ simulation.
time integration CHARACTER: Can be ’implicit’, ’explicit’, or ’FAS’. The latter ’explicit’
uses the Full Algebraic Storage (FAS) multigrid scheme, which
can have implicit or explicit smoothers.
polynomial order INTEGER: Polynomial order to be assigned uniformly to all the –*
elements of the mesh. If the keyword polynomial order file is
specified, the value of this keyword is overridden.
polynomial order i INTEGER: Polynomial order in the i, j, or k component for all –*
polynomial order j the elements in the domain. If used, the three directions must be
polynomial order k declared explicitly, unless you are using a polynomial order file.
If the keyword polynomial order file is specified, the value of this
keyword is overridden.
polynomial order file CHARACTER: Path to a file containing the polynomial order of –*
each element in the domain.
restart LOGICAL: If .TRUE., initial conditions of simulation will be read Mandatory
from restart file specified using the keyword restart file name. keyword
cfl REAL: A constant related with the convective Courant- –**
Friedrichs-Lewy (CFL) condition that the program will use to
compute the time step size.
dcfl REAL: A constant related with the diffusive Courant-Friedrichs- –**
Lewy (DCFL) condition that the program will use to compute the
time step size.
dt REAL: Constant time step size. –**
final time REAL: This keyword is mandatory for time-accurate solvers –
mesh file name CHARACTER: Name of the mesh file. The currently supported Mandatory
formats are .mesh (SpecMesh file format) and .h5 (HOPR hdf5 keyword
file format).
mesh inner curves LOGICAL: Specifies if the mesh reader must suppose that the .TRUE.
inner surfaces (faces connecting the elements of the mesh) are
curved. This input variable only affects the hdf5 mesh reader.
number of time steps INTEGER: Maximum number of time steps that the program will Mandatory
compute. keyword

6
Table 3.1: General keywords for running a case - continued.

Keyword Description Default value


output interval INTEGER: In steady-state, this keyword indicates the interval of Mandatory
time steps to display the residuals on screen. In time-accurate keyword
simulations, this keyword indicates how often a 3D output file
must be stored.
convergence tolerance REAL: Residual convergence tolerance for steady-state cases Mandatory
keyword
partitioning CHARACTER: Specifies the method for partitioning the mesh in ’metis’
MPI simulations. Options are: ’metis’ (the code must have been
linked to METIS at compilation time, see Chapter 1), or ’SFC’ (to
use a space-filling curve method, no special compilation is needed
for this option).
partitioning with weights LOGICAL: Specifies if the method for partitioning the mesh in .TRUE.
MPI simulations takes the local polynomial order as weights. Nec-
essary for local polynomial refinement
manufactured solution CHARACTER: Must have the value ’2D’ or ’3D’. When this key- –
word is used, the program will add source terms for the conser-
vative variables taken into account an exact analytic solution for
each primitive variable j (ρ, u, v, w, p) of the form:
j = jC (1) + jC (2) sin(πjC (5)x) + jC (3) sin(πjC (6)y) +
jC (4) sin(πjC (7)z)
Where jC (i) are constants defined in the file ManufacturedSolu-
tions.f90. Proper initial and boundary conditions must be im-
posed (see the test case). The mesh must be a unit cube.
* One of these keywords must be specified
** For Euler simulations, the user must specify either the CFL number or the time-step size. For Navier-
Stokes simulations, the user must specify the CFL and DCFL numbers or the time-step size.

3.2 Boundary conditions


The boundary conditions are specified as blocks in the control file. The block start with a the keywords ‘#define’
and ends with ‘#end’. Inside the block the options are specified as a pair of keywords and values, just as the
normal body of the rest of the file.
Each boundary condition can be individually defined or if multiple boundaries are set with the same defini-
tion, it could be done on the same block (with the name separated by a double under score ‘ ’ sign). The name
of each boundary must match with the one specified at the mesh file.
The block in general can be seen below. Table 3.2 show the values for the type keyword, and the possible
value for the parameters depends on the boundary condition.
#define boundary myBoundary1 myBoundary2 myBoundary3
type = typeValue
parameter 1 = v a l u e 1
parameter 2 = v a l u e 2
# end

Table 3.2: Keywords for Boundary Conditions.


Keyword Description Default value
type CHARACTER: Type of boundary condition to be applied. Op- N/A
tions are: Inflow, Outflow, NoSlipWall, FreeSlipWall, Periodic,
User-defined.

By default, NoSlipWall is adiabatic. Isothermal wall can be activated with the following block:
#define boundary myBoundary1 myBoundary2 myBoundary3
type = NoSlipWall
w a l l type ( a d i a b a t i c / i s o t h e r m a l ) = i s o t h e r m a l
w a l l t e m p e r a t u r e = 2 0 0 0 . 0 d0 ! Wall t e m p e r a t u r e i n K
7
# end
It is also possible to set a moving wall with the keyword wall velocity = value.
For periodic boundary conditions, the second boundary that must be used as a complement must be specified
by the keyword ‘coupled boundary’. These two boundaries must have the same node position in all directions
but one. For mesh files generated by commercial software where this strict rule is not imposed a comparison
based on the minimum edge size of the face element can be used by a boolean parameter in the normal body of
the control file (not in the block body), with the keyword ‘periodic relative tolerance’.

8
Chapter 4

Spatial Discretization

HORSES3D uses a high-order discontinuous Galerkin Spectral Element (DGSEM) method. As part of the
numerical method, several options of volume and surface discretization options can be selected. Some options
are only available in certain solvers.

Table 4.1: Keywords for spatial discretization.

Keyword Description Default value


Discretization nodes CHARACTER: Node type to use in the solution. Options are: ’Gauss’

• Gauss
• Gauss-Lobatto

inviscid discretization CHARACTER: DG discretization of inviscid fluxes. Options are: ’Standard’


• Standard
• Split-Form

averaging CHARACTER: Type of averaging function to use in numerical –


fluxes and split-forms (if in use). Options are:
• Standard

• Morinishi
• Ducros
• Kennedy-Gruber

• Pirozzoli
• Entropy conserving
• Chandrasekar
• Skew-symmetric 1 (only for Incompressible Navier–Stokes)

• Skew-symmetric 2 (only for Incompressible Navier–Stokes)

viscous discretization CHARACTER: Method for viscous fluxes. Options are: ’BR2’
• BR1
• BR2
• IP

9
Table 4.1: Keywords for spatial discretization - continued.

Keyword Description Default value


riemann solver CHARACTER: Riemann solver for inviscid fluxes. Options are: Mandatory
keyword
• Central
• Roe (Only for compressible Navier–Stokes)
• Standard Roe (Only for compressible Navier–Stokes)

• Roe-Pike (Only for compressible Navier–Stokes)


• Low dissipation Roe (Only for compressible Navier–Stokes)
• Lax-Friedrichs (Only for compressible and Incompressible
Navier–Stokes)

• ES Lax-Friedrichs (Only for compressible Navier–Stokes,


not including RANS)
• u-diss (Only for compressible Navier–Stokes, not including
RANS)
• Rusanov (Only for compressible Navier–Stokes)

• Matrix dissipation (Only for compressible Navier–Stokes)


• Viscous NS (Only for compressible Navier–Stokes, not in-
cluding RANS)
• Exact (Only for Incompressible Navier-Stokes, and Multi-
phase)

10
Chapter 5

Restarting a Case

Table 5.1: Keywords for restarting a case.


Keyword Description Default value
restart LOGICAL: If .TRUE., initial conditions of simulation will be read Mandatory
from restart file specified using the keyword restart file name. keyword
restart file name CHARACTER: Name of the restart file to be written and, if key- Mandatory
word restart = .TRUE., also name of the restart file to be read keyword
for starting the simulation.
restart polorder INTEGER: Uniform polynomial order of the solution to restart same as case’s
from. This keyword is only needed when the restart solution is of
a different order than the current case.
restart nodetype CHARACTER: node type of the solution to restart from (Gauss same as case’s
or Gauss-Lobatto). This keyword is only needed when the restart
node type is different than the current case.
restart polorder file CHARACTER: File containing the polynomial orders of the solu- same as case’s
tion to restart from. This keyword is only needed when the restart
solution is of a different order than the current case.
get discretization error of CHARACTER: Path to solution file. This can be used to estimate –
the discretization error of a solution when restarting from a higher-
order solution.
NS load from NSSA LOGICAL: Used only for NS simulations that are restarted from .FALSE.
RANS SA.

11
Chapter 6

Physics related keyword

6.1 Compressible flow

Table 6.1: Keywords for compressible flow (Euler / Navier-Stokes).


Keyword Description Default value
Mach number REAL: Mandatory
keyword
Reynolds number REAL: Mandatory
keyword
Prandtl number REAL: 0.72
Turbulent Prandtl number REAL: Equal to
Prandtl
AOA theta REAL: Angle of attack (degrees), based on the spherical coordi- 0.0
nates polar angle (θ) definition
AOA phi REAL: Angle of attack (degrees), based on the spherical coordi- 0.0
nates azimuthal angle (φ) definition
LES model CHARACTER(*): Options are: None
• Vreman
• Wale

• Smagorinsky
• None

Wall model CHARACTER: linear

6.1.1 Shock-capturing
The shock-capturing module helps stabilize cases with discontinuous solutions, and may also improve the results
of under-resolved turbulent cases. It is built on top of a Sensors module that detects problematic flow regions,
classifying them according to the value of the sensor, s, mapped into the interval a ∈ [0, 1],

 0,
1 s−s0
 if s ≤ s0 − ∆s/2,
a= 1 + sin , if s0 − ∆s/2 < s < s0 + ∆s/2,
 2 ∆s
1, elsewhere.

The values of s0 = (s1 + s2 )/2 and ∆s = s2 − s1 depend on the sensor thresholds s1 and s2 .
At the moment, flow regions where a ≤ 0 are considered smooth and no stabilization algorithm can be
imposed there. In the central region of the sensor, with 0 < a < 1, the methods shown in the next table can be
used and even scaled with the sensor value, so that their intensity increases in elements with more instabilities.
Finally, the higher part of the sensor range can implement a different method from the table; however, the
intensity is set to the maximum this time.
12
All the methods implemented introduce artificial dissipation into the equations, which can be filtered with
an SVV kernel to reduce the negative impact on the accuracy of the solution. Its intensity is controlled with the
parameters µ (similar to the viscosity of the Navier-Stokes equations) and α (scaling of the density-regularization
term of the Guermond-Popov flux), which can be set as constants or coupled to the value of the sensor or to a
Smagorinsky formulation.

Table 6.2: Keywords for shock-capturing algorithms in the Navier-


Stokes equations.

Keyword Description Default value


Enable shock-capturing LOGICAL: Switch on/off the shock-capturing stabilization .FALSE.
Shock sensor CHARACTER: Type of sensor to be used to detect discontinuous Integral
regions Options are:
• Zeros: always return 0

• Ones: always return 1


• Integral: integral of the sensor variable inside each element
• Integral with sqrt: square root of the Integral sensor

• Modal: based on the relative weight of the higher order


modes
• Truncation error: estimate the truncation error of the ap-
proximation
• Aliasing error: estimate the aliasing error of the approxima-
tion
• GMM: clustering sensor based on the divergence of the ve-
locity and the gradient of the pressure

Shock first method CHARACTER: Method to be used in the middle region of the None
sensor (a ∈ [0, 1]). Options are:
• None: Do not apply any smoothing

• Non-filtered: Apply the selected viscous flux without SVV


filtering
• SVV: Apply an entropy-stable, SVV-filtered viscous flux

Shock second method CHARACTER: Method to be used in the top-most region of the None
sensor (a = 1). Options are:
• None: Do not apply any smoothing

• Non-filtered: Apply the selected viscous flux without SVV


filtering
• SVV: Apply an entropy-stable, SVV-filtered viscous flux

Shock viscous flux 1 CHARACTER: Viscous flux to be applied in the elements –


where a ∈ [0, 1]. Options are:
• Physical

• Guermond-Popov (only with entropy variables gradients)

13
Table 6.2: Keywords for shock-capturing algorithms in the Navier-
Stokes equations – continuation.

Keyword Description Default value


Shock viscous flux 2 CHARACTER: Viscous flux to be applied in the elements –
where a = 1. Options are:
• Physical
• Guermond-Popov (only with entropy variables gradients)

Shock update strategy CHARACTER: Method to compute the variable parameter of the Constant
specified shock-captruing approach in the middle region of the
sensor. Options are:

• Constant
• Sensor
• Smagorinsky: only for non-filtered and SVV

Shock mu 1 REAL/CHARACTER(*): Viscosity parameter µ1 , or Cs in the 0.0


case of LES coupling
Shock alpha 1 REAL: Viscosity parameter α1 0.0
Shock mu 2 REAL: Viscosity parameter µ2 µ1
Shock alpha 2 REAL: Viscosity parameter α2 α1
Shock alpha/mu REAL: Ratio between α and µ. It can be specified instead of α –
itself to make it dependent on the corresponding values of µ, and
it is compulsory when using LES coupling
SVV filter cutoff REAL/CHARACTER(*): Cutoff of the filter kernel, P . If ”auto- ”automatic”
matic”, its value is adjusted automatically
SVV filter shape CHARACTER(*): Options are: Power
• Power
• Sharp

• Exponential

SVV filter type CHARACTER(*): Options are: High-pass


• Low-pass
• High-pass

14
Table 6.2: Keywords for shock-capturing algorithms in the Navier-
Stokes equations – continuation.

Keyword Description Default value


Sensor variable CHARACTER(*): Variable used by the sensor to detect shocks. rhop
Options are:
• rho
• rhou

• rhov
• rhow
• u
• v

• w
• p
• rhop

• grad rho
• div v

Sensor lower limit REAL: Lower threshold of the central sensor region, s1 Mandatory
keyword (ex-
cept GMM)
Sensor higher limit REAL: Upper threshold of the central sensor region, s2 Mandatory
keyword (ex-
cept GMM)
Sensor TE min N INTEGER: Minimum polynomial order of the coarse mesh used 1
for the truncation error estimation
Sensor TE delta N Polynomial order difference between the solution mesh and its 1
coarser representation
Sensor TE derivative CHARACTER* : Whether the face terms must be considered in Isolated
the estimation of the truncation error or not. Options are:
• Non-isolated
• Isolated

Sensor number of clusters INTEGER: Maximum number of clusters to use with the GMM 2
sensor
Sensor min. steps INTEGER: Minimum number of time steps that an element will 1
remain detected. The last positive value will be used if the sensor
“undetects” an element too early

Spectral Vanishing Viscosity


The introduction of an SVV-filtered artificial flux helps dissipate high-frequency oscillations. The baseline
viscous flux can be chosen as the Navier-Stokes viscous flux or the flux developed by Guermond and Popov. In
any case, this flux is expressed in a modal base where it is filtered by any of the following three filter kernels:
• power: F̂i1D = (i/N )P ,
• sharp: F̂i1D = 0 if i < P , F̂i1D = 1 elsewhere,
 
)2
• exponential: F̂i1D = 0 if i ≤ P , F̂i1D = exp − (i−N
(i−P ) 2 elsewhere.
The extension to three dimensions allows the introduction of two types of kernels based on the one-dimensional
ones:
15
• high-pass: F̂ijk
H
= F̂i1D F̂j1D F̂k1D ,
   
• low-pass: F̂ijk
L
= 1 − 1 − F̂i1D 1 − F̂j1D 1 − F̂k1D ,

being the low-pass one more dissipative and, thus, more suited to supersonic cases. The high-pass filter, on the
other hand, works better as part of the SVV-LES framework for turbulent cases.
The cutoff parameter P can be set as ”automatic”, which uses a sensor to differentiate troubled elements
from smooth regions. The stabilisation strategy then depends on the region:
• smooth regions: P = 4, µ = µ2 , α = α2 ,
• shocks: P = 4, µ = µ1 , α = α1 .
In addition to this, the viscosity µ1 can be set to ”Smagorinsky” to use the implemented SVV-LES approach.
In this case, the µ = µLES viscosity is computed following a Smagorinsky formulation with Cs = µ2 and the
viscosity parameters do not depend on the region anymore,

µ = Cs2 ∆2 |S|2 , α = α1 .

6.1.2 Acoustic
The Ffowcs Williams and Hawkings (FWH) acoustic analogy is implemented as a complement to the compress-
ible NS solver. It can run both during the execution of the NS (in-time) or as at a post-process step. The
version implemented includes both the solid and permeable surface variations, but both of them for a static
body subjected to a constant external flow, i.e. a wind tunnel case scenario. The specifications for the FWH are
divided in two parts: the general definitions (including the surfaces) and the observers definitions. The former
is detailed in Table 6.3, while the latter are defined in a block section, similar to the monitors (see Chapter 12):
#define a c o u s t i c o b s e r v e r 1
name = SomeName
p o s i t i o n = [ 0 . d0 , 0 . d0 , 0 . d0 ]
#end
To run the in-time computation, the observers must be defined in the control file. Beware that adding
an additional observer will require to run the simulation again. To use the post-process computation, the
solution on the surface must be saved at a regular time. Beware that it will need more storage. To run the
post-process calculation the horses.tools binary is used, with a control file similar to the one use for the NS
simulation (without monitors), and adding the keywords ”tool type” and ”acoustic files pattern”, as explained
in Table 6.3.

16
Table 6.3: Keywords for acoustic analogy
Keyword Description Default value
acoustic analogy CHARACTER(*): This is the main keyword for activating the –
acoustic analogy. The only options is: ”FWH”.
acoustic analogy permeable LOGICAL: Defines if uses a permeable or solid approach. .FALSE.
acoustic solid surface CHARACTER(*): Array containing the name of each bound- –
ary to be used as a surface for integration. In the form:
’[bc1,bc2,bc3]’. Mandatory for using the solid surface variant.
acoustic surface file CHARACTER(*): Path to a fictitious surface that will be used –
for integration. It must be tailor-made for the mesh. Mandatory
for using the permeable surface variant.
observers flush interval INTEGER: Iteration interval to flush the observers information 100
to the files.
acoustic solution save LOGICAL: Defines whether it saves the NS solution on the sur- .FALSE.
face. Mandatory for post-process computation.
acoustic save timestep REAL: Controls the time or iteration at which the FWH will be –
calculated (and saved if specified). If the key is missing it will be
done at each timestep.
acoustic files pattern CHARACTER(*): Pattern to the path of all the saved solutions –
on the surface (To be used in horses.tools for the post-process
calculation).
tool type CHARACTER(*): Necessary for post-process calculation. De- –
fines the type of post-process of horses.tools. For the FWH anal-
ogy the value must be ”fwh post”

6.2 Incompressible Navier-Stokes


Among the various incompressible Navier-Stokes models, HORSES3D uses an artificial compressibility formu-
lation, which converts the elliptic problem into a hyperbolic system of equations, at the expense of a non
divergence–free velocity field. However, it allows one to avoid constructing an approximation that satisfies the
inf–sup condition. This methodology is well suited for use as a fluid flow engine for interface–tracking multiphase
flow models, as it allows the density to vary spatially.
The artificial compressibility system of equations is
⃗ · (ρ⃗u) = 0,
ρt + ∇ (6.1)
 
⃗ · 1 ∇⃗ 1

⃗ · (ρ⃗u⃗u) = −∇p
(ρ⃗u)t + ∇ ⃗ +∇ ⃗ u + ∇⃗
⃗ uT + 2 ρ⃗eg , (6.2)
Re Fr
⃗ · ⃗u = 0,
pt + ρ0 c20 ∇ (6.3)
The factor ρ0 is computed as max(ρ1 /ρ1 , ρ2 /ρ1 ).
This solver is run with the binary horses3d.ins.

Table 6.4: Keywords for incompressible Navier-Stokes solver


Keyword Description Default value
reference velocity (m/s) REAL: Reference value for velocity –
number of fluids (1/2) INTEGER: Number of fluids present in the simulation 1
maximum density (kg/mˆ3) REAL: Maximum value used in the limiter of the density Huge(1.0)
minimum density (kg/mˆ3) REAL: Minimum value used in the limiter of the density -Huge(1.0)
artificial compressibility factor REAL: Artificial compressibility factor c0 2 . –
gravity acceleration (m/sˆ2) REAL: Value of gravity acceleration –
gravity direction REAL: Array containing direction of gravity. Eg. [0.0, −1.0, 0.0]. –

The incompressible Navier Stokes solver has two modes: with 1 fluid and with 2 fluids. The required
keywords are listed below.

17
Table 6.5: Keywords for incompressible Navier-Stokes solver. Mode with 1 fluid
Keyword Description Default value
density (kg/mˆ3) REAL: Density of the fluid –
viscosity (pa.s) REAL: Viscosity of the fluid –

Table 6.6: Keywords for incompressible Navier-Stokes solver. Mode with 2 fluids
Keyword Description Default value
fluid 1 density (kg/mˆ3) REAL: Density of the fluid 1 –
fluid 1 viscosity (pa.s) REAL: Viscosity of the fluid 1 –
fluid 2 density (kg/mˆ3) REAL: Density of the fluid 2 –
fluid 2 viscosity (pa.s) REAL: Viscosity of the fluid 2 –

6.3 Multiphase
The multiphase flow solver implemented in HORSES3D is constructed by a combination of the diffuse interface
model of Cahn–Hilliard with the incompressible Navier–Stokes equations with variable density and artificial
compressibility. This model is entropy stable and guarantees phase conservation with an accurate representation
of surface tension effects. The modified entropy-stable version approximates:

ct + ∇⃗ · (c⃗u) = M0 ∇
⃗ 2 µ, (6.4)
 
√ √ ⃗ · 1 1 ⃗ u + c∇µ⃗ = −∇p ⃗ +∇
 
⃗ · η ∇⃗
⃗ u + ∇⃗
⃗ uT

ρ ( ρ⃗u)t + ∇ ρ⃗u⃗u + ρ⃗u · ∇⃗ + ρ⃗g , (6.5)
2 2
⃗ · ⃗u = 0,
pt + ρ0 c20 ∇ (6.6)
where c is the phase field parameter, M0 is the mobility, µ is the chemical potential, η is the viscosity and c0 is
the artificial speed of sound. The factor ρ0 is computed as max(ρ1 /ρ1 , ρ2 /ρ1 ). Mobility M0 is computed from
the control file parameters chemical characteristic time tCH , interface width ϵ and interface tension σ with the
formula M0 = L2ref ϵ/(tCH σ).
The term M0 ∇ ⃗ 2 µ can be implicity integrated to reduce the stiffnes of the problem with the keyword time
integration = IMEX. This is only recomended if the value of M0 is very high so that the time step of the explicit
scheme is very small.
This solver is run with the binary horses3d.mu.

Table 6.7: Keywords for multiphase Navier-Stokes solver


Keyword Description Default value
fluid 1 density (kg/mˆ3) REAL: Density of the fluid 1 –
fluid 1 viscosity (pa.s) REAL: Viscosity of the fluid 1 –
fluid 2 density (kg/mˆ3) REAL: Density of the fluid 2 –
fluid 2 viscosity (pa.s) REAL: Viscosity of the fluid 2 –
reference velocity (m/s) REAL: Reference value for velocity –
maximum density (kg/mˆ3) REAL: Maximum value used in the limiter of the density Huge(1.0)
minimum density (kg/mˆ3) REAL: Minimum value used in the limiter of the density -Huge(1.0)
artificial compressibility factor REAL: Artificial compressibility factor c0 2 . –
gravity acceleration (m/sˆ2) REAL: Value of gravity acceleration –
gravity direction REAL: Array containing direction of gravity. Eg. [0.0, −1.0, 0.0]. –
velocity direction REAL: Array containing direction of velocity used for the outflow –
BC. Eg. [1.0, 0.0, 0.0].
chemical characteristic time (s) REAL: tCH controls the speed of the phase separation –
interface width (m) REAL: ϵ controls the interface width between the phases –
interface tension (N/m) REAL: σ controls the interface tension between the phases –

6.4 Particles
WARNING: Lagrangian particles are only implemented for the compressible Navier Stokes (horses.ns binary)
18
WARNING: Lagrangian particles do not support MPI.
HORSES3D includes a two-way coupled Lagrangian solver. Particles are tracked along their trajectories,
according to the simplified particle equation of motion, where only contributions from Stokes drag and gravity
are retained,
dyi dui vi − u i
= ui , = + gi , (6.7)
dt dt τp
where ui and yi are the ith components of velocity and position of the particle, respectively. Furthermore, vi
accounts for the continuous velocity of the fluid at the position of the particle. We consider spherical Stokesian
particles, so their mass and aerodynamic response time are mp = ρp πDp3 /6 and τp = ρp Dp2 /18µ, respectively,
ρp being the particle density and Dp the particle diameter.
Each particle is considered to be subject to a radiative heat flux Io . The carrier phase is transparent to
radiation, whereas the incident radiative flux on each particle is completely absorbed. Because we focus on
relatively small volume fractions, the fluid-particle medium is considered to be optically thin. Under these
hypotheses, the direction of the radiation is inconsequential, and each particle receives the same radiative heat
flux, and its temperature Tp is governed by

d πDp2
(mp cV,p Tp ) = Io − πDp2 h(Tp − T ), (6.8)
dt 4
where cV,p is the specific heat of the particle, which is assumed to be constant with respect to temperature. Tp
is the particle temperature and h is the convective heat transfer coefficient, which for a Stokesian particle can
be calculated from the Nusselt number N u = hDp /k = 2.
In practical simulations, integrating the trajectory of every particle is too expensive. Therefore, particles
are agglomerated into parcels, each of them accounting for many particles with the same physical properties,
position, velocity, and temperature. The evolution of the parcels is tracked with the same set of equations
presented for the particles.
The two-way coupling means that fluid flow is modified because of the presence of particles. Therefore, the
Navier-Stokes equations are enriched with the following source terms:
 
0
 PNp mp (u − v )δ(x − y ) 
 n=1 τp 1,n 1 n 
 PNp m p

S =β  n=1 τp (u 2,n − v 2 )δ(x − y n ) ,
 (6.9)
P Np mp

n=1 (u 3,n − v 3 )δ(x − y n ) 
PNp τp2
 
n=1 πD p h(T p,n − T )δ(x − y n )

where δ is the Dirac delta function, Np is the number of parcels, β is the number of particles per parcel and
ui,n , yi,n , Tp,n are the velocity, spatial coordinates, and temperature of the parcel nth. The dimensionless form
of the Navier Stokes equations can be seen in the appendix at the end of this document.
Particles are solved in a box domain inside the flow domain. The box is defined with the keywords “minimum
box” and “maximum box”. The boundary conditions for the particles are defined with the keyword “bc box”.
Possible options are inflow/outflow, periodic and wall (with perfect rebound).

Table 6.8: Keywords for particles Navier-Stokes solver


Keyword Description Default value
lagrangian particles LOGICAL: If .true. activates particles .false.
stokes number REAL: Stokes number which for Stokesian particles is St = –
ρp Dp2 uo
18Lo µo
Gamma REAL: Ratio between specific heat of particles and fluid Γ = –
cv,p /cv
m N
phi m REAL: Ratio between total mass of particles and fluid ϕm = ρopL3p –
o
Io Dp
Radiation source REAL: Non dimensional radiation source intensity = Io∗ 4ko To –
Froude number REAL: Froude number F r = √guoL –
o o
high order particles source term LOGICAL: source term with high order dirac delta or averaged .false.
in the whole element
number of particles INTEGER: Total number of parcels in the simulation –
particles per parcel REAL: β particles per parcel –

19
Table 6.9: Keywords for particles Navier-Stokes solver - continued
Keyword Description Default value
Gravity direction INTEGER: Array with direction of gravity. Only required if Fr –
number is specified.[0,0,-1]
particles file CHARACTER(*): Path to file with initial position of the par- –
ticles. If not provided, initialization without particles inside the
domain. Not compatible with injecting particles in the domain
(see keyword below).
vel and temp from file LOGICAL: If .true. Initial velocity and temperature of particles –
read from file. If .false., initial velocity and temperature of parti-
cles are the same as flow at the position of the particle.
injection LOGICAL: If .true. injection of particles through a face of the –
box.
particles injection INTEGER: Array with a vector indicating the direction of the –
injection. Eg., [0,1,0]
particles per step INTEGER: Number of particles injected per time step. –
particles iter period INTEGER: Iteration period for particles injection. Set to 1 to –
inject particles every time step.
particles injection velocity REAL: Array with particles injection non dimensional velocity. –
Eg., [0.d0,1.d0,0.d0]
particles injection temperature REAL: Particles injection non-dimensional temperature –
minimum box REAL: Array with minimum x,y,z coordinates of box with parti- –
cles. Eg., [0.d0,0.d0,0.d0]
maximum box REAL: Array with maximum x,y,z coordinates of box with parti- –
cles. Eg., [4.d-2,1.6d-1,4.d-2]
bc box INTEGER: Array with boundary conditions for particles box in –
the form [yz,xz,xy]. 0 is inflow/outflow, 1 is wall, 2 is periodic.
Eg., [2,0,2]. In this example planes yz and xy are periodic, while
plane xz is inflow/outflow for particles.

20
6.5 Complementary Modes
6.5.1 Wall Function
The wall function overwrites the viscous flux on the specified boundaries based on an specific law using a
Newman condition. It must be used as a complement of no slip boundary condition. Table 6.10 shows the
parameters that can be set in the control file. The frictional velocity is calculated using the instantaneous
values of the first node (either Gauss or Gauss-Lobatto) of the element neighbour of the face element (at the
opposite side of the boundary face). Currently is only supported for the compressible Navier-Stokes solver.
The standard wall function uses the Reichardt law, solving the algebraic non-linear equation using the
newton method to obtain the frictional velocity. The ABL function uses the logarithmic atmospheric boundary
layer law, using the aerodynamic roughness; the frictional velocity is without using any numerical method.

Table 6.10: Keywords for Wall Function


Keyword Description Default value
Wall Function CHARACTER(*): This is the main keyword for activating the –
wall function. Identifies the wall law to be used. Options are:

• Standard: uses the Reichardt law.


• ABL: uses the atmospheric boundary layer law.

Wall Function Boundaries CHARACTER(*): Array containing the name of each boundary –
to be used. In the form: ’[bc1,bc2,bc3]’. Mandatory for using the
wall function.
Wall Function kappa REAL: von Karman constant 0.38
Wall Function C REAL: Log law ’C’ constant 4.1
Wall Function Seed REAL: Initial value for the newton method 1.0
Wall Function Damp REAL: Initial value damp for the newton method 1.0
Wall Function Tolerance REAL: Tolerance for the newton method 10−10
Wall Function max iter INTEGER: Maximum number of iterations for the newton 100
method
Wall Roughness REAL: Aerodynamic roughness for the ABL wall function. –
Mandatory value for the ABL law.
Wall Plane Displacement REAL: Plane displacement due to roughness for the ABL wall 0.0
function
Wall Function Use Average LOGICAL: Use the time average of the velocity in the wall func- .FALSE.
tion, each time step the time average is recalculated.

6.5.2 Tripping
A numerical source term is added to the momentum equations to replicate the effect of a tripping mechanism
used commonly in explerimental tests. The forcing is described via the product of two independent functions:
one that depends streamwise and vertical directions (space only) and the other one describing the spanwise
direction and time (space and time). It can be used for the compressible NS, both LES and RANS. The
keywords for the trip options are listed in table 6.11.

21
Table 6.11: Keywords for Tripping model
Keyword Description Default value
use trip LOGICAL: This is the main keyword for activating the trip .FALSE.
trip time scale REAL: Time interval between the change of the time dependent Mandatory
part of the trip.
trip number of modes INTEGER: Number of Fourier modes in the spanwise direction of Mandatory
the trip.
trip z points INTEGER: Number of points to create the Fourier Transforma- Mandatory
tion of the spanwise direction, it must be greater than the number
of modes and should be ideally equal to the number of discretiza-
tion points of the mesh in the same direction.
trip attenuation REAL ARRAY(2): Length scale of the gaussian attenuation of Mandatory
the trip, the first position is the streamwise direction and the
second is the wall-normal direction.
trip zone CHARACTER(*) ARRAY(:): Boundary condition name that Mandatory
constrains at least one surface where the trip center is located.
It can be ither one or two boundary conditions, the latter used to
generate a trip in two different positions (i.e. pressure and suction
sides of an airfoil).
trip center REAL: Position of the origin of the trip in the streamwise direc- Mandatory
tion.
trip center 2 REAL: Position of the origin of the second trip, if used, in the –
streamwise direction.
trip amplitude REAL: Maximum time varying amplitude of the trip. 1.0
trip amplitude steady REAL: Maximum steady amplitude of the trip. 0.0
random seed 1 INTEGER: Number used to initialize the random number gen- 930187532
erator of the trip. It can vary in different simulations but must
remain constant for a restart.
random seed 2 INTEGER: Number used to initialize the random number gen- 597734650
erator of the trip. It can vary in different simulations but must
remain constant for a restart.

22
Chapter 7

Implicit Solvers with Newton


linearisation

7.1 General Keywords


The keywords for the implicit solvers are listed in table 7.1

Table 7.1: Keywords for implicit solvers.

Keyword Description Default value


time integration CHARACTER: This is the main keyword for activating the im- ’explicit’
plicit solvers. The value of it should be set to ’implicit’ for the
BDF solvers and to ’rosenbrock’ for Rosenbrock schemes.
linear solver CHARACTER: Specifies the linear solver that has to be used. ’petsc’
Options are:

• ’petsc’: PETSc library Krylov-Subspace methods. Available


in serial, but use with care (PETSc is not thread-safe, so
OpenMP is not recommended). Only available in parallel
(MPI) for preallocated Jacobians (see next section).
• ’pardiso’: Intel MKL PARDISO. Only available in serial or
with OpenMP.

• ’matrix-free gmres’: A matrix-free version of the GM-


RES algorithm. Can be used without preconditioner
or with a recursive GMRES preconditioner using ’pre-
conditioner=GMRES’. Available in serial and parallel
(OpenMP+MPI)

• ’smooth’: Traditional iterative methods. One


can select either ’smoother=WeightedJacobi’ or
’smoother=BlockJacobi’.
• ’matrix-free smooth’: A matrix-free version of the previous
solver. Only available with ’smoother=BlockJacobi’.

7.2 Keywords for the BDF Methods


The BDF methods implemented in HORSES3D use a Newton’s method

23
Table 7.2: Keywords for the BDF solvers.

Keyword Description Default value


bdf order INTEGER: If present, the solver uses a BDF solver of the 1
specified order. BDF1 - BDF5 are available, and BDF2 -
BDF5 require constant time steps.
jacobian by convergence LOGICAL: When .TRUE., the Jacobian is only computed .FALSE.
when the convergence falls beneath a threshold (hard-
coded). This improves performance.
compute jacobian every INTEGER: Forces the Jacobian to be computed in an in- Inf
terval of iterations that is specified.
print newton info LOGICAL: If .TRUE., the information of the Newton iter- ’.FALSE.’
ations will be displayed.
implicit adaptive dt LOGICAL: Specifies if the time-step should be computed .FALSE.
according to the convergence behavior of the Newton iter-
ative method and the linear solver.
newton tolerance REAL: Specifies the tolerance for the Newton’s method. 10−6 for time-
accurate simulations,
or M axResidual × a
for steady-state sim-
ulations, where a is
the keyword newton
factor
newton max iter INTEGER: Maximum number of Newton iterations for 30
BDF solver.
linsolver max iter INTEGER: Maximum number of iterations to be taken by 500
the linear solver. This keyword only affects iterative linear
solvers.
newton factor REAL: In simulations that are not time-accurate, the tol- 10−3
erance of the Newton’s method is a function of the residual:
M axResidual × a, where a is the specified value.
linsolver tol factor REAL: The linear solver tolerance is a function of the abso- 0.5
lute error of the Newton’s method: tol = ∥e∥∞ ∗ ai , where
e is the absolute error of the Newton’s method, i is the
Newton iteration number, and a is the specified value.
newton first norm REAL: Specifies an assumed infinity norm of the absolute 0.2
error of the Newton’s method at the iteration 0 of the time
step 1. This can change the behavior of the first Newton it-
erative method because of the dependency of the linear sys-
tem tolerance on the absolute error of the Newton’s method
(see keyword linsolver tol factor ).

7.3 Keywords for the Rosenbrock-Type Implicit Runge-Kutta Meth-


ods

Table 7.3: Keywords for the Rosenbrock schemes.

Keyword Description Default value


rosenbrock scheme CHARACTER: Rosenbrock scheme to be used. Currently, only –
the RO6-6 is implemented.

7.4 Jacobian Specifications


The Jacobian must be defined using a block of the form:
#define J a c o b i a n
type = 2
24
p r i n t i n f o = .TRUE.
p r e a l l o c a t e = .TRUE.
#end

Table 7.4: Keywords for Jacobian definition block.

Keyword Description Default value


type INTEGER: Specifies the type of Jacobian matrix to be computed. Mandatory
Options are: Keyword
1. Numerical Jacobian: Uses a coloring algorithm and a finite
difference method to compute the DG Jacobian matrix (only
available with shared memory parallelization).
2. Analytical Jacobian: Available with shared (OpenMP)
or distributed (MPI) memory parallelization for advective
and/or diffusive nonlinear conservation laws, BUT only for
the standard DGSEM (no split-form).

print info LOGICAL: Specifies the verbosity of the Jacobian subroutines .TRUE.
preallocate LOGICAL: Specifies if the Jacobian must be allocated in prepro- .FALSE.
cessing (.TRUE. - only available for advective/diffusive nonlinear
conservation laws) or every time it is computed (.FALSE.)

25
Chapter 8

Explicit Solvers

Explicit time integration schemes available in HORSES3D. The main keywords to use it are shown in Table 8.1.

Table 8.1: Keywords for the multigrid solver.

Keyword Description Default value


time integration CHARACTER: This is the main keyword to activate the multi- ’explicit’
grid solvers. The value of it should be set to ’FAS’ for the Full
Approximation Scheme (FAS) nonlinear multigrid solvers and to
’AnisFAS’ for anisotropic FAS schemes.
simulation type CHARACTER: Specifies if HORSES3D must perform a ’steady- ’steady-state’
state’ or a ’time-accurate’. If ’time-accurate’ the solver switches
to BDF integration and uses FAS as a pseudo problem solver.
Compatible only with ’FAS’.
explicit method CHARACTER: Select desired Runge-Kutta solver. Options are: RK3
’Euler’, ’RK3’, ’RK5’, ’RKOpt’, ’SSPRK33’ and ’SSPRK43’.
rk order INTEGER: Order of Runge-Kutta method optimized for steady- 2
state solver (’RKOpt’). Possible orders are from 2 to 7.
limit timestep LOGICAL: Activate the possitivity limiter of Zhang and Shu (only .false.
for SSPRK methods).
limiter minimum REAL: Minimum value of density and pressure allowed by the 1e-13
limiter.

26
Chapter 9

Nonlinear p-Multigrid solver (FAS)

The code has an implementation of the Full Approximation Scheme (FAS) nonlinear p-multigrid method. The
main keywords to use it are shown in Table 9.1.

Table 9.1: Keywords for the multigrid solver.

Keyword Description Default value


time integration CHARACTER: This is the main keyword to activate the multi- ’explicit’
grid solvers. The value of it should be set to ’FAS’ for the Full
Approximation Scheme (FAS) nonlinear multigrid solvers and to
’AnisFAS’ for anisotropic FAS schemes.
simulation type CHARACTER: Specifies if HORSES3D must perform a ’steady- ’steady-state’
state’ or a ’time-accurate’. If ’time-accurate’ the solver switches
to BDF integration (the exact method can be set using ’bdf or-
der’ option) and uses FAS as a local steady-state problem solver.
Compatible only with ’FAS’.
multigrid levels INTEGER: Number of multigrid levels for the computations. Mandatory
keyword
delta n INTEGER: Interval of reduction of polynomial order for creating 1
coarser multigrid levels.
multigrid output LOGICAL: If .TRUE., the residuals at the different multigrid lev- .FALSE.
els will be displayed.
mg sweeps INTEGER: Number of smoothing sweeps to be taken. 1*
mg sweeps pre INTEGER: Number of pre-smoothing sweeps to be taken. 1*
mg sweeps post INTEGER: Number of post-smoothing sweeps to be taken. 1*
mg sweeps coarsest INTEGER: Number of pre- and post-smoothing sweeps to be Average
taken on the coarsest multigrid level. between pre-
sweeps and
post-sweeps
mg sweeps exact INTEGER(:): Alternative to ’mg sweeps’. Defines exact number 1*
of pre- and post- smoothing sweeps to be taken on each level.
Index of the array indicates the MG level for the sweeps to be
performed, e.g. [1,4] performs 1 pre-sweep and 1 post-sweep on
level 1 and 4 pre-post-sweeps on level 2.
mg sweeps pre exact INTEGER(:): Alternative to ’mg sweeps pre’. Defines exact num- 1*
ber of pre-smoothing sweeps to be taken on each level. Index of
the array indicates the MG level for the sweeps to be performed,
e.g. [1,4] performs 1 pre-sweep on level 1 and 4 pre-sweeps on
level 2.
mg sweeps post exact INTEGER(:): Alternative to ’mg sweeps post’. Defines exact 1*
number of post-smoothing sweeps to be taken on each level. Index
of the array indicates the MG level for the sweeps to be performed,
e.g. [1,4] performs 1 post-sweep on level 1 and 4 post-sweeps on
level 2.

27
Table 9.1: Keywords for the multigrid solver - continued.

Keyword Description Default value


mg smoother CHARACTER: The smoothing technique to be used. The key- RK3
words and possible explicit smoothers are the same as the ’ex-
plicit method’ in 8.1. For the semi-implicit residual relaxation
use ’BIRK5’.
fasfmg residual REAL: When this keyword is used, the code uses a full multigrid –
(FMG) method to obtain an initial condition for the simulation.
The initial condition has the specified residual.
fasfmg save solutions LOGICAL: Save the solutions that are obtained at the different .FALSE.
FMG levels. Only usable when fasfmg residual is used.
postsmooth option CHARACTER: When this keyword is used, the code performs –
extra post-smoothing sweeps, so that the final residual after com-
pleting the post-smoothing is lower than the residual achieved by
the pre-smoothing. The options are:

• f-cycle: Do the extra post-smoothing with an FMG cycle.


• smooth: Do normal smoothing.

smooth fine REAL: Extra pre-smoothing is performed on a multigrid level of –


P N
R
order P , until a residual is obtained R̃ R
< η R̃ , where
∞ ∞
N is the polynomial order of the next (coarsest) grid, and η is the
specified value.
max mg sweeps INTEGER: Maximum number of smoothing sweeps to be per- 10000
formed. This only makes sense if one uses the keywords
postsmooth option and/or smooth fine.
mg initialization LOGICAL: Sets the initial explicit residual smoothing with RK3 .FALSE.
and local time stepping.
P
initial residual REAL: Threshold for the R̃ R after which solver switches from 1.0

the ’mg initialization’ settings to user specified.
initial cfl REAL: CFL and DCFL number for initial residual smoothing. 0.1
* The user must specify mg sweeps pre and mg sweeps post, or mg sweeps.

28
Chapter 10

p-Adaptation Methods

The p-adaptation methods are used when the p-adaptation region is specified in the control file. There are two
different types of p-adaptation algorithms: A Truncation Error (TE) algorithm and a Reinforcement Learning
(RL) algorithm.

Table 10.1: General keywords for the p-adaptation algorithms.

Keyword Description Default value


adaptation type CHARACTER: Can be either ”TE” or ”RL”. TE
Nmax INTEGER(3): Maximum polynomial order in each direction for Mandatory
the p-adaptation algorithm (limited to 6 for RL adaptation type). keyword
Nmin INTEGER(3): Minimum polynomial order in each direction for [1,1,1]
the p-adaptation algorithm.
conforming boundaries CHARACTER(*): Specifies the boundaries of the geometry that –
must be forced to be conforming after the p-adaptation process.
order across faces CHARACTER: Mathematical expression to specify the maximum N −1
polynomial order jump across faces. Currently, only N ∗ 2/3 and
N − 1 are supported.
mode CHARACTER: p-Adaptation mode. Can be static, time or iter- static
ation. Static p-adaptation is performed once at the beginning of
a simulation for steady or unsteady simulations. Unsteady adap-
tation can be performed by time or by iteration.
interval INTEGER/REAL: In dynamic p-adaptation cases, this keyword huge number
specifies the iteration (integer) or time (real) interval for p-
adaptation.
restart files LOGICAL: If .TRUE., the program writes restart files before and .FALSE.
after the p-adaptation.
adjust nz LOGICAL: If .TRUE., the order across faces is adjusted in the .FALSE.
directions xi, eta, and zeta of the face (being zeta the normal
direction). If .FALSE., the order is only adjusted in the xi and
eta directions. The adjustment currently consists (hard-coded) in
limiting the jumps in the polynomial order.

10.1 Truncation Error p-Adaptation


This algorithm can perform a p-adaptation to decrease the truncation error below a threshold.
#define p−a d a p t a t i o n
a d a p t a t i o n type = TE
T r u n c a t i o n e r r o r type = isolated
truncation error = 1 . d−2
Nmax = [10 ,10 ,10]
Nmin = [ 2 ,2 ,2 ]
Conforming b o u n d a r i e s = [ InnerCylinder , sphere ]
order across faces = N∗2/3

29
increasing = . FALSE .
write error f i l e s = . FALSE .
a d j u s t nz = . FALSE .
mode = time
interval = 1 . d0
restart f i l e s = .TRUE.
max N d e c r e a s e = 1
padapted mg sweeps p r e = 10
padapted mg sweeps p o s t = 12
padapted mg sweeps c o a r s e s t = 20
#end

Table 10.2: Keywords for the TE p-adaptation algorithm.

Keyword Description Default value


truncation error type CHARACTER: Can be either ”isolated” or ”non-isolated”. isolated
truncation error REAL: Target truncation error for the p-adaptation algorithm. Mandatory
keyword
coarse truncation error REAL: Truncation error used for coarsening. same as trun-
cation error
increasing LOGICAL: If .TRUE. the multi-stage FMG adaptation algorithm .FALSE.
is used.
write error files LOGICAL: If .TRUE., the program writes a file per element con- .FALSE.
taining the directional tau-estimations. The files are stored in
the folder ./TauEstimation/. When the simulation has several
adaptation stages, the new information is just appended.
max N decrease INTEGER: Maximum decrease in the polynomial order in every N − Nmin
p-adaptation procedure.
post smoothing residual REAL: Specifies the maximum allowable deviation of ∂t q after the –
p-adaptation procedure.
post smoothing method CHARACTER: Either RK3 or FAS. RK3, if the
last keyword
is activated
estimation files CHARACTER: Name of the folder that contains the error esti- –
mations obtained with the multi tau-estimation (section 10.3).
estimation files number INTEGER(2): First and last estimation stages to be used for Mandatory if
p-adaptation. last keyword
is used.
padapted ≪ keyword ≫ MULTIPLE : Specifies control file keywords that should be re- –
placed after the adaptation procedure. Currently, only ’mg sweeps
’, ’mg sweeps pre’, ’mg sweeps post’, and ’mg sweeps coarsest’ are
supported.

10.2 Reinforcement Learning p-Adaptation


This algorithm can perform a p-adaptation based on a trained RL agent.
#define p−a d a p t a t i o n
a d a p t a t i o n type = RL
agent f i l e = policy padaptation / p adaptation policy
tolerance = 1d−2
Nmax = [6 , 6 , 2]
Nmin = [2 , 2 , 2]
Conforming b o u n d a r i e s = [ cylinder ]
restart f i l e s = . FALSE .
mode = iteration
interval = 10
threshold = 2.0
#end
30
Table 10.3: Keywords for the RL p-adaptation algorithm.

Keyword Description Default value


agent file CHARACTER: Relative path to the binary file that provide the Mandatory
policy of the RL agent. keyword
tolerance REAL: Tolerance for the RL agent. The smaller the tolerance, 0.01
the wider the adapted region.
threshold REAL: The mesh will be adapted only if the percentage of the 0.0
elements that require adaptation (in relation to the total number
of elements) is above the threshold.

10.3 Multiple truncation error estimations


When using Truncation Error based adaptation, a static p-adaptation procedure can be driven by a set of error
estimations, which have to be performed beforehand in a simulation with the following block:
#define m u l t i tau−e s t i m a t i o n
t r u n c a t i o n e r r o r type = i s o l a t e d
interval = 10
folder = MultiTau
#end

31
Chapter 11

Immersed boundary method

The immersed boundary is activated during the simulation if the following lines are specified in the control file:
#define IBM
name = myIBM
active = . true .
penalization = 1 . 0 d−6
semi i m p l i c i t = . false .
number o f o b j e c t s = 5
number o f i n t e r p o l a t i o n p o i n t s = 15
band r e g i o n = . true .
band r e g i o n c o e f f i c i e n t = 1.3
compute d i s t a n c e = . true .
clip axis = 1
aab = . false .
describe = . true .
p l o t obb = . false .
plot kdtree = . false .
p l o t mask = . true .
p l o t band p o i n t s = . false .
#end
A folder called ’IBM’ must be created.

Table 11.1: Keywords for the immersed boundary method.

Keyword Description Default value


name CHARACTER: name assigned to immersed boundary method job
active LOGICAL: When .TRUE. the immersed boundary method is ac- .FALSE.
tive.
penalization REAL: Specifies the value of the penalization term, i.e. η. ∆t
semi implicit LOGICAL: The source term is treated in a semi-implicit manner. .FALSE.
number of objects INTEGER: Specifies the maximum number of objects inside a leaf 5
of the KD-tree.
number of interpolation INTEGER: Number of points used for the interpolation of the 15
points variables’ values on the surface. It’s needed for the computation
of the forces.
band region LOGICAL: If it’s true, the band region is computed, otherwise it .FALSE.
is not.
band region coefficient INTEGER: A region n-times the oriented bounding box is created 1.5
(where n is the band region coefficient): all the points inside this
region belong to the band region. The band region’s points are
used for the interpolation. It must be greater then 1 and ’band
region’ must be .true. .

32
Table 11.1: Keywords for the immersed boundary method - con-
tinued.

Keyword Description Default value


compute distance LOGICAL: If it’s true, the distance between the points in the .FALSE.
band region and the stl file is computed, otherwise it is not. If
the distance is not required, turn it off since it is an expansive
operation.
clip axis INTEGER: It’s the axis along which the stl is cut. It is only 0
needed if the forces are computed so that the integration of the
variables is performed only on the portion of the stl surface lying
inside the mesh. 1 corresponds to x-axis, 2 with y-axis and 3 with
z-axis
aab LOGICAL: The Axis Aligned Box is computed instead of the Ori- .FALSE.
ented Bounding box. It is recommended when ’clip axis’ ̸= 0.
describe LOGICAL: The immersed boundary parameters are printed on .FALSE.
the screen.
plot obb LOGICAL: The oriented-bounding box is plotted. .FALSE.
plot kdtree LOGICAL: The kd-tree is plotted. .FALSE.
plot mask LOGICAL: The degrees of freedom belonging to the mask are .FALSE.
plotted.
plot band points LOGICAL: The band region’s points are plotted. .FALSE.

11.0.1 STL file


Immersed boundary requires, along with the mesh, a STL file. It must be put in the MESH folder with the
mesh. The STL file name must be in lowercase character. In some programs, like AutoCAD, a STL file has
always positive coordinates: the mesh should be built according to this consideration.
In the case of 2D simulations, the STL can be automatically cut by horses3D through the addition of the line
clip axis (described in the previous section) so that only the STL portions inside the mesh are considered.

Table 11.2: Keywords for stl files.

Keyword Description Default value


number of stl = INTEGER: Number of stl files. 1
stl file name = CHARACTER: The name of the STL file, without extension; it Mandatory
has to be inside the folder ”MESH” . keyword
stl file nameN = CHARACTER: The name of the Nth -STL file (where N starts none
from 2), without extension; for the first STL just use ”stl file
name”. It has to be inside the folder ”MESH” .

11.0.2 Computing forces


In order to compute the forces on a body, the monitor should be defined as usual but the ”Marker=” has to
be equal to the name of the stl file on which the user wants to compute the forces. Given a STL file called
”stlname”, the monitor should be:
#define s u r f a c e monitor 1
marker = s t l n a m e
.
.
.
#end
The result of this operation is a .tec file inside the RESULTS folder. This file contains a scalar or a vector data
projected on the body surface.

11.0.3 Moving bodies


If one or more of the stl files move, then the following lines must be added:

33
#define s t l motion 1
s t l name = mySTL
type = rotation
angular v e l o c i t y = 1 3 4 . 5 d0
motion a x i s = 2
#end

Table 11.3: Keywords for a moving stl.

Keyword Description Default value


stl name CHARACTER: name of the moving stl; it has to be equal to the mandatory
name of one of the stl files. keyword
type CHARACTER: Type of motion, it can be ROTATION or LIN- Mandatory
EAR. keyword
angular velocity REAL: Specifies the angular velocity. It must be in [Rad]/[s] Mandatory
keyword
for rotation
type
velocity REAL: Specifies the translation velocity. It must be in [m]/[s] Mandatory
keyword for
linear type
motion axis REAL: Specifies the axis along which the rotation/translation oc- Mandatory
curs. keyword

34
Chapter 12

Monitors

The monitors are specified individually as blocks in the control file. The only general keyword that can be
specified is explained in Table 12.1.

Table 12.1: Keywords for monitors.


Keyword Description Default value
monitors flush interval INTEGER: Iteration interval to flush the monitor information to 100
the monitor files.

12.1 Residual Monitors


12.2 Statistics Monitor

#define s t a t i s t i c s
i n i t i a l time = 1 . d0
initial iteration = 10
sampling i n t e r v a l = 10
dump i n t e r v a l = 20
@start
#end
By default, the statistic monitor will average following variables:

• u • uu • uv
• v • vv • uw

• w • ww • vw

A keyword preceded by @ is used in real-time to signalize the solver what it must do with the statistics
computation:

• @start • @stop • @dump


• @pause • @reset

After reading the keyword, the solver performs the desired action and marks it with a star, e.g. @start*.
ATTENTION: Real-time keywords may not work in parallel MPI computations. I depends on how the
system is configured.

12.3 Probes

35
#define probe 1
name = SomeName
variable = SomeVariable
position = [ 0 . d0 , 0 . d0 , 0 . d0 ]
#end

Table 12.2: Keywords for probes.

Keyword Description Default value


name CHARACTER: Name of the monitor. Mandatory
Keyword
variable CHARACTER: Variable to be monitored. Implemented options Mandatory
are: Keyword

• pressure • v • k
• velocity • w
• u • mach

position REAL(3): Coordinates of the point to be monitored. Mandatory


Keyword

12.4 Surface Monitors

#define s u r f a c e monitor 1
name = SomeName
marker = NameOfBoundary
variable = SomeVariable
r e f e r e n c e s u r f a c e = 1 . d0
direction = [ 1 . d0 , 0 . d0 , 0 . d0 ]
#end

Table 12.3: Keywords for probes.

Keyword Description Default value


name CHARACTER: Name of the monitor. Mandatory
Keyword
marker CHARACTER: Name of the boundary where a variable will be Mandatory
monitored. Keyword
variable CHARACTER: Variable to be monitored. Implemented options Mandatory
are: Keyword

• mass-flow • force
• flow • lift

• pressure-force • drag
• viscous-force • pressure-average

reference surface REAL: Reference surface [area] for the monitor. Needed for ”lift” –
and ”drag” computations.
direction REAL(3): Direction in which the force is going to be measured. –
Needed for ”pressure-force”, ”viscous-force” and ”force”. Can be
specified for ”lift” (default [0.d0,1.d0,0.d0]) and ”drag” (default
[1.d0,0.d0,0.d0])

36
12.5 Volume Monitors
Volume monitors compute the average of a quantity in the whole domain. They can be scalars(s) or vectors(v).
#define volume monitor 1
name = SomeName
v a r i a b l e = SomeVariable
#end

Table 12.4: Keywords for volume monitors.

Keyword Description Default value


name CHARACTER: Name of the monitor. Mandatory
Keyword
variable CHARACTER: Variable to be monitored. The variable can be Mandatory
scalar (s) or vectorial (v). Implemented options are: Keyword

(s) kinetic energy (s) mean velocity


(s) kinetic energy rate
(v) velocity
(s) enstrophy
(v) momentum
(s) entropy
(s) entropy rate (v) source

12.6 Load Balancing Monitors


Load balancing monitors compute the DOF in each partition of the mesh to check the unbalance.
#define l o a d b a l a n c i n g monitor 1
name = SomeName
v a r i a b l e = SomeVariable
#end

Table 12.5: Keywords for load balancing monitors.

Keyword Description Default value


name CHARACTER: Name of the monitor. Mandatory
Keyword
variable CHARACTER: Variable to be monitored. Implemented options Mandatory
are: Keyword

• max dof per partition • absolute dof unbalancing


• min dof per partition
• avg dof per partition • relative dof unbalancing

The variable absolute dof unbalancing is computed as follows:

absolute dof unbalancing = max dof per partition − min dof per partition (12.1)

The variable relative dof unbalancing is computed as follows:

relative dof unbalancing = 100 ∗ absolute dof unbalancing/avg dof per partition (12.2)

37
Chapter 13

Advanced User Setup

Advanced users can have additional control over a simulation without having to modify the source code and
recompile the code. To do that, the user can provide a set of routines that are called in different stages of the
simulation via the Problem file (ProblemFile.f90 ). A description of the routines of the Problem File can be
found in section 13.1.

13.1 Routines of the Problem File: ProblemFile.f90


• UserDefinedStartup: Called before any other routines
• UserDefinedFinalSetup: Called after the mesh is read in to allow mesh related initializations or memory
allocations.
• UserDefinedInitialCondition: called to set the initial condition for the flow. By default it sets an uniform
initial condition, but the user can change it.
• UserDefinedState1, UserDefinedNeumann: Used to define an user-defined boundary condition.
• UserDefinedPeriodicOperation: Called before every time-step to allow periodic operations to be performed.
• UserDefinedSourceTermNS: Called to apply source terms to the equation.
• UserDefinedFinalize: Called after the solution computed to allow, for example error tests to be performed.
• UserDefinedTermination: Called at the the end of the main driver after everything else is done.

13.2 Compiling the Problem File


The Problem File file must be compiled using a specific Makefile that links it with the libraries of the code. If
you are using the horses/dev environment module, you can get templates of the Problemfile.f90 and Makefile
with the following commands:
$ h o r s e s −get−m a k e f i l e
$ h o r s e s −get−p r o b l e m f i l e
Otherwise, search the test cases for examples.

To run a simulation using user-defined operations, create a folder called SETUP on the path were the
simulation is going to be run. Then, store the modified ProblemFile.f90 and the Makefile in SETUP, and
compile using:
$ make <<Options>>
where again the options are (bold are default):
• MODE=DEBUG/HPC/RELEASE
• COMPILER=ifort/gfortran
• COMM=PARALLEL/SEQUENTIAL
• ENABLE THREADS=NO/YES
38
Chapter 14

Postprocessing

For postprocessing the Simulation Results

14.1 Visualization with Tecplot Format: horses2plt


HORSES3D provides a script for converting the native binary solution files (*.hsol) into tecplot ASCII format
(*.tec), which can be visualized in Pareview or Tecplot. It can also export the solution to the more recent
VTKHDF format; however, note that this feature does not export boundary information or mesh files. Usage:
$ h o r s e s 2 p l t S o l u t i o n F i l e . h s o l MeshFile . hmesh <<Options>>
The options comprise following flags:

Table 14.1: Flags for horses2plt.

Flag Description Default value


--output-order= INTEGER: Output order nodes. The solution is interpolated into Not Present
the desired number of points.
--output-basis= CHARACTER: Either Homogeneous (for equispaced nodes, or Gauss*
Gauss.
--output-mode= CHARACTER: Either multizone or FE. The option multizone multizone
generates a Tecplot zone for each element. The option FE gener-
ates only one Tecplot zone for the fluid and one for each boundary
(if --boundary-file is defined). Each subcell is mapped as a linear
finite element. This format is faster to read by Paraview and
Tecplot.
--output-variables= CHARACTER: Output variables separated by commas.A com- Q
plete description can be found in Section 14.1.1.
--dimensionless Specifies that the output quantities must be dimensionless Not Present
--partition-file= CHARACTER: Specifies the path to the partition file (*.pmesh) Not Present
to export the MPI ranks of the simulation.
--boundary-file= CHARACTER: Specifies the path to the boundary mesh file Not Present
(*.bmesh) to export the surfaces as additional zones of the Tecplot
file.
--output-type= CHARACTER: Specifies the type of output file: tecplot or vtkhdf. tecplot
* Homogeneous when --output-order is specified

Additionally, depending on the type of solution file, the user can specify additional options.

14.1.1 Solution Files (*.hsol)


For standard solution files, the user can specify which variables they want to be exported to the Tecplot file
with the flag --output-variables=. The options are:

39
• Q (default) • V • N av • ux • cy

• rho • Ht • N • vx
• cz
• u • rhou • Ax Xi • wx
• omega
• v • rhov • Ax Eta • uy

• w • rhow • Ax Zeta • vy • omega x

• p • rhoe • T hreeAxes • wy • omega y


• T • c • Axes • uz
• omega z
• M ach • N xi • mpi rank • vz
• omega abs
• s • N eta • eID • wz
• V abs • N zeta • gradV • cx • Qcrit

14.1.2 Statistics Files (*.stats.hsol)


Statistics files can generate the standard variables as well as the following variables (being Sij the components
of the Reynolds Stress tensor):

• umean • Sxx • Sxy


• vmean • Syy • Sxz
• wmean • Szz • Syz

14.2 Extract geometry


Under construction.

14.3 Merge statistics tool


Tool to merge several statistics files. The usage is the following:
$ h o r s e s . m e r g e S t a t s ∗ . h s o l −− i n i t i a l −i t e r a t i o n=INTEGER −− f i l e −name=CHARACTER
Some remarks:
• Only usable with statistics files that are obtained with the ”reset interval” keyword and/or with individual
consecutive simulations.
• Only constant time-stepping is supported.
• If the hsol files have the gradients, the following flag must be used
$ −−has−g r a d i e n t s

• Dynamic p-adaptation is currently not supported.

14.4 Mapping result to different mesh


HORSES3D addons, horsesConverter, has a capability to map result into different mesh file, with both have
a consistent geometry. This is done by performing interpolation with the polynomial inside each element for
each node point of the new mesh. The type of node quadrature will follow the quadrature defined in the
.hmesh file with selected polynomial order in the control file. A control input file is required and must has
name horsesConverter.convert. The template of control input file will be generated by default when executing
./horsesConverter in a directory without the control file. Error message is given when at least one node point
of the new mesh is not within any element of the old mesh. After completion, a new result file is generated and
named Result interpolation.hsol. The required keywords in the control file are described in table 14.2. Command
to execute:
40
$ ./ horsesConverter

Table 14.2: Keywords for meshInterpolation.

Keyword Description Default value


Task meshInterpolation
Mesh Filename 1 Location of the origin mesh (*.hmesh)
Boundary Filename 1 Location of the origin boundary mesh (*.bmesh)
Result 1 Location of the solution file with origin mesh (*.hsol)
Mesh Filename 2 Location of the target mesh (*.hmesh)
Boundary Filename 2 Location of the target boundary mesh (*.bmesh)
Polynomial Order Polynomial order of the target mesh (1, 1, 1)

14.5 Generate OpenFOAM mesh


Another functionality of horsesConverter addons is to convert the mesh files, (*.hmesh) and (*.bmesh), into
OpenFOAM format, the polyMesh folder. Each element is discretised into nx × ny × nz cells distributed as
Gauss-Lobatto nodes. The number of division of each element, (nx , ny , and nz ), is required in the control file,
see section 14.4. After completion, a folder named foamFiles is generated. OpenFOAM mesh files, i.e. points,
faces, owner, neighbour, and boundary, are located within foamFiles/constant/polyMesh. The required keywords
in the control file are described in table 14.3. Command to execute:
$ ./ horsesConverter

Table 14.3: Keywords for horsesMesh2OF.

Keyword Description Default value


Task horsesMesh2OF
Mesh Filename 1 Location of the origin mesh (*.hmesh)
Boundary Filename 1 Location of the origin boundary mesh (*.bmesh)
Polynomial Order Number of division of each element (nx , ny , and nz ) (1, 1, 1)

NOTE: Before running the mesh in the OpenFOAM environment, the type of boundaries inside the boundary
file needs to be adjusted according to the actual type (patch, wall, and symmetry).

14.6 Generate HORSES3D solution file from OpenFOAM result


HORSES3D provides a capability to convert OpenFOAM result into HORSES3D solution file (*.hsol). The mesh
of the OpenFOAM result must be generated by converting HORSES3D mesh files, see section 14.5. Beforehand,
the OpenFOAM result must be converted into VTK format(*.vtk). This not only allows the result to be in the
single file but also converts cell data into point data. In the OpenFOAM environment, the command for this
conversion:
$ foamToVTK − f i e l d s ” (U p T rho ) ” − a s c i i −l a t e s t T i m e
The necessary file (.vtk) required for the control file input is inside VTK folder, see section 14.4 for the control
file template. The HORSES3D solution file is named Result OF.hsol. The required keywords in the control file
are described in table 14.4. Command to execute:
$ ./ horsesConverter

Table 14.4: Keywords for OF2Horses.

Keyword Description Default value


Task OF2Horses
Mesh Filename 1 Location of the origin mesh (*.hmesh)
Boundary Filename 1 Location of the origin boundary mesh (*.bmesh)

41
Table 14.4: Keywords for OF2Horses - continued.

Keyword Description Default value


Polynomial Order Polynomial order of the solution file (.hsol) (1, 1, 1)
VTK file Location of VTK file (.vtk)
Reynolds Number Reynolds Number/m of the solution – Lref =1.0m
Mach Number Mach Number of the solution
Reference pressure (Pa) Reference Pressure 101325
Reference temperature (K) Reference Temperature 288.889

42
Appendices
Non-dimensional Navier Stokes equations
To illustrate the roles of various terms in the governing equations, we present here the non-dimensionalized
governing compressible Navier Stokes equations with particles. We define the non-dimensional variables as

x∗i = xi /Lo , yi∗ = yi /Lo , t∗ = tuo /Lo , ρ∗ = ρ/ρo , u∗i = ui /uo (14.1)

vi∗ = vi /uo , p∗ = p/ρo u2o , e∗ = e/u2o T ∗ = T /To , Tp∗ = Tp /To , (14.2)


∗ ∗
µ = µ/µo , κ = κ/κo gi∗ = gi /go (14.3)
where the subscript o denotes a reference value. Under these scalings, the Navier Stokes equations become

∂ρ∗ ∂ρ∗ u∗j


+ = 0, (14.4)
∂t∗ ∂x∗j

Np
∂ρ∗ u∗i ∂ρ∗ u∗i u∗j ∂p∗ ∗
1 ∂τij 1 ∗ µ∗ ϕm X ∗ ∗
+ = − + + g − β (u − vi,n )δ(x∗ − yn∗ ), (14.5)
∂t∗ ∂x∗j ∂x∗i Re ∂x∗j F r2 i Np St n=1 i
" !#
∂ρ∗ e∗ ∂u∗j (ρ∗ e∗ + p∗ ) 1 ∂τij ∗ ∗
uj 1 ∂ ∗ ∂T

+ = + k +
∂t∗ ∂x∗j Re ∂x∗i (γ − 1)P rMo2 ∂x∗j ∂x∗j
Np
(14.6)
ϕm Nu X
+β (T ∗ − T ∗ )δ(x∗ − yn∗ ).
3Np (γ − 1)P rMo2 St n=1 p,n
ρo Lo uo m N τ
Where Re = is the Reynolds number, F r = √ uo is the Froude number, ϕm = ρopL3p , St = τfp is the
µo go Lo o
ρp Dp2 uo
Stokes number which for Stokesian particles is St = 18Lo µo , the Prandtl number (which is assumed constant
µo cp hD
and equal to 0.72) P r = ko , the Nusselt number N u = kop = 2 (for Stokesian particles) and the Mach
uo
number Mo = √γRT .
o

Non-dimensional particle equations


The non dimensional set of equations for the particles reads:
dyi∗ dvi∗ µ∗ ∗ 1 ∗
= vi∗ , = (ui − vi∗ ) + g . (14.7)
dt∗ dt ∗ St F r2 i
dTp∗ γ
Io∗ − N u(Tp∗ − T ∗ ) ,


= (14.8)
dt 3ΓStP r
I D
where Io∗ = 4koo Tpo and Γ = cv,p /cv is the ratio of the particle specific heat capacity to the fluid isochoric
specific heat capacity.

43
Bibliography

44

You might also like