ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_Utils.H File Reference
#include <utility>
#include "AMReX.H"
#include "AMReX_MultiFab.H"
#include "AMReX_BCRec.H"
#include "ERF_NumericalConstants.H"
#include "ERF_MicrophysicsConstants.H"
#include "ERF_DataStruct.H"
#include "ERF_IndexDefines.H"
#include "ERF_SurfaceLayer.H"
#include "ERF_FillPatcher.H"
#include "ERF_ImmersedWallCell.H"
#include "ERF_ReadBndryPlanes.H"
Include dependency graph for ERF_Utils.H:

Go to the source code of this file.

Classes

struct  RealBdyConsMaps
 
struct  BdyTimeWeights
 

Enumerations

enum class  TimeLevelSel { Old , New , Interp }
 

Functions

RealBdyConsMaps real_bdy_cons_maps (const bool read_density)
 
void rebalance_columns (amrex::MultiFab &rho, amrex::MultiFab &theta, const amrex::MultiFab &qt, const amrex::MultiFab &qv, const amrex::MultiFab *z_phys, const amrex::Geometry &geom, const bool &maintain_Th, bool use_sfc=false)
 
void recompute_p_pi_hse (amrex::MultiFab &base_state_mf, amrex::Real l_rdOcp)
 
void ChopGrids2D (amrex::BoxArray &ba, const amrex::Box &domain, int target_size)
 
amrex::BoxArray ERFPostProcessBaseGrids (const amrex::Box &domain, bool decompose_in_z)
 
void cons_to_prim (const amrex::MultiFab &cons_state, amrex::MultiFab &S_prim, int ng)
 
void fill_wall_dist_ghost_cells (amrex::MultiFab &wdist, const amrex::Geometry &geom)
 
void make_qt (const amrex::MultiFab &cons_state, amrex::MultiFab &qt, int n_qstate_into_total)
 
void average_down_faces_mapfac (const amrex::MultiFab &fine, amrex::MultiFab &crse, const amrex::IntVect &rr, const amrex::Periodicity &cper, const amrex::MultiFab &mf_f, const amrex::MultiFab &mf_c, const amrex::MultiFab *mf2_f, const amrex::MultiFab *mf2_c, const amrex::MultiFab *area_f, const amrex::MultiFab *area_c)
 
void if_average_down (const amrex::MultiFab &S_fine, amrex::MultiFab &S_crse, const amrex::MultiFab &beta_fine, const amrex::MultiFab &beta_crse, const amrex::MultiFab &vol_fine, int scomp, int ncomp, const amrex::IntVect &ratio)
 
void immersed_wall_dist (amrex::MultiFab &wdist, const amrex::MultiFab &terrain_blank, const amrex::MultiFab &z_phys_nd, const amrex::MultiFab &z_phys_cc, const amrex::Box &domain, amrex::Real small_volfrac, amrex::MultiFab *wall_height=nullptr, const amrex::MultiFab *wall_height_crse=nullptr)
 
void make_ib_wall_face_masks (const amrex::MultiFab &terrain_blank, amrex::MultiFab &mask13, amrex::MultiFab &mask23, amrex::MultiFab &mask33, const amrex::Box &domain, amrex::Real small_volfrac, int spacing=0, amrex::Real dz=amrex::Real(1.0), amrex::Real z0=amrex::Real(0.1))
 
std::pair< int, amrex::Real > if_cf_surface_mismatch (const amrex::MultiFab &fine_tb, const amrex::BoxArray &fine_grids, const amrex::BoxArray &crse_grids, const amrex::DistributionMapping &crse_dmap, const amrex::Geometry &crse_geom, const amrex::IntVect &ratio, amrex::Real warn)
 
void make_J (const amrex::Geometry &geom, amrex::MultiFab &z_phys_nd, amrex::MultiFab &detJ_cc)
 
void make_areas (const amrex::Geometry &geom, amrex::MultiFab &z_phys_nd, amrex::MultiFab &ax, amrex::MultiFab &ay, amrex::MultiFab &az)
 
void make_zcc (const amrex::Geometry &geom, amrex::MultiFab &z_phys_nd, amrex::MultiFab &z_phys_cc)
 
void make_zsfc_nd (const amrex::Geometry &geom, const amrex::MultiFab &z_phys_nd, amrex::MultiFab &z_sfc_nd, const amrex::MultiFab *z_sfc_crse=nullptr, const amrex::IntVect &ref_ratio=amrex::IntVect(1))
 
void MomentumToVelocity (amrex::MultiFab &xvel_out, amrex::MultiFab &yvel_out, amrex::MultiFab &zvel_out, const amrex::MultiFab &cons_in, const amrex::MultiFab &xmom_in, const amrex::MultiFab &ymom_in, const amrex::MultiFab &zmom_in, const amrex::Box &domain, const amrex::Vector< amrex::BCRec > &domain_bcs_type_h, const amrex::MultiFab *c_vfrac=nullptr)
 
void VelocityToMomentum (const amrex::MultiFab &xvel_in, const amrex::IntVect &xvel_ngrow, const amrex::MultiFab &yvel_in, const amrex::IntVect &yvel_ngrow, const amrex::MultiFab &zvel_in, const amrex::IntVect &zvel_ngrow, const amrex::MultiFab &cons_in, amrex::MultiFab &xmom_out, amrex::MultiFab &ymom_out, amrex::MultiFab &zmom_out, const amrex::Box &domain, const amrex::Vector< amrex::BCRec > &domain_bcs_type_h, const amrex::MultiFab *c_vfrac=nullptr)
 
void ConvertForProjection (const amrex::MultiFab &den_div, const amrex::MultiFab &den_mlt, amrex::MultiFab &xmom, amrex::MultiFab &ymom, amrex::MultiFab &zmom, const amrex::Box &domain, const amrex::Vector< amrex::BCRec > &domain_bcs_type_h)
 
void MakeProjectionWeights (const amrex::MultiFab &den_div, const amrex::MultiFab &den_mlt, const amrex::MultiFab &xmom, const amrex::MultiFab &ymom, const amrex::MultiFab &zmom, amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &beta, const amrex::Box &domain, const amrex::Vector< amrex::BCRec > &domain_bcs_type_h)
 
void MakeAdvectiveProjectionWeights (const amrex::MultiFab &den_div, const amrex::MultiFab &den_mlt, const amrex::MultiFab &xmom, const amrex::MultiFab &ymom, const amrex::MultiFab &zmom, amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &beta, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const amrex::Periodicity &period)
 
