ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
rotate_flux Struct Reference

#include <ERF_MOSTStress.H>

Collaboration diagram for rotate_flux:

Public Member Functions

 rotate_flux (int l_zlo)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real compute_q_flux (const int &i, const int &j, const int &k, const int &n, const int &icomp, const amrex::Real &dz, const amrex::Real &dz1, const bool &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &cons_arr, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< amrex::Real > &dest_arr) const
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real compute_t_flux (const int &i, const int &j, const int &k, const int &n, const int &icomp, const amrex::Real &dz, const amrex::Real &dz1, const bool &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &cons_arr, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &tm_arr, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &t_star_arr, const amrex::Array4< const amrex::Real > &t_surf_arr, const amrex::Array4< amrex::Real > &dest_arr) const
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real compute_u_flux (const int &i, const int &j, const int &k, const int &icomp, const amrex::Real &dz, const amrex::Real &dz1, const bool &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &cons_arr, const amrex::Array4< const amrex::Real > &velx_arr, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &u_star_arr, const amrex::Array4< amrex::Real > &dest_arr) const
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real compute_v_flux (const int &i, const int &j, const int &k, const int &icomp, const amrex::Real &dz, const amrex::Real &dz1, const bool &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &vely_arr, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< amrex::Real > &dest_arr) const
 

Private Attributes

int zlo
 
const amrex::Real eps = 1e-15
 

Detailed Description

Rotate flux formulation

Constructor & Destructor Documentation

◆ rotate_flux()

rotate_flux::rotate_flux ( int  l_zlo)
inline
2107  : zlo(l_zlo) {}
int zlo
Definition: ERF_MOSTStress.H:2266

Member Function Documentation

◆ compute_q_flux()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real rotate_flux::compute_q_flux ( const int &  i,
const int &  j,
const int &  k,
const int &  n,
const int &  icomp,
const amrex::Real &  dz,
const amrex::Real &  dz1,
const bool &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  cons_arr,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< amrex::Real > &  dest_arr 
) const
inline
2131  {
2132  int ic, jc;
2133  ic = i < lbound(cons_arr).x ? lbound(cons_arr).x : i;
2134  jc = j < lbound(cons_arr).y ? lbound(cons_arr).y : j;
2135  ic = ic > ubound(cons_arr).x ? ubound(cons_arr).x : ic;
2136  jc = jc > ubound(cons_arr).y ? ubound(cons_arr).y : jc;
2137 
2138  // surface gradient equal to gradient at first zface
2139  amrex::Real deltaz = dz * (zlo - k);
2140  amrex::Real rqvgrad = ( cons_arr(ic,jc,zlo+1,RhoQ1_comp)
2141  - cons_arr(ic,jc,zlo ,RhoQ1_comp) ) / (0.5*(dz+dz1));
2142  dest_arr(i,j,k,icomp+n) = cons_arr(ic,jc,zlo,RhoQ1_comp) - rqvgrad * deltaz;
2143 
2144  // NOTE: this is the total stress
2145  amrex::Real rho = cons_arr(ic,jc,zlo,Rho_comp);
2146  amrex::Real qstar = 0.0; //q_star_arr(ic,jc,zlo);
2147  amrex::Real moflux = (std::abs(qstar) > eps) ? -rho * qstar : 0.0;
2148 
2149  return moflux;
2150  }
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
@ rho
Definition: ERF_Kessler.H:30
const amrex::Real eps
Definition: ERF_MOSTStress.H:2267

◆ compute_t_flux()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real rotate_flux::compute_t_flux ( const int &  i,
const int &  j,
const int &  k,
const int &  n,
const int &  icomp,
const amrex::Real &  dz,
const amrex::Real &  dz1,
const bool &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  cons_arr,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  tm_arr,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  t_star_arr,
const amrex::Array4< const amrex::Real > &  t_surf_arr,
const amrex::Array4< amrex::Real > &  dest_arr 
) const
inline
2173  {
2174  int ic, jc;
2175  ic = i < lbound(cons_arr).x ? lbound(cons_arr).x : i;
2176  jc = j < lbound(cons_arr).y ? lbound(cons_arr).y : j;
2177  ic = ic > ubound(cons_arr).x ? ubound(cons_arr).x : ic;
2178  jc = jc > ubound(cons_arr).y ? ubound(cons_arr).y : jc;
2179 
2180  // surface gradient equal to gradient at first zface
2181  amrex::Real deltaz = dz * (zlo - k);
2182  amrex::Real rthetagrad = ( cons_arr(ic,jc,zlo+1,RhoTheta_comp)
2183  - cons_arr(ic,jc,zlo ,RhoTheta_comp) ) / (0.5*(dz+dz1));
2184  dest_arr(i,j,k,icomp+n) = cons_arr(ic,jc,zlo,RhoTheta_comp) - rthetagrad * deltaz;
2185 
2186  // NOTE: this is the total stress
2187  amrex::Real theta_mean = tm_arr(ic,jc,zlo);
2188  amrex::Real theta_surf = t_surf_arr(ic,jc,zlo);
2189  amrex::Real rho = cons_arr(ic,jc,zlo,Rho_comp);
2190  amrex::Real tstar = t_star_arr(ic,jc,zlo);
2191  amrex::Real moflux = (std::abs(tstar) > eps) ? -rho * tstar * (theta_mean-theta_surf) : 0.0;
2192 
2193  return moflux;
2194  }
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37

◆ compute_u_flux()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real rotate_flux::compute_u_flux ( const int &  i,
const int &  j,
const int &  k,
const int &  icomp,
const amrex::Real &  dz,
const amrex::Real &  dz1,
const bool &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  cons_arr,
const amrex::Array4< const amrex::Real > &  velx_arr,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  u_star_arr,
const amrex::Array4< amrex::Real > &  dest_arr 
) const
inline
2214  {
2215  int ic, jc;
2216  ic = i < lbound(cons_arr).x+1 ? lbound(cons_arr).x+1 : i;
2217  jc = j < lbound(cons_arr).y ? lbound(cons_arr).y : j;
2218  ic = ic > ubound(cons_arr).x ? ubound(cons_arr).x : ic;
2219  jc = jc > ubound(cons_arr).y ? ubound(cons_arr).y : jc;
2220 
2221  // surface gradient equal to gradient at first zface
2222  amrex::Real deltaz = dz * (zlo - k);
2223  amrex::Real ugrad = (velx_arr(i,j,zlo+1) - velx_arr(i,j,zlo)) / (0.5*(dz+dz1));
2224  dest_arr(i,j,k,icomp) = velx_arr(i,j,zlo) - ugrad * deltaz;
2225 
2226  // NOTE: this is the total stress
2227  amrex::Real rho = 0.5 *( cons_arr(ic-1,jc,zlo,Rho_comp)
2228  + cons_arr(ic ,jc,zlo,Rho_comp) );
2229  amrex::Real ustar = 0.5 * ( u_star_arr(ic-1,jc,zlo) + u_star_arr(ic,jc,zlo) );
2230  amrex::Real stressx = -rho * ustar * ustar;
2231 
2232  return stressx;
2233  }

◆ compute_v_flux()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real rotate_flux::compute_v_flux ( const int &  i,
const int &  j,
const int &  k,
const int &  icomp,
const amrex::Real &  dz,
const amrex::Real &  dz1,
const bool &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  vely_arr,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< amrex::Real > &  dest_arr 
) const
inline
2253  {
2254  // surface gradient equal to gradient at first zface
2255  amrex::Real deltaz = dz * (zlo - k);
2256  amrex::Real vgrad = (vely_arr(i,j,zlo+1) - vely_arr(i,j,zlo)) / (0.5*(dz+dz1));
2257  dest_arr(i,j,k,icomp) = vely_arr(i,j,zlo) - vgrad * deltaz;
2258 
2259  // NOTE: this is the total stress
2260  amrex::Real stressy = 0.0;
2261 
2262  return stressy;
2263  }

Member Data Documentation

◆ eps

const amrex::Real rotate_flux::eps = 1e-15
private

Referenced by compute_q_flux(), and compute_t_flux().

◆ zlo

int rotate_flux::zlo
private

The documentation for this struct was generated from the following file: