AMR-Wind  v0.1.0
CFD solver for wind plant simulations
Functions
Field operations

Operators for manipulating fields and computing derived quantities. More...

Collaboration diagram for Field operations:

Functions

template<typename T1 , typename T2 >
void amr_wind::field_ops::add (T1 &dst, const T2 &src, int srccomp, int dstcomp, int numcomp, const amrex::IntVect &nghost)
 Add two fields \(y = x + y\). More...
 
template<typename T1 , typename T2 >
void amr_wind::field_ops::add (T1 &dst, const T2 &src, int srccomp, int dstcomp, int numcomp, int nghost)
 Add two fields \(y = x + y\). More...
 
template<typename T1 , typename T2 >
void amr_wind::field_ops::copy (T1 &dst, const T2 &src, int srccomp, int dstcomp, int numcomp, const amrex::IntVect &nghost)
 Copy source field to destination field. More...
 
template<typename T1 , typename T2 >
void amr_wind::field_ops::copy (T1 &dst, const T2 &src, int srccomp, int dstcomp, int numcomp, int nghost)
 Copy source field to destination field. More...
 
template<typename T1 , typename T2 >
void amr_wind::field_ops::saxpy (T1 &dst, amrex::Real a, const T2 &src, int srccomp, int dstcomp, int numcomp, const amrex::IntVect &nghost)
 Perform operation \(y = a x + y\). More...
 
template<typename T1 , typename T2 >
void amr_wind::field_ops::saxpy (T1 &dst, amrex::Real a, const T2 &src, int srccomp, int dstcomp, int numcomp, int nghost)
 Perform operation \(y = a x + y\). More...
 
template<typename T1 , typename T2 >
void amr_wind::field_ops::xpay (T1 &dst, amrex::Real a, const T2 &src, int srccomp, int dstcomp, int numcomp, const amrex::IntVect &nghost)
 Perform operation \(y = x + a y\). More...
 
template<typename T1 , typename T2 >
void amr_wind::field_ops::xpay (T1 &dst, amrex::Real a, const T2 &src, int srccomp, int dstcomp, int numcomp, int nghost)
 Perform operation \(y = x + a y\). More...
 
template<typename T1 , typename T2 , typename T3 >
void amr_wind::field_ops::lincomb (T1 &dst, amrex::Real a, const T2 &x, int xcomp, amrex::Real b, const T3 &y, int ycomp, int dstcomp, int numcomp, const amrex::IntVect &nghost)
 Perform operation \(z = a x + b y\). More...
 
template<typename T1 , typename T2 , typename T3 >
void amr_wind::field_ops::lincomb (T1 &dst, amrex::Real a, const T2 &x, int xcomp, amrex::Real b, const T3 &y, int ycomp, int dstcomp, int numcomp, int nghost)
 Perform operation \(z = a x + b y\). More...
 
template<typename FType >
void amr_wind::field_ops::lower_bound (FType &field, const amrex::Real min_value, const int icomp=0)
 Set the lower bound for a given scalar field. More...
 
template<typename FType >
amrex::Real amr_wind::field_ops::global_max_magnitude (FType &field)
 Computes the global maximum of a field from all levels. More...
 
template<typename FType >
void amr_wind::field_ops::normalize (FType &field)
 Normalizes a field using its magnitude. More...
 
amrex::IndexType amr_wind::field_impl::index_type (const FieldLoc floc)
 Convert amr_wind::FieldLoc to index type for use with AMReX objects. More...
 
std::string amr_wind::field_impl::field_name_with_state (const std::string &fname, const FieldState fstate)
 Given a base field name and a state, return a unique string that identifies this state in the field repository. More...
 
bool amr_wind::field_impl::is_valid_field_name (const std::string &name)
 Check if the field is not a reserved field name. More...
 
amrex::Interpolater * amr_wind::field_impl::get_interpolation_operator (const FieldInterpolator itype)
 Return an AMReX coarse-to-fine field interpolation object based on amr_wind::FieldInterpolator. More...
 

Detailed Description

Operators for manipulating fields and computing derived quantities.

This group documents functions that provide various operations defined on the field. These operations can be grouped into two major categories: simple linear algebra operations (e.g., saxpy), and discretization operators such as gradient, laplacian computations.

Function Documentation

◆ add() [1/2]

template<typename T1 , typename T2 >
void amr_wind::field_ops::add ( T1 &  dst,
const T2 &  src,
int  srccomp,
int  dstcomp,
int  numcomp,
const amrex::IntVect &  nghost 
)
inline

Add two fields \(y = x + y\).

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]srcField to be added
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated

◆ add() [2/2]

template<typename T1 , typename T2 >
void amr_wind::field_ops::add ( T1 &  dst,
const T2 &  src,
int  srccomp,
int  dstcomp,
int  numcomp,
int  nghost 
)
inline

Add two fields \(y = x + y\).

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]srcField to be added
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated

◆ copy() [1/2]

template<typename T1 , typename T2 >
void amr_wind::field_ops::copy ( T1 &  dst,
const T2 &  src,
int  srccomp,
int  dstcomp,
int  numcomp,
const amrex::IntVect &  nghost 
)
inline

Copy source field to destination field.

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]srcField to be added
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated

◆ copy() [2/2]

template<typename T1 , typename T2 >
void amr_wind::field_ops::copy ( T1 &  dst,
const T2 &  src,
int  srccomp,
int  dstcomp,
int  numcomp,
int  nghost 
)
inline

Copy source field to destination field.

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]srcField to be added
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated

◆ field_name_with_state()

std::string amr_wind::field_impl::field_name_with_state ( const std::string &  fname,
const FieldState  fstate 
)
inline

Given a base field name and a state, return a unique string that identifies this state in the field repository.

◆ get_interpolation_operator()

amrex::Interpolater* amr_wind::field_impl::get_interpolation_operator ( const FieldInterpolator  itype)
inline

Return an AMReX coarse-to-fine field interpolation object based on amr_wind::FieldInterpolator.

◆ global_max_magnitude()

template<typename FType >
amrex::Real amr_wind::field_ops::global_max_magnitude ( FType &  field)
inline

Computes the global maximum of a field from all levels.

Parameters
[in]fieldwe need to compute its global maximum magnitude

◆ index_type()

amrex::IndexType amr_wind::field_impl::index_type ( const FieldLoc  floc)
inline

Convert amr_wind::FieldLoc to index type for use with AMReX objects.

◆ is_valid_field_name()

bool amr_wind::field_impl::is_valid_field_name ( const std::string &  name)
inline

Check if the field is not a reserved field name.

In amr_wind::FieldRepo, field with states are stored using suffixes that create a unique string to identify different states. This function checks if the user specified field name matches any of those reserved suffixes.

.

Returns
True if the field is not a reserved field name

◆ lincomb() [1/2]

template<typename T1 , typename T2 , typename T3 >
void amr_wind::field_ops::lincomb ( T1 &  dst,
amrex::Real  a,
const T2 &  x,
int  xcomp,
amrex::Real  b,
const T3 &  y,
int  ycomp,
int  dstcomp,
int  numcomp,
const amrex::IntVect &  nghost 
)
inline

Perform operation \(z = a x + b y\).

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]aCoefficient
[in]xField to be added
[in]xcompStarting component index of x field
[in]bCoefficient
[in]yField to be added
[in]ycompStarting component index of y field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated

◆ lincomb() [2/2]

template<typename T1 , typename T2 , typename T3 >
void amr_wind::field_ops::lincomb ( T1 &  dst,
amrex::Real  a,
const T2 &  x,
int  xcomp,
amrex::Real  b,
const T3 &  y,
int  ycomp,
int  dstcomp,
int  numcomp,
int  nghost 
)
inline

Perform operation \(z = a x + b y\).

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]aCoefficient
[in]xField to be added
[in]xcompStarting component index of x field
[in]bCoefficient
[in]yField to be added
[in]ycompStarting component index of y field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated

◆ lower_bound()

template<typename FType >
void amr_wind::field_ops::lower_bound ( FType &  field,
const amrex::Real  min_value,
const int  icomp = 0 
)
inline

Set the lower bound for a given scalar field.

Parameters
[in]min_valueMinimum value for a given field
[in]icompComponent to set the minimum bound

◆ normalize()

template<typename FType >
void amr_wind::field_ops::normalize ( FType &  field)
inline

Normalizes a field using its magnitude.

Parameters
[in]fieldthat needs to be normalized

◆ saxpy() [1/2]

template<typename T1 , typename T2 >
void amr_wind::field_ops::saxpy ( T1 &  dst,
amrex::Real  a,
const T2 &  src,
int  srccomp,
int  dstcomp,
int  numcomp,
const amrex::IntVect &  nghost 
)
inline

Perform operation \(y = a x + y\).

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]aCoefficient
[in]srcField to be added
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated

◆ saxpy() [2/2]

template<typename T1 , typename T2 >
void amr_wind::field_ops::saxpy ( T1 &  dst,
amrex::Real  a,
const T2 &  src,
int  srccomp,
int  dstcomp,
int  numcomp,
int  nghost 
)
inline

Perform operation \(y = a x + y\).

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]aCoefficient
[in]srcField to be added
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated

◆ xpay() [1/2]

template<typename T1 , typename T2 >
void amr_wind::field_ops::xpay ( T1 &  dst,
amrex::Real  a,
const T2 &  src,
int  srccomp,
int  dstcomp,
int  numcomp,
const amrex::IntVect &  nghost 
)
inline

Perform operation \(y = x + a y\).

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]aCoefficient
[in]srcField to be added
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated

◆ xpay() [2/2]

template<typename T1 , typename T2 >
void amr_wind::field_ops::xpay ( T1 &  dst,
amrex::Real  a,
const T2 &  src,
int  srccomp,
int  dstcomp,
int  numcomp,
int  nghost 
)
inline

Perform operation \(y = x + a y\).

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]aCoefficient
[in]srcField to be added
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]numcompNumber of components to be updated
[in]nghostNumber of ghost cells to be updated