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 64^{3} as guidance. The settings for the 128^{3} 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.

`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 t_{c} = L∕V _{0} = 1
and will be τ = 20t_{c}, with the first turbulent structures starting to build up at
τ = 8t_{c} = 8.

`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 64^{3} and 128^{3}. Remember to set the parameters following the
typical XML syntax:

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 L_{z} = 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 N_{z} = 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.

`TGV64_conditions.xml`

under the tag `PARAMETERS`

, define all the solver
parameters for the homogeneous z-direction discretisation as described above. These include:
`LZ`

and`HomModesZ`

.- The SVV diffusion coefficient
`SVVDiffCoeff`

set to 0.1 and the Fourier cut-off frequency ratio`SVVCutoffRatio`

set to 0.7

These parameters also apply for both 64^{3} and 128^{3}, except for N_{z} which must be set to
128 instead for the latter case. Note that π can be used directly with the keyword
`PI`

.

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.

`TGV64_conditions.xml`

under the tag `SOLVERINFO`

, define all the solver
properties. These include:
- Setting the
`TimeIntegrationMethod`

to`IMEXOrder2`

. - Setting the
`SolverType`

to`VelocityCorrectionScheme`

and the`EqType`

to`UnsteadyNavierStokes`

. - (Optional) Setting the
`UseFFT`

property to`True`

to indicate that the Fast Fourier Transform method will be used to speed up the operations related to the harmonic expansions, using the FFTW library. This may only be used if sources have been compiled with the CMake option`NEKTAR_USE_FFTW`

set to`ON`

or if you are using a binary package. - Setting
`Homogeneous`

to`1D`

to tell the solver we are using harmonic expansions along the z-direction only. - Setting
`GlobalSysSoln`

to`DirectMultiLevelStaticCond`

to specify that a serial Cholesky factorisation will be used to directly solve the global linear systems. - Setting the properties
`SpectralHPDealiasing`

and`SpectralVanishingViscosity`

both to`True`

.

These properties apply for both 64^{3} and 128^{3} cases. Remember to set the property/value pairs
following the typical XML syntax:

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.

`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>`

)

1<FUNCTION NAME="[NAME]">

2 <E VAR="[VARIABLE_1]" VALUE="[EXPRESSION]"/>

3 <E VAR="[VARIABLE_2]" VALUE="[EXPRESSION]"/>

4 ...

5</FUNCTION>

2 <E VAR="[VARIABLE_1]" VALUE="[EXPRESSION]"/>

3 <E VAR="[VARIABLE_2]" VALUE="[EXPRESSION]"/>

4 ...

5</FUNCTION>

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.

`TGV64_conditions.xml`

, within the `FILTERS`

section, create two filters:
- A
`ModalEnergy`

-type filter named`TGV64MEnergy`

which will compute the energy spectrum of the flow. Set its`OutputFrequency`

to 10 timesteps. - A second,
`Energy`

-type filter named`TGV64Energy`

, which will calculate the time evolution of the kinetic energy and the enstrophy. Set its`OutputFrequency`

to 10 timesteps.

1<FILTER TYPE="TypeName">

2 <PARAM NAME="OutputFile">FileName</PARAM>

3 <PARAM NAME="OutputFrequency">10</PARAM>

4</FILTER>

2 <PARAM NAME="OutputFile">FileName</PARAM>

3 <PARAM NAME="OutputFrequency">10</PARAM>

4</FILTER>

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.

`$NEK/IncNavierStokesSolver TGV64_mesh.xml TGV64_conditions.xml`

`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 XX^{T } library.