14 #ifndef ERF_RADIATION_H
15 #define ERF_RADIATION_H
21 #include <AMReX_FArrayBox.H>
22 #include <AMReX_Geometry.H>
23 #include <AMReX_TableData.H>
24 #include <AMReX_MultiFabUtil.H>
26 #include "ERF_Config.H"
40 if (!yakl::isInitialized()) yakl::init();
46 void initialize (
const amrex::MultiFab& cons_in,
47 amrex::MultiFab* lsm_fluxes,
48 amrex::MultiFab* lsm_zenith,
49 amrex::MultiFab* qheating_rates,
52 amrex::Vector<amrex::MultiFab*> qmoist,
53 const amrex::BoxArray& grids,
54 const amrex::Geometry& geom,
55 const amrex::Real& dt_advance,
56 const bool& do_sw_rad,
57 const bool& do_lw_rad,
58 const bool& do_aero_rad,
59 const bool& do_snow_opt,
60 const bool& is_cmip6_volcano);
70 const real2d&
pmid,
const real2d&
pint,
const real2d&
tmid,
const real2d&
tint,
71 const real3d& cld_tau_gpt,
const real3d& aer_tau_bnd,
72 FluxesByband& fluxes_clrsky, FluxesByband& fluxes_allsky,
73 const real2d&
qrl,
const real2d&
qrlc);
78 const real3d& cld_tau_gpt,
const real3d& cld_ssa_gpt,
const real3d& cld_asm_gpt,
79 const real3d& aer_tau_bnd,
const real3d& aer_ssa_bnd,
const real3d& aer_asm_bnd,
80 FluxesByband& fluxes_clrsky, FluxesByband& fluxes_allsky,
81 const real2d&
qrs,
const real2d&
qrsc);
84 const int1d& day_indices,
85 const int1d& night_indices);
87 void get_gas_vmr (
const std::vector<std::string>& gas_names,
91 const real2d& flux_dn,
93 const real2d& heating_rate);
98 void yakl_to_mf(
const real2d &data, amrex::MultiFab &mf);
101 void writePlotfile(
const std::string& plot_prefix,
const amrex::Real time,
const int level_step);
130 static constexpr amrex::Real
eccen = 0.0;
131 static constexpr amrex::Real
obliqr = 23.0 *
PI / 180.0;
132 static constexpr amrex::Real
mvelpp = 103.0 *
PI / 180.0 +
PI;
133 static constexpr amrex::Real
lambm0 = -3.2503635878519378e-2;
182 "H2O",
"CO2",
"O3",
"N2O",
183 "CO" ,
"CH4",
"O2",
"N2" };
257 real2d
cld,
cldfsnow,
iclwp,
iciwp,
icswp,
dei,
des,
lambdac,
mu,
rei,
rel;
constexpr amrex::Real PI
Definition: ERF_Constants.H:6
Definition: ERF_Aero_rad_props.H:18
Definition: ERF_Optics.H:24
Definition: ERF_Radiation.H:36
amrex::MultiFab * m_lon
Definition: ERF_Radiation.H:115
void on_complete()
Definition: ERF_Radiation.cpp:1074
real3d cld_tau_gpt_lw
Definition: ERF_Radiation.H:263
real1d lw_band_midpoints
Definition: ERF_Radiation.H:227
real2d clear_rh
Definition: ERF_Radiation.H:242
std::string rrtmgp_data_path
Definition: ERF_Radiation.H:218
real3d aer_tau_bnd_sw
Definition: ERF_Radiation.H:261
real fixed_total_solar_irradiance
Definition: ERF_Radiation.H:196
std::string rrtmgp_coefficients_file_lw
Definition: ERF_Radiation.H:220
real1d net_flux
Definition: ERF_Radiation.H:166
real3d aer_ssa_bnd_sw
Definition: ERF_Radiation.H:261
real2d rei
Definition: ERF_Radiation.H:257
void initialize(const amrex::MultiFab &cons_in, amrex::MultiFab *lsm_fluxes, amrex::MultiFab *lsm_zenith, amrex::MultiFab *qheating_rates, amrex::MultiFab *lat, amrex::MultiFab *lon, amrex::Vector< amrex::MultiFab * > qmoist, const amrex::BoxArray &grids, const amrex::Geometry &geom, const amrex::Real &dt_advance, const bool &do_sw_rad, const bool &do_lw_rad, const bool &do_aero_rad, const bool &do_snow_opt, const bool &is_cmip6_volcano)
Definition: ERF_Radiation.cpp:102
bool is_cmip6_volc
Definition: ERF_Radiation.H:169
void get_gas_vmr(const std::vector< std::string > &gas_names, const real3d &gas_vmr)
Definition: ERF_Radiation.cpp:855
std::string moisture_type
Definition: ERF_Radiation.H:121
bool use_rad_dt_cosz
Definition: ERF_Radiation.H:191
real3d liq_tau_bnd_lw
Definition: ERF_Radiation.H:266
real2d mu
Definition: ERF_Radiation.H:257
real1d fsnt
Definition: ERF_Radiation.H:175
real2d qrl
Definition: ERF_Radiation.H:238
void export_surface_fluxes(FluxesByband &fluxes, std::string band)
Definition: ERF_Radiation.cpp:992
real3d cld_ssa_gpt_sw
Definition: ERF_Radiation.H:259
int nswbands
Definition: ERF_Radiation.H:142
real2d pint
Definition: ERF_Radiation.H:252
real2d pmid
Definition: ERF_Radiation.H:251
real2d qrlc
Definition: ERF_Radiation.H:247
int1d rrtmg_to_rrtmgp
Definition: ERF_Radiation.H:234
amrex::BoxArray m_box
Definition: ERF_Radiation.H:108
real3d aer_asm_bnd_sw
Definition: ERF_Radiation.H:261
real1d aer_ssa_bnd_sw_o_1d
Definition: ERF_Radiation.H:276
amrex::Vector< int > rank_offsets
Definition: ERF_Radiation.H:124
real1d aer_tau_bnd_sw_o_1d
Definition: ERF_Radiation.H:276
bool rrtmgp_enable_temperature_warnings
Definition: ERF_Radiation.H:202
void writePlotfile(const std::string &plot_prefix, const amrex::Real time, const int level_step)
Definition: ERF_Radiation.cpp:1132
real1d cld_asm_bnd_sw_o_1d
Definition: ERF_Radiation.H:273
real1d cld_tau_bnd_sw_o_1d
Definition: ERF_Radiation.H:273
static constexpr amrex::Real obliqr
Definition: ERF_Radiation.H:131
real1d aer_ssa_bnd_sw_1d
Definition: ERF_Radiation.H:275
real1d fsns
Definition: ERF_Radiation.H:174
int naer
Definition: ERF_Radiation.H:230
void expand_yakl1d_to_mf(const real1d &data, amrex::MultiFab &mf)
Definition: ERF_Radiation.cpp:1105
void set_daynight_indices(const real1d &coszrs, const int1d &day_indices, const int1d &night_indices)
Definition: ERF_Radiation.cpp:831
real2d dei
Definition: ERF_Radiation.H:257
amrex::MultiFab * m_lsm_fluxes
Definition: ERF_Radiation.H:118
static constexpr amrex::Real eccen
Definition: ERF_Radiation.H:130
int nswgpts
Definition: ERF_Radiation.H:141
bool spectralflux
Definition: ERF_Radiation.H:185
static constexpr amrex::Real lambm0
Definition: ERF_Radiation.H:133
int nlev
Definition: ERF_Radiation.H:136
amrex::MultiFab * qrad_src
Definition: ERF_Radiation.H:111
bool do_aerosol_rad
Definition: ERF_Radiation.H:151
real1d flns
Definition: ERF_Radiation.H:176
real3d snw_tau_bnd_lw
Definition: ERF_Radiation.H:266
real3d cld_tau_bnd_lw
Definition: ERF_Radiation.H:262
real2d des
Definition: ERF_Radiation.H:257
real1d cld_tau_bnd_sw_1d
Definition: ERF_Radiation.H:272
void run()
Definition: ERF_Radiation.cpp:278
AerRadProps aer_rad
Definition: ERF_Radiation.H:160
real2d tint
Definition: ERF_Radiation.H:252
std::vector< std::string > gasnames
Definition: ERF_Radiation.H:231
real2d zi
Definition: ERF_Radiation.H:241
const std::vector< std::string > active_gases
Definition: ERF_Radiation.H:181
real2d qi
Definition: ERF_Radiation.H:250
real3d cld_asm_gpt_sw
Definition: ERF_Radiation.H:259
int1d gpoint_bands_sw
Definition: ERF_Radiation.H:269
real2d cld
Definition: ERF_Radiation.H:257
int nlwgpts
Definition: ERF_Radiation.H:141
real3d gas_vmr
Definition: ERF_Radiation.H:268
FluxesByband sw_fluxes_clrsky
Definition: ERF_Radiation.H:271
std::string rrtmgp_coefficients_file_sw
Definition: ERF_Radiation.H:219
bool do_snow_optics
Definition: ERF_Radiation.H:147
real3d cld_asm_bnd_sw
Definition: ERF_Radiation.H:260
real1d sw_band_midpoints
Definition: ERF_Radiation.H:226
int ncol
Definition: ERF_Radiation.H:139
real2d qn
Definition: ERF_Radiation.H:250
real2d rel
Definition: ERF_Radiation.H:257
real dt
Definition: ERF_Radiation.H:171
std::string rrtmgp_coefficients_file_name_lw
Definition: ERF_Radiation.H:222
real1d aer_asm_bnd_sw_1d
Definition: ERF_Radiation.H:275
real2d iclwp
Definition: ERF_Radiation.H:257
real2d qrs
Definition: ERF_Radiation.H:237
amrex::MultiFab * m_lsm_zenith
Definition: ERF_Radiation.H:119
int ihirsfq
Definition: ERF_Radiation.H:209
real2d iciwp
Definition: ERF_Radiation.H:257
real2d qt
Definition: ERF_Radiation.H:250
std::vector< std::string > aernames
Definition: ERF_Radiation.H:232
Optics optics
Definition: ERF_Radiation.H:157
real2d albedo_dir
Definition: ERF_Radiation.H:253
real2d albedo_dif
Definition: ERF_Radiation.H:253
real3d ice_tau_bnd_lw
Definition: ERF_Radiation.H:266
int nlwbands
Definition: ERF_Radiation.H:142
real2d lambdac
Definition: ERF_Radiation.H:257
void yakl_to_mf(const real2d &data, amrex::MultiFab &mf)
Definition: ERF_Radiation.cpp:1076
real3d ice_tau_bnd_sw
Definition: ERF_Radiation.H:265
FluxesByband sw_fluxes_allsky
Definition: ERF_Radiation.H:271
real2d qrsc
Definition: ERF_Radiation.H:246
real3d cld_tau_gpt_sw
Definition: ERF_Radiation.H:259
real2d qc
Definition: ERF_Radiation.H:250
void radiation_driver_sw(int ncol, const real3d &gas_vmr, const real2d &pmid, const real2d &pint, const real2d &tmid, const real2d &albedo_dir, const real2d &albedo_dif, const real1d &coszrs, const real3d &cld_tau_gpt, const real3d &cld_ssa_gpt, const real3d &cld_asm_gpt, const real3d &aer_tau_bnd, const real3d &aer_ssa_bnd, const real3d &aer_asm_bnd, FluxesByband &fluxes_clrsky, FluxesByband &fluxes_allsky, const real2d &qrs, const real2d &qrsc)
Definition: ERF_Radiation.cpp:582
int zhi
Definition: ERF_Radiation.H:136
real2d tmid
Definition: ERF_Radiation.H:251
real1d aer_tau_bnd_sw_1d
Definition: ERF_Radiation.H:275
real3d liq_tau_bnd_sw
Definition: ERF_Radiation.H:265
void radiation_driver_lw(int ncol, int nlev, const real3d &gas_vmr, const real2d &pmid, const real2d &pint, const real2d &tmid, const real2d &tint, const real3d &cld_tau_gpt, const real3d &aer_tau_bnd, FluxesByband &fluxes_clrsky, FluxesByband &fluxes_allsky, const real2d &qrl, const real2d &qrlc)
Definition: ERF_Radiation.cpp:772
bool do_short_wave_rad
Definition: ERF_Radiation.H:145
real1d cld_ssa_bnd_sw_1d
Definition: ERF_Radiation.H:272
real1d cld_ssa_bnd_sw_o_1d
Definition: ERF_Radiation.H:273
real2d pdel
Definition: ERF_Radiation.H:251
real2d icswp
Definition: ERF_Radiation.H:257
void calculate_heating_rate(const real2d &flux_up, const real2d &flux_dn, const real2d &pint, const real2d &heating_rate)
Definition: ERF_Radiation.cpp:959
real1d coszrs
Definition: ERF_Radiation.H:256
bool has_qmoist
Definition: ERF_Radiation.H:122
Rrtmgp radiation
Definition: ERF_Radiation.H:154
int zlo
Definition: ERF_Radiation.H:136
FluxesByband lw_fluxes_clrsky
Definition: ERF_Radiation.H:278
static constexpr amrex::Real mvelpp
Definition: ERF_Radiation.H:132
real2d cldfsnow
Definition: ERF_Radiation.H:257
amrex::Geometry m_geom
Definition: ERF_Radiation.H:105
real1d aer_asm_bnd_sw_o_1d
Definition: ERF_Radiation.H:276
std::string rrtmgp_coefficients_file_name_sw
Definition: ERF_Radiation.H:221
amrex::MultiFab * m_lat
Definition: ERF_Radiation.H:114
real3d cld_tau_bnd_sw
Definition: ERF_Radiation.H:260
real3d snw_tau_bnd_sw
Definition: ERF_Radiation.H:265
real1d fsds
Definition: ERF_Radiation.H:178
amrex::Real uniform_angle
Definition: ERF_Radiation.H:127
int ngas
Definition: ERF_Radiation.H:230
FluxesByband lw_fluxes_allsky
Definition: ERF_Radiation.H:278
real3d cld_ssa_bnd_sw
Definition: ERF_Radiation.H:260
real dt_avg
Definition: ERF_Radiation.H:214
int1d gpoint_bands_lw
Definition: ERF_Radiation.H:269
real3d aer_tau_bnd_lw
Definition: ERF_Radiation.H:262
bool dohirs
Definition: ERF_Radiation.H:208
bool do_long_wave_rad
Definition: ERF_Radiation.H:146
real1d cld_asm_bnd_sw_1d
Definition: ERF_Radiation.H:272
real1d flnt
Definition: ERF_Radiation.H:177
Radiation()
Definition: ERF_Radiation.H:38
Definition: ERF_Rrtmgp.H:39