Field Class Reference
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
|
#include <Field.H>
Public Member Functions | |
Field (const Field &)=delete | |
Field & | operator= (const Field &)=delete |
~Field () | |
const std::string & | name () const |
Name of this field (including state information) | |
const std::string & | base_name () const |
Base name (without state information) | |
unsigned | id () const |
Unique integer identifier for this field. | |
int | num_comp () const |
Number of components for this field. | |
const amrex::IntVect & | num_grow () const |
Ghost cells. | |
int | num_time_states () const |
Number of exact time states available for this field. | |
int | num_states () const |
Number of states available for this field. | |
FieldLoc | field_location () const |
Cell, node, or face centered field. | |
FieldState | field_state () const |
State of this field instance. | |
FieldRepo & | repo () const |
FieldRepo instance that manages this field. | |
bool & | fillpatch_on_regrid () |
bool | fillpatch_on_regrid () const |
bool | query_state (const FieldState fstate) const |
Return true if the requested state exists for this field. | |
const amrex::GpuArray< BC, AMREX_SPACEDIM *2 > & | bc_type () const |
amrex::GpuArray< BC, AMREX_SPACEDIM *2 > & | bc_type () |
amrex::Vector< amrex::Vector< amrex::Real > > & | bc_values () |
Return reference to the host view of BC values array. | |
amrex::Vector< amrex::BCRec > & | bcrec () const |
Return reference to host view of BCRec array. | |
const amrex::GpuArray< const amrex::Real *, AMREX_SPACEDIM *2 > & | bc_values_device () const |
const amrex::Gpu::DeviceVector< amrex::BCRec > & | bcrec_device () const |
void | copy_bc_to_device () |
bool | bc_initialized () const |
Return flag indicating whether BCs have been initialized. | |
bool | has_fillpatch_op () const |
Return a flag indicating whether a fillpatch Op has been registered. | |
void | set_default_fillpatch_bc (const SimTime &time, const amrex::BCType::mathematicalBndryTypes bctype=amrex::BCType::hoextrap) noexcept |
void | to_uniform_space () noexcept |
void | to_stretched_space () noexcept |
Field & | state (const FieldState fstate) |
Return field at a different time state. | |
const Field & | state (const FieldState fstate) const |
amrex::MultiFab & | operator() (int lev) noexcept |
Return MultiFab instance for a given level. | |
const amrex::MultiFab & | operator() (int lev) const noexcept |
amrex::Vector< amrex::MultiFab * > | vec_ptrs () noexcept |
Return a vector of MultiFab pointers for all levels. | |
amrex::Vector< const amrex::MultiFab * > | vec_const_ptrs () const noexcept |
Return vector of const MultiFab* for all levels. | |
void | advance_states () noexcept |
Advance timestep for fields with multiple states. | |
void | copy_state (FieldState to_state, FieldState from_state) noexcept |
Copy a user-specified "from_state" to "to_state". | |
Field & | create_state (const FieldState fstate) noexcept |
Create a new time state after the field has been created. | |
void | setVal (amrex::Real value) noexcept |
Set the field to a constant value at all levels. | |
void | setVal (amrex::Real value, int start_comp, int num_comp=1, int nghost=0) noexcept |
void | setVal (const amrex::Vector< amrex::Real > &values, int nghost=0) noexcept |
ViewField< Field > | subview (const int scomp=0, const int ncomp=1) |
template<typename T , class... Args> | |
void | register_fill_patch_op (Args &&... args) |
template<typename T , class... Args> | |
void | register_custom_bc (Args &&... args) |
void | fillpatch (const amrex::Real time) noexcept |
void | fillpatch (const amrex::Real time, amrex::IntVect ng) noexcept |
void | fillpatch_sibling_fields (const amrex::Real time, const amrex::IntVect ng, amrex::Array< Field *, AMREX_SPACEDIM > &fields) const noexcept |
void | fillphysbc (const amrex::Real time) noexcept |
void | fillphysbc (const amrex::Real time, const amrex::IntVect ng) noexcept |
void | apply_bc_funcs (const FieldState rho_state) noexcept |
void | fillpatch (const int lev, const amrex::Real time, amrex::MultiFab &mfab, const amrex::IntVect &nghost) noexcept |
void | fillpatch_from_coarse (const int lev, const amrex::Real time, amrex::MultiFab &mfab, const amrex::IntVect &nghost) noexcept |
void | fillphysbc (const int lev, const amrex::Real time, amrex::MultiFab &mfab, const amrex::IntVect &nghost) noexcept |
void | set_inflow (const int lev, const amrex::Real time, amrex::MultiFab &mfab, const amrex::IntVect &nghost) noexcept |
void | set_inflow_sibling_fields (const int lev, const amrex::Real time, const amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > mfabs) noexcept |
void | fillpatch (const int lev, const amrex::Real time, amrex::MultiFab &mfab, const int nghost) noexcept |
void | fillpatch_from_coarse (const int lev, const amrex::Real time, amrex::MultiFab &mfab, const int nghost) noexcept |
void | fillphysbc (const int lev, const amrex::Real time, amrex::MultiFab &mfab, const int nghost) noexcept |
void | set_inflow (const int lev, const amrex::Real time, amrex::MultiFab &mfab, const int nghost) noexcept |
bool & | in_uniform_space () |
bool | in_uniform_space () const |
bool | has_inout_bndry () const |
Check if any of the boundaries is a mass-inflow-outflow. | |
void | set_inout_bndry () |
Set the inout_bndry flag. | |
Protected Member Functions | |
Field (FieldRepo &repo, std::string name, std::shared_ptr< FieldInfo > finfo, const unsigned fid, FieldState state) | |
Protected Attributes | |
FieldRepo & | m_repo |
Reference to the FieldRepository instance. | |
const std::string | m_name |
Name of the field. | |
std::shared_ptr< FieldInfo > | m_info |
Common data for all field states. | |
const unsigned | m_id |
Unique ID for this field. | |
const FieldState | m_state |
State for this field. | |
bool | m_fillpatch_on_regrid {false} |
bool | m_mesh_mapped {false} |
Flag to track mesh mapping (to uniform space) of field. | |
bool | m_inout_bndry {false} |
Flag to indicate whether any of the boundaries is mass-inflow-outflow. | |
Friends | |
class | FieldRepo |
Detailed Description
Computational field
This is an abstraction of a collection of MultiFabs over multiple levels, and allows operations on the field as a whole. The Field cannot be constructed directly but instead must be created using field creation functions in amr_wind::FieldRepo. This indirection is necessary to allow different parts of the code to hold a reference to the Field instance without having to worry about the changes in underlynig MultiFab data during regrid operations.
Field data is split into two groups: information that is unique to a particular field at a given time state, and data that is common to a given field with multiple timestates. The latter is held within amr_wind::FieldInfo object that is common to all time instances of a given Field (which are themselves Field instances). Different time instances of a Field can access other states through this FieldInfo instance, as well as access boundary conditions and fill patch operators applicable to all states.
As Field does not hold any data itself, but instead is just a thin wrapper to data held by amr_wind::FieldRepo, Field instance cannot be created directly. Instead the user must use amr_wind::FieldRepo::declare_field to create and initialize the field. This also ensures that the FieldInfo instance is managed properly during field creation. Once a field is created, the user can customize the behavior (e.g., registering fill patch operator, handling I/O on a per-field basis).
Constructor & Destructor Documentation
◆ Field() [1/2]
|
delete |
◆ ~Field()
|
default |
◆ Field() [2/2]
|
protected |
Member Function Documentation
◆ advance_states()
|
noexcept |
Advance timestep for fields with multiple states.
◆ apply_bc_funcs()
|
noexcept |
◆ base_name()
|
inline |
Base name (without state information)
◆ bc_initialized()
|
inline |
Return flag indicating whether BCs have been initialized.
◆ bc_type() [1/2]
|
inline |
◆ bc_type() [2/2]
|
inline |
◆ bc_values()
|
inline |
Return reference to the host view of BC values array.
◆ bc_values_device()
|
inline |
◆ bcrec()
|
inline |
Return reference to host view of BCRec array.
◆ bcrec_device()
|
inline |
◆ copy_bc_to_device()
|
inline |
Copy BC data from host to device
The data must have been created on host using the host arrays
◆ copy_state()
|
noexcept |
Copy a user-specified "from_state" to "to_state".
◆ create_state()
|
noexcept |
Create a new time state after the field has been created.
◆ field_location()
|
inline |
Cell, node, or face centered field.
◆ field_state()
|
inline |
State of this field instance.
◆ fillpatch() [1/4]
|
noexcept |
◆ fillpatch() [2/4]
|
noexcept |
◆ fillpatch() [3/4]
|
noexcept |
◆ fillpatch() [4/4]
|
inlinenoexcept |
◆ fillpatch_from_coarse() [1/2]
|
noexcept |
◆ fillpatch_from_coarse() [2/2]
|
inlinenoexcept |
◆ fillpatch_on_regrid() [1/2]
|
inline |
◆ fillpatch_on_regrid() [2/2]
|
inline |
◆ fillpatch_sibling_fields()
|
noexcept |
◆ fillphysbc() [1/4]
|
noexcept |
◆ fillphysbc() [2/4]
|
noexcept |
◆ fillphysbc() [3/4]
|
noexcept |
◆ fillphysbc() [4/4]
|
inlinenoexcept |
◆ has_fillpatch_op()
|
inline |
Return a flag indicating whether a fillpatch Op has been registered.
◆ has_inout_bndry()
|
inline |
Check if any of the boundaries is a mass-inflow-outflow.
◆ id()
|
inline |
Unique integer identifier for this field.
◆ in_uniform_space() [1/2]
|
inline |
◆ in_uniform_space() [2/2]
|
inline |
◆ name()
|
inline |
Name of this field (including state information)
◆ num_comp()
|
inline |
Number of components for this field.
◆ num_grow()
|
inline |
Ghost cells.
◆ num_states()
|
inline |
Number of states available for this field.
◆ num_time_states()
|
inline |
Number of exact time states available for this field.
◆ operator()() [1/2]
|
noexcept |
◆ operator()() [2/2]
|
noexcept |
Return MultiFab instance for a given level.
◆ operator=()
◆ query_state()
|
inline |
Return true if the requested state exists for this field.
◆ register_custom_bc()
|
inline |
Register a custom boundary conditions class
◆ register_fill_patch_op()
|
inline |
Register a custom fillpatch class instance for this field
The class must be a subclass of amr_wind::FieldFillPatchOpsBase
◆ repo()
◆ set_default_fillpatch_bc()
|
noexcept |
Setup default BC conditions for fillpatch operations
This method initializes the necessary BC data on the field so that a fillpatch call will interpolations on periodic faces and extrapolation on all the other boundaries. This method is useful for use with derived quantities where we still require some fill patch operations.
◆ set_inflow() [1/2]
|
noexcept |
◆ set_inflow() [2/2]
|
inlinenoexcept |
◆ set_inflow_sibling_fields()
|
noexcept |
◆ set_inout_bndry()
|
inline |
Set the inout_bndry flag.
◆ setVal() [1/3]
|
noexcept |
Set the field to a constant value at all levels.
◆ setVal() [2/3]
|
noexcept |
Set specific components of a multi-component field to a given value
- Parameters
-
value Constant value for initialization start_comp Starting component index (0-based) num_comp Number of components from starting component to initialize nghost Number of ghost cells to include
◆ setVal() [3/3]
|
noexcept |
Set components to those in the vector for a multi-component field
◆ state() [1/2]
Field & amr_wind::Field::state | ( | const FieldState | fstate | ) |
Return field at a different time state.
◆ state() [2/2]
const Field & amr_wind::Field::state | ( | const FieldState | fstate | ) | const |
◆ subview()
Return a sub-view of the Field instance
◆ to_stretched_space()
|
noexcept |
Map field to the stretched mesh
This method transforms the field to the stretched mesh based on the fields mesh_scaling_factor_cc or mesh_scaling_factor_nd depending on whether the field is cell-centered or node-centered, respectively.
◆ to_uniform_space()
|
noexcept |
Map field to the uniform mesh
This method transforms the field to the uniform mesh based on the fields mesh_scaling_factor_cc or mesh_scaling_factor_nd depending on whether the field is cell-centered or node-centered, respectively.
◆ vec_const_ptrs()
|
noexcept |
Return vector of const MultiFab*
for all levels.
◆ vec_ptrs()
|
noexcept |
Return a vector of MultiFab pointers for all levels.
Friends And Related Symbol Documentation
◆ FieldRepo
|
friend |
Member Data Documentation
◆ m_fillpatch_on_regrid
|
protected |
Flag indicating whether fill patch operation must be performed for this field during regrid
◆ m_id
|
protected |
Unique ID for this field.
◆ m_info
|
protected |
Common data for all field states.
◆ m_inout_bndry
|
protected |
Flag to indicate whether any of the boundaries is mass-inflow-outflow.
◆ m_mesh_mapped
|
protected |
Flag to track mesh mapping (to uniform space) of field.
◆ m_name
|
protected |
Name of the field.
◆ m_repo
|
protected |
Reference to the FieldRepository instance.
◆ m_state
|
protected |
State for this field.
The documentation for this class was generated from the following files:
Generated by 1.12.0