Field operations

AMR-Wind API: Field operations
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
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)
template<typename T1, typename T2>
void amr_wind::field_ops::add (T1 &dst, const T2 &src, int srccomp, int dstcomp, int numcomp, int nghost)
template<typename T1, typename T2>
void amr_wind::field_ops::divide (T1 &dst, const T2 &src, const int srccomp, const int dstcomp, const int ncomp_src, const int ncomp_dst, const amrex::IntVect &nghost)
template<typename T1, typename T2>
void amr_wind::field_ops::divide (T1 &dst, const T2 &src, const int srccomp, const int dstcomp, const int ncomp_src, const int ncomp_dst, const int nghost)
template<typename T1, typename T2>
void amr_wind::field_ops::copy (T1 &dst, const T2 &src, const int srccomp, const int dstcomp, const int numcomp, const amrex::IntVect &nghost)
template<typename T1, typename T2>
void amr_wind::field_ops::copy (T1 &dst, const T2 &src, int srccomp, int dstcomp, int numcomp, int nghost)
template<typename T1, typename T2>
void amr_wind::field_ops::saxpy (T1 &dst, const amrex::Real a, const T2 &src, const int srccomp, const int dstcomp, const int numcomp, const amrex::IntVect &nghost)
template<typename T1, typename T2>
void amr_wind::field_ops::saxpy (T1 &dst, const amrex::Real a, const T2 &src, const int srccomp, const int dstcomp, const int numcomp, const int nghost)
template<typename T1, typename T2>
void amr_wind::field_ops::xpay (T1 &dst, const amrex::Real a, const T2 &src, const int srccomp, const int dstcomp, const int numcomp, const amrex::IntVect &nghost)
template<typename T1, typename T2>
void amr_wind::field_ops::xpay (T1 &dst, const amrex::Real a, const T2 &src, const int srccomp, const int dstcomp, const int numcomp, const int nghost)
template<typename T1, typename T2, typename T3>
void amr_wind::field_ops::lincomb (T1 &dst, const amrex::Real a, const T2 &x, const int xcomp, const amrex::Real b, const T3 &y, const int ycomp, const int dstcomp, const int numcomp, const amrex::IntVect &nghost)
template<typename T1, typename T2, typename T3>
void amr_wind::field_ops::lincomb (T1 &dst, const amrex::Real a, const T2 &x, const int xcomp, const amrex::Real b, const T3 &y, const int ycomp, const int dstcomp, const int numcomp, const int nghost)
template<typename FType>
void amr_wind::field_ops::lower_bound (FType &field, const amrex::Real min_value, const int icomp=0)
template<typename FType>
amrex::Real amr_wind::field_ops::global_max_magnitude (FType &field)
template<typename FType>
void amr_wind::field_ops::normalize (FType &field)
AMREX_INLINE amrex::IndexType amr_wind::field_impl::index_type (const FieldLoc floc)
AMREX_INLINE std::string amr_wind::field_impl::field_name_with_state (const std::string &fname, const FieldState fstate)
AMREX_INLINE bool amr_wind::field_impl::is_valid_field_name (const std::string &name)
AMREX_INLINE amrex::Interpolater * amr_wind::field_impl::get_interpolation_operator (const FieldInterpolator itype)

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 )

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 )

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,
const int srccomp,
const int dstcomp,
const int numcomp,
const amrex::IntVect & nghost )

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 )

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

◆ divide() [1/2]

template<typename T1, typename T2>
void amr_wind::field_ops::divide ( T1 & dst,
const T2 & src,
const int srccomp,
const int dstcomp,
const int ncomp_src,
const int ncomp_dst,
const amrex::IntVect & nghost )

Divide two fields \(y = y / x\)

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]srcField to be divisor
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]ncomp_srcNumber of components to divide by
[in]ncomp_dstNumber of components to be divided
[in]nghostNumber of ghost cells to be updated

◆ divide() [2/2]

template<typename T1, typename T2>
void amr_wind::field_ops::divide ( T1 & dst,
const T2 & src,
const int srccomp,
const int dstcomp,
const int ncomp_src,
const int ncomp_dst,
const int nghost )

Divide two fields \(y = y / x\)

Template Parameters
T1Field or ScratchField
T2Field or ScratchField
Parameters
[out]dstField that is updated
[in]srcField to be divisor
[in]srccompStarting component index of source field
[in]dstcompStarting component index of destination field
[in]ncomp_srcNumber of components to divide by
[in]ncomp_dstNumber of components to be divided
[in]nghostNumber of ghost cells to be updated

◆ field_name_with_state()

AMREX_INLINE 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.

◆ get_interpolation_operator()

AMREX_INLINE 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

◆ global_max_magnitude()

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

Computes the global maximum of a field from all levels

Parameters
[in]fieldField for global maximum magnitude

◆ index_type()

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

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

◆ is_valid_field_name()

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

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,
const amrex::Real a,
const T2 & x,
const int xcomp,
const amrex::Real b,
const T3 & y,
const int ycomp,
const int dstcomp,
const int numcomp,
const amrex::IntVect & nghost )

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,
const amrex::Real a,
const T2 & x,
const int xcomp,
const amrex::Real b,
const T3 & y,
const int ycomp,
const int dstcomp,
const int numcomp,
const int nghost )

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 )

Set the lower bound for a given scalar field

Parameters
[in]fieldField that will be clipped
[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)

Normalizes a field using its magnitude

Parameters
[in]fieldField that needs to be normalized

◆ saxpy() [1/2]

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

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,
const amrex::Real a,
const T2 & src,
const int srccomp,
const int dstcomp,
const int numcomp,
const int nghost )

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,
const amrex::Real a,
const T2 & src,
const int srccomp,
const int dstcomp,
const int numcomp,
const amrex::IntVect & nghost )

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,
const amrex::Real a,
const T2 & src,
const int srccomp,
const int dstcomp,
const int numcomp,
const int nghost )

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