|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|
Runtime state and operations for turbulent perturbation forcing. More...
#include <ERF_TurbPertStruct.H>

Classes | |
| struct | UniformClock |
Public Member Functions | |
| ~TurbulentPerturbation () | |
| Destroy turbulent perturbation state. More... | |
| void | init_tpi_type (const int lev, const PerturbationType &pert_type, const int max_level) |
| Store the integer perturbation-type selector for one AMR level. More... | |
| void | init_tpi (const int lev, const amrex::Vector< amrex::BoxArray > &subdomains_lev, const amrex::GpuArray< amrex::Real, 3 > dx, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm, const int ngrow_state, std::string pp_prefix, const amrex::Vector< amrex::IntVect > refRatio, const int max_level, const bool automatic=false) |
| Initialize turbulent perturbation regions and per-box storage. More... | |
| amrex::Box | automatic_face_box (const amrex::Box &subdomain, int face) const |
| bool | automatic_update_due (int lev, double time) const |
| bool | uniform_refresh_enabled (int lev) const |
| bool | uniform_wind_update_due (int lev, double time) const |
| amrex::Real | uniform_sampling_height () const |
| amrex::Real | uniform_sampling_period () const |
| bool | uniform_sampling_face (int face) const |
| void | set_uniform_advection (int lev, double time, amrex::Real speed, double wind_period) |
| double | uniform_refresh_interval (int lev) const |
| bool | calc_tpi_uniform_update (int lev, double time) |
| void | configure_automatic (int lev, double time, double period, const amrex::Vector< AutomaticPerturbationFace > &faces, const amrex::Geometry &geom, const amrex::MultiFab *z_cc, const amrex::MultiFab *z_nd, const amrex::MultiFab *z_ground) |
| void | calc_tpi_update (const int lev, const double dt, amrex::MultiFab &mf_xvel, amrex::MultiFab &mf_yvel, amrex::MultiFab &mf_cons) |
| Update perturbation amplitudes and intervals when each box is ready. More... | |
| void | apply_tpi (const int &lev, const amrex::Box &vbx, const int &comp, const amrex::IndexType &m_ixtype, const amrex::Array4< amrex::Real > &src_arr, const amrex::Array4< amrex::Real const > &pert_cell, const amrex::Real scale=one) |
| Apply stored turbulent perturbations to a source or state array. More... | |
| void | calc_tpi_amp (const int &lev, const int &boxIdx, const double &interval) |
| Compute the perturbation amplitude for one perturbation box. More... | |
| void | pseudoRandomPert (const int &boxIdx, const int &lev, const amrex::IndexType &m_ixtype) |
| Assign pseudo-random perturbations to cells in one perturbation box. More... | |
| void | zero_amp (const int &boxIdx, const int &lev, const amrex::IndexType &m_ixtype) |
| Reset CPM perturbation amplitudes in one perturbation box to zero. More... | |
| void | netZeroBuoyant (const int &lev) |
| Remove the mean of the box-perturbation field, so the net buoyant forcing is zero. More... | |
| void | calc_tpi_meanMag (const int &lev, const amrex::Vector< int > &update_box, amrex::MultiFab &mf_cons, amrex::MultiFab &mf_xvel, amrex::MultiFab &mf_yvel) |
| Compute the mean horizontal velocity magnitude and direction of the refreshing perturbation boxes. More... | |
| void | debug (double) |
| Write perturbation debug information when debug output is enabled. More... | |
Static Public Member Functions | |
| static amrex::Real | box_sum (const amrex::Array4< const amrex::Real > &arr, const amrex::Box &bx) |
| Sum an array over a box. More... | |
Public Attributes | |
| amrex::Vector< int > | pt_type |
| Integer perturbation type for each AMR level. More... | |
| amrex::Vector< amrex::BoxArray > | pb_ba |
| Perturbation-box BoxArray for each AMR level. More... | |
| amrex::Vector< amrex::Vector< amrex::Real > > | pb_mag |
| Mean velocity magnitude for each perturbation box [m/s]. More... | |
| amrex::Vector< amrex::Vector< amrex::Real > > | pb_dir |
| Mean velocity direction for each perturbation box. More... | |
| amrex::Vector< amrex::MultiFab > | pb_cell |
| Per-cell perturbation amplitude storage. More... | |
Private Attributes | |
| bool | uniform_mode {true} |
| amrex::Real | uniform_height {amrex::Real(20)} |
| amrex::Real | uniform_wind_period {amrex::Real(600)} |
| amrex::Vector< UniformClock > | uniform_clock |
| bool | auto_mode {false} |
| amrex::Vector< amrex::Vector< amrex::Real > > | pb_Ug |
| amrex::Vector< amrex::MultiFab > | auto_mask |
| amrex::Vector< double > | auto_next_update |
| amrex::Vector< int > | auto_ready |
| int | tpi_layers |
| Number of layers of perturbation boxes. More... | |
| int | tpi_offset |
| Cell offset for the start of the perturbation region. More... | |
| amrex::Vector< int > | tpi_boxDim |
| Dimensions of each perturbation box. More... | |
| amrex::Vector< int > | tpi_direction |
| Boundary directions where perturbations are applied. More... | |
| amrex::Real | tpi_nonDim |
| Nondimensional number used by the perturbation formulation. More... | |
| amrex::Real | tpi_Ti |
| Temperature intensity used by the perturbation formulation. More... | |
| amrex::Real | tpi_Tinf |
| Reference temperature used by the perturbation formulation [K]. More... | |
| amrex::Vector< amrex::Real > | tpi_Hpb |
| Perturbation-box height for each AMR level [m]. More... | |
| amrex::Vector< amrex::Real > | tpi_Lpb |
| Perturbation-box length for each AMR level [m]. More... | |
| amrex::Vector< amrex::Real > | tpi_Wpb |
| Perturbation-box width for each AMR level [m]. More... | |
| amrex::Vector< amrex::Real > | tpi_lref |
| Perturbation-box reference length for each AMR level [m]. More... | |
| amrex::Real | tpi_net_buoyant |
| Accumulated net buoyant perturbation used for correction. More... | |
| amrex::Real | tpi_pert_adjust |
| Per-cell perturbation adjustment used for net-zero buoyancy. More... | |
| amrex::Vector< amrex::IntVect > | ref_ratio |
| Refinement ratios used by multilevel perturbation scaling. More... | |
| amrex::Real | input_Ug |
| Input geostrophic wind speed used to scale CPM perturbations. More... | |
| amrex::Real | input_w_amp |
| Input vertical velocity perturbation amplitude. More... | |
| int | perturbation_klo |
| Lower vertical index bound for perturbations. More... | |
| int | perturbation_khi |
| Upper vertical index bound for perturbations. More... | |
| amrex::Vector< amrex::Vector< double > > | pb_interval |
| Perturbation update interval for each box [s]. More... | |
| amrex::Vector< amrex::Vector< double > > | pb_local_etime |
| Local elapsed time for each perturbation box [s]. More... | |
| amrex::Vector< amrex::Vector< amrex::Real > > | pb_amp |
| Perturbation amplitude for each perturbation box. More... | |
| amrex::Vector< amrex::Vector< amrex::Real > > | pb_netZero |
| Per-box storage used for net-zero buoyancy calculation. More... | |
| amrex::Vector< amrex::Vector< int > > | pb_nupdate |
| Number of times each perturbation box has been refreshed; keys its random numbers. More... | |
| std::uint64_t | tpi_seed = 0 |
| Seed of the hashed random numbers (1024 with erf.fix_random_seed, else erf.random_seed, else 0). More... | |
Static Private Attributes | |
| static constexpr int | hash_comp_cell = 0 |
| Hash salt of the per-cell perturbation values. More... | |
| static constexpr int | hash_comp_cpm = 1 |
| Hash salt of the per-box CPM values. More... | |
| static constexpr int | hash_comp_interval = 2 |
| Hash salt of the refresh-interval variation. More... | |
Runtime state and operations for turbulent perturbation forcing.
|
inline |
|
inline |
Apply stored turbulent perturbations to a source or state array.
| lev | AMR level index. |
| vbx | Valid box over which perturbations may be applied. |
| comp | Component to modify, or -1 for vertical velocity perturbations. |
| m_ixtype | Index type of the destination array. |
| src_arr | Destination array receiving perturbation increments. |
| pert_cell | Stored perturbation amplitudes. |
| scale | Factor applied to the stored amplitudes (the time step for the direct perturbation, whose stored amplitudes are rates). |
Referenced by make_sources().


|
inline |
Referenced by init_tpi().

|
inline |
|
inlinestatic |
Sum an array over a box.
| arr | Array to sum. |
| bx | Box to sum over. |
Referenced by calc_tpi_meanMag(), and netZeroBuoyant().

|
inline |
Compute the perturbation amplitude for one perturbation box.
| lev | AMR level index. |
| boxIdx | Perturbation-box index on the level. |
| interval | Current perturbation update interval [s]. |
Referenced by calc_tpi_uniform_update(), and calc_tpi_update().

|
inline |
Compute the mean horizontal velocity magnitude and direction of the refreshing perturbation boxes.
The velocities are summed over every grid box a perturbation box overlaps, each face once, and over all ranks, so every rank gets the same mean whatever the domain decomposition.
| lev | AMR level index. |
| update_box | Nonzero for the perturbation boxes that refresh this step. |
| mf_cons | Conserved state used for iteration layout. |
| mf_xvel | X-velocity field. |
| mf_yvel | Y-velocity field. |
Referenced by calc_tpi_update().


|
inline |

|
inline |
Update perturbation amplitudes and intervals when each box is ready.
| lev | AMR level index. |
| dt | Time step for elapsed-time accumulation. |
| mf_xvel | X-velocity field used to compute box mean velocities. |
| mf_yvel | Y-velocity field used to compute box mean velocities. |
| mf_cons | Conserved state used for iteration layout. |

