1 #ifndef ERF_RAD_STRUCT_H_
2 #define ERF_RAD_STRUCT_H_
8 #include <AMReX_ParmParse.H>
9 #include <AMReX_ParallelDescriptor.H>
10 #include <AMReX_Print.H>
11 #include <AMReX_Gpu.H>
39 AMREX_ENUM(AerosolProfileType, Constant, Exponential, Table);
699 if (amrex::ParallelDescriptor::IOProcessor()) {
700 amrex::Print() <<
"WARNING: erf.radiation." << key <<
" = " << value
701 <<
" is below its minimum " <<
lo <<
"; using " <<
lo <<
"\n";
709 if (amrex::ParallelDescriptor::IOProcessor()) {
710 amrex::Print() <<
"WARNING: erf.radiation." << key <<
" = " << value
711 <<
" is above its maximum " <<
hi <<
"; using " <<
hi <<
"\n";
718 if (!std::isfinite(value) || value <= 0.0) {
719 if (amrex::ParallelDescriptor::IOProcessor()) {
720 amrex::Print() <<
"WARNING: erf.radiation." << key <<
" = " << value
721 <<
" must be positive; using " << fallback <<
"\n";
727 void init_params(
bool two_stream_selected,
int max_level, std::string pp_prefix)
729 amrex::ParmParse
pp(pp_prefix);
736 if (
enabled && max_level > 0) {
737 amrex::Abort(
"erf.radiation_model = TwoStream runs on a single level; "
738 "set amr.max_level = 0 or select another radiation model.");
753 static const char* retired_keys[][2] = {
754 {
"radiation.solar_zenith",
755 "erf.fixed_solar_zenith_angle, which is the cosine of the angle (60 degrees is 0.5)"},
756 {
"radiation.solar_zenith_deg",
757 "erf.fixed_solar_zenith_angle, which is the cosine of the angle (60 degrees is 0.5)"},
758 {
"radiation.S0",
"erf.fixed_total_solar_irradiance"},
759 {
"radiation.earth_sun_distance_enable",
760 "nothing: leave erf.fixed_total_solar_irradiance unset and the irradiance follows the date"},
761 {
"radiation.surface_temp_k",
"erf.rad_t_sfc"},
762 {
"radiation.solar_geometry_dynamic_enable",
763 "nothing: leave erf.fixed_solar_zenith_angle unset and the sun follows start_datetime"},
764 {
"radiation.latitude_deg",
"erf.rad_cons_lat"},
765 {
"radiation.longitude_deg",
"erf.rad_cons_lon"},
766 {
"radiation.day_of_year",
"start_datetime"},
767 {
"radiation.time_zone_offset_hours",
768 "nothing: start_datetime is UTC and the longitude sets the local solar time"},
770 for (
const auto& entry : retired_keys) {
771 if (
pp.contains(entry[0])) {
772 amrex::Abort(std::string(
"erf.") + entry[0] +
" is no longer read by the "
773 "two-stream model; use " + entry[1] +
".");
779 " is the cosine of the solar zenith angle (as for RRTMGP) and cannot "
780 "exceed 1; 60 degrees is 0.5.");
784 amrex::Abort(
"erf.radiation_model = TwoStream needs erf.rad_t_sfc, the surface "
785 "temperature [K] used where no land-surface model or surface layer "
786 "supplies one (the same input RRTMGP requires).");
789 amrex::Abort(
"erf.rad_t_sfc = " + std::to_string(
rad_t_sfc) +
" must be a positive temperature [K].");
793 if (!std::isfinite(
rad_cons_lat) || rad_cons_lat < -90.0 || rad_cons_lat > 90.0) {
794 amrex::Abort(
"erf.rad_cons_lat = " + std::to_string(
rad_cons_lat) +
" must lie in [-90, 90] degrees.");
796 if (!std::isfinite(
rad_cons_lon) || rad_cons_lon < -180.0 || rad_cons_lon > 180.0) {
797 amrex::Abort(
"erf.rad_cons_lon = " + std::to_string(
rad_cons_lon) +
" must lie in [-180, 180] degrees.");
803 if (
pp.contains(
"rad_freq_in_steps") && amrex::ParallelDescriptor::IOProcessor()) {
804 amrex::Print() <<
"WARNING: erf.rad_freq_in_steps is not read by the two-stream model, "
805 "which runs every step.\n";
807 std::string tau_model_str =
"per_layer";
808 pp.query(
"radiation.tau_model", tau_model_str);
809 if (tau_model_str ==
"per_layer") {
811 }
else if (tau_model_str ==
"mass") {
817 if (amrex::ParallelDescriptor::IOProcessor()) {
818 amrex::Print() <<
"WARNING: unknown erf.radiation.tau_model '"
819 << tau_model_str <<
"'; valid values are per_layer "
820 "and mass. Using per_layer.\n";
849 std::string tau_profile_type_str =
"constant";
850 pp.query(
"radiation.tau_profile_type", tau_profile_type_str);
851 if (tau_profile_type_str ==
"constant") {
853 }
else if (tau_profile_type_str ==
"cloud_layer") {
858 if (amrex::ParallelDescriptor::IOProcessor()) {
859 amrex::Print() <<
"WARNING: unknown erf.radiation.tau_profile_type '"
860 << tau_profile_type_str <<
"'; valid values are "
861 "constant and cloud_layer. Using constant, so no "
862 "cloud layer is applied.\n";
910 if (amrex::ParallelDescriptor::IOProcessor()) {
911 amrex::Print() <<
"WARNING: unknown erf.radiation.diag_callsite_mode '"
913 "pre_only and post_only. Using both.\n";
973 std::string aerosol_profile_type_str =
"constant";
974 pp.query(
"radiation.aerosol_profile_type", aerosol_profile_type_str);
975 if (aerosol_profile_type_str ==
"constant") {
977 }
else if (aerosol_profile_type_str ==
"exponential") {
979 }
else if (aerosol_profile_type_str ==
"table") {
984 if (amrex::ParallelDescriptor::IOProcessor()) {
985 amrex::Print() <<
"WARNING: erf.radiation.aerosol_profile_type = table is "
986 "not implemented and contributes no aerosol optical "
987 "depth. Use constant or exponential.\n";
992 if (amrex::ParallelDescriptor::IOProcessor()) {
993 amrex::Print() <<
"WARNING: unknown erf.radiation.aerosol_profile_type '"
994 << aerosol_profile_type_str <<
"'; valid values are "
995 "constant and exponential. Using constant.\n";
1044 if (amrex::ParallelDescriptor::IOProcessor()) {
1045 amrex::Print() <<
"NOTE: erf.radiation.seb_prognostic_enable = true "
1046 "also enables seb_enable and "
1047 "seb_diagnostic_enable, which it depends on.\n";
AMREX_ENUM(TauProfileType, Constant, CloudLayer)
Optical depth profile type for the two-stream solver.
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ tmp
Definition: ERF_AdvanceWSM6.cpp:116
Container holding radiation-related choices and parameters.
Definition: ERF_RadStruct.H:70
amrex::Real lw_kabs_dry
Dry-air gray LW mass absorption coefficient [m^2/kg].
Definition: ERF_RadStruct.H:188
bool aerosol_enable
Enable prescribed bulk aerosol/turbidity optical depth. When true, aerosol optical depth is added on ...
Definition: ERF_RadStruct.H:577
TauModel tau_model
Optical depth model: "per_layer" (default, fixed tau per layer) or "mass" (from the layer mass path i...
Definition: ERF_RadStruct.H:155
amrex::Real sw_kabs_vapor
Mass model, SW: water-vapor gray absorption coefficient [m^2/kg].
Definition: ERF_RadStruct.H:164
amrex::Real cloud_top_height_m
Cloud layer top height [m]. Only used when tau_profile_type == CloudLayer. Must be >= cloud_base_heig...
Definition: ERF_RadStruct.H:276
static void reset_nonpositive(const char *key, amrex::Real &value, amrex::Real fallback)
Definition: ERF_RadStruct.H:716
amrex::Real aerosol_tau_surface
Total-column aerosol optical depth at surface [dimensionless]. Used for AerosolProfileType::Exponenti...
Definition: ERF_RadStruct.H:609
int rad_orbital_year
erf.rad_orbital_year and the orbital overrides: negative means the year of the timestamp and the Berg...
Definition: ERF_RadStruct.H:145
amrex::Real fixed_solar_zenith_angle
erf.fixed_solar_zenith_angle: the COSINE of the solar zenith angle (mu0), as RRTMGP takes it,...
Definition: ERF_RadStruct.H:120
bool sw_enabled
Enable shortwave (solar) radiation computation. Only used by the two-stream model.
Definition: ERF_RadStruct.H:82
amrex::Real cloud_asymmetry_factor
Cloud scattering asymmetry factor in [-1, 1], used instead of asymmetry_factor for levels where the c...
Definition: ERF_RadStruct.H:331
void init_params(bool two_stream_selected, int max_level, std::string pp_prefix)
Definition: ERF_RadStruct.H:727
std::string diag_file
Output file path for radiation diagnostics CSV. Paths are relative to the simulation working director...
Definition: ERF_RadStruct.H:206
static void clamp_high(const char *key, amrex::Real &value, amrex::Real hi)
Definition: ERF_RadStruct.H:706
amrex::Real tau_lw_per_layer
Longwave optical depth per layer (constant for all layers). Used in gray-gas LW two-stream solver....
Definition: ERF_RadStruct.H:102
amrex::Real surface_albedo_sw
Shortwave surface albedo fallback [0, 1] for per-column heterogeneous-surface-property resolution....
Definition: ERF_RadStruct.H:340
amrex::Real surface_emissivity_lw
Longwave surface emissivity fallback [0, 1] for per-column heterogeneous-surface-property resolution....
Definition: ERF_RadStruct.H:355
amrex::Real rad_orbital_mvelp
Definition: ERF_RadStruct.H:148
amrex::Real seb_grdflx_default
Fallback SEB ground heat flux [W/m^2].
Definition: ERF_RadStruct.H:396
amrex::Real diag_dedup_tol
Tolerance for time equality in duplicate guard [s]. Times within this tolerance are considered equal....
Definition: ERF_RadStruct.H:257
amrex::Real seb_restore_timescale_s
Force-restore timescale for surface temperature [s]. Relaxation time constant toward T_deep in progno...
Definition: ERF_RadStruct.H:446
std::string diag_callsite_mode
Call-site filtering mode: "both" (pre+post rows), "pre_only", or "post_only".
Definition: ERF_RadStruct.H:250
bool diag_regtest_line_enable
Enable RADIATION_DIAG: line emission. Controls regtest-parsing diagnostics line. Default true.
Definition: ERF_RadStruct.H:237
amrex::Real sw_kext_cloud
Mass model, SW: cloud-water extinction coefficient m^2/kg.
Definition: ERF_RadStruct.H:167
amrex::Real tau_sw_coeff_qv
Shortwave optical depth coefficient for water vapor [dimensionless]. Dynamic SW tau = tau_sw_coeff_qv...
Definition: ERF_RadStruct.H:513
amrex::Real fixed_total_solar_irradiance
erf.fixed_total_solar_irradiance: top-of-atmosphere irradiance [W/m^2] when >= 0. Otherwise (default)...
Definition: ERF_RadStruct.H:127
bool tau_lw_dynamic_enable
Enable dynamic longwave optical depth diagnosis from moisture/clouds. When true, LW optical depth is ...
Definition: ERF_RadStruct.H:504
amrex::Real seb_lh_default
Fallback SEB latent heat flux [W/m^2].
Definition: ERF_RadStruct.H:391
amrex::Real seb_moisture_restore_timescale_s
Force-restore timescale for surface moisture [s]. Relaxation time constant toward q_deep in prognosti...
Definition: ERF_RadStruct.H:462
amrex::Real seb_lw_flux_default
Fallback SEB surface net longwave flux [W/m^2].
Definition: ERF_RadStruct.H:381
amrex::Real tau_sw_coeff_qc
Shortwave optical depth coefficient for cloud liquid water [dimensionless]. Default 0....
Definition: ERF_RadStruct.H:521
amrex::Real aerosol_tau_per_layer
Constant aerosol optical depth per layer [dimensionless]. Used for AerosolProfileType::Constant profi...
Definition: ERF_RadStruct.H:593
amrex::Real seb_q_sfc_default
Fallback SEB surface moisture [kg/kg].
Definition: ERF_RadStruct.H:401
amrex::Real rad_orbital_eccentricity
Definition: ERF_RadStruct.H:146
amrex::Real single_scattering_albedo
Clear-sky (background gas) single-scattering albedo in [0, 1] for the SW diffuse (scattering) two-str...
Definition: ERF_RadStruct.H:302
bool diag_csv_enable
Enable CSV file append behavior. When false, no file writes; other enabled streams may still print....
Definition: ERF_RadStruct.H:244
bool tau_sw_dynamic_enable
Definition: ERF_RadStruct.H:505
bool uses_two_stream_radiation() const noexcept
Check if two-stream radiation is active.
Definition: ERF_RadStruct.H:1113
amrex::Real seb_t_deep_default
Fallback SEB deep soil temperature [K].
Definition: ERF_RadStruct.H:406
AerosolProfileType aerosol_profile_type
Aerosol optical depth profile type: Constant, Exponential, or Table.
Definition: ERF_RadStruct.H:586
amrex::Real seb_prognostic_t_max_k
Maximum clamping bound for prognostic surface temperature [K]. After each Euler update,...
Definition: ERF_RadStruct.H:479
amrex::Real rad_t_sfc
erf.rad_t_sfc: surface temperature [K] used as the longwave boundary condition wherever no land-surfa...
Definition: ERF_RadStruct.H:135
bool seb_prognostic_enable
Enable prognostic SEB surface temperature and moisture evolution. When true, integrates SEB residual ...
Definition: ERF_RadStruct.H:430
bool seb_use_radiation_fluxes
Take the SEB's net surface shortwave and longwave fluxes from the two-stream sweep itself (per column...
Definition: ERF_RadStruct.H:371
amrex::Real seb_prognostic_t_min_k
Minimum clamping bound for prognostic surface temperature [K]. After each Euler update,...
Definition: ERF_RadStruct.H:471
amrex::Real tau_lw_coeff_qc
Longwave optical depth coefficient for cloud liquid water [dimensionless]. Default 0....
Definition: ERF_RadStruct.H:537
amrex::Real rad_orbital_obliquity
Definition: ERF_RadStruct.H:147
amrex::Real cloud_fraction
Cloud fraction in [0, 1] used to blend clear-sky and cloudy-column fluxes: F = (1 - cloud_fraction) *...
Definition: ERF_RadStruct.H:292
amrex::Real cloud_single_scattering_albedo
Cloud single-scattering albedo in [0, 1], used instead of single_scattering_albedo for levels where t...
Definition: ERF_RadStruct.H:322
amrex::Real lw_kabs_cloud
Cloud-water LW mass absorption coefficient m^2/kg.
Definition: ERF_RadStruct.H:194
amrex::Real sw_cloud_omega
Mass model, SW: cloud-water single-scattering albedo.
Definition: ERF_RadStruct.H:170
amrex::Real sw_kscat_dry
Mass model, SW: dry-air (Rayleigh) scattering coefficient [m^2/kg], omega = 1, g = 0.
Definition: ERF_RadStruct.H:161
amrex::Real sw_kabs_dry
Mass model, SW: dry-air gray absorption coefficient [m^2/kg].
Definition: ERF_RadStruct.H:158
amrex::Real asymmetry_factor
Clear-sky (background gas) scattering asymmetry factor in [-1, 1] (0 = isotropic scattering,...
Definition: ERF_RadStruct.H:310
static void clamp_low(const char *key, amrex::Real &value, amrex::Real lo)
Read radiation options from the input parameter database.
Definition: ERF_RadStruct.H:696
amrex::Real cloud_fraction_qc_scale
Cloud water [kg/kg] at which the liquid-water term alone gives a cloud fraction of 1: cf += min(1,...
Definition: ERF_RadStruct.H:569
bool cloud_fraction_prog_enable
Enable prognostic cloud fraction diagnosis from RH/qc. When true, cloud fraction is computed per-leve...
Definition: ERF_RadStruct.H:545
amrex::Real seb_prognostic_q_max
Maximum clamping bound for prognostic surface moisture [kg/kg]. After each Euler update,...
Definition: ERF_RadStruct.H:495
bool lw_enabled
Enable longwave (thermal) radiation computation. Only used by the two-stream model.
Definition: ERF_RadStruct.H:88
amrex::Real surface_albedo_sw_diffuse
Shortwave surface albedo for diffuse light [0,1]. A negative value (default) uses surface_albedo_sw f...
Definition: ERF_RadStruct.H:346
amrex::Real cloud_base_height_m
Cloud layer base height [m]. Only used when tau_profile_type == CloudLayer.
Definition: ERF_RadStruct.H:270
amrex::Real lw_kabs_vapor
Water-vapor gray LW mass absorption coefficient [m^2/kg].
Definition: ERF_RadStruct.H:191
amrex::Real tau_per_layer
Shortwave optical depth per layer (constant for all layers). Used in Beer-Lambert direct-beam formula...
Definition: ERF_RadStruct.H:95
amrex::Real seb_moisture_layer_depth_m
Effective surface moisture layer depth [m]. Used in force-restore prognostic q_s equation: dq_s/dt = ...
Definition: ERF_RadStruct.H:454
amrex::Real tau_lw_coeff_qv
Longwave optical depth coefficient for water vapor [dimensionless]. Dynamic LW tau = tau_lw_coeff_qv ...
Definition: ERF_RadStruct.H:529
amrex::Real seb_hfx_default
Fallback SEB sensible heat flux [W/m^2].
Definition: ERF_RadStruct.H:386
amrex::Real cloud_fraction_rh_max
Maximum relative humidity threshold for cloud fraction diagnosis [0, 1]. Must be >= cloud_fraction_rh...
Definition: ERF_RadStruct.H:561
amrex::Real sw_cloud_g
Mass model, SW: cloud-water asymmetry factor.
Definition: ERF_RadStruct.H:173
amrex::Real rad_cons_lon
Definition: ERF_RadStruct.H:139
bool lw_mass_absorption_enable
Gray longwave optical depth from the layer mass path instead of the fixed tau_lw_per_layer (also sele...
Definition: ERF_RadStruct.H:185
amrex::Real cloud_tau_per_layer
Additional optical depth per layer contributed by the cloud, added on top of the clear-sky tau_per_la...
Definition: ERF_RadStruct.H:284
amrex::Real aerosol_scale_height_m
Scale height for exponential aerosol profile [m]. Controls decay rate: tau_aerosol(k) = aerosol_tau_s...
Definition: ERF_RadStruct.H:601
bool diag_tagged_enable
Enable tagged [RAD][...] debug lines. Controls emission of bracketed-tag debug output....
Definition: ERF_RadStruct.H:230
amrex::Real seb_q_deep_default
Fallback SEB deep soil moisture [kg/kg].
Definition: ERF_RadStruct.H:411
amrex::Real rad_cons_lat
erf.rad_cons_lat / erf.rad_cons_lon: site latitude and longitude [degrees] when the grid has no lat/l...
Definition: ERF_RadStruct.H:138
amrex::Real seb_sw_flux_default
Fallback SEB surface net shortwave flux [W/m^2].
Definition: ERF_RadStruct.H:376
bool diag_enable
Master switch for radiation diagnostics emission. When false, no diagnostics output (stdout/tagged/re...
Definition: ERF_RadStruct.H:216
amrex::Real seb_prognostic_q_min
Minimum clamping bound for prognostic surface moisture [kg/kg]. After each Euler update,...
Definition: ERF_RadStruct.H:487
amrex::Real cloud_fraction_rh_min
Minimum relative humidity threshold for cloud fraction diagnosis [0, 1]. Cloud fraction ramps from 0 ...
Definition: ERF_RadStruct.H:553
bool seb_enable
Master switch for simplified SEB infrastructure. When false (default), no SEB MultiFabs are allocated...
Definition: ERF_RadStruct.H:361
bool diag_stdout_enable
Enable human-readable stdout diagnostics block. Controls tagged [RAD][...] debug line emission (when ...
Definition: ERF_RadStruct.H:223
bool enabled
True when erf.radiation_model = TwoStream. Set by init_params from the model SolverChoice read; the e...
Definition: ERF_RadStruct.H:76
int verbosity
Debug verbosity level (0=off, 1+=debug output). Gated debug prints only emit when this is >= 1.
Definition: ERF_RadStruct.H:200
amrex::Real seb_surface_heat_capacity
Effective surface heat capacity [J/(m^2*K)]. Used in force-restore prognostic T_s equation: dT_s/dt =...
Definition: ERF_RadStruct.H:438
TauProfileType tau_profile_type
Optical depth profile type: "constant" (default, the thickness-independent tau) or "cloud_layer" (add...
Definition: ERF_RadStruct.H:264
bool seb_diagnostic_enable
Enable diagnostic SEB residual computation and reporting. When true, computes and reports SEB residua...
Definition: ERF_RadStruct.H:421