nalu_preprocess
– Nalu Preprocessing Utilities¶
This utility loads an input mesh and performs various pre-processing tasks so that the resulting output database can be used in a wind LES simulation. Currently, the following tasks have been implemented within this utility.
Task type | Description |
---|---|
init_abl_fields |
Initialize ABL velocity and temperature fields |
generate_planes |
Generate horizontal sampling planes for dp/dx forcing |
create_bdy_io_mesh |
Create an I/O transfer mesh for sampling inflow planes |
rotate_mesh |
Rotate mesh |
Warning
Not all tasks are capable of running in parallel. Please consult
documentation of individual tasks to determine if it is safe to run it in
parallel using MPI. It might be necessary to set
automatic_decomposition_type
when running in parallel.
The input file (download
) must contain
a nalu_preprocess section as shown below. Input options for the individual
tasks are provided as sub-sections within nalu_preprocess with the
corresponding task names provided under tasks
. For example, in the sample
shown below, the program will expect to see two sub-sections, namely
init_abl_fields
and generate_planes
based on the list of tasks shown in
lines 22-23.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # -*- mode: yaml -*-
#
# Nalu Preprocessing Utility - Example input file
#
# Mandatory section for Nalu preprocessing
nalu_preprocess:
# Name of the input exodus database
input_db: abl_mesh.g
# Name of the output exodus database
output_db: abl_mesh_precursor.g
# Flag indicating whether the database contains 8-bit integers
ioss_8bit_ints: false
# Flag indicating mesh decomposition type (for parallel runs)
# automatic_decomposition_type: rcb
# Nalu preprocessor expects a list of tasks to be performed on the mesh and
# field data structures
tasks:
- init_abl_fields
- generate_planes
|
Command line invocation¶
mpiexec -np <N> nalu_preprocess -i [YAML_INPUT_FILE]
-
-i
,
--input-file
¶
Name of the YAML input file to be used. Default:
nalu_preprocess.yaml
.
Common input file options¶
-
input_db
¶ Path to an existing Exodus-II mesh database file, e.g..,
ablNeutralMesh.g
-
output_db
¶ Filename where the pre-processed results database is output, e.g.,
ablNeutralPrecursor.g
-
automatic_decomposition_type
¶ Used only for parallel runs, this indicates how the a single mesh database must be decomposed amongst the MPI processes during initialization. This option should not be used if the mesh has already been decomposed by an external utility. Possible values are:
Value Description rcb recursive coordinate bisection rib recursive inertial bisection linear elements in order first n/p to proc 0, next to proc 1. cyclic elements handed out to id % proc_count
-
tasks
¶ A list of task names that define the various pre-processing tasks that will be performed on the input mesh database by this utility. The program expects to find additional sections with headings matching the task names that provide additional inputs for individual tasks. By default, the task names found within the list should correspond to one of the task types discussed earlier in this section. If the user desires to use custom names, then the exact task type should be provided with a
type
within the task section. A specific use-case where this is useful is when the user desires to rotate the mesh, perform additional operations, and, finally, rotate it back to the original orientation.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
tasks: - rotate_mesh_ccw # Rotate mesh such that sides align with XYZ axes - generate_planes # Generate sampling planes using bounding box - rotate_mesh_cw # Rotate mesh back to the original orientation rotate_mesh_ccw: task_type: rotate_mesh mesh_parts: - unspecified-2-hex angle: 30.0 origin: [500.0, 0.0, 0.0] axis: [0.0, 0.0, 1.0] rotate_mesh_cw: task_type: rotate_mesh mesh_parts: - unspecified-2-hex - zplane_0080.0 # Rotate auto generated parts also angle: -30.0 origin: [500.0, 0.0, 0.0] axis: [0.0, 0.0, 1.0]
-
transfer_fields
¶ A Boolean flag indicating whether the time histories of the fields available in the input mesh database must be transferred to the output database. Default:
false
.
-
ioss_8bit_ints
¶ A Boolean flag indicating whether the output database must be written out with 8-bit integer support. Default:
false
.
init_abl_fields
¶
This task initializes the vertical velocity and temperature profiles for use
with an ABL precursor simulations based on the parameters provided by the user
and writes it out to the output_db
. It is safe to run
init_abl_fields
in parallel. A sample invocation is shown below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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]
|
-
fluid_parts
¶ A list of element block names where the velocity and/or temperature fields are to be initialized.
-
temperature
¶ A YAML dictionary containing two arrays:
heights
and the correspondingvalues
at those heights. The data must be provided in SI units. No conversion is performed within the code.
-
velocity
¶ A YAML dictionary containing two arrays:
heights
and the correspondingvalues
at those heights. The data must be provided in SI units. No conversion is performed within the code. The values in this case are two dimensional lists of shape[nheights, 3]
wherenheights
is the length of the heights array provided.
Note
Only one of the entries velocity
or temperature
needs to be present.
The program will skip initialization of a particular field if it cannot find
an entry in the input file. This can be used to speed up the execution
process if the user intends to initialize uniform velocity throughout the
domain within Nalu.
generate_planes
¶
Generates horizontal planes of nodesets at given heights that are used for sampling velocity and temperature fields during an ABL simulation. The resulting spatial average at given heights is used within Nalu to determine the driving pressure gradient necessary to achieve the desired ABL profile during the simulation. This task is capable of running in parallel.
The horizontal extent of the sampling plane can be either prescribed manually,
or the program will use the bounding box of the input mesh. Note that the latter
approach only works if the mesh boundaries are oriented along the major axes.
The extent and orientation of the sampling plane is controlled using the
boundary_type
option in the input file.
-
boundary_type
¶ Flag indicating how the program should estimate the horizontal extents of the sampling plane when generating nodesets. Currently, two options are supported:
Type Description bounding_box Automatically estimate based on bounding box of the mesh quad_vertices Use user-provided vertices
This flag is optional, and if it is not provided the program defaults to using the
bounding_box
approach to estimate horizontal extents.
-
fluid_part
¶ A list of element block names used to compute the extent using bounding box approach.
-
heights
¶ A list of vertical heights where the nodesets are generated.
-
part_name_format
¶ A
printf
style string that takes one floating point argument%f
representing the height of the plane. For example, if the user desires to generate nodesets at 70m and 90m respectively and desires to name the planezh_070
andzh_090
respectively, this can be achieved by settingpart_name_format: zh_%03.0f
.
-
dx, dy
¶ Uniform resolutions in the x- and y-directions when generating nodesets. Used only when
boundary_type
is set tobounding_box
.
-
nx, ny
¶ Number of subdivisions of along the two axes of the quadrilateral provided. Given 4 points,
nx
will divide segments1-2
and3-4
, andny
will divide segments2-3
and4-1
. Used only whenboundary_type
is set toquad_vertices
.
-
vertices
¶ Used to provide the horizontal extents of the sampling plane to the utility. For example
vertices: - [250.0, 0.0] # Vertex 1 (S-W corner) - [500.0, -250.0] # Vertex 2 (S-E corner) - [750.0, 0.0] # Vertex 3 (N-E corner) - [500.0, 250.0] # Vertex 4 (N-W corner)
Example using custom vertices¶
1 2 3 4 5 6 7 8 9 10 11 12 13 | generate_planes:
boundary_type: quad_vertices # Override default behavior
fluid_part: Unspecified-2-hex # Fluid part
heights: [ 70.0 ] # Heights were sampling planes are generated
part_name_format: "zplane_%06.1f" # Name format for new nodesets
nx: 25 # X resolution
ny: 25 # Y resolution
vertices: # Vertices of the quadrilateral
- [250.0, 0.0]
- [500.0, -250.0]
- [750.0, 0.0]
- [500.0, 250.0]
|
create_bdy_io_mesh
¶
Create an I/O transfer mesh containing the boundaries of a given ABL precursor mesh. The I/O transfer mesh can be used with Nalu during the precursor runs to dump inflow planes for use with a later wind farm LES simulation with inflow/outflow boundaries. Unlike other utilities described in this section, this utility creates a new mesh instead of adding to the database written out by the nalu_preprocess executable. It is safe to invoke this task in a parallel MPI run.
-
output_db
¶ Name of the I/O transfer mesh where the boundary planes are written out. This argument is mandatory.
-
boundary_parts
¶ A list of boundary parts that are saved in the I/O mesh. The names in the list must correspond to the names of the sidesets in the given ABL mesh.
rotate_mesh
¶
Rotates the mesh given angle, origin, and axis using quaternion rotations.
-
mesh_parts
¶ A list of element block names that must be rotated.
-
angle
¶ The rotation angle in degrees.
-
origin
¶ An (x, y, z) coordinate for mesh rotation.
-
axis
¶ A unit vector about which the mesh is rotated.
1 2 3 4 5 6 7 | rotate_mesh:
mesh_parts:
- unspecified-2-hex
angle: 30.0
origin: [500.0, 0.0, 0.0]
axis: [0.0, 0.0, 1.0]
|
calc_ndtw2d
¶
Deprecated since version 0.1.0: The implementation uses a brute-force method to compute the nearest wall distance and as such is unsitable for production use. Use only on small two-dimensional meshes.
Calculate the nearest distance to wall (NDTW) for 2-D airfoil meshes.
1 2 3 4 5 6 7 | calc_ndtw2d:
fluid_parts:
- Unspecified-2-QUAD
- Unspecified-3-QUAD
wall_parts:
- airfoil
|