ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_BuoyancyUtils.H File Reference
#include <ERF_EOS.H>
#include <ERF_Constants.H>
Include dependency graph for ERF_BuoyancyUtils.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_anelastic (int &i, int &j, int &k, const amrex::Real &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &cell_data)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_anelastic_eb (int &i, int &j, int &k, const amrex::Real &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &cell_data, amrex::Array4< amrex::EBCellFlag const > const &flag)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_moist_anelastic (int &i, int &j, int &k, const amrex::Real &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &qv0_arr, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &qt_arr)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_rhopert (int &i, int &j, int &k, const amrex::Real &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &qv0_arr, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &qt_arr)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_rhopert_eb (int &i, int &j, int &k, const amrex::Real &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &qv0_arr, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &qt_arr, amrex::Array4< amrex::EBCellFlag const > const &flag)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_Tpert (int &i, int &j, int &k, const amrex::Real &grav_gpu, const amrex::Real &, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &p0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &cell_data)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_Thpert (int &i, int &j, int &k, const amrex::Real &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &cell_prim)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_moist_Tpert (int &i, int &j, int &k, const int &n_qstate, const amrex::Real &grav_gpu, const amrex::Real &, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &qv0_arr, const amrex::Array4< const amrex::Real > &p0_arr, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &qt_arr)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_moist_Thpert (int &i, int &j, int &k, const int &n_qstate, const amrex::Real &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &qv0_arr, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &qt_arr)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_anelastic_T (int &i, int &j, int &k, const amrex::Real &grav_gpu, const amrex::Real &, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &p0_arr, const amrex::Array4< const amrex::Real > &cell_data)
 

Function Documentation

◆ buoyancy_dry_anelastic()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_anelastic ( int &  i,
int &  j,
int &  k,
const amrex::Real grav_gpu,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  th0_arr,
const amrex::Array4< const amrex::Real > &  cell_data 
)
15 {
16  // Note: this is the same term as the moist anelastic buoyancy when qv = qc = qt = 0
17  amrex::Real theta_d_hi = cell_data(i,j,k ,RhoTheta_comp)/cell_data(i,j,k ,Rho_comp);
18  amrex::Real theta_d_lo = cell_data(i,j,k-1,RhoTheta_comp)/cell_data(i,j,k-1,Rho_comp);
19 
20  amrex::Real theta_d_wface = myhalf * (theta_d_lo + theta_d_hi);
21  amrex::Real theta_d0_wface = myhalf * (th0_arr(i,j,k) + th0_arr(i,j,k-1));
22  amrex::Real rho0_wface = myhalf * (r0_arr(i,j,k) + r0_arr(i,j,k-1));
23 
24  return (-rho0_wface * grav_gpu * (theta_d_wface - theta_d0_wface) / theta_d0_wface);
25 }
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
amrex::Real Real
Definition: ERF_ShocInterface.H:19

Referenced by make_buoyancy().

Here is the caller graph for this function:

◆ buoyancy_dry_anelastic_eb()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_anelastic_eb ( int &  i,
int &  j,
int &  k,
const amrex::Real grav_gpu,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  th0_arr,
const amrex::Array4< const amrex::Real > &  cell_data,
amrex::Array4< amrex::EBCellFlag const > const &  flag 
)
36 {
37  amrex::Real buoyancy = zero;
38  if (flag(i,j,k).isRegular()) {
39  amrex::Real theta_d_hi = cell_data(i,j,k ,RhoTheta_comp)/cell_data(i,j,k ,Rho_comp);
40  amrex::Real theta_d_lo = cell_data(i,j,k-1,RhoTheta_comp)/cell_data(i,j,k-1,Rho_comp);
41  amrex::Real theta_d_wface = myhalf * (theta_d_lo + theta_d_hi);
42  amrex::Real theta_d0_wface = myhalf * (th0_arr(i,j,k) + th0_arr(i,j,k-1));
43  amrex::Real rho0_wface = myhalf * (r0_arr(i,j,k) + r0_arr(i,j,k-1));
44  buoyancy = -rho0_wface * grav_gpu * (theta_d_wface - theta_d0_wface) / theta_d0_wface;
45  } else if (flag(i,j,k).isSingleValued()) {
46  if (flag(i,j,k-1).isCovered()) {
47  amrex::Real theta_d_hihi = cell_data(i,j,k+1,RhoTheta_comp)/cell_data(i,j,k+1,Rho_comp);
48  amrex::Real theta_d_hi = cell_data(i,j,k ,RhoTheta_comp)/cell_data(i,j,k ,Rho_comp);
49  amrex::Real theta_d_wface = myhalf * (three*theta_d_hi - theta_d_hihi);
50  amrex::Real theta_d0_wface = myhalf * (three*th0_arr(i,j,k) - th0_arr(i,j,k+1));
51  amrex::Real rho0_wface = myhalf * (three*r0_arr(i,j,k) - r0_arr(i,j,k+1));
52  buoyancy = -rho0_wface * grav_gpu * (theta_d_wface - theta_d0_wface) / theta_d0_wface;
53  } else if (flag(i,j,k).isCovered()) {
54  amrex::Real theta_d_lo = cell_data(i,j,k-1,RhoTheta_comp)/cell_data(i,j,k-1,Rho_comp);
55  amrex::Real theta_d_lolo = cell_data(i,j,k-2,RhoTheta_comp)/cell_data(i,j,k-2,Rho_comp);
56  amrex::Real theta_d_wface = myhalf * (three*theta_d_lo - theta_d_lolo);
57  amrex::Real theta_d0_wface = myhalf * (three*th0_arr(i,j,k-1) - th0_arr(i,j,k-2));
58  amrex::Real rho0_wface = myhalf * (three*r0_arr(i,j,k-1) - r0_arr(i,j,k-2));
59  buoyancy = -rho0_wface * grav_gpu * (theta_d_wface - theta_d0_wface) / theta_d0_wface;
60  } else {
61  amrex::Real theta_d_hi = cell_data(i,j,k ,RhoTheta_comp)/cell_data(i,j,k ,Rho_comp);
62  amrex::Real theta_d_lo = cell_data(i,j,k-1,RhoTheta_comp)/cell_data(i,j,k-1,Rho_comp);
63  amrex::Real theta_d_wface = myhalf * (theta_d_lo + theta_d_hi);
64  amrex::Real theta_d0_wface = myhalf * (th0_arr(i,j,k) + th0_arr(i,j,k-1));
65  amrex::Real rho0_wface = myhalf * (r0_arr(i,j,k) + r0_arr(i,j,k-1));
66  buoyancy = -rho0_wface * grav_gpu * (theta_d_wface - theta_d0_wface) / theta_d0_wface;
67  }
68  }
69  return buoyancy;
70 }
constexpr amrex::Real three
Definition: ERF_Constants.H:11
constexpr amrex::Real zero
Definition: ERF_Constants.H:8

Referenced by make_buoyancy().

Here is the caller graph for this function:

◆ buoyancy_dry_anelastic_T()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_anelastic_T ( int &  i,
int &  j,
int &  k,
const amrex::Real grav_gpu,
const amrex::Real ,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  p0_arr,
const amrex::Array4< const amrex::Real > &  cell_data 
)
302 {
303  amrex::Real rt0_hi = getRhoThetagivenP(p0_arr(i,j,k));
304  amrex::Real t0_hi = getTgivenPandTh(p0_arr(i,j,k), rt0_hi/r0_arr(i,j,k), RdoCp);
305  amrex::Real t_hi = getTgivenPandTh(p0_arr(i,j,k), cell_data(i,j,k,RhoTheta_comp)/r0_arr(i,j,k), RdoCp);
306  amrex::Real q_hi = (t_hi-t0_hi)/t0_hi;
307 
308  amrex::Real rt0_lo = getRhoThetagivenP(p0_arr(i,j,k-1));
309  amrex::Real t0_lo = getTgivenPandTh(p0_arr(i,j,k-1), rt0_lo/r0_arr(i,j,k-1), RdoCp);
310  amrex::Real t_lo = getTgivenPandTh(p0_arr(i,j,k-1), cell_data(i,j,k-1,RhoTheta_comp)/r0_arr(i,j,k-1), RdoCp);
311  amrex::Real q_lo = (t_lo-t0_lo)/t0_lo;
312 
313  amrex::Real r0_q_avg = myhalf * (r0_arr(i,j,k) * q_hi + r0_arr(i,j,k-1) * q_lo);
314  return (-r0_q_avg * grav_gpu);
315 }
constexpr amrex::Real RdoCp
Definition: ERF_Constants.H:54
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getRhoThetagivenP(const amrex::Real p, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:172
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenPandTh(const amrex::Real P, const amrex::Real th, const amrex::Real rdOcp)
Definition: ERF_EOS.H:32
Here is the call graph for this function:

◆ buoyancy_dry_Thpert()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_Thpert ( int &  i,
int &  j,
int &  k,
const amrex::Real grav_gpu,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  th0_arr,
const amrex::Array4< const amrex::Real > &  cell_prim 
)
208 {
209  amrex::Real thetaprime_hi = (cell_prim(i,j,k ,PrimTheta_comp) - th0_arr(i,j,k )) / th0_arr(i,j,k );
210  amrex::Real thetaprime_lo = (cell_prim(i,j,k-1,PrimTheta_comp) - th0_arr(i,j,k-1)) / th0_arr(i,j,k-1);
211 
212  amrex::Real thp_avg = myhalf * (thetaprime_hi + thetaprime_lo);
213  amrex::Real r0_avg = myhalf * (r0_arr(i,j,k) + r0_arr(i,j,k-1));
214 
215  return ( -r0_avg * grav_gpu * thp_avg);
216 }
#define PrimTheta_comp
Definition: ERF_IndexDefines.H:55

Referenced by make_buoyancy().

Here is the caller graph for this function:

◆ buoyancy_dry_Tpert()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_Tpert ( int &  i,
int &  j,
int &  k,
const amrex::Real grav_gpu,
const amrex::Real ,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  p0_arr,
const amrex::Array4< const amrex::Real > &  th0_arr,
const amrex::Array4< const amrex::Real > &  cell_data 
)
184 {
185  amrex::Real t0_hi = getTgivenPandTh(p0_arr(i,j,k), th0_arr(i,j,k), RdoCp);
186  amrex::Real t_hi = getTgivenRandRTh(cell_data(i,j,k ,Rho_comp), cell_data(i,j,k ,RhoTheta_comp));
187 
188  amrex::Real t0_lo = getTgivenPandTh(p0_arr(i,j,k-1), th0_arr(i,j,k-1), RdoCp);
189  amrex::Real t_lo = getTgivenRandRTh(cell_data(i,j,k-1,Rho_comp), cell_data(i,j,k-1,RhoTheta_comp));
190 
191  amrex::Real tprime_hi = (t_hi-t0_hi)/t0_hi;
192  amrex::Real tprime_lo = (t_lo-t0_lo)/t0_lo;
193 
194  amrex::Real tp_avg = myhalf * (tprime_hi + tprime_lo);
195  amrex::Real r0_avg = myhalf * (r0_arr(i,j,k) + r0_arr(i,j,k-1));
196 
197  return ( -r0_avg * grav_gpu * tp_avg);
198 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:46

Referenced by make_buoyancy().

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

◆ buoyancy_moist_anelastic()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_moist_anelastic ( int &  i,
int &  j,
int &  k,
const amrex::Real grav_gpu,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  th0_arr,
const amrex::Array4< const amrex::Real > &  qv0_arr,
const amrex::Array4< const amrex::Real > &  cell_data,
const amrex::Array4< const amrex::Real > &  qt_arr 
)
82 {
83  amrex::Real Fact = (one - RvoRd); // ~= -amrex::Real(0.61)
84 
85  amrex::Real th_d_hi = cell_data(i,j,k ,RhoTheta_comp)/cell_data(i,j,k ,Rho_comp);
86  amrex::Real th_d_lo = cell_data(i,j,k-1,RhoTheta_comp)/cell_data(i,j,k-1,Rho_comp);
87 
88  amrex::Real qv_hi = cell_data(i,j,k ,RhoQ1_comp) /cell_data(i,j,k ,Rho_comp);
89  amrex::Real qv_lo = cell_data(i,j,k-1,RhoQ1_comp) /cell_data(i,j,k-1,Rho_comp);
90 
91  amrex::Real qt_hi = qt_arr(i,j,k ) - qv_hi;
92  amrex::Real th_v_hi = th_d_hi * (one - Fact*qt_hi - RvoRd*qt_hi);
93 
94  amrex::Real qt_lo = qt_arr(i,j,k-1) - qv_lo;
95  amrex::Real th_v_lo = th_d_lo * (one - Fact*qt_lo - RvoRd*qt_lo);
96 
97  amrex::Real th_v0_hi = th0_arr(i,j,k ) * (one - Fact*qv0_arr(i,j,k ));
98  amrex::Real th_v0_lo = th0_arr(i,j,k-1) * (one - Fact*qv0_arr(i,j,k-1));
99 
100  amrex::Real qv0_hi = qv0_arr(i,j,k );
101  amrex::Real qv0_lo = qv0_arr(i,j,k-1);
102 
103  amrex::Real q_hi = (qv_hi-qv0_hi) - qt_hi + (th_v_hi - th_v0_hi) / th_v0_hi;
104  amrex::Real q_lo = (qv_lo-qv0_lo) - qt_lo + (th_v_lo - th_v0_lo) / th_v0_lo;
105 
106  amrex::Real qavg = myhalf * (q_hi + q_lo);
107 
108  amrex::Real r0avg = myhalf * (r0_arr(i,j,k) + r0_arr(i,j,k-1));
109 
110  return (-r0avg * grav_gpu * qavg);
111 }
constexpr amrex::Real one
Definition: ERF_Constants.H:9
constexpr amrex::Real RvoRd
Definition: ERF_Constants.H:56
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42

◆ buoyancy_moist_Thpert()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_moist_Thpert ( int &  i,
int &  j,
int &  k,
const int &  n_qstate,
const amrex::Real grav_gpu,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  th0_arr,
const amrex::Array4< const amrex::Real > &  qv0_arr,
const amrex::Array4< const amrex::Real > &  cell_prim,
const amrex::Array4< const amrex::Real > &  qt_arr 
)
266 {
267  amrex::Real qv_hi = (n_qstate >= 1) ? cell_prim(i,j,k ,PrimQ1_comp) : zero;
268  amrex::Real qv_lo = (n_qstate >= 1) ? cell_prim(i,j,k-1,PrimQ1_comp) : zero;
269 
270  amrex::Real qt_hi = qt_arr(i,j,k ) - qv_hi;
271  amrex::Real qt_lo = qt_arr(i,j,k-1) - qv_lo;
272 
273  amrex::Real dth_hi = cell_prim(i,j,k ,PrimTheta_comp) - th0_arr(i,j,k );
274  amrex::Real dth_lo = cell_prim(i,j,k-1,PrimTheta_comp) - th0_arr(i,j,k-1);
275 
276  amrex::Real qv0_hi = qv0_arr(i,j,k );
277  amrex::Real qv0_lo = qv0_arr(i,j,k-1);
278 
279  amrex::Real q_hi = epsv * (qv_hi-qv0_hi) - qt_hi + dth_hi/th0_arr(i,j,k );
280  amrex::Real q_lo = epsv * (qv_lo-qv0_lo) - qt_lo + dth_lo/th0_arr(i,j,k-1);
281 
282  amrex::Real qavg = myhalf * (q_hi + q_lo);
283 
284  amrex::Real r0avg = myhalf * (r0_arr(i,j,k) + r0_arr(i,j,k-1));
285 
286  return ( -r0avg * grav_gpu * qavg);
287 }
constexpr amrex::Real epsv
Definition: ERF_Constants.H:53
#define PrimQ1_comp
Definition: ERF_IndexDefines.H:58

Referenced by make_buoyancy().

Here is the caller graph for this function:

◆ buoyancy_moist_Tpert()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_moist_Tpert ( int &  i,
int &  j,
int &  k,
const int &  n_qstate,
const amrex::Real grav_gpu,
const amrex::Real ,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  th0_arr,
const amrex::Array4< const amrex::Real > &  qv0_arr,
const amrex::Array4< const amrex::Real > &  p0_arr,
const amrex::Array4< const amrex::Real > &  cell_prim,
const amrex::Array4< const amrex::Real > &  cell_data,
const amrex::Array4< const amrex::Real > &  qt_arr 
)
232 {
233  amrex::Real qv_hi = (n_qstate >= 1) ? cell_prim(i,j,k ,PrimQ1_comp) : zero;
234  amrex::Real qv_lo = (n_qstate >= 1) ? cell_prim(i,j,k-1,PrimQ1_comp) : zero;
235 
236  amrex::Real t0_hi = getTgivenPandTh(p0_arr(i,j,k ), th0_arr(i,j,k ), RdoCp);
237  amrex::Real t0_lo = getTgivenPandTh(p0_arr(i,j,k-1), th0_arr(i,j,k-1), RdoCp);
238 
239  amrex::Real dt_hi = getTgivenRandRTh(cell_data(i,j,k ,Rho_comp), cell_data(i,j,k ,RhoTheta_comp), qv_hi) - t0_hi;
240  amrex::Real dt_lo = getTgivenRandRTh(cell_data(i,j,k-1,Rho_comp), cell_data(i,j,k-1,RhoTheta_comp), qv_lo) - t0_lo;
241 
242  amrex::Real qv0_hi = qv0_arr(i,j,k );
243  amrex::Real qv0_lo = qv0_arr(i,j,k-1);
244 
245  amrex::Real q_hi = epsv * (qv_hi-qv0_hi) - (qt_arr(i,j,k )-qv_hi) + dt_hi/t0_hi;
246  amrex::Real q_lo = epsv * (qv_lo-qv0_lo) - (qt_arr(i,j,k-1)-qv_lo) + dt_lo/t0_lo;
247 
248  amrex::Real qavg = myhalf * (q_hi + q_lo);
249 
250  amrex::Real r0avg = myhalf * (r0_arr(i,j,k) + r0_arr(i,j,k-1));
251 
252  return ( -r0avg * grav_gpu * qavg);
253 }

Referenced by make_buoyancy().

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

◆ buoyancy_rhopert()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_rhopert ( int &  i,
int &  j,
int &  k,
const amrex::Real grav_gpu,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  qv0_arr,
const amrex::Array4< const amrex::Real > &  cell_data,
const amrex::Array4< const amrex::Real > &  qt_arr 
)
122 {
123  amrex::Real rhop_hi = cell_data(i,j,k ,Rho_comp) * (one + qt_arr(i,j,k )) -
124  r0_arr(i,j,k ) * (one + qv0_arr(i,j,k ));
125  amrex::Real rhop_lo = cell_data(i,j,k-1,Rho_comp) * (one + qt_arr(i,j,k-1)) -
126  r0_arr(i,j,k-1 ) * (one + qv0_arr(i,j,k-1));
127  return( grav_gpu * myhalf * ( rhop_hi + rhop_lo ) );
128 }

Referenced by make_buoyancy().

Here is the caller graph for this function:

◆ buoyancy_rhopert_eb()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_rhopert_eb ( int &  i,
int &  j,
int &  k,
const amrex::Real grav_gpu,
const amrex::Array4< const amrex::Real > &  r0_arr,
const amrex::Array4< const amrex::Real > &  qv0_arr,
const amrex::Array4< const amrex::Real > &  cell_data,
const amrex::Array4< const amrex::Real > &  qt_arr,
amrex::Array4< amrex::EBCellFlag const > const &  flag 
)
140 {
141  amrex::Real buoyancy = zero;
142  if (flag(i,j,k).isRegular()) {
143  amrex::Real rhop_hi = cell_data(i,j,k ,Rho_comp) * (one + qt_arr(i,j,k )) -
144  r0_arr(i,j,k ) * (one + qv0_arr(i,j,k ));
145  amrex::Real rhop_lo = cell_data(i,j,k-1,Rho_comp) * (one + qt_arr(i,j,k-1)) -
146  r0_arr(i,j,k-1 ) * (one + qv0_arr(i,j,k-1));
147  buoyancy = grav_gpu * myhalf * ( rhop_hi + rhop_lo );
148  } else if (flag(i,j,k).isSingleValued()) {
149  if (flag(i,j,k-1).isCovered()) {
150  amrex::Real rhop_hihi = cell_data(i,j,k+1,Rho_comp) * (one + qt_arr(i,j,k+1)) -
151  r0_arr(i,j,k+1 ) * (one + qv0_arr(i,j,k+1));
152  amrex::Real rhop_hi = cell_data(i,j,k ,Rho_comp) * (one + qt_arr(i,j,k )) -
153  r0_arr(i,j,k ) * (one + qv0_arr(i,j,k ));
154  buoyancy = grav_gpu * myhalf * ( three * rhop_hi - rhop_hihi );
155  // buoyancy = grav_gpu * rhop_hi;
156  } else if (flag(i,j,k).isCovered()) {
157  amrex::Real rhop_lo = cell_data(i,j,k-1,Rho_comp) * (one + qt_arr(i,j,k-1)) -
158  r0_arr(i,j,k-1 ) * (one + qv0_arr(i,j,k-1));
159  amrex::Real rhop_lolo = cell_data(i,j,k-2,Rho_comp) * (one + qt_arr(i,j,k-2)) -
160  r0_arr(i,j,k-2 ) * (one + qv0_arr(i,j,k-2));
161  buoyancy = grav_gpu * myhalf * ( three * rhop_lo - rhop_lolo );
162  // buoyancy = grav_gpu * rhop_lo;
163  } else {
164  amrex::Real rhop_hi = cell_data(i,j,k ,Rho_comp) * (one + qt_arr(i,j,k )) -
165  r0_arr(i,j,k ) * (one + qv0_arr(i,j,k ));
166  amrex::Real rhop_lo = cell_data(i,j,k-1,Rho_comp) * (one + qt_arr(i,j,k-1)) -
167  r0_arr(i,j,k-1 ) * (one + qv0_arr(i,j,k-1));
168  buoyancy = grav_gpu * myhalf * ( rhop_hi + rhop_lo );
169  }
170  }
171  return buoyancy;
172 }

Referenced by make_buoyancy().

Here is the caller graph for this function: