ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_SurfacePrecipitation.H
Go to the documentation of this file.
1 #ifndef ERF_SURFACE_PRECIPITATION_H_
2 #define ERF_SURFACE_PRECIPITATION_H_
3 
4 #include <AMReX_GpuQualifiers.H>
5 #include <AMReX_MultiFab.H>
6 #include <AMReX_REAL.H>
7 
8 // Shared microphysics-to-IO contract for surface precipitation accumulation.
9 // Scheme-native precipitation accumulators do not all have the same semantics.
10 // Some schemes store explicit species accumulations; others store total
11 // precipitation plus frozen-species subset accumulations. The IO layer uses
12 // these typed slots to build public kg/m^2 fields without double-counting.
13 
14 /**
15  * @brief Precipitation accumulation field and its conversion factor.
16  * @var SurfacePrecipAccumulationSource::accum Pointer to the accumulation MultiFab.
17  * @var SurfacePrecipAccumulationSource::native_to_kg_m2 Conversion factor from native units to kg/m^2.
18  */
20 {
21  const amrex::MultiFab* accum = nullptr;
23 };
24 
25 /**
26  * @brief Collection of precipitation accumulation sources for different species.
27  * @var SurfacePrecipAccumulationSources::total Total precipitation source.
28  * @var SurfacePrecipAccumulationSources::rain Rain precipitation source.
29  * @var SurfacePrecipAccumulationSources::snow Snow precipitation source.
30  * @var SurfacePrecipAccumulationSources::graupel Graupel precipitation source.
31  * @var SurfacePrecipAccumulationSources::hail Hail precipitation source.
32  */
34 {
40 };
41 
42 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
44 {
45  return src.accum != nullptr;
46 }
47 
48 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
50 {
51  return surface_precip_has_source(src.total);
52 }
53 
54 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
56 {
57  return surface_precip_has_source(src.rain);
58 }
59 
60 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
62 {
63  return surface_precip_has_source(src.total)
64  || surface_precip_has_source(src.rain)
65  || surface_precip_has_source(src.snow)
66  || surface_precip_has_source(src.graupel)
67  || surface_precip_has_source(src.hail);
68 }
69 
70 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
72 {
73  // Public frozen precipitation is available whenever the scheme has any
74  // precipitation source, because the IO layer can derive the frozen field
75  // from the total or species accumulators and fill zero for warm-rain cases.
77 }
78 
79 #endif
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_precip_has_total_source(const SurfacePrecipAccumulationSources &src) noexcept
Definition: ERF_SurfacePrecipitation.H:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_precip_has_any_frozen_source(const SurfacePrecipAccumulationSources &src) noexcept
Definition: ERF_SurfacePrecipitation.H:71
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_precip_has_source(const SurfacePrecipAccumulationSource &src) noexcept
Definition: ERF_SurfacePrecipitation.H:43
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_precip_has_any_source(const SurfacePrecipAccumulationSources &src) noexcept
Definition: ERF_SurfacePrecipitation.H:61
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_precip_has_explicit_rain_source(const SurfacePrecipAccumulationSources &src) noexcept
Definition: ERF_SurfacePrecipitation.H:55
Definition: ERF_SurfacePrecipitation.H:20
const amrex::MultiFab * accum
Definition: ERF_SurfacePrecipitation.H:21
amrex::Real native_to_kg_m2
Definition: ERF_SurfacePrecipitation.H:22
Definition: ERF_SurfacePrecipitation.H:34
SurfacePrecipAccumulationSource rain
Definition: ERF_SurfacePrecipitation.H:36
SurfacePrecipAccumulationSource snow
Definition: ERF_SurfacePrecipitation.H:37
SurfacePrecipAccumulationSource hail
Definition: ERF_SurfacePrecipitation.H:39
SurfacePrecipAccumulationSource total
Definition: ERF_SurfacePrecipitation.H:35
SurfacePrecipAccumulationSource graupel
Definition: ERF_SurfacePrecipitation.H:38