Using HONEE¶
Note
Options in the documentation are specified by command-line flag and YAML format interchangeably. See YAML vs Command line options for details.
Setting up a problem in HONEE requires a few different things:
Below we detail how to tell HONEE these individual pieces.
Mesh¶
HONEE uses PETSc’s DMPlex module for handling the mesh and its related data structures, and so is the interface point for this area. The mesh can either be generated by PETSc on the fly or input via a file.
To use a mesh from a file, HONEE supports reading in meshes supported by DMPlex using -dm_plex_filename.
Often, this is either a CGNS file or a GMSH file.
Option |
Description |
|---|---|
|
Path to the mesh file to be read in (usually a CGNS or GMSH file) |
To have PETSc generate a mesh, DMPlex offers many runtime options to determine the shape and parameters of the mesh.
Shapes maybe a box, sphere, or many other options and are specified with -dm_plex_shape.
The dimensionality of the shape must be set with -dm_plex_dim.
We focus on the box option here, specifically recommending -dm_plex_shape zbox[1].
The number of elements in each direction is set via -dm_plex_box_faces, which is a comma-delimited list of the number of elements in the x, y, and z directions.
To set the size of the box, use -dm_plex_box_lower and -dm_plex_box_upper to set the coordinates of the lower and upper corner of the box.
Option |
Description |
|---|---|
|
Shape for mesh to be generated (usually |
|
Topological dimension for mesh to be generated (usually |
|
Number of elements in each direction |
|
Coordinates of the lower corner of the box |
|
Coordinates of the upper corner of the box |
|
Set periodic boundary conditions (i.e. |
The box meshes that PETSc generates are equispaced in every direction.
HONEE offers some limited options of warping or transforming the mesh to better suit certain problems.
Currently, only platemesh is supported, see Platemesh Transform for more details.
Option |
Description |
|---|---|
|
Transformation to apply to the mesh |
Governing Equations¶
The governing equations that HONEE will solve on the given mesh is determined by the -problem parameter.
In addition to governing equation, -problem may also specify boundary conditions and initial conditions available to use for specific example problems (see Examples).
There are currently two primary governing equations supported:
Compressible Navier-Stokes (
newtonian)Advection-diffusion (
advection)
Using either of these options in -problem ignores any example-specific additions.
While not always strictly governing equations, turbulence models may also be specified using -sgs_model_type (see Subgrid Stress Modeling).
Option |
Description |
Default value |
|---|---|---|
|
Problem to solve ( |
|
|
Subgrid stress model to use ( |
|
Initial Conditions / Restart¶
Initial conditions are either created from an analytical definition or from a solution file.
All the example problems have their own custom analytical initial conditions.
See those examples for their custom IC options.
The newtonian initial condition simply sets everything equal to the reference state given by -reference*.
For newtonian, IC Boundary Layer can also be used.
To set initial conditions from a file, simply pass the path to the file to -continue_filename.
This must either be a binary or CGNS file.
Restarting from CGNS is the preferred method as it may be done in parallel.
Loading from binary is used exclusively for testing purposes.
To use the CGNS file as input, -dm_plex_filename must load the same file and -dm_plex_cgns_parallel must also be given.
Restarting from a CGNS file created by HONEE will also load in the step number and solution time of the solution being loaded (see Solution Output for how to write out CGNS solution files).
Option |
Description |
|---|---|
|
Path to file from which to continue from. Either binary file or CGNS |
|
Turn on the parallel CGNS reader in DMPlex. Required if |
Boundary Conditions¶
Boundary conditions (BCs) are defined by a name and a list of face IDs that said BC applies to.
These are collectively known as a BCDefinition.
A list of BCDefinition names is specified by the user using -bc_names.
The BCDefinition name will be used in the flag prefix -bc_{name}_* for every option pertaining to that BCDefinition.
The list of face_ids used for a BCDefinition is specified using -bc_{name}_face_ids.
For example:
bc_names: airfoil,inflow
bc_airfoil:
face_ids: 2,5
bc_inflow:
face_ids: 1,3,4
Essential boundary conditions (i.e. strong, Dirichlet, etc.) are defined by the component indices they constrain in the solution vector.
They are specified by -bc_{name}_essential_comps.
Note
The essential boundary conditions are specified by component indices rather than by their solution component name to inhibit invalid states. For example, if the user specifies an essential constraint on velocity and is running with entropy solution variables, that constraint cannot be set, and is thus an invalid state. Additionally, this more generic interface allows for expansion to other governing equations (e.g. RANS turbulence models, chemistry transport, etc.).
Natural boundary conditions (i.e. weak, Neumann, etc.) are specified by type (a string), from a list of possibilities given by the given governing equation and example problem.
These possibilities are registered by the problem/governing equation and are specified by -bc_{name}_natural_type.
Option |
Description |
|---|---|
|
List of names used to reference boundary conditions |
|
List of face label values to define BC |
|
Component indices to apply essential BC on |
|
Type of natural BC to apply ( |
The face_ids are simply the label values of the Face Sets label on the DM.
If the mesh is read in from file, the label values are determined from the file.
For the case of PETSc-generated box meshes, those labels correspond to the following faces:
PETSc Face Name |
Cartesian direction |
Face ID |
|---|---|---|
faceMarkerBottom |
-z |
1 |
faceMarkerRight |
+x |
2 |
faceMarkerTop |
+z |
3 |
faceMarkerLeft |
-x |
4 |
PETSc Face Name |
Cartesian direction |
Face ID |
|---|---|---|
faceMarkerBottom |
-z |
1 |
faceMarkerTop |
+z |
2 |
faceMarkerFront |
-y |
3 |
faceMarkerBack |
+y |
4 |
faceMarkerRight |
+x |
5 |
faceMarkerLeft |
-x |
6 |
Discretization¶
The order of the spatial discretization can be specified by -degree.
HONEE also allows for using more than the required number of quadrature points when computing the finite element operators.
This is controlled by -q_extra.
Option |
Description |
Default value |
|---|---|---|
|
Polynomial degree of tensor product basis (must be >= 1) |
|
|
Number of extra quadrature points |
|
Solvers¶
HONEE uses the PETSc solver stack for solving the defined problem, which is described below.
Solver Name |
Description |
Options Prefix |
Options Documentation |
User Documentation |
|---|---|---|---|---|
TS |
Timestepping |
|
||
SNES |
Non-linear solver |
|
||
KSP |
Linear solver |
|
||
PC |
Preconditioner (for linear solver) |
|
The prefix options listed above will apply for the primary solve that HONEE performs.
Other auxillary solves and functionality will use the same options, but with an additional prefix.
For example, -auxillary_ksp_*.
In addition to these options, there are a few HONEE-specific solver options as well.
The method of timestepping is controlled by -implicit.
Note this must match with the choice of timestepper set by -ts_type.
Option |
Description |
Default value |
|---|---|---|
|
CEED resource specifier |
|
|
Use implicit time integrator formulation |
|
|
|
Mass Matrix and Explicit Timestepping¶
When using explicit timestepping, the inverted mass matrix must be applied to the residual.
This matrix inversion is implemented as a KSP solve and is controlled by the -mass_ksp* prefix.
By default, a lumped mass matrix is used, but modifying the KSP options can make it into a consistent mass matrix (specifically, setting -mass_ksp_type to something other than pconly).
Option |
Description |
|---|---|
|
Prefix for giving specific KSP options for the mass matrix inversion |
|
Prefix for giving specific PC options for the mass matrix inversion |
|
View mass KSP once before |
Nondimensionalization¶
Problems may have solution values or parameters vary by orders of magnitude between them. For example, low-Mach flow using sea-level air properties would have velocities at \(O(10)\), while pressures would be \(O(10^5)\). These large differences in scales can lead to poorly-conditioned problems. To ease these issues, the values solved can be nondimensionalized.
Caution
This feature may be broken for certain use cases. If you discover a bug related to nondimensionalization, please submit an issue to the HONEE repo so that we can address it.
Option |
Description |
Default value |
|---|---|---|
|
1 meter in scaled length units |
|
|
1 second in scaled time units |
|
|
1 kilogram in scaled mass units |
|
|
1 Kelvin in scaled temperature units |
|
Solution Output¶
HONEE offers the following options for writing out solution information. We divide this into complete solution output and post-processed output.
Complete Solution Output¶
Option |
Description |
Default value |
|---|---|---|
|
PETSc output format, such as |
|
|
Number of time steps between visualization output frames. |
|
|
Number of frames written per CGNS file if the CGNS file name includes a format specifier ( |
|
|
Sets intermediate time points to evaluate the solution at. See PETSc documentation for more details. |
|
|
PETSc output format for |
The following options are options using the legacy output system. It is not advised to use them.
Option |
Description |
Default value |
|---|---|---|
|
Number of steps between writing binary checkpoints. |
|
|
Checkpoints include VTK ( |
|
|
Use regular refinement for VTK visualization |
|
|
Output directory for binary checkpoints and VTK files (if enabled). |
|
|
Whether to add step numbers to output binary files |
|
Post-Processed Solution Output¶
Here are the options for monitoring specific quantities of interest of the solution as the solver progresses.
Note that all of these options have an addition *_interval option which specifies the
Option |
Description |
Default value |
|---|---|---|
|
Viewer for the min/max CFL in the domain e.g., |
|
|
Viewer for the force on each no-slip wall, e.g., |
|
|
Puts the solution into a SmartSim database. This does not take “normal” viewer inputs. |
|
|
Viewer for the total kinetic energy in the domain and other terms, e.g., |
|
|
Number of timesteps between executing the monitor |
|
Common Options¶
HONEE is controlled via command-line options. The following options are common among all problem types:
Option |
Description |
Default value |
|---|---|---|
|
View comprehensive information about run-time options |
|
|
Number of time steps between checking the solution for Nans. Negative interval indicates it will not run. |
|
|
Wall clock duration of simulation before it should be stopped. Acceptable formats are |
|
|
Approximate time required to exit simulation cleanly (write checkpoints, etc.) |
|
|
Number of time steps between checking whether simulation should stop based on |
|
Logging Options¶
Some of these are PETSc options here as reference, while others are custom to HONEE.
Option |
Description |
|---|---|
|
View PETSc |
|
View log for every timestep taken by the |
|
View log for every iteration taken by the |
|
View convergence reason for every iteration taken by the |
|
View convergence reason for every iteration taken by the |
|
View PETSc performance log |
|
Print KSP residual summary information after each |
Testing Options¶
Option |
Description |
Default value |
|---|---|---|
|
Run in test mode and specify whether solution ( |
|
|
Test absolute tolerance |
|
|
Test filename |
|
|
Run unit tests of Newtonian state variable transformation functions |
|
|
Run unit tests of Riemann problem solver and it’s Jacobian |
|
YAML vs Command line options¶
Options for HONEE and PETSc can be given by either command line options or via a YAML file.
Command-line flags can be represented in a YAML file by removing the leading - and by allowing underscores (_) to be converted into a hierarchy of options (so that options with redundant prefixes can be more easily grouped together).
For example,
-dm_plex_shape zbox -dm_plex_box_faces 10,12,4 -dm_plex_box_bd none,none,periodic
could be represented as
dm_plex:
shape: zbox
box:
faces: 10,12,4
bd: none,none,periodic
A YAML file of options can be passed to HONEE via -options_file <yaml file>.
Overriding of options are done in the order that HONEE/PETSc reads them.
Given the following YAML file:
# ./options.yaml
option_a: 1
Running
navierstokes -option_a 2 -options_file options.yaml
will result in option_a == 1, but
navierstokes -option_a 2 -options_file options.yaml -option_a 3
will result in option_a == 3.
See PETSc documentation for more advanced uses of the yaml file system.