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

#include <ERF_MOSTStress.H>

Collaboration diagram for custom_flux:

Public Member Functions

 custom_flux (bool specified_rho_surf)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real compute_q_flux (const int &i, const int &j, const int &k, const int &, 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 > &q_star_arr, const amrex::Array4< const amrex::Real > &) const
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real compute_t_flux (const int &i, const int &j, const int &k, const int &, 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 > &t_star_arr, const amrex::Array4< const amrex::Real > &) const
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real compute_u_flux (const int &i, const int &j, const int &k, const int &, const amrex::Array4< const amrex::Real > &cons_arr, const amrex::Array4< const amrex::Real > &velx_arr, 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< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &u_star_arr) const
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real compute_v_flux (const int &i, const int &j, const int &k, const int &, const amrex::Array4< const amrex::Real > &cons_arr, const amrex::Array4< const amrex::Real > &velx_arr, 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< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &u_star_arr) const
 

Private Attributes

const amrex::Real eps = amrex::Real(1e-15)
 
const bool fluxes_include_rho {false}
 

Detailed Description

Custom flux formulation

Constructor & Destructor Documentation

◆ custom_flux()

custom_flux::custom_flux ( bool  specified_rho_surf)
inline

Construct the custom flux calculator.

Parameters
[in]specified_rho_surfwhether the supplied custom fluxes include density
2550  : fluxes_include_rho(specified_rho_surf)
2551  {}
const bool fluxes_include_rho
Definition: ERF_MOSTStress.H:2701

Member Function Documentation

◆ compute_q_flux()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real custom_flux::compute_q_flux ( const int &  i,
const int &  j,
const int &  k,
const int &  ,
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 > &  q_star_arr,
const amrex::Array4< const amrex::Real > &   
) const
inline

Compute moisture flux for one surface point.

Calling sequence
i, j, k, cons_arr, velx_arr, vely_arr, umm_arr, qvm_arr, u_star_arr, q_star_arr, q_surf_arr.
2576  {
2577  amrex::Real rho = (fluxes_include_rho) ? one : cons_arr(i,j,k,Rho_comp);
2578  amrex::Real qstar = q_star_arr(i,j,0);
2579 
2580  // NOTE: this is rho*<q'w'> = -K dqdz
2581  amrex::Real moflux = (std::abs(qstar) > eps) ? rho * qstar : zero;
2582 
2583  return moflux;
2584  }
#define Rho_comp
Definition: ERF_IndexDefines.H:61
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
@ qstar
Definition: ERF_SLM.H:32
@ rho
Definition: ERF_Kessler.H:25
const amrex::Real eps
Definition: ERF_MOSTStress.H:2699

◆ compute_t_flux()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real custom_flux::compute_t_flux ( const int &  i,
const int &  j,
const int &  k,
const int &  ,
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 > &  t_star_arr,
const amrex::Array4< const amrex::Real > &   
) const
inline

Compute heat flux for one surface point.

Calling sequence
i, j, k, cons_arr, velx_arr, vely_arr, umm_arr, tm_arr, u_star_arr, t_star_arr, t_surf_arr.
2609  {
2610  amrex::Real rho = (fluxes_include_rho) ? one : cons_arr(i,j,k,Rho_comp);
2611  amrex::Real tstar = t_star_arr(i,j,0);
2612 
2613  // NOTE: this is rho*<T'w'> = -K dTdz
2614  amrex::Real moflux = (std::abs(tstar) > eps) ? rho * tstar : zero;
2615 
2616  return moflux;
2617  }
@ tstar
Definition: ERF_SLM.H:31

◆ compute_u_flux()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real custom_flux::compute_u_flux ( const int &  i,
const int &  j,
const int &  k,
const int &  ,
const amrex::Array4< const amrex::Real > &  cons_arr,
const amrex::Array4< const amrex::Real > &  velx_arr,
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< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  u_star_arr 
) const
inline

Compute x-momentum flux for one surface face.

Calling sequence
i, j, k, cons_arr, velx_arr, vely_arr, umm_arr, um_arr, u_star_arr.
2642  {
2643  amrex::Real velx = velx_arr(i,j,k);
2644  amrex::Real vely = fourth * ( vely_arr(i ,j,k) + vely_arr(i ,j+1,k)
2645  + vely_arr(i-1,j,k) + vely_arr(i-1,j+1,k) );
2646  amrex::Real rho = (fluxes_include_rho) ? one : myhalf * ( cons_arr(i-1,j,k,Rho_comp) + cons_arr(i,j,k,Rho_comp) );
2647 
2648  amrex::Real ustar = myhalf * ( u_star_arr(i-1,j,0) + u_star_arr(i,j,0) );
2649  amrex::Real wsp = std::sqrt(velx*velx+vely*vely);
2650 
2651  // NOTE: this is rho*<u'w'> = -K dudz; still air has no stress direction, so no stress
2652  amrex::Real stressx = (wsp > zero) ? -rho * ustar * ustar * velx / wsp : zero;
2653 
2654  return stressx;
2655  }
constexpr amrex::Real fourth
Definition: ERF_NumericalConstants.H:42
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
@ ustar
Definition: ERF_SLM.H:30

◆ compute_v_flux()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real custom_flux::compute_v_flux ( const int &  i,
const int &  j,
const int &  k,
const int &  ,
const amrex::Array4< const amrex::Real > &  cons_arr,
const amrex::Array4< const amrex::Real > &  velx_arr,
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< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  u_star_arr 
) const
inline

Compute y-momentum flux for one surface face.

Calling sequence
i, j, k, cons_arr, velx_arr, vely_arr, umm_arr, vm_arr, u_star_arr.
2680  {
2681  amrex::Real velx = fourth * ( velx_arr(i,j ,k) + velx_arr(i+1,j ,k)
2682  + velx_arr(i,j-1,k) + velx_arr(i+1,j-1,k) );
2683  amrex::Real vely = vely_arr(i,j,k);
2684  amrex::Real rho = (fluxes_include_rho) ? one : myhalf * ( cons_arr(i,j-1,k,Rho_comp) + cons_arr(i,j,k,Rho_comp) );
2685 
2686  amrex::Real ustar = myhalf * ( u_star_arr(i,j-1,0) + u_star_arr(i,j,0) );
2687  amrex::Real wsp = std::sqrt(velx*velx+vely*vely);
2688 
2689  // NOTE: this is rho*<v'w'> = -K dvdz; still air has no stress direction, so no stress
2690  amrex::Real stressy = (wsp > zero) ? -rho * ustar * ustar * vely / wsp : zero;
2691 
2692  return stressy;
2693  }

Member Data Documentation

◆ eps

const amrex::Real custom_flux::eps = amrex::Real(1e-15)
private

Referenced by compute_q_flux(), and compute_t_flux().

◆ fluxes_include_rho

const bool custom_flux::fluxes_include_rho {false}
private

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