hexed 0.3.0
 
Loading...
Searching...
No Matches
Solver Parameters

Input Parameters

This section lists variables that directly affect the behavior of the solver. Some of them are preset to default values with the intent that you should override them, and some are not defined and must be defined by you.

Important Input Parameters

Setting these parameters appropriately is critical to get the right answer, and you should generally think about them every time you run a simulation.


n_dim

type: integer
Number of dimensions. Must be at least 1 and at most 3.


done

type: string
default: {println {Error: you forgot to a set stop condition} & throw}
Termination condition. This should be a macro that evaluates to an integer. It will be evaluated at each iteration, and the simulation will continue iff it evaluates to false. As should be clear from the default value, you must set this variable yourself. You can consider setting it based on the iteration count, residual, and/or output variable history.


local_time

type: integer
default: true
If true, use local time stepping, otherwise use global.

Note
Not defined until create_solver is evaluated.

max_safety

type: float
default: 0.7
Maximum allowable safety factor on the CFL condition for time step determination. The time step will be either this number times the estimated maximum stable time step or max_time_step, whichever is smaller. This parameter is applicable to both local and global time stepping. If the actual safety factor (accounting for max_time_step constraints) is greater than 1 the scheme will almost certainly be unstable. Thus even if you intend for your time integration not to be CFL-driven, it is strongly recommended that you keep this parameter less than 1 and simply make your max_time_step small enough to be the active constraint.

Note
Not defined until create_solver is evaluated.

max_time_step

type: float
default: huge
Maximum allowable time step. The time step will be either this number or max_safety times the estimated maximum stable time step, whichever is smaller. This parameter is only meaningful for global time stepping. If you intend for your time stepping to be CFL driven, simply keep this number large enough not to be the active constraint.

Note
Not defined until create_solver is evaluated.

transport_model

type: string
default: {inviscid}
Specifies model to use for molecular transport coefficients (viscosity and thermal conductivity). Accepted values:

  • {inviscid}
  • {sutherland}: Uses Sutherland's law for air (non-constant Prandtl number)

thermal_bc

type: string
default: {heat_flux = 0.}
Only applicable when surface_bc = {no_slip}. Specifies thermal boundary condition. Default gives an adiabatic wall. Accepted values:

  • {heat_flux = x}: Prescribes the wall heat flux (out of the domain, into the wall) to be x.
  • {temperature = x}: Prescribes the temperature at the wall to be x.
  • {internal_energy = x}: Prescribes the internal energy at the wall to be x. For now, since you're stuck in the CPG world, this is equivalent to {temperature = x*(heat_rat - 1)/specific_gas_air}.
  • {emissivity = x; conduction = y; temperature = z}: Specifies that the wall is in thermal equilibrium according to a simple 1D heat equation. Specifically, sets the heat flux equal to the sum of the radiative cooling flux and the thermal conduction through the wall. The radiative cooling flux is determined by the Stefan-Boltzmann Law with the emissivity \( \sigma \) given by emissivity. The conductive flux is determined by assuming that the wall has a small but finite thickness and the temperature on the non-air side is known. Specifically, it is equal to \( kL(T_w - T_p) \) where \( k \) is the thermal conductivity of the wall material, \( L \) is the wall thickness, \( T_w \) is the current wall temperature, and \( T_p \) is the prescribed temperature. The product \( kL \) is equal to conduction and the prescribed temperature \( T_p \) is temperature. You don't have to specify all 3 parameters—they all default to 0. You may specify emissivity and/or you may specify the other parameters, but if you specify either conduction or temperature you must specify both. If your wall is highly conductive, you might need to reduce heat_flux_coercion to maintain stability.

row_size

type: integer
default: 6
Row size of polynomial basis. Must be at lead 2 and at most hexed::config::max_row_size.


attack

type: float
default: 0.
Angle of attack (radian, as specified in Units and physical quantities).


sideslip

type: float
default: 0.
Sideslip angle (radian, as specified in Units and physical quantities).


art_visc_width

type: float
default: -1.
If set to a positive number, turns on artificial viscosity with a smoothness-based coefficient and sets the smoothness width to art_visc_width.


refine_if

type: string
default: {false}
Mesh refinement criterion. Should be an expression that can be evaluated for each mesh element in an environment that includes the variables assigned by hexed::hil_properties::element(). If this expression evaluates to true (and unrefine_if evaluates to false), the element will be refined. Otherwise it will not.


mesh_extreme00, mesh_extreme01, mesh_extreme10, mesh_extreme11, mesh_extreme20, mesh_extreme21

type: float
default: 0, 1, 0, 1, 0, 1
Mesh extremes. That is, all elements will have coordinates \( x_0, x_1, x_2 \) such that mesh_extreme00 \( \le x_0 \le \) mesh_extreme01, etc. If each mesh dimension is an integer multiple of the initial element size, then the above inequalities are equalities. Of course, only the first n_dim dimensions are considered.

extremal_bc00, extremal_bc01, extremal_bc10, extremal_bc11, extremal_bc20, extremal_bc21

type: string
default: {characteristic}
Boundary conditions for extremal boundaries (defined by mesh_extreme00, mesh_extreme01, mesh_extreme10, mesh_extreme11, mesh_extreme20, mesh_extreme21).

See also
Boundary Conditions

init_layer_splits

type: integer
default: 0
Number of times to call split_layers during initial mesh generation (immediately after surface-based refinement but before state initialization). If you don't edit layer_split_points, then the wall spacing will be \( 3^{-\mathtt{\text{init_layer_splits}}} \) times the local isotropic mesh spacing. The default value of 0 is appropriate for inviscid simulations, but for high Reynolds-number viscous simulations it should be greater than zero. There currently is not a well-established best practice for how large it needs to be, but having the boundary layer be one or two wall layers thick often works well for subsonic simulations, and significantly more layers are often required for hypersonic simulations with a cold wall.


max_ref_level

type: float
default: 10
When performing geometry-based refinement with set_geometry_refinement, elements will not be refined beyond this refinement level. This prevents excessive refinement in certain no-win scenarios such as sharp edges. This parameter must often be adjusted based on the scale of the geometry.


Useful Input Parameters

You will probably want to adjust these parameters for some simulations, but you can often leave them alone.


init_ref_level

type: integer
default: 3
Number of levels to refine the mesh in init_refinement before surface geometry is introduced. May be any non-negative integer, up to time and memory constraints.


surface_bc

type: string
default: {auto}
Specifies surface boundary condition. If {auto}, surface boundary condition will be determined automatically depending on the value of transport_model. {inviscid}{nonpenetration} and {sutherland}{no_slip}. Otherwise, the name of a supported Boundary condition type.


monitor_vars

type: string
default: {}
Structured expression defining variables to monitor the convergence history of. For each variable myvar, after every update, variables myvar_min and myvar_max will be assigned to the minimum and maximum of myvar over the last monitor_window fraction of the iterations among at most monitor_samples evenly-spaced (roughly) samples. For additional details, see the implementation in hexed::History_monitor.


temperature_offset

type: float
default: 0.
Applicable when altitude is specified. Sets the temperature offset passed to hexed::standard_atmosphere.


geometry_uncertainty

type: float
default: 3e-3
When performing geometry-based refinement with set_geometry_refinement, a non-dimensional uncertainty metric for the surface representation will be compared to this value, and any elements with a larger value will be refined. Thus reducing this number results in a finer mesh and vice versa, although the default value produces reasonable results in a wide range of cases, in my opinion.


art_visc_constant

type: float
default: -1.
If set to a positive number, turns on artificial viscosity and sets the artificial viscosity coefficient to be uniformly equal to art_visc_constant.


fix_therm_admis

type: integer
default: false
If true, check thermodynamic admissibility (positive density, non-negative energy, non-NaN state) after every time integration stage and if problems are found, run as many Laplacian smearing iterations as necessary to restore admissibility. Results in a major robustness improvement for hypersonic cases and comes at a modest performance cost.


working_dir

type: string
default: {hexed_out/}
Directory in which to write output files. Path can be relative or absolute. If the directory does not exist, it will be created. Any modifications to this variable must take place before the solver is initialized.


vis_freq

type: integer
default: 10000
Visualization files will be written every vis_freq iterations.


write_freq

type: integer
default: 10000
Mesh and state files will be written every vis_freq iterations.


print_freq

type: integer
default: 100
Solver status will be printed to stdout every print_freq iterations.


unrefine_if

type: string
default: {false}
Mesh unrefinement criterion. Behaves the same as refine_if except that if this expression evaluates to true (and refine_if evaluates to false), the element will be unrefined (subject to refinement level constraints).


max_refinement_iters

type: integer
default: 100
Maximum number of refinement sweeps to run if refinement convergence is not achieved.


n_smooth

type: integer
default: 30
Number of mesh smoothing iterations to run after every surface-geometry-based refinement sweep.


geom_n_segments

type: integer
default: 1000
Number of subdivisions to use when discretizing 2D CAD geometry with hexed::Occt::segments.


vis_surface

type: integer
default: true
Whether to visualize surface data when visualize is invoked.


vis_field

type: integer
default: true
Whether to visualize field data when visualize is invoked.


vis_contour

type: integer
default: true
Whether to explicitly compute and visualize contours when visualize is invoked. Normally, you would visualize contour plots by loading the field visualization in your plotting software of choice and using its contour plotting feature. However, Hexed can also compute isocontours on its own and write out files containing just the contour. This could be useful if your computation is I/O bound or if you want to streamline some postprocessing pipeline that uses isocontours. This can also be used to visualize slices, which are simply special cases of contours. To control what contours are visualized, use contour0, contour1, contour2, ... and to control the variables included in each contour file, use vis_contour_vars. If you want to visualize contours and field data, but contours more frequently than field, you can add to iterate, E.g.

vis_freq = 10^5
iterate = iterate + {
case0 = {}
case1 = {
vis_field = false
print {visualizing contours...}
visualize
println {done}
vis_field = true
}
$$({case} + (iteration%10^3 == 0))
}

contour0, contour1, contour2, ...

type: string
Defines contours to visualize if vis_contour is true. By default, none of these variables are defined. If you define any number of these variables (consecutively numbered and starting with 0), then each of them will define one isocontour to be computed. Each should be a string containing an expression (which will be evaluated directly after vis_contour_vars in the same environment), and the resulting contour will be the locus of points where that expression evaluates to 0. So, for example, to visualize the sonic line/surface, you could do contour0 = {mach - 1.}, and to visualize the slice at \( x_0 = 3 \), you could do contour0 = {pos0 - 3.}. Each of the contours will be written to a separate file. For details on the algorithm to compute contours, see the source code for hexed::Vis_data::compute_contour.


vis_tecplot

type: integer
default: false
If true, write visualization files in Tecplot format (requires compilation with use_tecplot ON).


vis_xdmf

type: integer
default: true
If true, write visualization files in XDMF format (requires compilation with use_xdmf ON).


vis_skew

type: integer
default: false
If true, write a (separate) visualization file with the equiangle skewness as a field variable.


vis_field_vars

type: string
default: state_vars + art_visc_expr
Structured expression specifying which field variables to visualize.


vis_surface_vars

type: string
default: state_vars + visc_stress_expr + heat_flux_expr
Structured expression specifying which surface variables to visualize.


vis_contour_vars

type: string
default: vis_field_vars
Structured expression specifying which variables to visualize in natively-computed contours.


vis_n_sample

type: integer
default: 10
Each element will be visualized at sample points distributed in a uniformly-spaced structured block with vis_n_sample points on each edge. If you want, you can think of this as the visualization row size.


print_vars

type: string
default: iteration_expr + residual_expr + av_advection_residual_expr + av_diffusion_residual_expr + flow_time_expr + time_step_expr
Structured expression specifying what quantities to print when the solver status is printed.


integrand_field

type: string
default: {}
Structured expression specifying what quantities integrate when field integrals are computed.


integrand_surface

type: string
default: {}
Structured expression specifying what quantities integrate when surface integrals are computed.


max_angle

type: float
default: 15*degree Maximum allowable angle between adjacent panels when discretizing 3D CAD geometry with hexed::Occt::triangles.


max_deflection

type: float
default: huge
Maximum allowable linear deflection of surface panels when discretizing 3D CAD geometry with hexed::Occt::triangles (dimensional).


flood_fill_start0, flood_fill_start1, flood_fill_start2

type: float
default: huge, huge, huge
Location to start the flood fill algorithm when add_geom is evaluated. If any of the coordinates are not within the mesh extremes (which is the case by default), the flood fill start location will effectively default to the minimum corner of the domain (mesh_extreme00, mesh_extreme10, mesh_extreme20).


init_cond

type: string
default:

{state0 = freestream0
state1 = freestream1
state2 = freestream2
state3 = freestream3
state4 = freestream4
}

Structured expression which sets the state variables state0, state1, ... to the desired initial condition. It shall be evaluated in an environment that includes the variables pos0, pos1, pos2, and time.


fix_admis_max_safety

type: float
default: 0.7
Maximum safety factor for Laplacian smearing iterations when fixing thermodynamic admissibility.

Note
Not defined until create_solver is evaluated.
See also
fix_therm_admis

av_advect_max_safety

type: float
default: 0.7
Maximum safety factor on pseudotime step in advection equation for smoothness-based artificial viscosity. Analogous to max_safety.

Note
Not defined until create_solver is evaluated.

av_diff_max_safety

type: float
default: 0.7
Maximum safety factor on pseudotime step in diffusion equation for smoothness-based artificial viscosity. Analogous to max_safety.

Note
Not defined until create_solver is evaluated.

layer_split_points

type: string
default: {split0 = 1./3.;}
Structured expression defining the aspect ratio of anisotropic wall layers created by split_layers. The values of the variables in the expression determine the split points in order from closest to the wall to farthest. The names of the variables are irrelevant.


diffusive_admissibility

type: integer
default: false
Experimental feature, but shows potential to be very useful. If true, it will add a Laplacian artificial diffusion term triggered based on elementwise smoothness of the specific volume (reciprocal of density), with a very coarse tolerance. This appears to be very effective for stabilizing severely underresolved (or unresolvable) features without affecting well-resolved regions, including properly captured shocks. For example, this allows reasonable results to be obtained for inviscid flow around a square, which had thus far defeated the solver even with shock capturing. This feature introduces very little performance overhead in and of itself, but it will enable LDG, introducing significant overhead over pure inviscid problems.


input_data

type: string
default: {auto}
Name of mesh and state files for read_mesh and read_state, including the directory, but not including the .mesh.h5/.state.h5 suffix. If {auto}, it will be initialized to working_dir + latest, which is appropriate if you want to restart a previous simulation in the same working directory from the last available save point. Note that if you want to restart from mesh and state files with different names (questionable, since the state must be read with an exactly matching mesh), you can just change the value of this variable between calling read_mesh and read_state (or just rename your files).


aerothermo_bl_multirate

type: integer
default: true
If true, activates a form of Chebyshev-accelerated multirate time integration in the boundary layer. This is still somewhat experimental, but has been shown to dramatically accelerate ( \( \approx 6 \times \)) aerodynamic heating simulations. If you encounter stability problems, consider reducing bl_multirate_iters or modifying aerothermo_conv_sub_iters .


bl_multirate_iters

type: integer
default: 10
For multirate boundary layer marching (aerothermo_bl_multirate = true or set_subsonic_bl_multirate ), this many sub-iterations will be executed at each multirate level before proceeding to the next level, except for the first (global) level, which will use flow_iters iterations. Thus, flow_iters and bl_multirate_iters should usually be similar. For Chebyshev acceleration (e.g. if aerothermo_bl_multirate = true ), a large number can help overcome a severe diffusive time step restriction. However, a large number can also cause stability issues and induces a stricter convective time step restriction (although this can be somewhat mitigated by increasing aerothermo_conv_sub_iters ).


aerothermo_conv_sub_iters

type: integer
default: 2
Problem: Using a large number of Chebyshev acceleration stages causes the convective CFL condition to be more restrictive. Solution: On the last stage of the Chebyshev scheme, take multiple sub-steps where the convective residual is updated but the diffusive is not. This is the number of sub-steps to take on the last Chebyshev stage (sometimes, an automatically-determined number of sub-steps may be applied to other stages as well). In general, it appears that less is more with this parameter, but a small (but > 1) number is usually beneficial.


n_cheby_av

type: integer
default: 0.7
Number of Chebyshev acceleration stages to use for diffusion equation for smoothness-based artificial viscosity. Increasing this number will help the artificial viscosity coefficient converge faster but cause a larger fraction of the time to be spent in the artificial viscosity calculation.

Note
Not defined until create_solver is evaluated.

av_advect_iters

type: integer
default: 1
Number of pseudotime iterations to run in artificial viscosity advection equation per nominal iteration (i.e. per hexed::Solver::update_art_visc_smoothness call). Increasing this number will help the artificial viscosity coefficient converge faster but cause a larger fraction of the CPU time to be spent in the artificial viscosity calculation.

Note
Not defined until create_solver is evaluated.

flow_iters

type: integer
default: 1
Number of physical flow iterations to run per nominal iteration (i.e. per hexed::Solver::update call). Increasing this number can help balance the amount of CPU time spent in the physical flow relative to the artificial viscosity iteration. The disadvantage is it can cause the iteration count to be misleading.

Note
Not defined until create_solver is evaluated.

Esoteric Input Parameters

You will probably never need to worry about these parameters. They are tunable in principle, but in practice the same values tend to work for pretty much every problem. In some cases, even I don't fully understand why the accepted defaults work.


mesh_extreme_eps

type: float
default: 1e-6
Comparison tolerance to use when determining whether points are inside or outside mesh extremes. Relative to domain size.


av_diff_iters

type: integer
default: 1
Number of pseudotime iterations to run in artificial viscosity diffusion equation per nominal iteration (i.e. per hexed::Solver::update_art_visc_smoothness call). Increasing this number will help the artificial viscosity coefficient converge faster but cause a larger fraction of the CPU time to be spent in the artificial viscosity calculation.

Note
This was useful before Chebyshev acceleration was discovered. Increasing n_cheby_av instead will usually be more productive, up to the limit where stability falls apart.
Not defined until create_solver is evaluated.

av_diff_ratio

type: float
default: 0.1
Determines amount of to smear artificial viscosity coefficient for smoothness-based artificial viscosity. A larger number means that the artificial viscosity field will be smoother but also spread further from the shocks.

Note
Not defined until create_solver is evaluated.

av_visc_mult

type: float
default: 30.
Final linear scaling parameter on smoothness-based artificial viscosity coefficient.

Note
Not defined until create_solver is evaluated.

av_unscaled_max

type: float
default: 2e-4
Maximum amount of artificial viscosity allowed before dimensional scaling. If this value is too small, artificial viscosity will not be sufficient to fully capture shocks. If it is too large, excessively small time steps may be encountered during the initial transient phase of the simulation.

Note
Not defined until create_solver is evaluated.

av_advect_max_res

type: float
default: 1e-3
Limit on the residual in the advection equation for smoothness-based artificial viscosity determination to improve robustness when weak instabilities are encountered.

Note
Not defined until create_solver is evaluated.

vis_lts_constraints

type: integer
default: false
If true, visualize the local time step constraints due to convection and diffusion, respectively.


iter_width

type: integer
default: 10
Visualization file names will contain iteration numbers with leading zeros added such that there are at least iter_width digits.


heat_flux_coercion

type: float
default: 2.
When weakly applying heat flux boundary conditions, this determines how strongly the heat flux is coerced to match the prescribed value. If this number is too large, the simulation might be unstable, but if it too small the boundary condition might not be fully satisfied. The default value is adequate for almost all cases, but there are rare situations in which it might need to be reduced.


shock_sub_iters

type: integer
default: 12 number of sub-iterations to run in each nominal iteration to get efficient Chebyshev-accelerated diffusion (when $set_shock has been called)


ramping_initial_iters

type: integer
default: 1000
number of initial iterations to run at a small safety factor (ramping_initial_safety) to let the artificial viscosity catch up (when $set_ramping has been called)


ramping_initial_safety

type: float
default: 3e-3
safety factor to use in initial iterations


ramping_final_safety

type: float
default: 0.7
will revert to this factor after initial iterations are complete (when $set_ramping)


monitor_window

type: float
default: 0.25

See also
monitor_vars

monitor_samples

type: integer
default: 100

See also
monitor_vars

elementwise_art_visc

type: integer
default: false
If true, artificial viscosity determined in an elementwise fashion based on the work of Persson. This feature is provided purely for the purpose of comparing the discretization-independent artificial viscosity to conventional methods. It is not recommended for practical simulations with this solver.


elementwise_art_visc_pde

type: integer
default: false
If elementwise artificial viscosity is used, if this variable is true, the artificial viscosity field will be regularized with PDE-based smoothing. Otherwise, it will be continuous and piecewise n-linear.


elementwise_art_visc_diff_ratio

type: float
default: 0.5
If PDE-based elementwise artificial viscosity is used, this controls the amount of diffusion used to smooth the artificial viscosity coefficient.


Command Variables & Macros

The following variables are used to execute actions. Some are Heisenberg variables which, when evaluated, cause the solver to perform certain tasks, while others are simply HIL macros. Most of the time you shouldn't need to know about most of these variables. For an overview of what variables you actually need to run a typical simulation, see Running Hexed. The remaining ones are used internally by other macros and/or are only necessary for specific situations, but all are made available to you to help you deal with edge cases that the default behavior does not cover. See example cases for standard best practices.

List of Command Variables


start

type: string (macro)
Performs basic initialization that has to happen before you can do anything with the solver (but after you've defined your parameters). Behavior is roughly the following:

  1. creates working directory if it does not already exist
  2. copies the input file to the working directory for the user's future reference
  3. initializes automatically-determined parameters
  4. calls create_solver

At this point, the mesh technically exists but contains only one element and no geometry.

mesh

Generates the initial mesh (although you can continue to modify it).

  1. calls init_refinement
  2. calls add_geom
  3. calls refine as many times as appropriate
  4. calls split_layers as many times as appropriate

run

type: string (macro)
Executes solution (requires start, meshing, and state initialization to have been performed). Behavior is roughly the following:

  1. writes mesh and state files
  2. visualizes the solution
  3. creates runtime_cmd.hil if it does not already exist.
  4. calls iterate as many times as appropriate
  5. writes mesh and state files
  6. visualizes solution

iterate

type: string (macro)
Executes one iteration (called by run). Behavior is roughly the following:

  1. calls update
  2. computes residuals
  3. prints history variables
  4. may writes mesh and state files, depending on write_freq
  5. may write visualization files, depending on vis_freq
  6. executes any commands in runtime_cmd.hil and empties the file

The user can modify the behavior of the iteration loop by adding additional HIL code to the beginning or the end of this macro.


create_solver

type: Heisenberg string
Creates a hexed::Solver object. Mesh contains a single element and the flow is uninitialized. Evaluates to {}.


init_refinement

type: Heisenberg string
Performs initial refinement (not based on geometry surface). Evaluates to {}.


add_geom

type: Heisenberg string
Inserts geometry into mesh. You can define 0 or more string variables named geom0, geom1, geom2, ... containing paths to geometry definition files. Paths can be absolute or relative to execution directory (not working_dir). Geometry variable numbers must start at 0 and be consecutive. E.g., if you define geom0 = leading.txt, geom1 = main.txt, geom3 = trailing.txt, then geom3 will be ignored. If these geometries split the domain into disjoint regions, then the region containing the flood fill start shall be meshed. Geometry file format is inferred from the file extension, which is case-insensitive. The following extension/format combinations are supported:

  • .csv: Comma Separated Value format (2D only). A comma-delimited table with at least 2 columns, which are interpreted as \( x_0 \) and \( x_1 \) coordinates of the nodes of a polygonal curve, in standard units. Curve is treated as open – if you are trying to model a closed shape, simply make the first point (approximately) equal to the last.
  • .igs, .iges: IGES CAD format (2D or 3D). For 2D simulations, the model edges will be extracted and projected onto the \( (x_0, x_1) \) plane. For 3D simulations, the model surfaces will be used. Units are read from the file and converted.
  • .stp, .step: STEP CAD format. As above.
  • .stl: STL 3D geometry format (3D only). ASCII or binary formats accepted. Units are assumed to be standard. Evaluates to {}.

refine

type: Heisenberg string
Performs one refinement sweep. Elements are refined or unrefined based on refine_if and unrefine_if. Evaluates to {}.


init_state

type: Heisenberg string
Initializes the solver state to init_cond. Evaluates to {}.


visualize

type: Heisenberg string
Writes visualization files. Evaluates to {}.


compute_residuals

type: Heisenberg string
Evaluates the residuals and assigns them to float variables residual_momentum, residual_density, residual_energy. Returns the empty string.


compute_forces

type: string (macro)
Computes aerodynamic forces and force coefficients. Will assign values to the following variables

  • force0
  • force1
  • force2
  • drag
  • lift
  • side_force
  • drag_coef
  • lift_coef
  • side_force_coef

Any of the above which are not applicable to the dimensionality of the problem are set to zero. This macro involves computing integrals, so it has non-negligible performance overhead if called very frequently.


print_forces

type: string (macro)
Calls compute_forces and prints the results in a pretty way.


plot_history

type: string (macro)
Creates a real-time, interactive plot of the convergence history. Specifically, it starts a background process which creates a hexed_utils.History_plot instance in a Python interpreter. Usually, this macro should be executed before the start, mesh, init_state, run sequence.


update

type: Heisenberg string
Executes print_freq solver iterations and returns an empty string. Each "solver iteration" consists of:

  1. Calling hexed::Solver::set_art_visc_constant, if applicable.
  2. Calling hexed::Solver::update_art_visc_smoothness, if applicable.
  3. Calling hexed::Solver::update.

integrate_field

type: Heisenberg string
Computes integrals of the variables in integrand_field over the domain by the native quadrature rule of the numerical scheme. The integrals of the variables are assigned to float variables names integral_field_var where var is the name of the variable. Returns an empty string.


integrate_surface

type: Heisenberg string
Computes integrals of the variables in integrand_surface over the geometry surface by the native quadrature rule of the numerical scheme. The integrals of the variables are assigned to float variables names integral_surface_var where var is the name of the variable. Returns an empty string.


split_layers

type: Heisenberg string
Creates anisotropic wall layers by splitting the last wall layer (the layer of extruded elements closest to the geometry surface) into thinner layers. The layer will be split at user-specified set of points controlled by layer_split_points. For each split point, the layer will be cut by the level surface where the wall-normal reference coordinate equals that value. Thus split points should be strictly increasing and in the interval (0, 1). For example, to split the last wall layer into 4 approximately equal parts, you could set layer_split_points = {split0 = 0.25; split1 = 0.5; split2 = 0.75} and then evaluate split_layers. The state of the original layer will be interpolated into the new layers, so layer splitting can be performed dynamically as a simulation is running. Evaluates to {}.


set_geometry_refinement

type: string (macro)
Sets refine_if and unrefine_if to refine elements in order to efficiently resolve the geometry surface.

See also
max_ref_level
geometry_uncertainty

set_shock

type: string (macro)
Configures settings to be good for shock capturing (in particular turning on smoothness-based artificial viscosity).


set_ramping

type: string (macro)
Implements a crude CFL ramping scheme. The CFL safety factor is initially set to a very small value (ramping_initial_safety) and then after a set number of iterations (ramping_initial_iters) it is instantaneously increased to a reasonable value (ramping_final_safety). The reason why this is necessary is that the artificial viscosity coefficient can take time to adjust to the flow conditions, so an initial condition where the flow does not satisfy the boundary conditions and the artificial viscosity coefficient is zero can cause robustness problems. It is usually only necessary in supersonic viscous simulations.


set_aerothermo

type: string (macro)
Configures settings to be good for aerothermodynamics. Assumes $set_shock has already been called. Automatically calls $set_ramping.


set_subsonic_bl_multirate

type: string (macro)
Activates a form of multirate time integration which causes the solver to spend more time in the boundary layer instead of the mainstream flow. This is an experimental feature, but it has shown promise to substantially accelerate (2 to 3 \( \times \)) high-Reynolds-number simulations.


read_mesh

type: Heisenberg string
Reads the mesh from a Hexed mesh file (which you can create using write_mesh). This can be used in place of mesh, but you will still have to call init_state or read_state to initialize the flow state. The file name of the mesh file given by input_data with .mesh.h5 appended. Evaluates to {}.


read_state

type: Heisenberg string
Reads the flow state from a file created with the write_state command. The file name is given by input_data with .state.h5 appended. The state file must have been created for the exact same mesh, meaning that if the state file was not created during the same simulation you're currently running, you need to first use read_mesh to get the mesh. Two meshes that look the same might not actually be the same for a variety of reasons. For example, if elements were refined in a different order, then you cannot use the same state files, even if the mesh is geometrically identical. So, just play it safe and read the mesh first. This command can be used instead of init_state. read_mesh and read_state together can be used to restart a previous simulation from where it left off. Evaluates to {}.


read_status

type: Heisenberg string
Reads HIL variables from a file created with the write_status command. This should be preferred over simply using the read command to read the HIL code because it also reinitializes the history monitors from the _max and _min variables. Evaluates to {}.


restart

type: string (macro)
Reads the mesh, state, and HIL variables from a previous simulation. File names without extensions are given by input_data. This should be the method of choice for restarting a simulation. restart replaces start, mesh, and init_state, but you still need to evaluate run. You may need to modify some parameters between restart and run (probably done). A typical input for a restart simulation would look something like:

$restart
done = {iteration >= 10^5}
$run

write_mesh

type: Heisenberg string
Writes the mesh to a file in the Hexed mesh format, which can then be used again in a future simulation using read_mesh, or, in theory, imported into another program. The file name will be iterXXXXXXXXXX.mesh.h5 in the working directory, where the Xs are replaced with the current iteration number. Also creates a symlink latest.mesh.h5 pointing to this file for convenience. Evaluates to {}.


write_state

type: Heisenberg string
Writes the flow state to a file which can then be used in a future simulation using read_state. The file name will be iterXXXXXXXXXX.state.h5 in the working directory, where the Xs are replaced with the current iteration number. Also creates a symlink latest.state.h5 pointing to this file for convenience. Evaluates to {}.


write_status

type: Heisenberg string
Writes the values of all user-defined variables to a file. "User-defined" means variables that were written to after the start of the input script (i.e. not the default values of builtin variables). Some variables are explicitly excluded as their values should always be redefined for the restarted simulation, namely working_dir, input_data. The file name will be iterXXXXXXXXXX.status.hil in the working directory, where the Xs are replaced with the current iteration number. Also creates a symlink latest.status.hil pointing to this file for convenience. The file is a standard HIL script that can be read using the standard read operator. E.g., $read {hexed_out/latest.status.hil}. Evaluates to {}.


terminate

type: string (macro)
Terminates the simulation. Ending activities including writing restart and visualization data will still be performed, but done will not be modified and the simulation will be considered to have failed. If the simulation is not going the way you want, this should be the method of choice to terminate it. Generally, you should only use the keyboard interrupt (Ctrl C) or kill signals if you encounter a bug, as they will not write visualization and restart data to help you diagnose the problem.


Output Parameters

The following variables are defined and/or updated by the solver in order to provide information to you. Some are Heisenberg variables whereas others are writable, but you should not write to them even if you are technically able to. Not all of these variables are defined at the start of the simulation. See individual documentation for details.

List of Output Parameters


input_file

type: string
If hexecute was invoked from an input file, input_file will be the path to the input file (relative or absolute as provided by user). If this is an interactive session, it will be an empty string.


version

type: string
Version of Hexed you are running in {major.minor.patch} format.


version_major

type: int
Major (first) component of version.


version_minor

type: int
Minor (second) component of version.


version_patch

type: int
Patch (third) component of version.


commit

type: string
Commit hash of the source code your Hexed binary was compiled from. If you're running a release version, this should be redundant with version, but if you're running a development version, it tells you how far ahead of the latest release you are.


license

type: string
Information about the copyright of this software and the license, if any, under which it was provided to you.


iteration

type: integer
Number of iterations executed since solver was created. Equal to print_freq times the number of update evaluations.


wall_time

type: float
Wall clock time (seconds) elapsed since solver was created. Not to be confused with flow_time —if the distinction isn't clear, here is an example: if you start a simulation and then take a 5-minute break to make coffee, if your simulation is still running upon your return the wall time will be 5*60s = 300s.


flow_time

type: float
Amount of time (seconds) elapsed in the physical flow since the simulation started. Only meaningful for global time stepping. Not to be confused with wall_time —if the distinction isn't clear, here is an example: if you have a shock propagating at 100 m/s and run your simulation with global time stepping until the flow time reaches 0.01 s, then the shock will have propagated a distance of 1 m.


time_step

type: float
Time step taken in the most recent iteration. Only meaningful for global time stepping.


header

type: Heisenberg string
The names of the print_vars variables as a comma-delimited list.


report

type: Heisenberg string
Evaluates compute_residuals and then returns the values of the print_vars variables as a comma-delimited list.


residual_momentum

type: float
Magnitude of the dimensional residual of the vector momentum equation. Begins the simulation uninitialized and is only assigned when compute_residuals is evaluated.


residual_density

type: float
Dimensional residual of the continuity equation. Begins the simulation uninitialized and is only assigned when compute_residuals is evaluated.


residual_energy

type: float
Dimensional residual of the energy equation. Begins the simulation uninitialized and is only assigned when compute_residuals is evaluated.


init_residual_momentum

type: float
Magnitude of the dimensional residual of the vector momentum equation at the start of the simulation. Defined at the beginning of run.


init_residual_density

type: float
Dimensional residual of the continuity equation at the start of the simulation. Defined at the beginning of run.


init_residual_energy

type: float
Dimensional residual of the energy equation at the start of the simulation. Defined at the beginning of run.


normalized_residual

type: float
Average of momentum, density, and energy residuals, each normalized by their value after the first iteration.


art_visc_residual

type: float
\( L^2 \) norm of the most recent update to the artificial viscosity coefficient. This is a dimensional value that depends on the domain area and time step, but it can be useful to qualitatively asses the convergence of the simulation.


n_elements

type: Heisenberg string
The number of elements currently in the mesh. Evaluates to {}.


performance_report

type: Heisenberg string
Human-readable summary of kernel performance metrics for all iterations that have been run in the current simulation.