Chapter 3
Configuring and Running the Solver

We will now proceed to set up the .xml file with the solver characteristics and parameters to run the simulation, using the case with 643 as guidance. The settings for the 1283 are very similar, and it will be specified if otherwise.

The files required can be found under the folder $NEKTUTORIAL/solver64. The file TGV64_conditions.xml must be modified to set up the solver. Also in the same folder, TGV64_mesh.xml contains the definition of the mesh and the expansion bases that will be used for the computation.

Tip: The geometry contained in TGV64_mesh.xml under the section GEOMETRY is compressed in binary Base64 format. In case the user wants to see its definition, the file must be converted to an uncompressed format by the command:

$NEK/NekMesh TGV64_mesh.xml TGV64_mesh.xml:xml:uncompress

The tag EXPANSIONS defines the type of polynomial expansions to be used on each element, and their order (NUMMODES= p + 1) as well as the FIELDS and COMPOSITES to which they are applied (in this case the whole domain C[0]).

The following sections all refer to modifications in the file TGV64_conditions.xml.


The TGV case will be run at Re = 1600 with integral length scale L = 1 and initial velocity V 0 = 1 so that the kinematic viscosity ν = 1∕1600. The temperature field is not included in the computations since it doesn’t influence the dynamics of the fluid. The physical time of the computation is based on the convective time scale tc = L∕V 0 = 1 and will be τ = 20tc, with the first turbulent structures starting to build up at τ = 8tc = 8.

Task: 3.1 In the file TGV64_conditions.xml under the tag PARAMETERS, define all the flow parameters for the TGV flow as described above. These are declared as: Re, Kinvis, V0, L and FinalTime. Define the number of steps NumSteps as the ratio of the FinalTime to the time-step TimeStep.

These parameters apply for both 643 and 1283. Remember to set the parameters following the typical XML syntax:

2   <P> [KEY] = [VALUE] </P> 
3   ... 

Note that expressions using a previously defined KEY can be inputted as a VALUE.

Once the flow parameters have been defined, we must define the discretisation in the homogeneous z-direction. Since we are interested in determining the flow on a cubic mesh, the length of the domain along the z-direction will also be Lz = 2π (not to be confused with the integral length scale, L). We must also specify the number of Fourier planes we are going to discretise our z-direction into. For a fully uniform mesh, we then choose Nz = 64 or 128, depending on the case that we are running. This corresponds to 32 or 64 complex Fourier modes, respectively.

Additionally, we also enable the spectral vanishing viscosity (SVV) feature which acts to dampen high-frequency oscillations in the solution which would otherwise introduce numerical instability.

Task: 3.2 In the file TGV64_conditions.xml under the tag PARAMETERS, define all the solver parameters for the homogeneous z-direction discretisation as described above. These include:

These parameters also apply for both 643 and 1283, except for Nz which must be set to 128 instead for the latter case. Note that π can be used directly with the keyword PI.

Solver Properties

We now declare how the flow will be solved. We will use the Velocity Correction Scheme (VCS) to solve the components of the unsteady Navier-Stokes equations separately, rather than as one single system. We must also specify the time integration method, which will be explicit-implicit of order 2, and the approach to be used when solving linear matrix systems of the form Ax = b that arise from the VCS scheme. Finally, we must describe how the homogeneous z-direction will be treated in the quasi 3D approach.

Task: 3.3 In the file TGV64_conditions.xml under the tag SOLVERINFO, define all the solver properties. These include:

These properties apply for both 643 and 1283 cases. Remember to set the property/value pairs following the typical XML syntax:

3   ... 

Boundary and Initial Conditions

The periodic boundary conditions for the domain are already defined for the user in the .xml file, under the tag BOUNDARYCONDITIONS. The initial conditions can be prescribed to the solver by means of a standard function.

Task: 3.4 In the file TGV64_conditions.xml, within the CONDITIONS section, create a function named InitialConditions where the initial conditions for the variables u, v, w and P are defined. Go back to Chapter 1 if you don’t remember the expressions for the initial conditions.

Multi-variable functions such as initial conditions and analytic solutions may be specified for use in, or comparison with, simulations. These may be specified using expressions (<E>)

4   ... 


Turbulent flows, as is the TGV flow, have very high diffusivity. The random and chaotic motion of the fluid particles results in an increased momentum and mass convection as well as heat transfer, with the flow composed of fluid structures with a wide range of length scales. The large, energy-containing fluid structures inertially break down into smaller and smaller structures by vortex stretching, with an associated kinetic energy transfer between the scales. When these small fluid structures are of the size of the Kolgomorov length scales η, molecular viscosity becomes substantial and dissipates the kinetic energy into heat. As such, a good way of characterising turbulent flows is via the evolution of the kinetic energy or, more appropriately, via its dissipation rate.

Task: 3.5 In the file TGV64_conditions.xml, within the FILTERS section, create two filters:

1<FILTER TYPE="TypeName"> 
2   <PARAM NAME="OutputFile">FileName</PARAM> 
3   <PARAM NAME="OutputFrequency">10</PARAM> 

Running the Solver

If you have not completed Task 1.2 or would like to test your configuration, the IncNavierStokesSolver can now be run with the XML files above to solve the TGV problem.

Task: 3.6 Run the solver by typing the following command on the command line:

$NEK/IncNavierStokesSolver TGV64_mesh.xml TGV64_conditions.xml

Tip: To reduce the solution time on computers with multi-core, or multiple, processors, MPI can be used to run the simulation in parallel. Note that, for binaries compiled from source, the CMake option NEKTAR_USE_MPI must have been set to ON. To run in parallel, prefix the command in the previous task with mpirun -np X, replacing X by the number of parallel processes to use. For example, to use two processes:

mpirun -np 2 $NEK/IncNavierStokesSolver TGV64_mesh.xml TGV64_conditions.xml

Additionally, setting GlobalSysSoln to XxtMultiLevelStaticCond (Task 3.3) will specify that a parallel Cholesky factorisation will be used to directly solve the global linear systems using the XXT library.