|
inline |

|
inline |
|
inline |
Initialize turbulent perturbation regions and per-box storage.
| lev | AMR level index. |
| subdomains_lev | Rectangular level subdomains used to define perturbation regions. |
| dx | Cell spacing for this level. |
| ba | State BoxArray used for perturbation-cell storage. |
| dm | DistributionMapping for perturbation-cell storage. |
| ngrow_state | Number of ghost cells for perturbation-cell storage. |
| pp_prefix | ParmParse prefix for the ERF input namespace. |
| refRatio | Refinement ratios between AMR levels. |
| max_level | Maximum AMR level configured for the run. |
| automatic | Select runtime inflow/height masks driven by the parent. |

|
inline |
Store the integer perturbation-type selector for one AMR level.
| lev | AMR level index. |
| pert_type | Perturbation type selected for this level. |
| max_level | Maximum AMR level configured for the run. |
|
inline |
Remove the mean of the box-perturbation field, so the net buoyant forcing is zero.
Each perturbation box's mean is summed over every grid box it overlaps and over all ranks, so the correction does not depend on the domain decomposition.
| lev | AMR level index. |
Referenced by calc_tpi_update().


|
inline |
Assign pseudo-random perturbations to cells in one perturbation box.
| boxIdx | Perturbation-box index on the level. |
| lev | AMR level index. |
| m_ixtype | Index type used to align perturbation storage. |
Referenced by calc_tpi_uniform_update(), and calc_tpi_update().


|
inline |

|
inline |
Referenced by apply_tpi(), calc_tpi_uniform_update(), init_tpi(), and set_uniform_advection().

|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Reset CPM perturbation amplitudes in one perturbation box to zero.
| boxIdx | Perturbation-box index on the level. |
| lev | AMR level index. |
| m_ixtype | Index type used to align perturbation storage. |
Referenced by calc_tpi_update().


|
private |
Referenced by configure_automatic(), init_tpi(), netZeroBuoyant(), and pseudoRandomPert().
|
private |
Referenced by calc_tpi_amp(), calc_tpi_uniform_update(), calc_tpi_update(), init_tpi(), netZeroBuoyant(), and pseudoRandomPert().
|
private |
Referenced by automatic_update_due(), configure_automatic(), and init_tpi().
|
private |
Referenced by automatic_update_due(), calc_tpi_uniform_update(), calc_tpi_update(), configure_automatic(), and init_tpi().
|
staticconstexprprivate |
Hash salt of the per-cell perturbation values.
Referenced by pseudoRandomPert().
|
staticconstexprprivate |
Hash salt of the per-box CPM values.
Referenced by pseudoRandomPert().
|
staticconstexprprivate |
Hash salt of the refresh-interval variation.
Referenced by calc_tpi_update().
|
private |
Input geostrophic wind speed used to scale CPM perturbations.
Referenced by calc_tpi_amp(), and init_tpi().
|
private |
Input vertical velocity perturbation amplitude.
Referenced by calc_tpi_amp(), and init_tpi().
|
private |
Perturbation amplitude for each perturbation box.
Referenced by calc_tpi_amp(), init_tpi(), and pseudoRandomPert().
| TurbulentPerturbation::pb_ba |
Perturbation-box BoxArray for each AMR level.
Referenced by apply_tpi(), calc_tpi_meanMag(), calc_tpi_uniform_update(), calc_tpi_update(), configure_automatic(), init_tpi(), netZeroBuoyant(), pseudoRandomPert(), and zero_amp().
| TurbulentPerturbation::pb_cell |
Per-cell perturbation amplitude storage.
Referenced by calc_tpi_uniform_update(), configure_automatic(), init_tpi(), make_sources(), netZeroBuoyant(), pseudoRandomPert(), and zero_amp().
| TurbulentPerturbation::pb_dir |
Mean velocity direction for each perturbation box.
Referenced by calc_tpi_meanMag(), calc_tpi_update(), configure_automatic(), and init_tpi().
|
private |
Perturbation update interval for each box [s].
Referenced by calc_tpi_uniform_update(), calc_tpi_update(), configure_automatic(), and init_tpi().
|
private |
Local elapsed time for each perturbation box [s].
Referenced by calc_tpi_uniform_update(), calc_tpi_update(), configure_automatic(), and init_tpi().
| TurbulentPerturbation::pb_mag |
Mean velocity magnitude for each perturbation box [m/s].
Referenced by calc_tpi_amp(), calc_tpi_meanMag(), calc_tpi_update(), configure_automatic(), and init_tpi().
|
private |
Per-box storage used for net-zero buoyancy calculation.
Referenced by init_tpi(), and netZeroBuoyant().
|
private |
Number of times each perturbation box has been refreshed; keys its random numbers.
Referenced by calc_tpi_uniform_update(), calc_tpi_update(), init_tpi(), and pseudoRandomPert().
|
private |
Referenced by calc_tpi_amp(), configure_automatic(), and init_tpi().
|
private |
Upper vertical index bound for perturbations.
Referenced by init_tpi().
|
private |
Lower vertical index bound for perturbations.
Referenced by init_tpi().
| TurbulentPerturbation::pt_type |
Integer perturbation type for each AMR level.
Referenced by apply_tpi(), calc_tpi_amp(), calc_tpi_update(), configure_automatic(), init_tpi(), init_tpi_type(), pseudoRandomPert(), uniform_refresh_enabled(), and zero_amp().
|
private |
Refinement ratios used by multilevel perturbation scaling.
Referenced by calc_tpi_amp(), and init_tpi().
|
private |
Dimensions of each perturbation box.
Referenced by automatic_face_box(), and init_tpi().
|
private |
Boundary directions where perturbations are applied.
Referenced by init_tpi(), and uniform_sampling_face().
|
private |
Perturbation-box height for each AMR level [m].
Referenced by calc_tpi_amp(), and init_tpi().
|
private |
Number of layers of perturbation boxes.
Referenced by automatic_face_box(), calc_tpi_uniform_update(), calc_tpi_update(), init_tpi(), and set_uniform_advection().
|
private |
Perturbation-box length for each AMR level [m].
Referenced by calc_tpi_update(), init_tpi(), and set_uniform_advection().
|
private |
Perturbation-box reference length for each AMR level [m].
Referenced by calc_tpi_update(), and init_tpi().
|
private |
Accumulated net buoyant perturbation used for correction.
Referenced by init_tpi(), and netZeroBuoyant().
|
private |
Nondimensional number used by the perturbation formulation.
Referenced by calc_tpi_amp(), and init_tpi().
|
private |
Cell offset for the start of the perturbation region.
Referenced by automatic_face_box(), and init_tpi().
|
private |
Per-cell perturbation adjustment used for net-zero buoyancy.
Referenced by init_tpi(), and netZeroBuoyant().
|
private |
Seed of the hashed random numbers (1024 with erf.fix_random_seed, else erf.random_seed, else 0).
Referenced by calc_tpi_update(), init_tpi(), and pseudoRandomPert().
|
private |
Temperature intensity used by the perturbation formulation.
Referenced by calc_tpi_amp(), and init_tpi().
|
private |
Reference temperature used by the perturbation formulation [K].
Referenced by calc_tpi_amp(), and init_tpi().
|
private |
Perturbation-box width for each AMR level [m].
Referenced by calc_tpi_update(), init_tpi(), and set_uniform_advection().
|
private |
|
private |
Referenced by init_tpi(), and uniform_sampling_height().
|
private |
Referenced by init_tpi(), and uniform_refresh_enabled().
|
private |
Referenced by init_tpi(), and uniform_sampling_period().