ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
derived Namespace Reference

Functions

void erf_derrhodivide (const Box &bx, FArrayBox &derfab, const FArrayBox &datfab, const int scalar_index)
 
void erf_dernull (const Box &, FArrayBox &, int, int, const FArrayBox &, const Geometry &, Real, const int *, const int)
 
void erf_dersoundspeed (const Box &bx, FArrayBox &derfab, int, int, const FArrayBox &datfab, const Geometry &, Real, const int *, const int)
 
void erf_dertemp (const Box &bx, FArrayBox &derfab, int, int, const FArrayBox &datfab, const Geometry &, Real, const int *, const int)
 
void erf_dermoisttemp (const Box &bx, FArrayBox &derfab, int, int, const FArrayBox &datfab, const Geometry &, Real, const int *, const int)
 
void erf_dertheta (const Box &bx, FArrayBox &derfab, int, int, const FArrayBox &datfab, const Geometry &, Real, const int *, const int)
 
void erf_derscalar (const Box &bx, FArrayBox &derfab, int, int, const FArrayBox &datfab, const Geometry &, Real, const int *, const int)
 
void erf_derKE (const Box &bx, FArrayBox &derfab, int, int, const FArrayBox &datfab, const Geometry &, Real, const int *, const int)
 
void erf_dervortx (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real, const int *, const int)
 
void erf_dervorty (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real, const int *, const int)
 
void erf_dervortz (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real, const int *, const int)
 
void erf_dermagvel (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &, amrex::Real, const int *, const int)
 
void erf_derrhodivide (const amrex::Box &bx, amrex::FArrayBox &derfab, const amrex::FArrayBox &datfab, const int scalar_index)
 
void erf_dernull (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real time, const int *bcrec, const int level)
 
void erf_dersoundspeed (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real time, const int *bcrec, const int level)
 
void erf_dertemp (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real time, const int *bcrec, const int level)
 
void erf_dermoisttemp (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real time, const int *bcrec, const int level)
 
void erf_dertheta (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real time, const int *bcrec, const int level)
 
void erf_derscalar (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real time, const int *bcrec, const int level)
 
void erf_derKE (const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datfab, const amrex::Geometry &geomdata, amrex::Real time, const int *bcrec, const int level)
 

Function Documentation

◆ erf_derKE() [1/2]

void derived::erf_derKE ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  time,
const int *  bcrec,
const int  level 
)

◆ erf_derKE() [2/2]

void derived::erf_derKE ( const Box &  bx,
FArrayBox &  derfab,
int  ,
int  ,
const FArrayBox &  datfab,
const Geometry &  ,
Real  ,
const int *  ,
const int   
)

Function to define the kinetic energy KE by dividing (rho KE) by rho

@params[in] bx box on which to divide by density @params[out] derfab array of derived quantity – here it holds KE @params[in] datfab array of data used to construct derived quantity

195 {
196  erf_derrhodivide(bx, derfab, datfab, RhoKE_comp);
197 }
#define RhoKE_comp
Definition: ERF_IndexDefines.H:38
void erf_derrhodivide(const Box &bx, FArrayBox &derfab, const FArrayBox &datfab, const int scalar_index)
Definition: ERF_Derive.cpp:18

Referenced by ERF::WritePlotFile().

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

◆ erf_dermagvel()

void derived::erf_dermagvel ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  ,
amrex::Real  ,
const int *  ,
const int   
)
294 {
295  AMREX_ALWAYS_ASSERT(dcomp == 0);
296  AMREX_ALWAYS_ASSERT(ncomp == 1);
297 
298  auto const dat = datfab.array(); // cell-centered velocity
299  auto tfab = derfab.array(); // cell-centered magvel
300 
301  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
302  {
303  Real u = dat(i,j,k,0);
304  Real v = dat(i,j,k,1);
305  Real w = dat(i,j,k,2);
306  tfab(i,j,k,dcomp) = std::sqrt(u*u + v*v + w*w);
307  });
308 }

Referenced by ERF::WritePlotFile().

Here is the caller graph for this function:

◆ erf_dermoisttemp() [1/2]

void derived::erf_dermoisttemp ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  time,
const int *  bcrec,
const int  level 
)

◆ erf_dermoisttemp() [2/2]

void derived::erf_dermoisttemp ( const Box &  bx,
FArrayBox &  derfab,
int  ,
int  ,
const FArrayBox &  datfab,
const Geometry &  ,
Real  ,
const int *  ,
const int   
)
122 {
123  auto const dat = datfab.array();
124  auto tfab = derfab.array();
125 
126  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
127  {
128  const Real rho = dat(i, j, k, Rho_comp);
129  const Real rhotheta = dat(i, j, k, RhoTheta_comp);
130  AMREX_ALWAYS_ASSERT(rhotheta > 0.);
131  const Real qv = dat(i, j, k, RhoQ1_comp) / rho;
132  tfab(i,j,k) = getTgivenRandRTh(rho,rhotheta,qv);
133  });
134 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real qv=0.0)
Definition: ERF_EOS.H:46
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
@ rho
Definition: ERF_Kessler.H:30
@ qv
Definition: ERF_Kessler.H:36

Referenced by WriteBndryPlanes::write_planes(), and ERF::WritePlotFile().

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

◆ erf_dernull() [1/2]

void derived::erf_dernull ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  time,
const int *  bcrec,
const int  level 
)

◆ erf_dernull() [2/2]

void derived::erf_dernull ( const Box &  ,
FArrayBox &  ,
int  ,
int  ,
const FArrayBox &  ,
const Geometry &  ,
Real  ,
const int *  ,
const int   
)

Placeholder function that does nothing

48 { }

Referenced by ERF::WritePlotFile().

Here is the caller graph for this function:

◆ erf_derrhodivide() [1/2]

void derived::erf_derrhodivide ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
const amrex::FArrayBox &  datfab,
const int  scalar_index 
)

◆ erf_derrhodivide() [2/2]

void derived::erf_derrhodivide ( const Box &  bx,
FArrayBox &  derfab,
const FArrayBox &  datfab,
const int  scalar_index 
)

Function to define a derived quantity by dividing by density (analogous to cons_to_prim)

@params[in] bx box on which to divide by density @params[out] derfab array of derived quantity @params[in] datfab array of data used to construct derived quantity @params[in] scalar_index index of quantity to be divided by density

22 {
23  // This routine divides any cell-centered conserved quantity by density
24  auto const dat = datfab.array();
25  auto primitive = derfab.array();
26 
27  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
28  {
29  const Real rho = dat(i, j, k, Rho_comp);
30  const Real conserved = dat(i, j, k, scalar_index);
31  primitive(i,j,k) = conserved / rho;
32  });
33 }

Referenced by erf_derKE(), erf_derscalar(), erf_dertheta(), and WriteBndryPlanes::write_planes().

Here is the caller graph for this function:

◆ erf_derscalar() [1/2]

void derived::erf_derscalar ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  time,
const int *  bcrec,
const int  level 
)

◆ erf_derscalar() [2/2]

void derived::erf_derscalar ( const Box &  bx,
FArrayBox &  derfab,
int  ,
int  ,
const FArrayBox &  datfab,
const Geometry &  ,
Real  ,
const int *  ,
const int   
)

Function to define a scalar s by dividing (rho s) by rho

@params[in] bx box on which to divide by density @params[out] derfab array of derived quantity – here it holds scalar s @params[in] datfab array of data used to construct derived quantity

174 {
175  erf_derrhodivide(bx, derfab, datfab, RhoScalar_comp);
176 }
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:40

Referenced by ERF::ErrorEst(), and ERF::WritePlotFile().

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

◆ erf_dersoundspeed() [1/2]

void derived::erf_dersoundspeed ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  time,
const int *  bcrec,
const int  level 
)

◆ erf_dersoundspeed() [2/2]

void derived::erf_dersoundspeed ( const Box &  bx,
FArrayBox &  derfab,
int  ,
int  ,
const FArrayBox &  datfab,
const Geometry &  ,
Real  ,
const int *  ,
const int   
)

Function to define the sound speed by calling an EOS routine

@params[in] bx box on which to divide by density @params[out] derfab array of derived quantity – here it holds pressure @params[in] datfab array of data used to construct derived quantity

67 {
68  auto const dat = datfab.array();
69  auto cfab = derfab.array();
70 
71  // NOTE: we compute the soundspeed of dry air -- we do not account for any moisture effects here
72  Real qv = 0.;
73 
74  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
75  {
76  const Real rhotheta = dat(i, j, k, RhoTheta_comp);
77  const Real rho = dat(i, j, k, Rho_comp);
78  AMREX_ALWAYS_ASSERT(rhotheta > 0.);
79  cfab(i,j,k) = std::sqrt(Gamma * getPgivenRTh(rhotheta,qv) / rho);
80  });
81 }
constexpr amrex::Real Gamma
Definition: ERF_Constants.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv=0.)
Definition: ERF_EOS.H:84

Referenced by ERF::WritePlotFile().

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

◆ erf_dertemp() [1/2]

void derived::erf_dertemp ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  time,
const int *  bcrec,
const int  level 
)

◆ erf_dertemp() [2/2]

void derived::erf_dertemp ( const Box &  bx,
FArrayBox &  derfab,
int  ,
int  ,
const FArrayBox &  datfab,
const Geometry &  ,
Real  ,
const int *  ,
const int   
)

Function to define the temperature by calling an EOS routine

@params[in] bx box on which to divide by density @params[out] derfab array of derived quantity – here it holds pressure @params[in] datfab array of data used to construct derived quantity

100 {
101  auto const dat = datfab.array();
102  auto tfab = derfab.array();
103 
104  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
105  {
106  const Real rho = dat(i, j, k, Rho_comp);
107  const Real rhotheta = dat(i, j, k, RhoTheta_comp);
108  AMREX_ALWAYS_ASSERT(rhotheta > 0.);
109  tfab(i,j,k) = getTgivenRandRTh(rho,rhotheta);
110  });
111 }

Referenced by WriteBndryPlanes::write_planes(), and ERF::WritePlotFile().

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

◆ erf_dertheta() [1/2]

void derived::erf_dertheta ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  time,
const int *  bcrec,
const int  level 
)

◆ erf_dertheta() [2/2]

void derived::erf_dertheta ( const Box &  bx,
FArrayBox &  derfab,
int  ,
int  ,
const FArrayBox &  datfab,
const Geometry &  ,
Real  ,
const int *  ,
const int   
)

Function to define the potential temperature by calling an EOS routine

@params[in] bx box on which to divide by density @params[out] derfab array of derived quantity – here it holds pressure @params[in] datfab array of data used to construct derived quantity

153 {
154  erf_derrhodivide(bx, derfab, datfab, RhoTheta_comp);
155 }

Referenced by ERF::ErrorEst(), and ERF::WritePlotFile().

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

◆ erf_dervortx()

void derived::erf_dervortx ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  ,
const int *  ,
const int   
)
210 {
211  AMREX_ALWAYS_ASSERT(dcomp == 0);
212  AMREX_ALWAYS_ASSERT(ncomp == 1);
213 
214  auto const dat = datfab.array(); // cell-centered velocity
215  auto tfab = derfab.array(); // cell-centered vorticity x-component
216 
217  const Real dy = geomdata.CellSize(1);
218  const Real dz = geomdata.CellSize(2);
219 
220  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
221  {
222  tfab(i,j,k,dcomp) = (dat(i,j+1,k,2) - dat(i,j-1,k,2)) / (2.0*dy) // dw/dy
223  - (dat(i,j,k+1,1) - dat(i,j,k-1,1)) / (2.0*dz); // dv/dz
224  });
225 }

Referenced by ERF::WritePlotFile().

Here is the caller graph for this function:

◆ erf_dervorty()

void derived::erf_dervorty ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  ,
const int *  ,
const int   
)
238 {
239  AMREX_ALWAYS_ASSERT(dcomp == 0);
240  AMREX_ALWAYS_ASSERT(ncomp == 1);
241 
242  auto const dat = datfab.array(); // cell-centered velocity
243  auto tfab = derfab.array(); // cell-centered vorticity y-component
244 
245  const Real dx = geomdata.CellSize(0);
246  const Real dz = geomdata.CellSize(2);
247 
248  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
249  {
250  tfab(i,j,k,dcomp) = (dat(i,j,k+1,0) - dat(i,j,k-1,0)) / (2.0*dz) // du/dz
251  - (dat(i+1,j,k,2) - dat(i-1,j,k,2)) / (2.0*dx); // dw/dx
252  });
253 }

Referenced by ERF::WritePlotFile().

Here is the caller graph for this function:

◆ erf_dervortz()

void derived::erf_dervortz ( const amrex::Box &  bx,
amrex::FArrayBox &  derfab,
int  dcomp,
int  ncomp,
const amrex::FArrayBox &  datfab,
const amrex::Geometry &  geomdata,
amrex::Real  ,
const int *  ,
const int   
)
266 {
267  AMREX_ALWAYS_ASSERT(dcomp == 0);
268  AMREX_ALWAYS_ASSERT(ncomp == 1);
269 
270  auto const dat = datfab.array(); // cell-centered velocity
271  auto tfab = derfab.array(); // cell-centered vorticity z-component
272 
273  const Real dx = geomdata.CellSize(0);
274  const Real dy = geomdata.CellSize(2);
275 
276  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
277  {
278  tfab(i,j,k,dcomp) = (dat(i+1,j,k,1) - dat(i-1,j,k,1)) / (2.0*dx) // dv/dx
279  - (dat(i,j+1,k,0) - dat(i,j-1,k,0)) / (2.0*dy); // du/dy
280  });
281 }

Referenced by ERF::WritePlotFile().

Here is the caller graph for this function: