Skip to content

Commit 4e14a9b

Browse files
Merge branch 'overfelt/eamxx/make_output_SO4_and_H2SO4_diagnostics_optional' (PR #7469)
Move dqdt_so4_aqueous_chemistry and dqdt_h2so4_uptake to the standard mam4xx diagnostic struct The column integrated modal values of the deposition flux of aqueous SO4 and the deposition flux of aqueous H2SO4 were always added to the Field Manager (FM) to be available for the output. This PR hides these diagnostics under a flag. Since EAMxx doesn't output any fields by default, this change will be BFB. [BFB] * overfelt/eamxx/make_output_SO4_and_H2SO4_diagnostics_optional: Update mam4xx to point to main. Add note that these fields are vertically reduced Move dqdt_so4_aqueous_chemistry and dqdt_h2so4_uptake to the standard mam4xx diagnostic struct.
2 parents c70062e + 03d8c09 commit 4e14a9b

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,6 @@ void MAMMicrophysics::set_grids(
199199
// - extfrc: 3D instantaneous forcing rate [kg/m³/s]
200200
add_field<Computed>("mam4_external_forcing", vector3d_extcnt, kg / m3 / s, grid_name);
201201

202-
// Diagnostic fluxes
203-
const FieldLayout vector2d_nmodes =
204-
grid_->get_2d_vector_layout(nmodes, "nmodes");
205-
206-
// Register computed diagnostic fields
207-
add_field<Computed>("dqdt_so4_aqueous_chemistry", vector2d_nmodes, kg/m2/s, grid_name);
208-
add_field<Computed>("dqdt_h2so4_uptake", vector2d_nmodes, kg/m2/s, grid_name);
209-
210202
// Diagnostic fields for aerosol microphysics
211203

212204
//Flag to indicate if we want to compute extra diagnostics
@@ -215,6 +207,9 @@ void MAMMicrophysics::set_grids(
215207
const FieldLayout vector3d_num_gas_aerosol_constituents =
216208
grid_->get_3d_vector_layout(true, mam_coupling::gas_pcnst(), "num_gas_aerosol_constituents");
217209

210+
const FieldLayout vector2d_nmodes =
211+
grid_->get_2d_vector_layout(nmodes, "nmodes");
212+
218213
// Diagnostics: tendencies due to gas phase chemistry [mixed units: kg/kg/s or #/kg/s]
219214
add_field<Computed>("mam4_microphysics_tendency_gas_phase_chemistry", vector3d_num_gas_aerosol_constituents, nondim, grid_name);
220215

@@ -227,6 +222,12 @@ void MAMMicrophysics::set_grids(
227222
// Diagnostics: H2SO4 in-cloud tendencies [mixed units: kg/kg/s or #/kg/s]
228223
add_field<Computed>("mam4_microphysics_tendency_aqh2so4", vector3d_mid_nmodes, nondim, grid_name);
229224

225+
// Register computed diagnostic fields
226+
//(NOTE: dqdt_so4_aqueous_chemistry is the vertically reduced field of "mam4_microphysics_tendency_aqso4")
227+
add_field<Computed>("dqdt_so4_aqueous_chemistry", vector2d_nmodes, kg/m2/s, grid_name);
228+
//(NOTE: dqdt_h2so4_uptake is the vertically reduced field of "mam4_microphysics_tendency_aqh2so4")
229+
add_field<Computed>("dqdt_h2so4_uptake", vector2d_nmodes, kg/m2/s, grid_name);
230+
230231
// Diagnostics: tendencies due to aerosol microphysics (gas aerosol exchange) [mixed units: mol/mol/s or #/mol/s]
231232
add_field<Computed>("mam4_microphysics_tendency_condensation", vector3d_num_gas_aerosol_constituents, nondim, grid_name);
232233
add_field<Computed>("mam4_microphysics_tendency_renaming", vector3d_num_gas_aerosol_constituents, nondim, grid_name);
@@ -490,7 +491,6 @@ void MAMMicrophysics::initialize_impl(const RunType run_type) {
490491
{"sfc_alb_dir_vis", {-1e10, 1e10}}, // FIXME
491492
{"snow_depth_land", {-1e10, 1e10}}, // FIXME
492493
{"surf_radiative_T", {-1e10, 1e10}}, // FIXME
493-
{"dqdt_so4_aqueous_chemistry", {-1e10, 1e10}}, // FIXME
494494
{"dqdt_h2so4_uptake", {-1e10, 1e10}} // FIXME
495495
};
496496
set_ranges_process(ranges_microphysics);
@@ -711,18 +711,17 @@ void MAMMicrophysics::run_impl(const double dt) {
711711
const const_view_1d snow_depth_land =
712712
get_field_in("snow_depth_land").get_view<const Real *>();
713713

714-
// Constituent fluxes
715-
view_2d aqso4_flx = get_field_out("dqdt_so4_aqueous_chemistry").get_view<Real **>();
716-
view_2d aqh2so4_flx = get_field_out("dqdt_h2so4_uptake").get_view<Real **>();
717-
718714
// - dvmr/dt: Tendencies for mixing ratios [kg/kg/s]
715+
view_2d dqdt_so4_aqueous_chemistry, dqdt_h2so4_uptake;
719716
view_3d gas_phase_chemistry_dvmrdt, aqueous_chemistry_dvmrdt;
720717
view_3d aqso4_incloud_mmr_tendency, aqh2so4_incloud_mmr_tendency;
721718
view_3d gas_aero_exchange_condensation, gas_aero_exchange_renaming,
722719
gas_aero_exchange_nucleation, gas_aero_exchange_coagulation,
723720
gas_aero_exchange_renaming_cloud_borne;
724721

725722
if (extra_mam4_aero_microphys_diags_) {
723+
dqdt_so4_aqueous_chemistry = get_field_out("dqdt_so4_aqueous_chemistry").get_view<Real **>();
724+
dqdt_h2so4_uptake = get_field_out("dqdt_h2so4_uptake").get_view<Real **>();
726725
gas_phase_chemistry_dvmrdt = get_field_out("mam4_microphysics_tendency_gas_phase_chemistry").get_view<Real ***>();
727726
aqueous_chemistry_dvmrdt = get_field_out("mam4_microphysics_tendency_aqueous_chemistry").get_view<Real ***>();
728727
aqso4_incloud_mmr_tendency = get_field_out("mam4_microphysics_tendency_aqso4").get_view<Real ***>();
@@ -997,9 +996,11 @@ void MAMMicrophysics::run_impl(const double dt) {
997996
mam4::MicrophysDiagnosticArrays diag_arrays;
998997

999998
if (extra_mam4_aero_microphys_diags) {
1000-
diag_arrays.gas_phase_chemistry_dvmrdt = ekat::subview(gas_phase_chemistry_dvmrdt, icol);
999+
diag_arrays.dqdt_so4_aqueous_chemistry = ekat::subview(dqdt_so4_aqueous_chemistry, icol);
1000+
diag_arrays.dqdt_h2so4_uptake = ekat::subview(dqdt_h2so4_uptake, icol);
1001+
diag_arrays.gas_phase_chemistry_dvmrdt = ekat::subview(gas_phase_chemistry_dvmrdt, icol);
10011002

1002-
diag_arrays.aqueous_chemistry_dvmrdt = ekat::subview(aqueous_chemistry_dvmrdt, icol);
1003+
diag_arrays.aqueous_chemistry_dvmrdt = ekat::subview(aqueous_chemistry_dvmrdt, icol);
10031004
diag_arrays.aqso4_incloud_mmr_tendency = ekat::subview(aqso4_incloud_mmr_tendency, icol);
10041005
diag_arrays.aqh2so4_incloud_mmr_tendency = ekat::subview(aqh2so4_incloud_mmr_tendency, icol);
10051006

@@ -1008,7 +1009,7 @@ void MAMMicrophysics::run_impl(const double dt) {
10081009
diag_arrays.gas_aero_exchange_nucleation = ekat::subview(gas_aero_exchange_nucleation, icol);
10091010
diag_arrays.gas_aero_exchange_coagulation = ekat::subview(gas_aero_exchange_coagulation, icol);
10101011
diag_arrays.gas_aero_exchange_renaming_cloud_borne = ekat::subview(gas_aero_exchange_renaming_cloud_borne, icol);
1011-
}
1012+
}
10121013

10131014

10141015
// Wind speed at the surface
@@ -1053,8 +1054,6 @@ void MAMMicrophysics::run_impl(const double dt) {
10531054
}
10541055
}
10551056
// These output values need to be put somewhere:
1056-
const auto aqso4_flx_col = ekat::subview(aqso4_flx, icol); // deposition flux of so4 [mole/mole/s]
1057-
const auto aqh2so4_flx_col = ekat::subview(aqh2so4_flx, icol); // deposition flux of h2so4 [mole/mole/s]
10581057
Real dflx_col[num_gas_aerosol_constituents] = {}; // deposition velocity [1/cm/s]
10591058
Real dvel_col[num_gas_aerosol_constituents] = {}; // deposition flux [1/cm^2/s]
10601059
// Output: values are dvel, dflx
@@ -1073,8 +1072,7 @@ void MAMMicrophysics::run_impl(const double dt) {
10731072
offset_aerosol,
10741073
dry_diameter_icol, wet_diameter_icol,
10751074
wetdens_icol, dry_atm.phis(icol), cmfdqr, prain_icol, nevapr_icol,
1076-
work_set_het_icol, drydep_data, aqso4_flx_col, aqh2so4_flx_col,
1077-
diag_arrays, dvel_col, dflx_col, progs);
1075+
work_set_het_icol, drydep_data, diag_arrays, dvel_col, dflx_col, progs);
10781076

10791077
team.team_barrier();
10801078
// Update constituent fluxes with gas drydep fluxes (dflx)

0 commit comments

Comments
 (0)