ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_LengthScaleCellSize.H File Reference
#include <AMReX_Array.H>
#include <AMReX_Box.H>
#include <AMReX_Geometry.H>
#include <AMReX_REAL.H>
Include dependency graph for ERF_LengthScaleCellSize.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > LengthScaleCellSize (const amrex::Geometry &geom)
 
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > LengthScaleInvCellSize (const amrex::Geometry &geom)
 

Function Documentation

◆ LengthScaleCellSize()

amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> LengthScaleCellSize ( const amrex::Geometry &  geom)
inline

Cell sizes for formulas that use a lateral cell size as a length scale rather than to divide a difference: LES filter widths, scale-aware parameterizations, drag rates and per-area densities.

On a domain with one cell in y and more than one in x (an x-z run), dy is arbitrary, so dx is used in its place; likewise dy replaces dx on a domain with one cell in x. The formula then keeps its 3-D form, as if the unresolved direction had the spacing of the resolved one. A single column (one cell in both) keeps the dx and dy of the inputs as its nominal column size.

The level's own domain decides: a lateral direction with one cell is not refined (amr.ref_ratio_vect = r 1 r), so it has one cell on every level, and the spacing copied is that of the level.

Parameters
[in]geomgeometry of the level
Returns
dx, dy and dz with the substitution above
29 {
30  amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> dx = geom.CellSizeArray();
31  const amrex::Box& domain = geom.Domain();
32  const int nx = domain.length(0);
33  const int ny = domain.length(1);
34  if (ny == 1 && nx > 1) {
35  dx[1] = dx[0];
36  } else if (nx == 1 && ny > 1) {
37  dx[0] = dx[1];
38  }
39  return dx;
40 }
GpuArray< Real, AMREX_SPACEDIM > dx
Definition: ERF_ActuatorSpreading.cpp:131
const int nx
Definition: ERF_InitCustomPertVels_CloudChamber.H:14
const int ny
Definition: ERF_InitCustomPertVels_CloudChamber.H:15

Referenced by ShocDriver::advance(), ComputeDiffusivityMRF(), ImmersedForcingBuildings_Scalar(), ImmersedForcingBuildings_Xmom(), ImmersedForcingBuildings_Ymom(), ImmersedForcingBuildings_Zmom(), ImmersedForcingTerrain_HorizMom_FractionStress(), ImmersedForcingTerrain_Scalar(), ImmersedForcingTerrain_Scalar_FractionStress(), ImmersedForcingTerrain_Xmom(), ImmersedForcingTerrain_Ymom(), ImmersedForcingTerrain_Zmom(), ERF::make_if_projection_sigma(), MOSTAverage::make_MOSTAverage_at_level(), EWP::source_terms_cellcentered(), Fitch::source_terms_cellcentered(), GeneralAD::source_terms_cellcentered(), SimpleAD::source_terms_cellcentered(), MassSource::update_geometry(), and SolverChoice::use_building_immersed_forcing().

Here is the caller graph for this function:

◆ LengthScaleInvCellSize()

amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> LengthScaleInvCellSize ( const amrex::Geometry &  geom)
inline

Inverse of LengthScaleCellSize.

Parameters
[in]geomgeometry of the level
Returns
1/dx, 1/dy and 1/dz with the substitution of LengthScaleCellSize
50 {
51  amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> dxinv = geom.InvCellSizeArray();
52  const amrex::Box& domain = geom.Domain();
53  const int nx = domain.length(0);
54  const int ny = domain.length(1);
55  if (ny == 1 && nx > 1) {
56  dxinv[1] = dxinv[0];
57  } else if (nx == 1 && ny > 1) {
58  dxinv[0] = dxinv[1];
59  }
60  return dxinv;
61 }

Referenced by ComputeTurbulentViscosityLES(), and ComputeTurbulentViscosityLES_EB().

Here is the caller graph for this function: