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

Classes

struct  FaceStressResult
 

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real conservative_to_kinematic_stress (amrex::Real conservative_stress, amrex::Real rho)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool lsm_flux_is_valid (bool has_flux, bool is_land, amrex::Real flux, amrex::Real undefined)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE FaceStressResult combine_lsm_and_most_stress (amrex::Real rho_low, amrex::Real rho_high, amrex::Real kinematic_low, amrex::Real kinematic_high, bool low_valid, bool high_valid, amrex::Real most_face_stress)
 

Function Documentation

◆ combine_lsm_and_most_stress()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE FaceStressResult surface_layer_stress::combine_lsm_and_most_stress ( amrex::Real  rho_low,
amrex::Real  rho_high,
amrex::Real  kinematic_low,
amrex::Real  kinematic_high,
bool  low_valid,
bool  high_valid,
amrex::Real  most_face_stress 
)

Combine cell-centered kinematic LSM stresses with a conservative MOST fallback stress at one face. The returned cache values are always kinematic, while face_stress is always conservative.

Parameters
[in]rho_lowdensity on the low-side cell
[in]rho_highdensity on the high-side cell
[in]kinematic_lowlow-side LSM kinematic stress
[in]kinematic_highhigh-side LSM kinematic stress
[in]low_validwhether the low-side LSM stress is valid
[in]high_validwhether the high-side LSM stress is valid
[in]most_face_stressconservative MOST fallback stress at the face
72 {
73  const amrex::Real half = amrex::Real(0.5);
74  FaceStressResult result{
75  amrex::Real(0.0),
76  low_valid ? kinematic_low
77  : conservative_to_kinematic_stress(most_face_stress, rho_low),
78  high_valid ? kinematic_high
79  : conservative_to_kinematic_stress(most_face_stress, rho_high)};
80 
81  if (low_valid && high_valid) {
82  result.face_stress =
83  half * rho_low * kinematic_low + half * rho_high * kinematic_high;
84  } else if (low_valid) {
85  result.face_stress =
86  half * rho_low * kinematic_low + half * most_face_stress;
87  } else if (high_valid) {
88  result.face_stress =
89  half * rho_high * kinematic_high + half * most_face_stress;
90  } else {
91  result.face_stress = most_face_stress;
92  }
93 
94  return result;
95 }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real conservative_to_kinematic_stress(amrex::Real conservative_stress, amrex::Real rho)
Definition: ERF_SurfaceLayerStress.H:18

Referenced by SurfaceLayer::compute_SurfaceLayer_bcs().

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

◆ conservative_to_kinematic_stress()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real surface_layer_stress::conservative_to_kinematic_stress ( amrex::Real  conservative_stress,
amrex::Real  rho 
)

LSM cache value from a conservative face stress.

Parameters
[in]conservative_stressconservative face stress
[in]rhodensity used to convert to kinematic stress
20 {
21  return conservative_stress / rho;
22 }
rho
Definition: ERF_InitCustomPert_Bubble.H:107

Referenced by combine_lsm_and_most_stress().

Here is the caller graph for this function:

◆ lsm_flux_is_valid()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_layer_stress::lsm_flux_is_valid ( bool  has_flux,
bool  is_land,
amrex::Real  flux,
amrex::Real  undefined 
)

Test one LSM side without coupling validity to another component's handle.

Parameters
[in]has_fluxwhether the LSM flux array exists
[in]is_landwhether the side is classified as land
[in]fluxflux value to test against the undefined sentinel
[in]undefinedsentinel value marking undefined LSM fluxes
37 {
38  return has_flux && is_land && flux < undefined;
39 }

Referenced by surface_diagnostics::classify_scalar_source(), and SurfaceLayer::compute_SurfaceLayer_bcs().

Here is the caller graph for this function: