Core Utilities

CFDMesh

class sierra::nalu::CFDMesh

STK Mesh interface.

This class provides a thin wrapper around the STK mesh objects (MetaData, BulkData, and StkMeshIoBroker) for use with various preprocessing utilities.

Public Functions

CFDMesh(stk::ParallelMachine &comm, const std::string filename)

Parameters
  • comm: MPI Communicator object
  • filename: Exodus database filename

CFDMesh(stk::ParallelMachine &comm, const int ndim)
~CFDMesh()
void init()

Initialize the mesh database.

If an input DB is provided, the mesh is read from the file. The MetaData is committed and the BulkData is ready for use/manipulation.

stk::ParallelMachine &comm()
stk::mesh::MetaData &meta()
stk::mesh::BulkData &bulk()
stk::io::StkMeshIoBroker &stkio()
void add_output_field(const std::string field)

Register a field for output during write.

void write_database(std::string output_db, double time = 0.0)

Write the Exodus results database with modifications.

Parameters
  • output_db: Filename for the output Exodus database
  • time: (Optional) time to write (default = 0.0)

void write_database_with_fields(std::string output_db)

Write database with restart fields.

BoxType calc_bounding_box(const stk::mesh::Selector selector, bool verbose = true)

Calculate the bounding box of the mesh.

The selector can pick parts that are not contiguous. However, the bounding box returned will be the biggest box that encloses all parts selected.

Return
An stk::search::Box instance containing the min and max points (3-D).
Parameters
  • selector: An instance of stk::mesh::Selector to filter parts of the mesh where bounding box is calculated.
  • verbose: If true, then print out the bounding box to standard output.

void set_decomposition_type(std::string decompType)

Set automatic mesh decomposition property.

void set_64bit_flags()
bool db_modified()

Flag indicating whether the DB has been modified.

void set_write_flag()

Force output of the results DB.

Interpolation utilities

struct sierra::nalu::utils::OutOfBounds

Flags and actions for out-of-bounds operation.

Public Types

enum boundLimits

Out of bounds limit types.

Values:

LOWLIM = -2

xtgt < xarray[0]

UPLIM = -1

xtgt > xarray[N]

VALID = 0

xarray[0] <= xtgt <= xarray[N]

enum OobAction

Flags indicating action to perform on Out of Bounds situation.

Values:

ERROR = 0

Raise runtime error.

WARN

Warn and then CLAMP.

CLAMP

Clamp values to the end points.

EXTRAPOLATE

Extrapolate linearly based on end point.

template <typename T>
InterpTraits<T>::index_type sierra::nalu::utils::check_bounds(const Array1D<T> &xinp, const T &x)

Determine whether the given value is within the limits of the interpolation table.

template <typename T>
InterpTraits<T>::index_type sierra::nalu::utils::find_index(const Array1D<T> &xinp, const T &x)

Return an index object corresponding to the x-value based on interpolation table.

The std::pair returned contains two values: the bounds indicator and the index of the element in the interpolation table such that xarray[i] <= x < xarray[i+1]

template <typename T>
void sierra::nalu::utils::linear_interp(const Array1D<T> &xinp, const Array1D<T> &yinp, const T &xout, T &yout, OutOfBounds::OobAction oob = OutOfBounds::CLAMP)

Perform a 1-D linear interpolation.

Parameters
  • xinp: A 1-d vector of x-values
  • yinp: Corresponding 1-d vector of y-values
  • xout: Target x-value for interpolation
  • yout: Interpolated value at xout
  • oob: (Optional) Out-of-bounds handling (default: CLAMP)

YAML utilities

Miscellaneous utilities for working with YAML C++ library.

namespace sierra
namespace nalu
namespace wind_utils

Functions

template <typename T>
bool get_optional(const YAML::Node &node, const std::string &key, T &result)
template <typename T>
bool get_optional(const YAML::Node &node, const std::string &key, T &result, const T &default_value)