Pre-processing Utilities

PreProcessDriver

class sierra::nalu::PreProcessDriver

A driver that runs all preprocessor tasks.

This class is responsible for reading the input file, parsing the user-requested list of tasks, initializing the task instances, executing them, and finally writing out the updated Exodus database with changed inputs.

Public Functions

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

Parameters
  • comm: MPI Communicator reference
  • filename: Name of the YAML input file

void run()

Run all tasks and output the updated Exodus database.

PreProcessingTask

class sierra::nalu::PreProcessingTask

An abstract implementation of a PreProcessingTask.

This class defines the interface for a pre-processing task and contains the infrastructure to allow concrete implementations of pre-processing tasks to register themselves for automatic runtime discovery. Derived classes must implement two methods:

  • initialize - Perform actions on STK MetaData before processing BulkData
  • run - All actions on BulkData and other operations on mesh after it has been loaded from the disk.

For automatic class registration, the derived classes must implement a constructor that takes two arguments: a CFDMesh reference, and a const reference to YAML::Node that contains the inputs necessary for the concrete task implementation. It is the derived class’ responsibility to process the input dictionary and perform error checking. No STK mesh manipulations must occur in the constructor.

Subclassed by sierra::nalu::ABLFields, sierra::nalu::BdyIOPlanes, sierra::nalu::NDTW2D, sierra::nalu::RotateMesh, sierra::nalu::SamplingPlanes

Public Functions

PreProcessingTask(CFDMesh &mesh)

Parameters

Public Static Functions

PreProcessingTask *create(CFDMesh &mesh, const YAML::Node &node, std::string lookup)

Runtime creation of concrete task instance.

Protected Attributes

CFDMesh &mesh_

Reference to the CFDMesh instance.

ABLFields

class sierra::nalu::ABLFields

Initialize velocity and temperature fields for ABL simulations.

This task is activated by using the init_abl_fields task in the preprocessing input file. It requires a section init_abl_fields in the nalu_preprocess section with the following parameters:

init_abl_fields:
  fluid_parts: [Unspecified-2-HEX]

  temperature:
    heights: [    0, 650.0, 750.0, 10750.0]
    values:  [280.0, 280.0, 288.0,   318.0]

  velocity:
    heights: [0.0, 10.0, 30.0, 70.0, 100.0, 650.0, 10000.0]
    values:
      - [ 0.0, 0.0, 0.0]
      - [4.81947, -4.81947, 0.0]
      - [5.63845, -5.63845, 0.0]
      - [6.36396, -6.36396, 0.0]
      - [6.69663, -6.69663, 0.0]
      - [8.74957, -8.74957, 0.0]
      - [8.74957, -8.74957, 0.0]

The sections temperature and velocity are optional, allowing the user to initialize only the temperature or the velocity as desired. The heights are in meters, the temperature is the potential temperature in Kelvin, and the velocity is the actual vector in m/s. Currently, the code does not include the ability to automatically convert (mangitude, direction) to velocity vectors.

Inherits from sierra::nalu::PreProcessingTask

Public Functions

void initialize()

Declare velocity and temperature fields and register them for output.

void run()

Initialize the velocity and/or temperature fields by linear interpolation.

Private Functions

void load(const YAML::Node &abl)

Parse the YAML file and initialize parameters.

void load_velocity_info(const YAML::Node &abl)

Helper function to parse and initialize velocity inputs.

void load_temperature_info(const YAML::Node &abl)

Helper function to parse and initialize temperature inputs.

void init_velocity_field()

Initialize the velocity field through linear interpolation.

void init_temperature_field()

Intialize the temperature field through linear interpolation.

Private Members

stk::mesh::MetaData &meta_

STK Metadata object.

stk::mesh::BulkData &bulk_

STK Bulkdata object.

stk::mesh::PartVector fluid_parts_

Parts of the fluid mesh where velocity/temperature is initialized.

std::vector<double> vHeights_

List of heights where velocity is defined.

Array2D<double> velocity_

List of velocity (3-d components) at the user-defined heights.

std::vector<double> THeights_

List of heights where temperature is defined.

std::vector<double> TValues_

List of temperatures (K) at user-defined heights (THeights_)

int ndim_

Dimensionality of the mesh.

bool doVelocity_

Flag indicating whether velocity is initialized.

bool doTemperature_

Flag indicating whether temperature is initialized.

BdyIOPlanes

class sierra::nalu::BdyIOPlanes

Extract boundary planes for I/O mesh.

Given an ABL precursor mesh, this utility extracts the specified boundaries and creates a new IO Transfer mesh for use with ABL precursor simulations.

Inherits from sierra::nalu::PreProcessingTask

Public Functions

void initialize()

Register boundary parts and attach coordinates to the parts.

The parts are created as SHELL elements to as needed by the Nalu Transfer class.

void run()

Copy user specified boundaries and save the IO Transfer mesh.

Private Functions

void load(const YAML::Node &node)

Parse user inputs from the YAML file.

void create_boundary(const std::string bdyName)

Copy the boundary from Fluid mesh to the IO Xfer mesh.

Private Members

CFDMesh &mesh_

Original mesh DB information.

CFDMesh iomesh_

IO Mesh db STK meta and bulk data.

std::vector<std::string> bdyNames_

User specified list of boundaries to be extracted.

std::string output_db_ = {""}

Name of the I/O db where the boundaries are written out.

SamplingPlanes

class sierra::nalu::SamplingPlanes

Generate 2-D grids/planes for data sampling.

Currently only generates horizontal planes at user-defined heights.

Requires a section generate_planes in the input file within the nalu_preprocess section:

generate_planes:
  fluid_part: Unspecified-2-hex

  heights: [ 70.0 ]
  part_name_format: "zplane_%06.1f"

  dx: 12.0
  dy: 12.0

With the above input definition, it will use the bounding box of the fluid_part to determine the bounding box of the plane to be generated. This will provide coordinate axis aligned sapling planes in x and y directions. Alternately, the user can specify boundary_type to be quad_vertices and provide the vertices of the quadrilateral that is used to generate the sampling plane as shown below:

generate_planes:
  boundary_type: quad_vertices
  fluid_part: Unspecified-2-hex

  heights: [ 50.0, 70.0, 90.0 ]
  part_name_format: "zplane_%06.1f"

  nx: 25  # Number of divisions along (1-2) and (4-3) vertices
  ny: 25  # Number of divisions along (1-4) and (2-3) vertices
  vertices:
    - [250.0, 0.0]
    - [500.0, -250.0]
    - [750.0, 0.0]
    - [500.0, 250.0]

part_name_format is a printf-like format specification that takes one argument - the height as a floating point number. The user can use this to tailor how the nodesets or the shell parts are named in the output Exodus file.

Inherits from sierra::nalu::PreProcessingTask

Public Types

enum PlaneBoundaryType

Sampling Plane boundary type.

Values:

BOUND_BOX = 0

Use bounding box of the fluid mesh defined.

QUAD_VERTICES

Use user-defined vertex list for plane boundary.

Private Functions

void calc_bounding_box()

Use fluid Realm mesh to estimate the x-y bounding box for the sampling planes.

void generate_zplane(const double zh)

Generate entities and update coordinates for a given sampling plane.

Private Members

stk::mesh::MetaData &meta_

STK Metadata object.

stk::mesh::BulkData &bulk_

STK Bulkdata object.

std::vector<double> heights_

Heights where the averaging planes are generated.

std::array<std::array<double, 3>, 2> bBox_

Bounding box of the original mesh.

std::string name_format_

Format specification for the part name.

std::vector<std::string> fluidPartNames_

Fluid realm parts (to determine mesh bounding box)

stk::mesh::PartVector fluidParts_

Parts of the fluid mesh (to determine mesh bounding box)

double dx_

Spatial resolution in x and y directions.

double dy_

Spatial resolution in x and y directions.

size_t nx_

Number of nodes in x and y directions.

size_t mx_

Number of elements in x and y directions.

int ndim_

Dimensionality of the mesh.

PlaneBoundaryType bdyType_ = {BOUND_BOX}

User defined selection of plane boundary type.

RotateMesh

class sierra::nalu::RotateMesh

Rotate a mesh.

rotate_mesh:
  mesh_parts:
    - unspecified-2-hex

  angle: 45.0
  origin: [500.0, 0.0, 0.0]
  axis: [0.0, 0.0, 1.0]

Inherits from sierra::nalu::PreProcessingTask

Private Members

stk::mesh::MetaData &meta_

STK Metadata object.

stk::mesh::BulkData &bulk_

STK Bulkdata object.

std::vector<std::string> meshPartNames_

Part names of the mesh that needs to be rotated.

stk::mesh::PartVector meshParts_

Parts of the mesh that need to be rotated.

double angle_

Angle of rotation.

std::vector<double> origin_

Point about which rotation is performed.

std::vector<double> axis_

Axis around which the rotation is performed.

int ndim_

Dimensionality of the mesh.

NDTW2D

class sierra::nalu::NDTW2D

2-D Nearest distance to wall calculator

Calculates a new field NDTW containing the wall distance for 2-D airfoil-like applications used in RANS wall models.

Inherits from sierra::nalu::PreProcessingTask

Public Functions

void initialize()

Initialize the NDTW field and register for output.

void run()

Calculate wall distance and update NDTW field.