ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_Radiation.H
Go to the documentation of this file.
1 #ifndef ERF_RADIATION_H
2 #define ERF_RADIATION_H
3 
4 /*
5  * RTE-RRTMGP radiation model interface to ERF
6  * The original code is developed by RobertPincus, and the code is open source available at:
7  * https://github.com/earth-system-radiation/rte-rrtmgp
8  * Please reference to the following paper,
9  * https://agupubs.onlinelibrary.wiley.com/doi/amrex::Real(10.1029)/2019MS001621
10  * NOTE: we use the C++ version of RTE-RRTMGP, which is the implementation of the original Fortran
11  * code using C++ KOKKOS for CUDA, HiP and SYCL application by E3SM ECP team, the C++ version
12  * of the rte-rrtmgp code is located at:
13  * https://github.com/E3SM-Project/rte-rrtmgp
14  * The RTE-RRTMGP uses BSD-3-Clause Open Source License, if you want to make changes,
15  * and modifications to the code, please refer to BSD-3-Clause Open Source License.
16  */
17 
18 #include <ctime>
19 #include <string>
20 #include <vector>
21 #include <memory>
22 
23 #include <mo_gas_concentrations.h>
24 
25 #include <Kokkos_Core.hpp>
26 
27 #include <AMReX_ParmParse.H>
28 #include <AMReX_FArrayBox.H>
29 #include <AMReX_Geometry.H>
30 #include <AMReX_TableData.H>
31 #include <AMReX_MultiFabUtil.H>
32 #include <AMReX_PlotFileUtil.H>
33 
34 #include <ERF_RadiationInterface.H>
35 #include <ERF_RRTMGP_Interface.H>
36 #include <ERF_RRTMGP_Utils.H>
37 #include <ERF_OrbCosZenith.H>
38 #include <ERF_IndexDefines.H>
39 #include <ERF_DataStruct.H>
40 #include <ERF_EOS.H>
41 
42 #include <ERF_LandSurface.H>
43 
44 class Radiation : public IRadiation {
45 public:
46 
47  #include <ERF_Kokkos.H>
48 
49  // Constructor
50  Radiation (const int& lev,
51  SolverChoice& sc);
52 
53  // Destructor
55  {
56  // Release k-distribution data and memory pool
57  if (rrtmgp::initialized) {
59  }
60  // Note that Kokkos is now finalized in main.cpp
61  }
62 
63  virtual
64  void
65  Init (const amrex::Geometry& geom,
66  const amrex::BoxArray& ba,
67  amrex::MultiFab* cons_in) override
68  {
69  // Check for nested patches: fine levels that don't reach the model top
70  // These need special handling since radiation requires complete atmospheric columns
71  int klo = geom.Domain().smallEnd(2);
72  int khi = geom.Domain().bigEnd(2);
73 
74  // Detect nested patches: a nested fine level doesn't span the full domain vertically.
75  // Use ba.minimalBox() which gives the bounding box of all grids on this level.
76  // If that box doesn't reach the domain top or bottom, it's a nested patch.
77  amrex::Box minimal_box = ba.minimalBox();
78  bool is_nested_patch = (minimal_box.smallEnd(2) > klo) || (minimal_box.bigEnd(2) < khi);
79 
80  // Update the nested patch flag - must be set/cleared on every Init call
81  // so that levels that stop being nested after regrid will resume radiation computation
83 
84  // Skip radiation on nested patches - heating rates will be interpolated from coarser level
85  if (is_nested_patch) {
86  return;
87  }
88 
89  // Reset vector of offsets for columnar data
90  m_nlay = geom.Domain().length(2);
91 
92  m_ncol = 0;
93  m_col_offsets.clear();
94  m_col_offsets.resize(int(ba.size()));
95  for (amrex::MFIter mfi(*cons_in); mfi.isValid(); ++mfi) {
96  const amrex::Box& vbx = mfi.validbox();
97  // This assertion catches true vertical MPI decomposition (individual boxes that don't
98  // span the full domain height). The nested patch case is handled above by returning early.
99  AMREX_ALWAYS_ASSERT_WITH_MESSAGE((klo == vbx.smallEnd(2)) &&
100  (khi == vbx.bigEnd(2)),
101  "Vertical decomposition with radiation is not allowed.");
102  int nx = vbx.length(0);
103  int ny = vbx.length(1);
104  m_col_offsets[mfi.index()] = m_ncol;
105  m_ncol += nx * ny;
106  }
107 
108  // Recompute the effective chunk size from the user's request rather than
109  // clamping the stored value in place. Init() is called again for every
110  // MakeNewLevelFromScratch / MakeNewLevelFromCoarse / RemakeLevel on the same
111  // Radiation object, so an in-place clamp could only ever shrink: a rank that
112  // owned no boxes at some Init (m_ncol == 0) would pin the chunk size at zero
113  // and then spin forever in the run_impl chunk loop once a regrid handed it
114  // real boxes. Deriving from the immutable request instead lets the chunk size
115  // grow back. It is zero only when m_ncol is zero, and a rank with no columns
116  // does no radiation work.
118 
119  // NOTE: the buffers are deliberately NOT allocated here. set_grids() allocates them
120  // at the top of every Run() that actually updates radiation, and finalize_impl()
121  // frees them again at the end of it, which is what keeps only one level's worth
122  // of RRTMGP working memory resident at a time (see RRTMGP_Memory_Reduction.md).
123  // Allocating here as well would hold every level's buffers from the moment that
124  // level is created until its first Run, so the whole hierarchy would be live
125  // simultaneously at startup -- the peak the chunking exists to avoid.
126  };
127 
128  virtual
129  void
130  Run (int& level,
131  int& step,
132  double& time,
133  const double& dt,
134  const amrex::BoxArray& ba,
135  amrex::Geometry& geom,
136  amrex::MultiFab* cons_in,
137  amrex::iMultiFab* lmask,
138  amrex::MultiFab* t_surf,
139  const amrex::Vector<const amrex::MultiFab*>& lsm_input_ptrs,
140  const amrex::Vector<amrex::MultiFab*>& lsm_output_ptrs,
141  amrex::MultiFab* qheating_rates,
142  amrex::MultiFab* rad_fluxes,
143  amrex::MultiFab* z_phys,
144  amrex::MultiFab* lat_ptr,
145  amrex::MultiFab* lon_ptr,
146  const bool updated_lsm,
147  amrex::Real& declin,
148  amrex::Real& calday) override
149  {
150  // Skip radiation computation on nested patches - heating rates will be
151  // filled via interpolation from coarser level in ERF::FillPatch
152  if (m_is_nested_patch) {
153  return;
154  }
155 
157  m_nlay == geom.Domain().length(2),
158  "Radiation: m_nlay (" + std::to_string(m_nlay) +
159  ") doesn't match domain vertical extent (" +
160  std::to_string(geom.Domain().length(2)) + ")");
161 
162  set_grids(level, step, time, dt, ba, geom,
163  cons_in, lmask, t_surf,
164  lsm_input_ptrs, qheating_rates,
165  rad_fluxes, z_phys, lat_ptr, lon_ptr,
166  updated_lsm);
167  rad_run_impl(lsm_output_ptrs);
168  declin = m_declin;
169  calday = m_calday;
170  }
171 
172  bool radiation_updated () const override { return m_update_rad && !m_is_nested_patch; }
173 
174  // Set the grid info for columnar data in KOKKOS
175  void
176  set_grids (int& level,
177  int& step,
178  double& time,
179  const double& dt,
180  const amrex::BoxArray& ba,
181  amrex::Geometry& geom,
182  amrex::MultiFab* cons_in,
183  amrex::iMultiFab* lmask,
184  amrex::MultiFab* t_surf,
185  const amrex::Vector<const amrex::MultiFab*>& lsm_input_ptrs,
186  amrex::MultiFab* qheating_rates,
187  amrex::MultiFab* rad_fluxes,
188  amrex::MultiFab* z_phys,
189  amrex::MultiFab* lat,
190  amrex::MultiFab* lon,
191  const bool updated_lsm);
192 
193  // Initialize the temporary variables
194  void
195  alloc_buffers ();
196 
197  // Clear the temporary variables
198  void
199  dealloc_buffers ();
200 
201  // Fill KOKKOS Views from AMReX MultiFabs
202  void
203  mf_to_kokkos_buffers (amrex::iMultiFab* lmask,
204  amrex::MultiFab* t_surf,
205  const amrex::Vector<const amrex::MultiFab*>& lsm_input_ptrs);
206 
207  // Fill AMReX MultiFabs from KOKKOS Views
208  void
209  kokkos_buffers_to_mf (const amrex::Vector<amrex::MultiFab*>& lsm_output_ptrs);
210 
211  // Write the rrtmgp fluxes
212  void
214 
215  // Initialize the implementation
216  void
217  initialize_impl ();
218 
219  // Run the implementation
220  void
221  run_impl ();
222 
223  // Finalize the implementation
224  void
225  finalize_impl (const amrex::Vector<amrex::MultiFab*>& lsm_output_ptrs);
226 
227  // Wrapper for implementation steps
228  void
229  rad_run_impl (const amrex::Vector<amrex::MultiFab*>& lsm_output_ptrs)
230  {
231  if (m_update_rad) {
232  amrex::Print() << "Radiation advancing level " << m_lev << " at (YY-MM-DD SS) " << m_orbital_year << '-'
233  << m_orbital_mon << '-' << m_orbital_day << ' ' << m_orbital_sec << " ...";
234  this->initialize_impl();
235  this->run_impl();
236  this->finalize_impl(lsm_output_ptrs);
237  amrex::Print() << "DONE\n";
238  }
239  }
240 
241  // Get names input varnames for lsm
242  virtual
243  amrex::Vector<std::string>
245  {
246  return m_lsm_input_names;
247  }
248 
249  // Get names output varnames for lsm
250  virtual
251  amrex::Vector<std::string>
253  {
254  return m_lsm_output_names;
255  }
256 
257  // Check if this is a nested patch (doesn't reach model top)
258  bool is_nested_patch () const override
259  {
260  return m_is_nested_patch;
261  }
262 
263  // Populate datalog structures
264  void
266 
267  // Write datalog
268  virtual
269  void
270  WriteDataLog (const double &time) override;
271 
272 private:
273 
274  // Process interface vars from ERF/AMReX
275  //===================================================================================
276 
277  // True if this level is a nested patch that doesn't reach model top
278  bool m_is_nested_patch = false;
279 
280  // Grid level
281  int m_lev;
282 
283  // Step number
284  int m_step;
285 
286  // Current time
287  double m_time;
288 
289  // Timestep at given level
290  double m_dt;
291 
292  // Geometry at given level
293  amrex::Geometry m_geom;
294 
295  // BoxArray at given level
296  amrex::BoxArray m_ba;
297 
298  // Are we updating radiation?
299  bool m_update_rad = false;
300 
301  // Are we writing out the fluxes?
302  bool m_rad_write_fluxes = false;
303 
304  // Do we have moisture and cold comps?
305  bool m_moist = false;
306  bool m_ice = false;
307  int m_qi_comp = -1;
308 
309  // Do we have a land surface model?
310  bool m_lsm = false;
311 
312  // List of input parameter names
313  amrex::Vector<std::string> m_lsm_input_names = {"t_sfc" , "sfc_emis" ,
314  "sfc_alb_dir_vis", "sfc_alb_dir_nir",
315  "sfc_alb_dif_vis", "sfc_alb_dif_nir"};
316 
317  // List of output parameter names
318  amrex::Vector<std::string> m_lsm_output_names = {"cos_zenith_angle" , "sw_flux_dn" ,
319  "sw_flux_dn_dir_vis", "sw_flux_dn_dir_nir",
320  "sw_flux_dn_dif_vis", "sw_flux_dn_dif_nir",
321  "lw_flux_dn"};
322 
323  // T surf if no LSM is available
326 
327  // Pointer to the CC conserved vars
328  amrex::MultiFab* m_cons_in = nullptr;
329 
330  // Pointer to the radiation source terms
331  amrex::MultiFab* m_qheating_rates = nullptr;
332 
333  // Pointer to the radiation fluxes
334  amrex::MultiFab* m_rad_fluxes = nullptr;
335 
336  // Pointer to the terrain heights
337  amrex::MultiFab* m_z_phys = nullptr;
338 
339  // Pointer to latitude and longitude
340  amrex::MultiFab* m_lat = nullptr;
341  amrex::MultiFab* m_lon = nullptr;
342 
343  // Constant lat/lon if the above MFs are not valid
346 
347  // Holds output from KOKKOS views used in the datalog
348  amrex::MultiFab datalog_mf;
349 
350  // Path, data file, and coefficient file for K-distribution
351  std::string rrtmgp_file_path = ".";
352  std::string rrtmgp_coeffs_sw = "rrtmgp-data-sw-g224-2018-12-04.nc";
353  std::string rrtmgp_coeffs_lw = "rrtmgp-data-lw-g256-2018-12-04.nc";
354  std::string rrtmgp_cloud_optics_sw = "rrtmgp-cloud-optics-coeffs-sw.nc";
355  std::string rrtmgp_cloud_optics_lw = "rrtmgp-cloud-optics-coeffs-lw.nc";
360 
361  // Active gases
362  int m_ngas = 8;
363  const std::vector<std::string> m_gas_names = {"H2O", "CO2", "O3", "N2O",
364  "CO" , "CH4", "O2", "N2" };
365  const std::vector<amrex::Real> m_mol_weight_gas = {amrex::Real(18.01528), amrex::Real(44.00950), amrex::Real(47.9982), amrex::Real(44.0128),
366  amrex::Real(28.01010), amrex::Real(16.04246), amrex::Real(31.9980), amrex::Real(28.0134)}; // g/mol
367 
368  // Prescribed greenhouse gas surface concentrations in moles / moles air
370  amrex::Vector<amrex::Real> m_o3vmr;
376  //amrex::Real m_f11vmr = amrex::Real(768.7644e-12);
377  //amrex::Real m_f12vmr = amrex::Real(531.2820e-12);
378 
381  std::vector<std::string> gas_names_offset;
382 
383  GasConcsK<amrex::Real, layout_t, KokkosDefaultDevice> m_gas_concs;
384 
385  // Process interface vars modeled after EAMXX
386  //===================================================================================
387 
388  // Keep track of number of columns and levels
389  int m_ncol;
390  int m_nlay;
391 
392  // Offsets for MultiFab <-> KOKKOS transfer
393  amrex::Vector<int> m_col_offsets;
394 
395  // Whether we use aerosol forcing in radiation.
396  // Aerosol plumbing is currently not implemented; this hook is retained so a
397  // future aerosol scheme can wire in without reintroducing the parameter.
398  // Setting it true today triggers an abort in the Radiation constructor.
399  bool m_do_aerosol_rad = false;
400 
401  // Whether we do extra aerosol forcing calls
402  bool m_extra_clnsky_diag = false;
404 
405  // The orbital year, used for zenith angle calculations:
406  // If >= 0, use constant orbital year for duration of simulation
407  // If < 0, use year from timestamp for orbital parameters
408  int m_orbital_year = -9999;
409  int m_orbital_mon = -9999;
410  int m_orbital_day = -9999;
411  int m_orbital_sec = -9999;
412 
413  // Orbital parameters, used for zenith angle calculations. Each is honored
414  // independently of the others:
415  // If >= 0, bypass computation based on orbital year and use the given value
416  // If < 0, compute based on orbital year, specified above
417  bool m_fixed_orbital_year = false;
418  amrex::Real m_orbital_eccen = -amrex::Real(9999.); // Eccentricity
419  amrex::Real m_orbital_obliq = -amrex::Real(9999.); // Obliquity
420  amrex::Real m_orbital_mvelp = -amrex::Real(9999.); // Vernal Equinox Mean Longitude of Perihelion
421 
422  // Value for prescribing an invariant solar constant (i.e. total solar irradiance
423  // at TOA). Used for idealized experiments such as RCE. This is only used when a
424  // positive value is supplied.
426 
427  // Fixed solar zenith angle to use for shortwave calculations
428  // This is only used if a positive value is supplied
430 
433 
434  // Dimensions to be read from lookup data
439 
440  // Rad frequency in number of steps
442 
443  // Number of columns to process per RRTMGP chunk (controls peak memory).
444  // m_ncol_chunk_requested is the user's erf.rad_ncol_chunk; it is set once in the
445  // constructor and never modified thereafter, so it is a valid upper bound on the
446  // chunk size for every level and every regrid. m_ncol_chunk is the effective chunk
447  // size for the current grids and is recomputed from the request in each Init();
448  // it is zero exactly when this rank owns no columns.
450  int m_ncol_chunk = 1024;
451 
452  // Number of vars for s_mem allocation
453  int m_rad_nvar = 12;
454 
455  // Whether or not to do subcolumn sampling of cloud state for MCICA
456  bool m_do_subcol_sampling = true;
457 
458  // 1d size (1 or nlay)
460 
461  // 1d size (ncol)
476 
477  // 2d size (ncol, nlay)
494 
495  // 2d size (ncol, nlay+1)
519 
520  // 3d size (ncol, nlay+1, nswbands)
525 
526  // 3d size (ncol, nlay+1, nlwbands)
529 
530  // 2d size (ncol, nswbands)
533 
534  // Aerosol optical properties. Dormant scaffolding kept so a future aerosol
535  // coupling (e.g. SPA, prescribed aerosol climatology) can populate these
536  // without re-adding members. Only allocated when m_do_aerosol_rad is true,
537  // which currently aborts in the constructor; when aerosol coupling is
538  // wired in, remove the abort and pass these into rrtmgp_main.
539  //
540  // 3d size (ncol, nlay, n[sw,lw]bands)
545 };
546 #endif
constexpr amrex::Real RdoCp
Definition: ERF_Constants.H:53
const int nx
Definition: ERF_InitCustomPertVels_CloudChamber.H:14
const int ny
Definition: ERF_InitCustomPertVels_CloudChamber.H:15
const int klo
Definition: ERF_InitCustomPert_ABL.H:75
const int khi
Definition: ERF_InitCustomPert_Bubble.H:21
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_cloud_chamber_config.active, "Cloud Chamber: initializer reached without a parsed configuration")
Kokkos::View< RealT *, KokkosDefaultDevice > real1d_k
Definition: ERF_Kokkos.H:18
Kokkos::View< RealT ***, layout_t, KokkosDefaultDevice > real3d_k
Definition: ERF_Kokkos.H:20
Kokkos::View< RealT **, layout_t, KokkosDefaultDevice > real2d_k
Definition: ERF_Kokkos.H:19
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_RadiationInterface.H:14
Definition: ERF_Radiation.H:44
real3d_k sw_bnd_flux_dn
Definition: ERF_Radiation.H:522
amrex::MultiFab * m_lon
Definition: ERF_Radiation.H:341
real2d_k lw_flux_up
Definition: ERF_Radiation.H:502
virtual amrex::Vector< std::string > get_lsm_output_varnames() override
Definition: ERF_Radiation.H:252
real3d_k aero_tau_sw
Definition: ERF_Radiation.H:541
int m_o3_size
Definition: ERF_Radiation.H:379
real3d_k sw_bnd_flux_dir
Definition: ERF_Radiation.H:523
real2d_k sw_clnsky_flux_dn
Definition: ERF_Radiation.H:511
bool is_nested_patch() const override
Definition: ERF_Radiation.H:258
std::string rrtmgp_coeffs_file_sw
Definition: ERF_Radiation.H:356
std::string rrtmgp_coeffs_sw
Definition: ERF_Radiation.H:352
real2d_k d_tint
Definition: ERF_Radiation.H:496
void set_grids(int &level, int &step, double &time, const double &dt, const amrex::BoxArray &ba, amrex::Geometry &geom, amrex::MultiFab *cons_in, amrex::iMultiFab *lmask, amrex::MultiFab *t_surf, const amrex::Vector< const amrex::MultiFab * > &lsm_input_ptrs, amrex::MultiFab *qheating_rates, amrex::MultiFab *rad_fluxes, amrex::MultiFab *z_phys, amrex::MultiFab *lat, amrex::MultiFab *lon, const bool updated_lsm)
Definition: ERF_Radiation.cpp:262
real2d_k lw_clnclrsky_flux_dn
Definition: ERF_Radiation.H:514
int m_rad_freq_in_steps
Definition: ERF_Radiation.H:441
void mf_to_kokkos_buffers(amrex::iMultiFab *lmask, amrex::MultiFab *t_surf, const amrex::Vector< const amrex::MultiFab * > &lsm_input_ptrs)
Definition: ERF_Radiation.cpp:580
real2d_k lwp
Definition: ERF_Radiation.H:488
real1d_k lw_src
Definition: ERF_Radiation.H:475
real2d_k eff_radius_qi
Definition: ERF_Radiation.H:487
void dealloc_buffers()
Definition: ERF_Radiation.cpp:490
real1d_k m_gas_mol_weights
Definition: ERF_Radiation.H:380
amrex::Real m_lon_cons
Definition: ERF_Radiation.H:345
void initialize_impl()
Definition: ERF_Radiation.cpp:1205
int m_nswbands
Definition: ERF_Radiation.H:435
bool m_do_aerosol_rad
Definition: ERF_Radiation.H:399
std::string rrtmgp_coeffs_lw
Definition: ERF_Radiation.H:353
void rad_run_impl(const amrex::Vector< amrex::MultiFab * > &lsm_output_ptrs)
Definition: ERF_Radiation.H:229
bool m_moist
Definition: ERF_Radiation.H:305
std::string rrtmgp_cloud_optics_file_lw
Definition: ERF_Radiation.H:359
amrex::MultiFab * m_cons_in
Definition: ERF_Radiation.H:328
amrex::MultiFab datalog_mf
Definition: ERF_Radiation.H:348
Radiation(const int &lev, SolverChoice &sc)
Definition: ERF_Radiation.cpp:85
int m_ncol_chunk_requested
Definition: ERF_Radiation.H:449
real2d_k sw_heating
Definition: ERF_Radiation.H:490
bool m_lsm
Definition: ERF_Radiation.H:310
bool m_do_subcol_sampling
Definition: ERF_Radiation.H:456
real3d_k lw_bnd_flux_dn
Definition: ERF_Radiation.H:528
bool m_rad_write_fluxes
Definition: ERF_Radiation.H:302
real3d_k sw_bnd_flux_up
Definition: ERF_Radiation.H:521
real2d_k qv_lay
Definition: ERF_Radiation.H:482
int m_qi_comp
Definition: ERF_Radiation.H:307
std::string rrtmgp_cloud_optics_file_sw
Definition: ERF_Radiation.H:358
amrex::Vector< std::string > m_lsm_output_names
Definition: ERF_Radiation.H:318
bool m_is_nested_patch
Definition: ERF_Radiation.H:278
void run_impl()
Definition: ERF_Radiation.cpp:1230
real2d_k sw_clnclrsky_flux_dn_dir
Definition: ERF_Radiation.H:506
real1d_k sfc_flux_dif_vis
Definition: ERF_Radiation.H:469
int m_step
Definition: ERF_Radiation.H:284
real2d_k lw_clnclrsky_flux_up
Definition: ERF_Radiation.H:513
real1d_k lat
Definition: ERF_Radiation.H:471
void populateDatalogMF()
Definition: ERF_Radiation.cpp:964
real2d_k qi_lay
Definition: ERF_Radiation.H:484
real2d_k sw_clrsky_flux_up
Definition: ERF_Radiation.H:507
amrex::Real m_orbital_mvelp
Definition: ERF_Radiation.H:420
real2d_k t_lev
Definition: ERF_Radiation.H:498
amrex::Vector< amrex::Real > m_o3vmr
Definition: ERF_Radiation.H:370
real1d_k o3_lay
Definition: ERF_Radiation.H:459
std::string rrtmgp_cloud_optics_sw
Definition: ERF_Radiation.H:354
real1d_k sfc_alb_dif_vis
Definition: ERF_Radiation.H:465
int m_nlwgpts
Definition: ERF_Radiation.H:438
real1d_k mu0
Definition: ERF_Radiation.H:462
real2d_k cldfrac_tot
Definition: ERF_Radiation.H:485
real1d_k sfc_flux_dir_nir
Definition: ERF_Radiation.H:468
amrex::MultiFab * m_z_phys
Definition: ERF_Radiation.H:337
real2d_k sw_clnclrsky_flux_up
Definition: ERF_Radiation.H:504
real3d_k aero_g_sw
Definition: ERF_Radiation.H:543
real2d_k sw_flux_up
Definition: ERF_Radiation.H:499
virtual void Run(int &level, int &step, double &time, const double &dt, const amrex::BoxArray &ba, amrex::Geometry &geom, amrex::MultiFab *cons_in, amrex::iMultiFab *lmask, amrex::MultiFab *t_surf, const amrex::Vector< const amrex::MultiFab * > &lsm_input_ptrs, const amrex::Vector< amrex::MultiFab * > &lsm_output_ptrs, amrex::MultiFab *qheating_rates, amrex::MultiFab *rad_fluxes, amrex::MultiFab *z_phys, amrex::MultiFab *lat_ptr, amrex::MultiFab *lon_ptr, const bool updated_lsm, amrex::Real &declin, amrex::Real &calday) override
Definition: ERF_Radiation.H:130
std::string rrtmgp_cloud_optics_lw
Definition: ERF_Radiation.H:355
amrex::MultiFab * m_rad_fluxes
Definition: ERF_Radiation.H:334
real3d_k sw_bnd_flux_dif
Definition: ERF_Radiation.H:524
real2d_k sfc_alb_dif
Definition: ERF_Radiation.H:532
amrex::Real m_co2vmr
Definition: ERF_Radiation.H:369
bool m_extra_clnsky_diag
Definition: ERF_Radiation.H:402
real1d_k sfc_alb_dif_nir
Definition: ERF_Radiation.H:466
virtual void Init(const amrex::Geometry &geom, const amrex::BoxArray &ba, amrex::MultiFab *cons_in) override
Definition: ERF_Radiation.H:65
real2d_k lw_clnsky_flux_dn
Definition: ERF_Radiation.H:518
void kokkos_buffers_to_mf(const amrex::Vector< amrex::MultiFab * > &lsm_output_ptrs)
Definition: ERF_Radiation.cpp:824
amrex::BoxArray m_ba
Definition: ERF_Radiation.H:296
real2d_k p_lay
Definition: ERF_Radiation.H:479
real2d_k r_lay
Definition: ERF_Radiation.H:478
int m_ncol
Definition: ERF_Radiation.H:389
real2d_k sw_flux_dn_dir
Definition: ERF_Radiation.H:501
const std::vector< amrex::Real > m_mol_weight_gas
Definition: ERF_Radiation.H:365
amrex::Real m_lat_cons
Definition: ERF_Radiation.H:344
amrex::Real m_fixed_total_solar_irradiance
Definition: ERF_Radiation.H:425
std::vector< std::string > gas_names_offset
Definition: ERF_Radiation.H:381
real2d_k sw_clrsky_flux_dn
Definition: ERF_Radiation.H:508
virtual amrex::Vector< std::string > get_lsm_input_varnames() override
Definition: ERF_Radiation.H:244
int m_orbital_mon
Definition: ERF_Radiation.H:409
amrex::Real m_declin
Definition: ERF_Radiation.H:431
real3d_k aero_ssa_sw
Definition: ERF_Radiation.H:542
real2d_k sw_clnsky_flux_dn_dir
Definition: ERF_Radiation.H:512
amrex::Real m_o2vmr
Definition: ERF_Radiation.H:374
GasConcsK< amrex::Real, layout_t, KokkosDefaultDevice > m_gas_concs
Definition: ERF_Radiation.H:383
amrex::MultiFab * m_qheating_rates
Definition: ERF_Radiation.H:331
double m_dt
Definition: ERF_Radiation.H:290
real2d_k qc_lay
Definition: ERF_Radiation.H:483
real2d_k lw_clrsky_flux_up
Definition: ERF_Radiation.H:515
amrex::Real m_n2ovmr
Definition: ERF_Radiation.H:371
amrex::Real m_rad_t_sfc
Definition: ERF_Radiation.H:324
std::string rrtmgp_file_path
Definition: ERF_Radiation.H:351
real2d_k sw_flux_dn
Definition: ERF_Radiation.H:500
int m_nlwbands
Definition: ERF_Radiation.H:436
real2d_k lw_clrsky_flux_dn
Definition: ERF_Radiation.H:516
amrex::Real m_orbital_eccen
Definition: ERF_Radiation.H:418
amrex::Real m_covmr
Definition: ERF_Radiation.H:372
int m_orbital_sec
Definition: ERF_Radiation.H:411
real2d_k z_del
Definition: ERF_Radiation.H:481
real3d_k aero_tau_lw
Definition: ERF_Radiation.H:544
int m_ncol_chunk
Definition: ERF_Radiation.H:450
real2d_k lw_flux_dn
Definition: ERF_Radiation.H:503
~Radiation()
Definition: ERF_Radiation.H:54
real2d_k sw_clrsky_flux_dn_dir
Definition: ERF_Radiation.H:509
void write_rrtmgp_fluxes()
Definition: ERF_Radiation.cpp:924
std::string rrtmgp_coeffs_file_lw
Definition: ERF_Radiation.H:357
int m_lev
Definition: ERF_Radiation.H:281
real1d_k sfc_flux_dif_nir
Definition: ERF_Radiation.H:470
int m_ngas
Definition: ERF_Radiation.H:362
real2d_k lw_heating
Definition: ERF_Radiation.H:491
real1d_k sfc_alb_dir_nir
Definition: ERF_Radiation.H:464
real2d_k lw_clnsky_flux_up
Definition: ERF_Radiation.H:517
amrex::Real m_ch4vmr
Definition: ERF_Radiation.H:373
bool m_update_rad
Definition: ERF_Radiation.H:299
real2d_k sfc_alb_dir
Definition: ERF_Radiation.H:531
bool m_ice
Definition: ERF_Radiation.H:306
amrex::Real m_fixed_solar_zenith_angle
Definition: ERF_Radiation.H:429
real1d_k lon
Definition: ERF_Radiation.H:472
int m_orbital_day
Definition: ERF_Radiation.H:410
real1d_k sfc_emis
Definition: ERF_Radiation.H:473
amrex::Real m_orbital_obliq
Definition: ERF_Radiation.H:419
amrex::Real m_n2vmr
Definition: ERF_Radiation.H:375
virtual void WriteDataLog(const double &time) override
Definition: ERF_Radiation.cpp:1070
bool m_fixed_orbital_year
Definition: ERF_Radiation.H:417
real2d_k sw_clnsky_flux_up
Definition: ERF_Radiation.H:510
int m_nlay
Definition: ERF_Radiation.H:390
real3d_k lw_bnd_flux_up
Definition: ERF_Radiation.H:527
int m_nswgpts
Definition: ERF_Radiation.H:437
real1d_k sfc_alb_dir_vis
Definition: ERF_Radiation.H:463
const std::vector< std::string > m_gas_names
Definition: ERF_Radiation.H:363
real2d_k sw_clrsky_heating
Definition: ERF_Radiation.H:492
bool m_extra_clnclrsky_diag
Definition: ERF_Radiation.H:403
real2d_k t_lay
Definition: ERF_Radiation.H:480
real1d_k sfc_flux_dir_vis
Definition: ERF_Radiation.H:467
real2d_k iwp
Definition: ERF_Radiation.H:489
amrex::Geometry m_geom
Definition: ERF_Radiation.H:293
amrex::MultiFab * m_lat
Definition: ERF_Radiation.H:340
amrex::Real m_rdOcp
Definition: ERF_Radiation.H:325
real2d_k p_lev
Definition: ERF_Radiation.H:497
void finalize_impl(const amrex::Vector< amrex::MultiFab * > &lsm_output_ptrs)
Definition: ERF_Radiation.cpp:1527
real2d_k lw_clrsky_heating
Definition: ERF_Radiation.H:493
real2d_k eff_radius_qc
Definition: ERF_Radiation.H:486
int m_rad_nvar
Definition: ERF_Radiation.H:453
amrex::Vector< int > m_col_offsets
Definition: ERF_Radiation.H:393
bool radiation_updated() const override
Reports whether the last radiation call updated its outputs.
Definition: ERF_Radiation.H:172
real1d_k t_sfc
Definition: ERF_Radiation.H:474
void alloc_buffers()
Definition: ERF_Radiation.cpp:335
double m_time
Definition: ERF_Radiation.H:287
amrex::Real m_calday
Definition: ERF_Radiation.H:432
int m_orbital_year
Definition: ERF_Radiation.H:408
real2d_k sw_clnclrsky_flux_dn
Definition: ERF_Radiation.H:505
amrex::Vector< std::string > m_lsm_input_names
Definition: ERF_Radiation.H:313
void rrtmgp_finalize()
Definition: ERF_RRTMGP_Interface.cpp:275
bool initialized
Definition: ERF_RRTMGP_Interface.cpp:25
Definition: ERF_DataStruct.H:685