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 
15 {
16  const amrex::MultiFab* accum = nullptr;
18 };
19 
21 {
27 };
28 
29 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
31 {
32  return src.accum != nullptr;
33 }
34 
35 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
37 {
38  return surface_precip_has_source(src.total);
39 }
40 
41 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
43 {
44  return surface_precip_has_source(src.rain);
45 }
46 
47 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
49 {
50  return surface_precip_has_source(src.total)
51  || surface_precip_has_source(src.rain)
52  || surface_precip_has_source(src.snow)
53  || surface_precip_has_source(src.graupel)
54  || surface_precip_has_source(src.hail);
55 }
56 
57 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
59 {
60  // Public frozen precipitation is available whenever the scheme has any
61  // precipitation source, because the IO layer can derive the frozen field
62  // from the total or species accumulators and fill zero for warm-rain cases.
64 }
65 
66 #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:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_precip_has_any_frozen_source(const SurfacePrecipAccumulationSources &src) noexcept
Definition: ERF_SurfacePrecipitation.H:58
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_precip_has_source(const SurfacePrecipAccumulationSource &src) noexcept
Definition: ERF_SurfacePrecipitation.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_precip_has_any_source(const SurfacePrecipAccumulationSources &src) noexcept
Definition: ERF_SurfacePrecipitation.H:48
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool surface_precip_has_explicit_rain_source(const SurfacePrecipAccumulationSources &src) noexcept
Definition: ERF_SurfacePrecipitation.H:42
Definition: ERF_SurfacePrecipitation.H:15
const amrex::MultiFab * accum
Definition: ERF_SurfacePrecipitation.H:16
amrex::Real native_to_kg_m2
Definition: ERF_SurfacePrecipitation.H:17
Definition: ERF_SurfacePrecipitation.H:21
SurfacePrecipAccumulationSource rain
Definition: ERF_SurfacePrecipitation.H:23
SurfacePrecipAccumulationSource snow
Definition: ERF_SurfacePrecipitation.H:24
SurfacePrecipAccumulationSource hail
Definition: ERF_SurfacePrecipitation.H:26
SurfacePrecipAccumulationSource total
Definition: ERF_SurfacePrecipitation.H:22
SurfacePrecipAccumulationSource graupel
Definition: ERF_SurfacePrecipitation.H:25