Skip to content

Commit 5b20431

Browse files
committed
Merge branch 'revert-7424-bartgol/eamxx/set-rad-outputs-and-diags-to-fill-value' into next (PR #7540)
Reverts #7424
2 parents f936387 + 8789851 commit 5b20431

File tree

8 files changed

+12
-103
lines changed

8 files changed

+12
-103
lines changed

components/eamxx/src/diagnostics/longwave_cloud_forcing.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ void LongwaveCloudForcingDiagnostic::compute_diagnostic_impl()
5252
const auto& LW_flux_up = get_field_in("LW_flux_up").get_view<const Real**>();
5353
const auto& LW_clrsky_flux_up = get_field_in("LW_clrsky_flux_up").get_view<const Real**>();
5454

55-
// NOTE: as part of fixing https://github.com/E3SM-Project/E3SM/issues/6803, this hack
56-
// may have to be revised. Namely, the "radiation_ran" extra data should be removed,
57-
// in favor of a more structured and uniform approach
58-
const auto radiation_ran = get_field_in("LW_flux_up").get_header().get_extra_data<bool>("radiation_ran");
59-
if (not radiation_ran) {
60-
m_diagnostic_output.deep_copy(constants::DefaultFillValue<Real>().value);
61-
return;
62-
}
63-
6455
Kokkos::parallel_for("LongwaveCloudForcingDiagnostic",
6556
default_policy,
6657
KOKKOS_LAMBDA(const MemberType& team) {

components/eamxx/src/diagnostics/shortwave_cloud_forcing.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,11 @@ void ShortwaveCloudForcingDiagnostic::compute_diagnostic_impl()
4747
const auto default_policy = ESU::get_default_team_policy(m_num_cols,1);
4848

4949
const auto& SWCF = m_diagnostic_output.get_view<Real*>();
50-
5150
const auto& SW_flux_dn = get_field_in("SW_flux_dn").get_view<const Real**>();
5251
const auto& SW_flux_up = get_field_in("SW_flux_up").get_view<const Real**>();
5352
const auto& SW_clrsky_flux_dn = get_field_in("SW_clrsky_flux_dn").get_view<const Real**>();
5453
const auto& SW_clrsky_flux_up = get_field_in("SW_clrsky_flux_up").get_view<const Real**>();
5554

56-
// NOTE: as part of fixing https://github.com/E3SM-Project/E3SM/issues/6803, this hack
57-
// may have to be revised. Namely, the "radiation_ran" extra data should be removed,
58-
// in favor of a more structured and uniform approach
59-
const auto radiation_ran = get_field_in("SW_flux_dn").get_header().get_extra_data<bool>("radiation_ran");
60-
if (not radiation_ran) {
61-
m_diagnostic_output.deep_copy(constants::DefaultFillValue<Real>().value);
62-
return;
63-
}
64-
6555
Kokkos::parallel_for("ShortwaveCloudForcingDiagnostic",
6656
default_policy,
6757
KOKKOS_LAMBDA(const MemberType& team) {

components/eamxx/src/diagnostics/tests/longwave_cloud_forcing_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ void run(std::mt19937_64& engine)
9696
f.allocate_view();
9797
const auto name = f.name();
9898
f.get_header().get_tracking().update_time_stamp(t0);
99-
f.get_header().set_extra_data("radiation_ran", true);
10099
diag->set_required_field(f.get_const());
101100
input_fields.emplace(name,f);
102101
}

components/eamxx/src/diagnostics/tests/shortwave_cloud_forcing_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ void run(std::mt19937_64& engine)
9898
f.allocate_view();
9999
const auto name = f.name();
100100
f.get_header().get_tracking().update_time_stamp(t0);
101-
f.get_header().set_extra_data("radiation_ran", true);
102101
diag->set_required_field(f.get_const());
103102
input_fields.emplace(name,f);
104103
}

components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,73 +1204,6 @@ void RRTMGPRadiation::run_impl (const double dt) {
12041204
});
12051205
});
12061206

1207-
// When rad does NOT run, we fill all the rad-specific output fields (i.e., NOT T_mid)
1208-
// with FillValue. We also ALWAYS set extra data to signal whether rad ran or not,
1209-
// so that diags like ShortwaveCloudForcing can decide whether it's ok to run or not
1210-
// NOTE: as part of fixing https://github.com/E3SM-Project/E3SM/issues/6803, this hack
1211-
// may have to be revised
1212-
std::vector<std::string> rad_computed_fields = {
1213-
"SW_flux_dn",
1214-
"SW_flux_up",
1215-
"SW_flux_dn_dir",
1216-
"LW_flux_up",
1217-
"LW_flux_dn",
1218-
"SW_clnclrsky_flux_dn",
1219-
"SW_clnclrsky_flux_up",
1220-
"SW_clnclrsky_flux_dn_dir",
1221-
"SW_clrsky_flux_dn",
1222-
"SW_clrsky_flux_up",
1223-
"SW_clrsky_flux_dn_dir",
1224-
"SW_clnsky_flux_dn",
1225-
"SW_clnsky_flux_up",
1226-
"SW_clnsky_flux_dn_dir",
1227-
"LW_clnclrsky_flux_up",
1228-
"LW_clnclrsky_flux_dn",
1229-
"LW_clrsky_flux_up",
1230-
"LW_clrsky_flux_dn",
1231-
"LW_clnsky_flux_up",
1232-
"LW_clnsky_flux_dn",
1233-
"cldlow",
1234-
"cldmed",
1235-
"cldhgh",
1236-
"cldtot",
1237-
"dtau067",
1238-
"dtau105",
1239-
"sunlit",
1240-
"cldfrac_rad",
1241-
"T_mid_at_cldtop",
1242-
"p_mid_at_cldtop",
1243-
"cldfrac_ice_at_cldtop",
1244-
"cldfrac_liq_at_cldtop",
1245-
"cldfrac_tot_at_cldtop",
1246-
"cdnc_at_cldtop",
1247-
"eff_radius_qc_at_cldtop",
1248-
"eff_radius_qi_at_cldtop",
1249-
"cosine_solar_zenith_angle"
1250-
};
1251-
1252-
for (auto& name : rad_computed_fields) {
1253-
auto f = get_field_out(name);
1254-
f.get_header().set_extra_data("radiation_ran",update_rad);
1255-
if (not update_rad) {
1256-
f.deep_copy(constants::DefaultFillValue<Real>().value);
1257-
}
1258-
}
1259-
1260-
// Also need to fill computed gas volume mixing ratios
1261-
for (auto& name : m_gas_names) {
1262-
// We read o3 in as a vmr already. Also, n2 and co are currently set
1263-
// as a constant value, read from file during init. Skip these.
1264-
if (name=="o3" or name == "n2" or name == "co") continue;
1265-
// The rest are computed by RRTMGP from prescribed surface values, but only when rad updates.
1266-
// Set to fillvalue here when rad does not run for consistency across restart between update steps
1267-
auto f = get_field_out(name + "_volume_mix_ratio");
1268-
f.get_header().set_extra_data("radiation_ran",update_rad);
1269-
if (not update_rad) {
1270-
f.deep_copy(constants::DefaultFillValue<Real>().value);
1271-
}
1272-
}
1273-
12741207
// If necessary, set appropriate boundary fluxes for energy and mass conservation checks.
12751208
// Any boundary fluxes not included in radiation interface are set to 0.
12761209
if (has_column_conservation_check()) {

components/eamxx/tests/multi-process/dynamics_physics/model_restart/input.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ atmosphere_processes:
6363
rrtmgp_coefficients_file_lw: ${SCREAM_DATA_DIR}/init/rrtmgp-data-lw-g128-210809.nc
6464
rrtmgp_cloud_optics_file_sw: ${SCREAM_DATA_DIR}/init/rrtmgp-cloud-optics-coeffs-sw.nc
6565
rrtmgp_cloud_optics_file_lw: ${SCREAM_DATA_DIR}/init/rrtmgp-cloud-optics-coeffs-lw.nc
66-
rad_frequency: 3
6766

6867
grids_manager:
6968
type: homme

components/eamxx/tests/multi-process/dynamics_physics/model_restart/output.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
---
33
filename_prefix: model_output_${SUFFIX}
44
averaging_type: average
5-
track_avg_cnt: true
6-
fill_threshold: 0.25
75
fields:
86
physics_gll:
97
field_names:

components/eamxx/tests/single-process/rrtmgp/rrtmgp_standalone.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ TEST_CASE("rrtmgp-stand-alone", "") {
5050
const auto& field_mgr = *ad.get_field_mgr();
5151

5252
// Get field managed variables we need to check
53-
auto rad_heating_pdel = field_mgr.get_field("rad_heating_pdel", grid->name());
53+
auto sw_flux_up = field_mgr.get_field("sw_flux_up", grid->name());
5454

5555
// Create deep copies so that we can check values before and after call to ad.run
5656
// Note: we have to do some trickery here to make sure the new fields we allocate
5757
// get the same size as the (packed) ones in the FM, otherwise the vertical dim
5858
// might be padded in the FM fields and unpadded in our copies, which will cause
5959
// the deep_copy below to fail.
60-
Field rad_heating_pdel_old = Field(rad_heating_pdel.get_header().get_identifier());
61-
const auto& ap_new = rad_heating_pdel.get_header().get_alloc_properties();
62-
auto& ap_old = rad_heating_pdel_old.get_header().get_alloc_properties();
60+
Field sw_flux_up_old = Field(sw_flux_up.get_header().get_identifier());
61+
const auto& ap_new = sw_flux_up.get_header().get_alloc_properties();
62+
auto& ap_old = sw_flux_up_old.get_header().get_alloc_properties();
6363
ap_old.request_allocation(ap_new.get_largest_pack_size());
64-
rad_heating_pdel_old.allocate_view();
64+
sw_flux_up_old.allocate_view();
6565

6666
int rad_freq = ad_params.sublist("atmosphere_processes").sublist("rrtmgp").get<int>("rad_frequency");
6767
// Start stepping
@@ -74,24 +74,24 @@ TEST_CASE("rrtmgp-stand-alone", "") {
7474
auto istep = time.get_num_steps();
7575
// Create a (deep) copy of fields we want to check before calling ad.run() so we can verify
7676
// that these fields do or do not change as we expect them to based on the rad frequency
77-
rad_heating_pdel_old.deep_copy(rad_heating_pdel);
77+
sw_flux_up_old.deep_copy(sw_flux_up);
7878

7979
ad.run(dt);
8080
if (atm_comm.am_i_root()) {
8181
std::cout << " - Iteration " << std::setfill(' ') << std::setw(3) << istep << " completed";
8282
std::cout << " [" << std::setfill(' ') << std::setw(3) << 100*(istep)/nsteps << "%]\n";
8383
}
8484

85-
// Test that in between rad steps, we maintain the same value of heating rate
86-
// get rad heating rates before; we set rad_requency to 3 in the input.yaml, so
85+
// Test that in between rad steps, we maintain the same values of fluxes and heating rates
86+
// get rad fluxes and heating rates before; we set rad_requency to 3 in the input.yaml, so
8787
// the first two steps should look the same
88-
auto d_rad_heating_pdel_new = rad_heating_pdel.get_view<Real**,Host>();
89-
auto d_rad_heating_pdel_old = rad_heating_pdel_old.get_view<Real**,Host>();
88+
auto d_sw_flux_up_new = sw_flux_up.get_view<Real**,Host>();
89+
auto d_sw_flux_up_old = sw_flux_up_old.get_view<Real**,Host>();
9090

9191
if (istep==1 or istep%rad_freq==0) {
92-
REQUIRE(!views_are_equal(rad_heating_pdel_old, rad_heating_pdel));
92+
REQUIRE(!views_are_equal(sw_flux_up_old, sw_flux_up));
9393
} else {
94-
REQUIRE(views_are_equal(rad_heating_pdel_old, rad_heating_pdel));
94+
REQUIRE(views_are_equal(sw_flux_up_old, sw_flux_up));
9595
}
9696
}
9797

0 commit comments

Comments
 (0)