void compute_influx_outflux_bdy (amrex::FArrayBox &bdy_data_xlo, amrex::FArrayBox &bdy_data_xhi, amrex::FArrayBox &bdy_data_ylo, amrex::FArrayBox &bdy_data_yhi, amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &area_vec, const amrex::iMultiFab &mask_x, const amrex::iMultiFab &mask_y, const amrex::Geometry &geom, amrex::Real &influx, amrex::Real &outflux, const int n)
 
void enforceInOutSolvability_bdy (const amrex::MultiFab &rho0, amrex::FArrayBox &bdy_data_xlo, amrex::FArrayBox &bdy_data_xhi, amrex::FArrayBox &bdy_data_ylo, amrex::FArrayBox &bdy_data_yhi, amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &area_vec, const amrex::Geometry &geom, const amrex::Vector< amrex::BCRec > &domain_bcs_type_h)
 
void enforceInOutSolvability (int lev, amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &vels_vec, amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &area_vec, const amrex::Geometry &geom)
 
void realbdy_interior_bxs_xy (const amrex::Box &bx, const amrex::Box &domain, const int &width, amrex::Box &bx_xlo, amrex::Box &bx_xhi, amrex::Box &bx_ylo, amrex::Box &bx_yhi, const amrex::IntVect &ng_vect=amrex::IntVect(0, 0, 0), const bool get_int_ng=false)
 
void realbdy_bc_bxs_xy (const amrex::Box &bx, const amrex::Box &domain, const int &set_width, amrex::Box &bx_xlo, amrex::Box &bx_xhi, amrex::Box &bx_ylo, amrex::Box &bx_yhi, const amrex::IntVect &ng_vect=amrex::IntVect(0, 0, 0))
 
AMREX_FORCE_INLINE BdyTimeWeights bdy_time_weights (const double time_since_start, const double data_span, const double dT)
 
void realbdy_compute_interior_ghost_rhs (const double &elapsed_time, const double &start_time, const double &delta_t, const double &start_bdy_time, const double &final_bdy_time, const double &bdy_time_interval, const amrex::Real &nudge_factor, int width, const amrex::Geometry &geom, amrex::Vector< amrex::MultiFab > &S_rhs, amrex::Vector< amrex::MultiFab > &S_cur_data, amrex::Vector< amrex::Vector< amrex::FArrayBox >> &bdy_data_xlo, amrex::Vector< amrex::Vector< amrex::FArrayBox >> &bdy_data_xhi, amrex::Vector< amrex::Vector< amrex::FArrayBox >> &bdy_data_ylo, amrex::Vector< amrex::Vector< amrex::FArrayBox >> &bdy_data_yhi, std::unique_ptr< ReadBndryPlanes > &m_r2d, const amrex::Real &c_p, const amrex::Real &rdOcp, const bool use_wrf_bdy_density, const amrex::Real &bdy_rho_nudge_factor)
 
void fine_compute_interior_ghost_rhs (const double &time, const double &delta_t, const int &width, const int &set_width, const amrex::Geometry &geom, ERFFillPatcher *FPr_c, ERFFillPatcher *FPr_u, ERFFillPatcher *FPr_v, ERFFillPatcher *FPr_w, amrex::Vector< amrex::BCRec > &domain_bcs_type, amrex::Vector< amrex::MultiFab > &S_rhs_f, amrex::Vector< amrex::MultiFab > &S_data_f)
 
void Time_Avg_Vel_atCC (double dt, double &t_avg_cnt, amrex::MultiFab *vel_t_avg, amrex::MultiFab &xvel, amrex::MultiFab &yvel, amrex::MultiFab &zvel)
 
void Accumulate_Interval_Means (double dt, double &t_mean_cnt, amrex::MultiFab *interval_means, amrex::MultiFab &xvel, amrex::MultiFab &yvel, amrex::MultiFab &zvel, amrex::MultiFab &cons)
 
AMREX_GPU_HOST AMREX_FORCE_INLINE void realbdy_compute_relaxation (const int &icomp, const int &num_var, const int &width, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dx, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &ProbLo, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &ProbHi, const amrex::Real &F1, const amrex::Box &bx_xlo, const amrex::Box &bx_xhi, const amrex::Box &bx_ylo, const amrex::Box &bx_yhi, const amrex::Array4< const amrex::Real > &arr_xlo, const amrex::Array4< const amrex::Real > &arr_xhi, const amrex::Array4< const amrex::Real > &arr_ylo, const amrex::Array4< const amrex::Real > &arr_yhi, const amrex::Array4< const amrex::Real > &data_arr, const amrex::Array4< amrex::Real > &rhs_arr, const amrex::Real &c_p, const amrex::Real &rdOcp, const int bdy_moist_nudge_type=0)
 
AMREX_GPU_HOST AMREX_FORCE_INLINE void ApplyMask (amrex::MultiFab &dst, const amrex::iMultiFab &imask, const int nghost=0)
 
AMREX_GPU_HOST AMREX_FORCE_INLINE void ApplyInvertedMask (amrex::MultiFab &dst, const amrex::iMultiFab &imask, const int nghost=0)
 
void thinbody_wall_dist (std::unique_ptr< amrex::MultiFab > &wdist, amrex::Vector< amrex::IntVect > &xfaces, amrex::Vector< amrex::IntVect > &yfaces, amrex::Vector< amrex::IntVect > &zfaces, const amrex::Geometry &geomdata, std::unique_ptr< amrex::MultiFab > &z_phys_cc)
 
void WeatherDataInterpolation (const double time)
 
TimeLevelSel select_time_level (double time, double t_old, double t_new)
 
amrex::Vector< amrex::MultiFab * > select_time_data (TimeLevelSel sel, amrex::MultiFab &old_mf, amrex::MultiFab &new_mf)
 

Enumeration Type Documentation

◆ TimeLevelSel

enum TimeLevelSel
strong

Which time level(s) a fillpatch at a given time should draw from.

Enumerator
Old 
New 
Interp 

Function Documentation

◆ Accumulate_Interval_Means()

void Accumulate_Interval_Means ( double  dt,
double &  t_mean_cnt,
amrex::MultiFab *  interval_means,
amrex::MultiFab &  xvel,
amrex::MultiFab &  yvel,
amrex::MultiFab &  zvel,
amrex::MultiFab &  cons 
)

Accumulate time-weighted cell-centered velocity/theta first and second moments.

Parameters
[in]dtaccumulation interval
[in,out]t_mean_cntaccumulated time
[in,out]interval_meansten-component moment storage
[in]xvelx-face velocity
[in]yvely-face velocity
[in]zvelz-face velocity
[in]consconserved cell-centered state

◆ ApplyInvertedMask()

AMREX_GPU_HOST AMREX_FORCE_INLINE void ApplyInvertedMask ( amrex::MultiFab &  dst,
const amrex::iMultiFab &  imask,
const int  nghost = 0 
)

Multiply a MultiFab by the inverse of an integer mask.

Parameters
[in,out]dstMultiFab to be masked.
[in]imaskInteger mask MultiFab.
[in]nghostNumber of ghost cells to include.
784 {
785  for (amrex::MFIter mfi(dst,amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi)
786  {
787  const amrex::Box& bx = mfi.growntilebox(nghost);
788  if (bx.ok())
789  {
790  auto dstFab = dst.array(mfi);
791  const auto maskFab = imask.const_array(mfi);
792  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
793  {
794  dstFab(i,j,k) *= (1-maskFab(i,j,k));
795  });
796  }
797  }
798 }
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})

Referenced by add_thin_body_sources(), and ERF::project_velocity_tb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ApplyMask()

AMREX_GPU_HOST AMREX_FORCE_INLINE void ApplyMask ( amrex::MultiFab &  dst,
const amrex::iMultiFab &  imask,
const int  nghost = 0 
)
756 {
757  for (amrex::MFIter mfi(dst,amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi)
758  {
759  const amrex::Box& bx = mfi.growntilebox(nghost);
760  if (bx.ok())
761  {
762  auto dstFab = dst.array(mfi);
763  const auto maskFab = imask.const_array(mfi);
764  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
765  {
766  dstFab(i,j,k) *= maskFab(i,j,k);
767  });
768  }
769  }
770 }

Referenced by ERF::FillIntermediatePatch(), and ERF::project_velocity_tb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ average_down_faces_mapfac()

void average_down_faces_mapfac ( const amrex::MultiFab &  fine,
amrex::MultiFab &  crse,
const amrex::IntVect &  rr,
const amrex::Periodicity &  cper,
const amrex::MultiFab &  mf_f,
const amrex::MultiFab &  mf_c,
const amrex::MultiFab *  mf2_f,
const amrex::MultiFab *  mf2_c,
const amrex::MultiFab *  area_f,
const amrex::MultiFab *  area_c 
)

Average the face momenta of a fine level down onto the coarse faces it covers, as mass fluxes: (rho u) ax/m_y, (rho v) ay/m_x or (rho w)/(m_x m_y) is averaged and divided by the same weight on the coarse face. With map factors other than one, or face areas other than one over terrain, the plain average of (rho u) is not the coarse momentum whose flux is the mean of the fine fluxes. The horizontal weights are those of ERF::average_down_mass_flux. Faces the fine level does not cover are left as they are.

Parameters
[in]fineFine face momenta.
[in,out]crseCoarse face momenta.
[in]rrRefinement ratio.
[in]cperPeriodicity of the coarse level.
[in]mf_fMap factor of the fine faces (no extent in z).
[in]mf_cMap factor of the coarse faces (no extent in z).
[in]mf2_fSecond map factor of the fine faces (the product m_x m_y on w-faces), or null.
[in]mf2_cSecond map factor of the coarse faces, or null.
[in]area_fArea of the fine faces, or null for an area of one.
[in]area_cArea of the coarse faces, or null for an area of one.

◆ bdy_time_weights()

AMREX_FORCE_INLINE BdyTimeWeights bdy_time_weights ( const double  time_since_start,
const double  data_span,
const double  dT 
)

Time interpolation weights for boundary data at fixed intervals.

The time must be measured from the first slice, and formed as elapsed + (start_time - start_bdy_time), not as (elapsed + start_time) - start_bdy_time: start_time and start_bdy_time are epoch seconds (~1.7e9), where doubles are spaced ~2.4e-7 s apart, so the second form rounds the elapsed time to that spacing. The difference of the two epoch times is exact.

Parameters
[in]time_since_starttime since the first slice
[in]data_spantime from the first slice to the last one
[in]dTinterval between slices
429 {
430  BdyTimeWeights w;
431  if (time_since_start >= data_span) {
432  // Do not over run the last slice
433  w.n_lo = static_cast<int>(data_span / dT);
434  w.n_hi = w.n_lo;
435  w.alpha = zero;
436  } else {
437  w.n_lo = static_cast<int>(time_since_start / dT);
438  w.n_hi = w.n_lo + 1;
439  w.alpha = static_cast<amrex::Real>((time_since_start - w.n_lo * dT) / dT);
440  }
441  AMREX_ALWAYS_ASSERT(w.alpha >= zero && w.alpha <= one);
442  return w;
443 }
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
Definition: ERF_Utils.H:407
int n_hi
Definition: ERF_Utils.H:409
amrex::Real alpha
Definition: ERF_Utils.H:410
int n_lo
Definition: ERF_Utils.H:408

Referenced by realbdy_compute_interior_ghost_rhs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChopGrids2D()

void ChopGrids2D ( amrex::BoxArray &  ba,
const amrex::Box &  domain,
int  target_size 
)

◆ compute_influx_outflux_bdy()

void compute_influx_outflux_bdy ( amrex::FArrayBox &  bdy_data_xlo,
amrex::FArrayBox &  bdy_data_xhi,
amrex::FArrayBox &  bdy_data_ylo,
amrex::FArrayBox &  bdy_data_yhi,
amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &  area_vec,
const amrex::iMultiFab &  mask_x,
const amrex::iMultiFab &  mask_y,
const amrex::Geometry &  geom,
amrex::Real &  influx,
amrex::Real &  outflux,
const int  n 
)

◆ cons_to_prim()

void cons_to_prim ( const amrex::MultiFab &  cons_state,
amrex::MultiFab &  S_prim,
int  ng 
)

Convert conservative state to primitive variables.

Parameters
[in]cons_stateConservative state MultiFab.
[out]S_primPrimitive state MultiFab.
[in]ngNumber of ghost cells.

◆ ConvertForProjection()

void ConvertForProjection ( const amrex::MultiFab &  den_div,
const amrex::MultiFab &  den_mlt,
amrex::MultiFab &  xmom,
amrex::MultiFab &  ymom,
amrex::MultiFab &  zmom,
const amrex::Box &  domain,
const amrex::Vector< amrex::BCRec > &  domain_bcs_type_h 
)

◆ enforceInOutSolvability()

void enforceInOutSolvability ( int  lev,
amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &  vels_vec,
amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &  area_vec,
const amrex::Geometry &  geom 
)

◆ enforceInOutSolvability_bdy()

void enforceInOutSolvability_bdy ( const amrex::MultiFab &  rho0,
amrex::FArrayBox &  bdy_data_xlo,
amrex::FArrayBox &  bdy_data_xhi,
amrex::FArrayBox &  bdy_data_ylo,
amrex::FArrayBox &  bdy_data_yhi,
amrex::Array< amrex::MultiFab *, AMREX_SPACEDIM > &  area_vec,
const amrex::Geometry &  geom,
const amrex::Vector< amrex::BCRec > &  domain_bcs_type_h 
)

◆ ERFPostProcessBaseGrids()

amrex::BoxArray ERFPostProcessBaseGrids ( const amrex::Box &  domain,
bool  decompose_in_z 
)

◆ fill_wall_dist_ghost_cells()

void fill_wall_dist_ghost_cells ( amrex::MultiFab &  wdist,
const amrex::Geometry &  geom 
)

Fill the ghost cells of the wall distance field, which is only computed on the valid region, so that operators reading from grown boxes do not see the sentinel value used to initialize it.

Parameters
[in,out]wdistMultiFab holding the wall distance.
[in]geomGeometry at this level.

◆ fine_compute_interior_ghost_rhs()

void fine_compute_interior_ghost_rhs ( const double &  time,
const double &  delta_t,
const int &  width,
const int &  set_width,
const amrex::Geometry &  geom,
ERFFillPatcher *  FPr_c,
ERFFillPatcher *  FPr_u,
ERFFillPatcher *  FPr_v,
ERFFillPatcher *  FPr_w,
amrex::Vector< amrex::BCRec > &  domain_bcs_type,
amrex::Vector< amrex::MultiFab > &  S_rhs_f,
amrex::Vector< amrex::MultiFab > &  S_data_f 
)

◆ if_average_down()

void if_average_down ( const amrex::MultiFab &  S_fine,
amrex::MultiFab &  S_crse,
const amrex::MultiFab &  beta_fine,
const amrex::MultiFab &  beta_crse,
const amrex::MultiFab &  vol_fine,
int  scomp,
int  ncomp,
const amrex::IntVect &  ratio 
)

Average down a cell-centered state over immersed-forcing levels (erf.if_average_down = fluid_mass). The fine cells are weighted by their fluid mass, (rho S)_c = rho_c * sum (1 - beta_f) V_f (rho S)_f / sum (1 - beta_f) V_f rho_f, with beta the solid fraction, V the fine cell volume (detJ / (m_x m_y), the weight the plain average carries in the state) and rho_c the coarse density: the fluid-volume-weighted mean of the fine density, sum (1 - beta_f) V_f rho_f / sum (1 - beta_f) V_f, when the density is in the component range, else the coarse cell's own. The coarse value is the fluid mean over the whole coarse cell (intensive), not the sum over the fine cells. Coarse cells that are solid on their own level, or with no fluid fine cell under them, keep their value. The plain average mixes the values of solid fine cells into coarse fluid cells.

Parameters
[in]S_fineFine state (unscaled).
[in,out]S_crseCoarse state (unscaled); the covered cells are written.
[in]beta_fineFine solid fraction (terrain_blanking).
[in]beta_crseCoarse solid fraction.
[in]vol_fineFine cell volume weight (any constant factor cancels).
[in]scompFirst component to average.
[in]ncompNumber of components.
[in]ratioRefinement ratio.

◆ if_cf_surface_mismatch()

std::pair<int, amrex::Real> if_cf_surface_mismatch ( const amrex::MultiFab &  fine_tb,
const amrex::BoxArray &  fine_grids,
const amrex::BoxArray &  crse_grids,
const amrex::DistributionMapping &  crse_dmap,
const amrex::Geometry &  crse_geom,
const amrex::IntVect &  ratio,
amrex::Real  warn 
)

Where the coarse and fine levels disagree on an immersed surface along the lateral coarse/fine faces of the fine level (erf.if_cf_mismatch_warning): the surface on a coarse cell's mid-plane leaves the coarse cell half solid over fine cells that are all solid and all fluid. For each coarse cell covered by the fine level and next to an uncovered one, the spread (max - min) of the fine solid fractions under it is formed; cells with a spread of at least warn are counted.

Parameters
[in]fine_tbfine solid fraction (terrain_blanking)
[in]fine_gridsfine BoxArray
[in]crse_gridscoarse BoxArray
[in]crse_dmapcoarse DistributionMapping
[in]crse_geomcoarse Geometry
[in]ratiorefinement ratio
[in]warnspread at or above which a cell is counted
Returns
the number of counted cells over all ranks, and the largest spread along those faces

◆ immersed_wall_dist()

void immersed_wall_dist ( amrex::MultiFab &  wdist,
const amrex::MultiFab &  terrain_blank,
const amrex::MultiFab &  z_phys_nd,
const amrex::MultiFab &  z_phys_cc,
const amrex::Box &  domain,
amrex::Real  small_volfrac,
amrex::MultiFab *  wall_height = nullptr,
const amrex::MultiFab *  wall_height_crse = nullptr 
)

RANS wall distance over terrain represented by immersed forcing with the fraction-stress wall law (erf.if_wall_form = fraction_stress): measured vertically from the surface itself, h = z_bot + beta dz of the wall cell (the partial cell, or the fluid cell on a solid cell; ERF_ImmersedWallCell.H), the wall cell at its fluid centroid (1 - beta) dz / 2 above it and every other cell at |z_cc - h|; a column without solid measures from the bottom of the domain. A box that does not see the surface of a column (a fine box inside the solid, or above the surface without reaching the bottom) measures from the coarser level's wall height.

Parameters
[out]wdistWall distance (valid cells; ghost cells are left untouched).
[in]terrain_blankCell-centered solid fraction.
[in]z_phys_ndNode heights.
[in]z_phys_ccCell-center heights.
[in]domainIndex domain of the level.
[in]small_volfracSolid fraction below which a cell counts as fluid.
[out]wall_heightOptional: the height measured from in each column, on the level's BoxArray flattened to the bottom cell (same DistributionMapping).
[in]wall_height_crseOptional, fine levels: wall_height of the coarser level brought to this level's flattened BoxArray. Without it every box must hold whole columns.

◆ make_areas()

