ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_NOAHMP_Fields.H
Go to the documentation of this file.
1 #ifndef ERF_NOAHMP_FIELDS_H
2 #define ERF_NOAHMP_FIELDS_H
3 
4 // Append X(...) rows to add coupling fields; enum order is an invariant -- do not reorder.
5 
6 // ERF-internal state fields (LsmData_NOAHMP), fixed 2D. The 3D soil profile
7 // (SMOIS/SH2O/TSLB) is appended at RUNTIME after NumVars -- see soil_data_idx.
8 #define NOAHMP_LSMDATA_FIELDS(X) \
9  /* radiation coupling */ \
10  X(t_sfc) X(sfc_emis) \
11  X(sfc_alb_dir_vis) X(sfc_alb_dir_nir) \
12  X(sfc_alb_dif_vis) X(sfc_alb_dif_nir) \
13  X(cos_zenith_angle) X(sw_flux_dn) \
14  X(sw_flux_dn_dir_vis) X(sw_flux_dn_dir_nir) \
15  X(sw_flux_dn_dif_vis) X(sw_flux_dn_dif_nir) \
16  X(lw_flux_dn) \
17  /* land return-term diagnostics */ \
18  X(grdflx) X(fira) X(sav) X(sag) X(albedo) \
19  X(sfcrunoff) X(udrunoff) X(smstav) X(smstot) \
20  /* native Noah-MP 2-m bundle */ \
21  X(noahmp_temperature_2m_vegetated) \
22  X(noahmp_temperature_2m_bare) \
23  X(noahmp_water_vapor_mixing_ratio_2m_vegetated) \
24  X(noahmp_water_vapor_mixing_ratio_2m_bare) \
25  X(noahmp_vegetation_fraction)
26 
27 // Forcing ERF -> Noah-MP, mechanical 1:1 copies: X( ERF comp, NoahmpIO member ).
28 // 3D members use the k/j transpose MEMBER(i,1,j); 2D use MEMBER(i,j).
29 #define NOAHMP_INPUT_3D_FIELDS(X) \
30  /* ERF comp NoahmpIO member */ \
31  X( u_phy, U_PHY ) \
32  X( v_phy, V_PHY ) \
33  X( t_phy, T_PHY ) \
34  X( qv_curr, QV_CURR ) \
35  X( p8w, P8W )
36 
37 #define NOAHMP_INPUT_2D_FIELDS(X) \
38  /* ERF comp NoahmpIO member */ \
39  X( swdown, SWDOWN ) \
40  X( glw, GLW ) \
41  X( coszen, COSZEN )
42 
43 // Results Noah-MP -> ERF, mechanical 1:1 copies: X( ERF comp, NoahmpIO member ).
44 // Split HEAD/TAIL so the enum can interleave the banded albedos; copy loop uses both.
45 #define NOAHMP_OUTPUT_2D_FIELDS_HEAD(X) \
46  /* ERF comp NoahmpIO member */ \
47  X( hfx, HFX ) \
48  X( lh, LH ) \
49  X( tau_ew, TAU_EW ) \
50  X( tau_ns, TAU_NS ) \
51  X( tsk, TSK ) \
52  X( emiss, EMISS )
53 
54 #define NOAHMP_OUTPUT_2D_FIELDS_TAIL(X) \
55  /* ERF comp NoahmpIO member */ \
56  X( o_grdflx, GRDFLX ) \
57  X( o_fira, FIRAXY ) \
58  X( o_sav, SAVXY ) \
59  X( o_sag, SAGXY ) \
60  X( o_albedo, ALBEDO ) \
61  X( o_sfcrunoff, SFCRUNOFF ) \
62  X( o_udrunoff, UDRUNOFF ) \
63  X( o_noahmp_t2m_veg, T2MVXY ) \
64  X( o_noahmp_t2m_bare, T2MBXY ) \
65  X( o_noahmp_q2m_veg, Q2MVXY ) \
66  X( o_noahmp_q2m_bare, Q2MBXY ) \
67  X( o_noahmp_fveg, FVEGXY )
68 
69 #define NOAHMP_OUTPUT_2D_FIELDS(X) NOAHMP_OUTPUT_2D_FIELDS_HEAD(X) \
70  NOAHMP_OUTPUT_2D_FIELDS_TAIL(X)
71 
72 // Noah-MP result -> ERF, mechanical 1:1: X( ERF Array4 alias, LsmData comp, Output
73 // comp ). Banded albedos are listed but read explicitly; SMSTAV/SMSTOT are not listed.
74 #define NOAHMP_RESULT_FIELDS(X) \
75  /* ERF Array4 alias LsmData comp Output comp */ \
76  X( TSK, t_sfc, tsk ) \
77  X( EMISS, sfc_emis, emiss ) \
78  X( ALBSFCDIR_VIS, sfc_alb_dir_vis, albsfcdir_vis ) \
79  X( ALBSFCDIR_NIR, sfc_alb_dir_nir, albsfcdir_nir ) \
80  X( ALBSFCDIF_VIS, sfc_alb_dif_vis, albsfcdif_vis ) \
81  X( ALBSFCDIF_NIR, sfc_alb_dif_nir, albsfcdif_nir ) \
82  X( GRDFLX_o, grdflx, o_grdflx ) \
83  X( FIRA_o, fira, o_fira ) \
84  X( SAV_o, sav, o_sav ) \
85  X( SAG_o, sag, o_sag ) \
86  X( ALBEDO_o, albedo, o_albedo ) \
87  X( SFCRUNOFF_o, sfcrunoff, o_sfcrunoff ) \
88  X( UDRUNOFF_o, udrunoff, o_udrunoff ) \
89  X( T2MVXY_o, noahmp_temperature_2m_vegetated, o_noahmp_t2m_veg ) \
90  X( T2MBXY_o, noahmp_temperature_2m_bare, o_noahmp_t2m_bare) \
91  X( Q2MVXY_o, noahmp_water_vapor_mixing_ratio_2m_vegetated, o_noahmp_q2m_veg ) \
92  X( Q2MBXY_o, noahmp_water_vapor_mixing_ratio_2m_bare, o_noahmp_q2m_bare) \
93  X( FVEGXY_o, noahmp_vegetation_fraction, o_noahmp_fveg )
94 
95 // ---------------------------------------------------------------------------
96 // Reusable field emitters -- the per-row action applied when a registry is
97 // expanded, e.g. NOAHMP_LSMDATA_FIELDS(NOAHMP_QUOTE) -> "t_sfc", "sfc_emis", ...
98 #define NOAHMP_ENUM(comp) comp, // (comp) -> enum entry
99 #define NOAHMP_QUOTE(comp) #comp, // (comp) -> "comp" literal
100 #define NOAHMP_COMP(comp, member) comp, // (comp, member) -> enum entry
101 
102 // ---------------------------------------------------------------------------
103 // Enums generated from the registries (plus fixed entries); order is preserved.
104 // ---------------------------------------------------------------------------
105 
106 namespace LsmData_NOAHMP {
107  enum {
109  NumVars
110  // Soil profile (SMOIS/SH2O/TSLB) appended at RUNTIME after NumVars as three
111  // contiguous groups of m_nsoil layers. See NOAHMP::soil_data_idx.
112  };
113 }
114 
115 namespace LsmFlux_NOAHMP {
116  enum {
117  // 2D SurfaceLayer flux vars
118  t_flux = 0,
122  NumVars
123  };
124 }
125 
126 // Fixed index per typed surface-precip source slot (field order of
127 // SurfacePrecipAccumulationSources), keying the snapshots and interval deltas.
128 namespace NoahmpPrecipSlot {
129  enum {
130  total = 0, // total non-convective precip (if the scheme exposes one)
131  rain, // explicit rain (schemes without a total slot)
132  snow, // snow (+ice)
133  graupel, // graupel
134  hail, // folded into MP_GRAUP (coupled MP_HAIL set to 0)
135  NumSlots
136  };
137 }
138 
139 namespace NoahmpInputComp {
140  enum {
143  // computed precip staging (explicit, not table-driven)
144  rainbl, // accumulated precip over the interval [mm]
145  sr_in, // frozen fraction [-]
146  mp_rainnc, // total non-convective precip this interval [mm]
147  mp_snow, // snow (+ice) subset of mp_rainnc [mm]
148  mp_graup, // graupel subset of mp_rainnc [mm]
149  NumComps
150  };
151 }
152 
153 namespace NoahmpOutputComp {
154  enum {
156  // banded albedos (explicit: read at band 1=VIS / 2=NIR)
162  // sentinels: not computed by this core -> emitted as lsm_undefined
165  NumComps
166  // Per-layer soil outputs appended at RUNTIME after NumComps; the output
167  // buffer is sized NumComps + 3*nsoil to match.
168  };
169 }
170 
171 #endif /* ERF_NOAHMP_FIELDS_H */
#define NOAHMP_LSMDATA_FIELDS(X)
Definition: ERF_NOAHMP_Fields.H:8
#define NOAHMP_COMP(comp, member)
Definition: ERF_NOAHMP_Fields.H:100
#define NOAHMP_ENUM(comp)
Definition: ERF_NOAHMP_Fields.H:98
#define NOAHMP_INPUT_2D_FIELDS(X)
Definition: ERF_NOAHMP_Fields.H:37
#define NOAHMP_OUTPUT_2D_FIELDS_HEAD(X)
Definition: ERF_NOAHMP_Fields.H:45
#define NOAHMP_INPUT_3D_FIELDS(X)
Definition: ERF_NOAHMP_Fields.H:29
#define NOAHMP_OUTPUT_2D_FIELDS_TAIL(X)
Definition: ERF_NOAHMP_Fields.H:54
Definition: ERF_NOAHMP_Fields.H:106
@ NumVars
Definition: ERF_NOAHMP_Fields.H:109
Definition: ERF_NOAHMP_Fields.H:115
@ t_flux
Definition: ERF_NOAHMP_Fields.H:118
@ tau13
Definition: ERF_NOAHMP_Fields.H:120
@ q_flux
Definition: ERF_NOAHMP_Fields.H:119
@ NumVars
Definition: ERF_NOAHMP_Fields.H:122
@ tau23
Definition: ERF_NOAHMP_Fields.H:121
Definition: ERF_NOAHMP_Fields.H:139
@ sr_in
Definition: ERF_NOAHMP_Fields.H:145
@ rainbl
Definition: ERF_NOAHMP_Fields.H:144
@ mp_graup
Definition: ERF_NOAHMP_Fields.H:148
@ mp_rainnc
Definition: ERF_NOAHMP_Fields.H:146
@ NumComps
Definition: ERF_NOAHMP_Fields.H:149
@ mp_snow
Definition: ERF_NOAHMP_Fields.H:147
Definition: ERF_NOAHMP_Fields.H:153
@ o_smstot
Definition: ERF_NOAHMP_Fields.H:164
@ o_smstav
Definition: ERF_NOAHMP_Fields.H:163
@ albsfcdir_vis
Definition: ERF_NOAHMP_Fields.H:157
@ albsfcdif_nir
Definition: ERF_NOAHMP_Fields.H:160
@ albsfcdif_vis
Definition: ERF_NOAHMP_Fields.H:159
@ albsfcdir_nir
Definition: ERF_NOAHMP_Fields.H:158
Definition: ERF_NOAHMP_Fields.H:128
@ graupel
Definition: ERF_NOAHMP_Fields.H:133
@ rain
Definition: ERF_NOAHMP_Fields.H:131
@ total
Definition: ERF_NOAHMP_Fields.H:130
@ hail
Definition: ERF_NOAHMP_Fields.H:134
@ snow
Definition: ERF_NOAHMP_Fields.H:132
@ NumSlots
Definition: ERF_NOAHMP_Fields.H:135