void make_areas ( const amrex::Geometry &  geom,
amrex::MultiFab &  z_phys_nd,
amrex::MultiFab &  ax,
amrex::MultiFab &  ay,
amrex::MultiFab &  az 
)

◆ make_ib_wall_face_masks()

void make_ib_wall_face_masks ( const amrex::MultiFab &  terrain_blank,
amrex::MultiFab &  mask13,
amrex::MultiFab &  mask23,
amrex::MultiFab &  mask33,
const amrex::Box &  domain,
amrex::Real  small_volfrac,
int  spacing = 0,
amrex::Real  dz = amrex::Real(1.0),
amrex::Real  z0 = amrex::Real(0.1) 
)

Wall-face masks of the fraction-stress wall law (erf.if_wall_form = fraction_stress): zero on the xz (yz) edge that is the bottom face of the wall cell of an x-face (y-face) column, the spacing factor on the face above it, one elsewhere. The vertical flux of x (y) momentum is multiplied by them, so no resolved flux crosses the wall face (see ERF_ImmersedWallCell.H).

Parameters
[in]terrain_blankCell-centered solid fraction; needs one more ghost cell than the masks.
[out]mask13On convert(ba, IntVect(1,0,1)), valid and ghost cells.
[out]mask23On convert(ba, IntVect(0,1,1)), valid and ghost cells.
[out]mask33On convert(ba, IntVect(0,0,1)): the same for the cell columns, applied to the vertical diffusive fluxes of theta and TKE (zero on the bottom face of the wall cell).
[in]domainIndex domain of the level.
[in]small_volfracSolid fraction below which a cell counts as fluid.
[in]spacingerf.if_wall_face_spacing (0 grid, 1 physical, 2 log): the face ABOVE the wall cell gets ib_wall::face_above_factor instead of one.
[in]dzCell height (constant-dz mesh).
[in]z0Roughness length of the wall law.

◆ make_J()

void make_J ( const amrex::Geometry &  geom,
amrex::MultiFab &  z_phys_nd,
amrex::MultiFab &  detJ_cc 
)

◆ make_qt()

void make_qt ( const amrex::MultiFab &  cons_state,
amrex::MultiFab &  qt,
int  n_qstate_into_total 
)

Compute total water mixing ratio from conservative state.

Parameters
[in]cons_stateConservative state MultiFab.
[out]qtMultiFab to store total water.
[in]n_qstate_into_totalNumber of components to include in total water.

◆ make_zcc()

void make_zcc ( const amrex::Geometry &  geom,
amrex::MultiFab &  z_phys_nd,
amrex::MultiFab &  z_phys_cc 
)

◆ make_zsfc_nd()

void make_zsfc_nd ( const amrex::Geometry &  geom,
const amrex::MultiFab &  z_phys_nd,
amrex::MultiFab &  z_sfc_nd,
const amrex::MultiFab *  z_sfc_crse = nullptr,
const amrex::IntVect &  ref_ratio = amrex::IntVect(1) 
)

◆ MakeAdvectiveProjectionWeights()

void MakeAdvectiveProjectionWeights ( const amrex::MultiFab &  den_div,
const amrex::MultiFab &  den_mlt,
const amrex::MultiFab &  xmom,
const amrex::MultiFab &  ymom,
const amrex::MultiFab &  zmom,
amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &  beta,
const AdvType  horiz_adv_type,
const AdvType  vert_adv_type,
const amrex::Real  horiz_upw_frac,
const amrex::Real  vert_upw_frac,
const amrex::Periodicity &  period 
)

◆ MakeProjectionWeights()

void MakeProjectionWeights ( const amrex::MultiFab &  den_div,
const amrex::MultiFab &  den_mlt,
const amrex::MultiFab &  xmom,
const amrex::MultiFab &  ymom,
const amrex::MultiFab &  zmom,
amrex::Array< amrex::MultiFab, AMREX_SPACEDIM > &  beta,
const amrex::Box &  domain,
const amrex::Vector< amrex::BCRec > &  domain_bcs_type_h 
)

◆ MomentumToVelocity()

void MomentumToVelocity ( amrex::MultiFab &  xvel_out,
amrex::MultiFab &  yvel_out,
amrex::MultiFab &  zvel_out,
const amrex::MultiFab &  cons_in,
const amrex::MultiFab &  xmom_in,
const amrex::MultiFab &  ymom_in,
const amrex::MultiFab &  zmom_in,
const amrex::Box &  domain,
const amrex::Vector< amrex::BCRec > &  domain_bcs_type_h,
const amrex::MultiFab *  c_vfrac = nullptr 
)

◆ real_bdy_cons_maps()

RealBdyConsMaps real_bdy_cons_maps ( const bool  read_density)
inline
37 {
39  m.read.assign(NVAR_max, 0);
40  m.map.resize(NVAR_max);
41  m.bnd.resize(NVAR_max);
42  for (int comp = 0; comp < NVAR_max; ++comp) {
43  m.map[comp] = comp;
44  m.bnd[comp] = cons_bc_comp(comp);
45  }
46  m.read[Rho_comp] = read_density ? 1 : 0;
47  m.map [Rho_comp] = read_density ? RealBdyVars::R : Rho_comp;
48  m.read[RhoTheta_comp] = 1;
50  m.read[RhoQ1_comp] = 1;
52  return m;
53 }
#define Rho_comp
Definition: ERF_IndexDefines.H:61
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int cons_bc_comp(int n) noexcept
Definition: ERF_IndexDefines.H:152
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:62
#define NVAR_max
Definition: ERF_IndexDefines.H:45
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:78
@ R
Definition: ERF_IndexDefines.H:182
@ QV
Definition: ERF_IndexDefines.H:181
@ T
Definition: ERF_IndexDefines.H:180
Definition: ERF_Utils.H:29
amrex::Vector< int > map
Definition: ERF_Utils.H:31
amrex::Vector< int > bnd
Definition: ERF_Utils.H:32
amrex::Vector< int > read
Definition: ERF_Utils.H:30
Here is the call graph for this function:

◆ realbdy_bc_bxs_xy()

void realbdy_bc_bxs_xy ( const amrex::Box &  bx,
const amrex::Box &  domain,
const int &  set_width,
amrex::Box &  bx_xlo,
amrex::Box &  bx_xhi,
amrex::Box &  bx_ylo,
amrex::Box &  bx_yhi,
const amrex::IntVect &  ng_vect = amrex::IntVect(0, 0, 0) 
)

◆ realbdy_compute_interior_ghost_rhs()

void realbdy_compute_interior_ghost_rhs ( const double &  elapsed_time,
const double &  start_time,
const double &  delta_t,
const double &  start_bdy_time,
const double &  final_bdy_time,
const double &  bdy_time_interval,
const amrex::Real &  nudge_factor,
int  width,
const amrex::Geometry &  geom,
amrex::Vector< amrex::MultiFab > &  S_rhs,
amrex::Vector< amrex::MultiFab > &  S_cur_data,
amrex::Vector< amrex::Vector< amrex::FArrayBox >> &  bdy_data_xlo,
amrex::Vector< amrex::Vector< amrex::FArrayBox >> &  bdy_data_xhi,
amrex::Vector< amrex::Vector< amrex::FArrayBox >> &  bdy_data_ylo,
amrex::Vector< amrex::Vector< amrex::FArrayBox >> &  bdy_data_yhi,
std::unique_ptr< ReadBndryPlanes > &  m_r2d,
const amrex::Real &  c_p,
const amrex::Real &  rdOcp,
const bool  use_wrf_bdy_density,
const amrex::Real &  bdy_rho_nudge_factor 
)

◆ realbdy_compute_relaxation()

AMREX_GPU_HOST AMREX_FORCE_INLINE void realbdy_compute_relaxation ( const int &  icomp,
const int &  num_var,
const int &  width,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  dx,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  ProbLo,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  ProbHi,
const amrex::Real &  F1,
const amrex::Box &  bx_xlo,
const amrex::Box &  bx_xhi,
const amrex::Box &  bx_ylo,
const amrex::Box &  bx_yhi,
const amrex::Array4< const amrex::Real > &  arr_xlo,
const amrex::Array4< const amrex::Real > &  arr_xhi,
const amrex::Array4< const amrex::Real > &  arr_ylo,
const amrex::Array4< const amrex::Real > &  arr_yhi,
const amrex::Array4< const amrex::Real > &  data_arr,
const amrex::Array4< amrex::Real > &  rhs_arr,
const amrex::Real &  c_p,
const amrex::Real &  rdOcp,
const int  bdy_moist_nudge_type = 0 
)

Compute the nudging relaxation

Parameters
[in]delta_ttime step
[in]icompcomponent offset
[in]num_varnumber of variables to loop
[in]widthwidth of wrf bdy file
[in]dom_lolow bound of domain
[in]dom_hihigh bound of domain
[in]F1drift relaxation parameter
[in]bx_xlobox for low x relaxation
[in]bx_xhibox for high x relaxation
[in]bx_ylobox for low y relaxation
[in]bx_yhibox for high y relaxation
[in]arr_xloarray for low x relaxation
[in]arr_xhiarray for high x relaxation
[in]arr_yloarray for low y relaxation
[in]arr_yhiarray for high y relaxation
[in]data_arrdata array
[out]rhs_arrRHS array
560 {
561  amrex::IntVect iv = bx_xlo.type();
562  amrex::Real ioff = (iv[0]==1) ? zero : myhalf;
563  amrex::Real joff = (iv[1]==1) ? zero : myhalf;
564 
565  // These are defined in ERF_Constants.H
566  amrex::Real l_rdOcp = rdOcp;
567  amrex::Real cond_fac = lcond / c_p; // condensation
568  amrex::Real sub_fac = lsub / c_p; // sublimation
569 
570  int nq = num_var;
571 
572  amrex::ParallelFor( bx_xlo, bx_xhi,
573  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
574  {
575  // Corners with x boxes
576  amrex::Real x = ProbLo[0] + (i + ioff) * dx[0];
577  amrex::Real y = ProbLo[1] + (j + joff) * dx[1];
578  amrex::Real x_end = ProbLo[0] + width * dx[0];
579  amrex::Real y_end = ProbLo[1] + width * dx[1];
580  amrex::Real y_strt = ProbHi[1] - width * dx[1];
581  amrex::Real xi = (x_end - x) / (x_end - ProbLo[0]);
582  amrex::Real eta_lo = (y < y_end ) ? (y_end - y) / (y_end - ProbLo[1]) : zero;
583  amrex::Real eta_hi = (y > y_strt) ? (y - y_strt) / (ProbHi[1] - y_strt) : zero;
584  amrex::Real eta = std::max(eta_lo,eta_hi);
585  amrex::Real Factor = std::max(xi*xi,eta*eta) * F1;
586 
587  if (icomp == RhoQ1_comp)
588  {
589  amrex::Real exner_pi = getExnergivenRTh(data_arr(i,j,k,RhoTheta_comp),l_rdOcp,
590  data_arr(i,j,k,RhoQ1_comp)/data_arr(i,j,k,Rho_comp));
591 
592  // qv
593  amrex::Real delta = arr_xlo(i,j,k,0) - data_arr(i,j,k,icomp);
594  rhs_arr(i,j,k,icomp) += Factor*delta;
595 
596  if (bdy_moist_nudge_type==2) {
597  // NOTE: we only operate on qv (above), qc and qi here; the
598  // precipitating species (qr/qs/qg) are left untouched.
599 
600  // qc and heat source term due to evaporation
601  delta = -data_arr(i,j,k,RhoQ2_comp); // This effectively nudges to 0
602  rhs_arr(i,j,k,RhoQ2_comp ) += Factor * delta;
603  rhs_arr(i,j,k,RhoTheta_comp) += Factor * delta * cond_fac / exner_pi;
604 
605  // qi and heat source term due to sublimation
606  if (nq > 3) { // nq > 3 guarantees that RhoQ3 is ice
607  delta = -data_arr(i,j,k,RhoQ3_comp); // This effectively nudges to 0
608  rhs_arr(i,j,k,RhoQ3_comp ) += Factor * delta;
609  rhs_arr(i,j,k,RhoTheta_comp) += Factor * delta * sub_fac / exner_pi;
610  }
611  } // moist_nudge_type
612  } else {
613  for (int n = 0; n < nq; n++) {
614  amrex::Real delta = arr_xlo(i,j,k,n) - data_arr(i,j,k,n+icomp);
615  rhs_arr(i,j,k,n+icomp) += Factor*delta;
616  }
617  }
618  },
619  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
620  {
621  // Corners with x boxes
622  amrex::Real x = ProbLo[0] + (i + ioff) * dx[0];
623  amrex::Real y = ProbLo[1] + (j + joff) * dx[1];
624  amrex::Real x_strt = ProbHi[0] - width * dx[0];
625  amrex::Real y_strt = ProbHi[1] - width * dx[1];
626  amrex::Real y_end = ProbLo[1] + width * dx[1];
627  amrex::Real xi = (x - x_strt) / (ProbHi[0] - x_strt);
628  amrex::Real eta_lo = (y < y_end ) ? (y_end - y) / (y_end - ProbLo[1]) : zero;
629  amrex::Real eta_hi = (y > y_strt) ? (y - y_strt) / (ProbHi[1] - y_strt) : zero;
630  amrex::Real eta = std::max(eta_lo,eta_hi);
631  amrex::Real Factor = std::max(xi*xi,eta*eta) * F1;
632 
633  if (icomp == RhoQ1_comp)
634  {
635  amrex::Real exner_pi = getExnergivenRTh(data_arr(i,j,k,RhoTheta_comp),l_rdOcp,
636  data_arr(i,j,k,RhoQ1_comp)/data_arr(i,j,k,Rho_comp));
637 
638  // qv
639  amrex::Real delta = arr_xhi(i,j,k,0) - data_arr(i,j,k,icomp);
640  rhs_arr(i,j,k,icomp) += Factor*delta;
641 
642  if (bdy_moist_nudge_type==2) {
643  // NOTE: we only operate on qv (above), qc and qi here; the
644  // precipitating species (qr/qs/qg) are left untouched.
645 
646  // qc and heat source term due to evaporation
647  delta = -data_arr(i,j,k,RhoQ2_comp); // This effectively nudges to 0
648  rhs_arr(i,j,k,RhoQ2_comp ) += Factor*delta;
649  rhs_arr(i,j,k,RhoTheta_comp) += Factor * delta * cond_fac / exner_pi;
650 
651  // qi and heat source term due to sublimation
652  if (nq > 3) { // nq > 3 guarantees that RhoQ3 is ice
653  delta = -data_arr(i,j,k,RhoQ3_comp); // This effectively nudges to 0
654  rhs_arr(i,j,k,RhoQ3_comp ) += Factor * delta;
655  rhs_arr(i,j,k,RhoTheta_comp) += Factor * delta * sub_fac / exner_pi;
656  }
657  } // moist_nudge_type
658  } else {
659  for (int n = 0; n < nq; n++) {
660  amrex::Real delta = arr_xhi(i,j,k,n) - data_arr(i,j,k,n+icomp);
661  rhs_arr(i,j,k,n+icomp) += Factor*delta;
662  }
663  }
664  });
665 
666  amrex::ParallelFor( bx_ylo, bx_yhi,
667  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
668  {
669  // No corners for y boxes
670  amrex::Real y = ProbLo[1] + (j + joff) * dx[1];
671  amrex::Real y_end = ProbLo[1] + width * dx[1];
672  amrex::Real eta = (y_end - y) / (y_end - ProbLo[1]);
673  amrex::Real Factor = eta*eta * F1;
674 
675  if (icomp == RhoQ1_comp)
676  {
677  amrex::Real exner_pi = getExnergivenRTh(data_arr(i,j,k,RhoTheta_comp),l_rdOcp,
678  data_arr(i,j,k,RhoQ1_comp)/data_arr(i,j,k,Rho_comp));
679  // qv
680  amrex::Real delta = arr_ylo(i,j,k,0) - data_arr(i,j,k,icomp);
681  rhs_arr(i,j,k,icomp) += Factor*delta;
682 
683  if (bdy_moist_nudge_type==2) {
684  // NOTE: we only operate on qv (above), qc and qi here; the
685  // precipitating species (qr/qs/qg) are left untouched.
686 
687  // qc and heat source term due to evaporation
688  delta = -data_arr(i,j,k,RhoQ2_comp); // This effectively nudges to 0
689  rhs_arr(i,j,k,RhoQ2_comp ) += Factor*delta;
690  rhs_arr(i,j,k,RhoTheta_comp) += Factor * delta * cond_fac / exner_pi;
691 
692  // qi and heat source term due to sublimation
693  if (nq > 3) { // nq > 3 guarantees that RhoQ3 is ice
694  delta = -data_arr(i,j,k,RhoQ3_comp); // This effectively nudges to 0
695  rhs_arr(i,j,k,RhoQ3_comp ) += Factor * delta;
696  rhs_arr(i,j,k,RhoTheta_comp) += Factor * delta * sub_fac / exner_pi;
697  }
698  } // moist_nudge_type
699  } else {
700  for (int n = 0; n < nq; n++) {
701  amrex::Real delta = arr_ylo(i,j,k,n) - data_arr(i,j,k,n+icomp);
702  rhs_arr(i,j,k,n+icomp) += Factor*delta;
703  }
704  }
705  },
706  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
707  {
708  // No corners for y boxes
709  amrex::Real y = ProbLo[1] + (j + joff) * dx[1];
710  amrex::Real y_strt = ProbHi[1] - width * dx[1];
711  amrex::Real eta = (y - y_strt) / (ProbHi[1] - y_strt);
712  amrex::Real Factor = eta*eta * F1;
713 
714  if (icomp == RhoQ1_comp)
715  {
716  amrex::Real exner_pi = getExnergivenRTh(data_arr(i,j,k,RhoTheta_comp),l_rdOcp,
717  data_arr(i,j,k,RhoQ1_comp)/data_arr(i,j,k,Rho_comp));
718  // qv
719  amrex::Real delta = arr_yhi(i,j,k,0) - data_arr(i,j,k,icomp);
720  rhs_arr(i,j,k,icomp) += Factor*delta;
721 
722  if (bdy_moist_nudge_type==2) {
723  // NOTE: we only operate on qv (above), qc and qi here; the
724  // precipitating species (qr/qs/qg) are left untouched.
725 
726  // qc and heat source term due to evaporation
727  delta = -data_arr(i,j,k,RhoQ2_comp); // This effectively nudges to 0
728  rhs_arr(i,j,k,RhoQ2_comp ) += Factor * delta;
729  rhs_arr(i,j,k,RhoTheta_comp) += Factor * delta * cond_fac / exner_pi;
730 
731  // qi and heat source term due to sublimation
732  if (nq > 3) { // nq > 3 guarantees that RhoQ3 is ice
733  delta = -data_arr(i,j,k,RhoQ3_comp); // This effectively nudges to 0
734  rhs_arr(i,j,k,RhoQ3_comp ) += Factor * delta;
735  rhs_arr(i,j,k,RhoTheta_comp) += Factor * delta * sub_fac / exner_pi;
736  }
737  } // moist_nudge_type
738  } else {
739  for (int n = 0; n < nq; n++) {
740  amrex::Real delta = arr_yhi(i,j,k,n) - data_arr(i,j,k,n+icomp);
741  rhs_arr(i,j,k,n+icomp) += Factor*delta;
742  }
743  }
744  });
745 }
GpuArray< Real, AMREX_SPACEDIM > dx
Definition: ERF_ActuatorSpreading.cpp:131
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getExnergivenRTh(const amrex::Real rhotheta, const amrex::Real rdOcp, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:156
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:79
#define RhoQ3_comp
Definition: ERF_IndexDefines.H:80
const Real rdOcp
Definition: ERF_InitCustomPert_ABL.H:128
constexpr amrex::Real lsub
Definition: ERF_MicrophysicsConstants.H:111
constexpr amrex::Real lcond
Definition: ERF_MicrophysicsConstants.H:109
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41

Referenced by realbdy_compute_interior_ghost_rhs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ realbdy_interior_bxs_xy()

void realbdy_interior_bxs_xy ( const amrex::Box &  bx,
const amrex::Box &  domain,
const int &  width,
amrex::Box &  bx_xlo,
amrex::Box &  bx_xhi,
amrex::Box &  bx_ylo,
amrex::Box &  bx_yhi,
const amrex::IntVect &  ng_vect = amrex::IntVect(0, 0, 0),
const bool  get_int_ng = false 
)

◆ rebalance_columns()

void rebalance_columns ( amrex::MultiFab &  rho,
amrex::MultiFab &  theta,
const amrex::MultiFab &  qt,
const amrex::MultiFab &  qv,
const amrex::MultiFab *  z_phys,
const amrex::Geometry &  geom,
const bool &  maintain_Th,
bool  use_sfc = false 
)

◆ recompute_p_pi_hse()

void recompute_p_pi_hse ( amrex::MultiFab &  base_state_mf,
amrex::Real  l_rdOcp 
)

◆ select_time_data()

amrex::Vector<amrex::MultiFab*> select_time_data ( TimeLevelSel  sel,
amrex::MultiFab &  old_mf,
amrex::MultiFab &  new_mf 
)
inline

The pair of MultiFabs to hand to an AMReX FillPatch routine for a given time-level selection. When only one time level is wanted it is passed twice, so that AMReX's own comparison of the (rounded) times can never bring in the other one.

Parameters
[in]selwhich time level(s) to use
[in]old_mfdata at the old time
[in]new_mfdata at the new time
864 {
865  if (sel == TimeLevelSel::Old) { return {&old_mf, &old_mf}; }
866  if (sel == TimeLevelSel::New) { return {&new_mf, &new_mf}; }
867  return {&old_mf, &new_mf};
868 }

Referenced by ERF::fill_sbm_mixing_density(), ERF::FillCoarseFineGhostsForImplicit(), ERF::FillIntermediatePatch(), ERF::FillPatchCrseLevel(), and ERF::FillPatchFineLevel().

Here is the caller graph for this function:

◆ select_time_level()

TimeLevelSel select_time_level ( double  time,
double  t_old,
double  t_new 
)
inline

Decide whether data at time "time" should come from the old-time data, the new-time data, or an interpolation between the two.

This is done in double precision, before any cast to Real, and with a single tolerance at both ends. The tolerance is a small fraction of (t_new - t_old), but never smaller than a few ulps of the times themselves, since those carry roundoff proportional to their magnitude – which matters once the time is large (e.g. months measured in seconds).

Times outside [t_old, t_new] are clamped to the nearer end rather than extrapolated. If t_old == t_new (to within the tolerance), Old is returned.

Parameters
[in]timetime at which data are requested
[in]t_oldold time of the level
[in]t_newnew time of the level
843 {
844  const double t_mag = std::max({std::abs(time), std::abs(t_old), std::abs(t_new)});
845  const double tol = std::max(1.e-8 * std::abs(t_new - t_old),
846  16.0 * std::numeric_limits<double>::epsilon() * t_mag);
847 
848  if (time <= t_old + tol) { return TimeLevelSel::Old; }
849  if (time >= t_new - tol) { return TimeLevelSel::New; }
850  return TimeLevelSel::Interp;
851 }
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12

Referenced by ERF::cf_zface_coarse_at(), ERF::fill_sbm_mixing_density(), ERF::FillCoarseFineGhostsForImplicit(), ERF::FillIntermediatePatch(), ERF::FillPatchCrseLevel(), and ERF::FillPatchFineLevel().

Here is the caller graph for this function:

◆ thinbody_wall_dist()

void thinbody_wall_dist ( std::unique_ptr< amrex::MultiFab > &  wdist,
amrex::Vector< amrex::IntVect > &  xfaces,
amrex::Vector< amrex::IntVect > &  yfaces,
amrex::Vector< amrex::IntVect > &  zfaces,
const amrex::Geometry &  geomdata,
std::unique_ptr< amrex::MultiFab > &  z_phys_cc 
)

Compute the distance to thin-body walls.

Parameters
[out]wdistMultiFab to store wall distances.
[in]xfacesIndices of x-faces forming walls.
[in]yfacesIndices of y-faces forming walls.
[in]zfacesIndices of z-faces forming walls.
[in]geomdataGeometry used for physical distance.
[in]z_phys_ccCell-centered physical height.

◆ Time_Avg_Vel_atCC()

void Time_Avg_Vel_atCC ( double  dt,
double &  t_avg_cnt,
amrex::MultiFab *  vel_t_avg,
amrex::MultiFab &  xvel,
amrex::MultiFab &  yvel,
amrex::MultiFab &  zvel 
)

◆ VelocityToMomentum()

void VelocityToMomentum ( const amrex::MultiFab &  xvel_in,
const amrex::IntVect &  xvel_ngrow,
const amrex::MultiFab &  yvel_in,
const amrex::IntVect &  yvel_ngrow,
const amrex::MultiFab &  zvel_in,
const amrex::IntVect &  zvel_ngrow,
const amrex::MultiFab &  cons_in,
amrex::MultiFab &  xmom_out,
amrex::MultiFab &  ymom_out,
amrex::MultiFab &  zmom_out,
const amrex::Box &  domain,
const amrex::Vector< amrex::BCRec > &  domain_bcs_type_h,
const amrex::MultiFab *  c_vfrac = nullptr 
)

◆ WeatherDataInterpolation()

void WeatherDataInterpolation ( const double  time)

Referenced by ERF::Evolve(), and ERF::init_stuff().

Here is the caller graph for this function: