Skip to content

Commit 2771f50

Browse files
committed
There are two diagnostic output fields that should be optional.
The column integrated modal values of the deposition flux of aqueous so4 and the deposition flux of aqueous h2so4 should be optional. This will be a non-BFB change sinde these values were always output before and now the default is not to create these fields and avoid the calculation.
1 parent 577298b commit 2771f50

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

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

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,12 @@ void MAMMicrophysics::set_grids(
164164
// Diagnostic fluxes
165165
const FieldLayout vector2d_nmodes =
166166
grid_->get_2d_vector_layout(nmodes, "nmodes");
167-
add_field<Computed>("dqdt_so4_aqueous_chemistry", vector2d_nmodes, kg/m2/s, grid_name);
168-
add_field<Computed>("dqdt_h2so4_uptake", vector2d_nmodes, kg/m2/s, grid_name);
167+
168+
extra_mam4_diags_ = m_params.get<bool>("extra_mam4_diags", false);
169+
if (extra_mam4_diags_) {
170+
add_field<Computed>("dqdt_so4_aqueous_chemistry_column_integrated_flux", vector2d_nmodes, kg/m2/s, grid_name);
171+
add_field<Computed>("dqdt_h2so4_aqueous_chemistry_column_integrated_flux", vector2d_nmodes, kg/m2/s, grid_name);
172+
}
169173

170174
// ---------------------------------------------------------------------
171175
// These variables are "updated" or inputs/outputs for the process
@@ -451,7 +455,8 @@ void MAMMicrophysics::initialize_impl(const RunType run_type) {
451455
{"sfc_alb_dir_vis", {-1e10, 1e10}}, // FIXME
452456
{"snow_depth_land", {-1e10, 1e10}}, // FIXME
453457
{"surf_radiative_T", {-1e10, 1e10}}, // FIXME
454-
{"dqdt_so4_aqueous_chemistry", {-1e10, 1e10}}, // FIXME
458+
{"dqdt_so4_aqueous_chemistry_column_integrated_flux", {-1e10, 1e10}}, // FIXME
459+
{"dqdt_h2so4_aqueous_chemistry_column_integrated_flux", {-1e10, 1e10}}, // FIXME
455460
{"dqdt_h2so4_uptake", {-1e10, 1e10}} // FIXME
456461
};
457462
set_ranges_process(ranges_microphysics);
@@ -634,8 +639,12 @@ void MAMMicrophysics::run_impl(const double dt) {
634639
get_field_in("snow_depth_land").get_view<const Real *>();
635640

636641
// Constituent fluxes
637-
view_2d aqso4_flx = get_field_out("dqdt_so4_aqueous_chemistry").get_view<Real **>();
638-
view_2d aqh2so4_flx = get_field_out("dqdt_h2so4_uptake").get_view<Real **>();
642+
view_2d aqso4_flx;
643+
view_2d aqh2so4_flx;
644+
if (extra_mam4_diags_) {
645+
aqso4_flx = get_field_out("dqdt_so4_aqueous_chemistry_column_integrated_flux").get_view<Real **>();
646+
aqh2so4_flx = get_field_out("dqdt_h2so4_aqueous_chemistry_column_integrated_flux").get_view<Real **>();
647+
}
639648

640649
// climatology data for linear stratospheric chemistry
641650
// ozone (climatology) [vmr]
@@ -916,8 +925,12 @@ void MAMMicrophysics::run_impl(const double dt) {
916925
}
917926
}
918927
// These output values need to be put somewhere:
919-
const auto aqso4_flx_col = ekat::subview(aqso4_flx, icol); // deposition flux of so4 [mole/mole/s]
920-
const auto aqh2so4_flx_col = ekat::subview(aqh2so4_flx, icol); // deposition flux of h2so4 [mole/mole/s]
928+
mam4::MicrophysDiagnosticArrays diagnostic_arrays;
929+
if (extra_mam4_diags_) {
930+
// deposition flux of so4 [kg/m2/s] and deposition flux of h2so4 [kg/m2/s]
931+
diagnostic_arrays.aqso4_column_integrated_flux = ekat::subview(aqso4_flx, icol);
932+
diagnostic_arrays.aqh2so4_column_integrated_flux = ekat::subview(aqh2so4_flx, icol);
933+
}
921934
Real dflx_col[gas_pcnst] = {}; // deposition velocity [1/cm/s]
922935
Real dvel_col[gas_pcnst] = {}; // deposition flux [1/cm^2/s]
923936
// Output: values are dvel, dflx
@@ -937,7 +950,7 @@ void MAMMicrophysics::run_impl(const double dt) {
937950
offset_aerosol, config.linoz.o3_sfc, config.linoz.o3_tau,
938951
config.linoz.o3_lbl, dry_diameter_icol, wet_diameter_icol,
939952
wetdens_icol, dry_atm.phis(icol), cmfdqr, prain_icol, nevapr_icol,
940-
work_set_het_icol, drydep_data, aqso4_flx_col, aqh2so4_flx_col, dvel_col, dflx_col, progs);
953+
work_set_het_icol, drydep_data, diagnostic_arrays, dvel_col, dflx_col, progs);
941954

942955
team.team_barrier();
943956
// Update constituent fluxes with gas drydep fluxes (dflx)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class MAMMicrophysics final : public MAMGenericInterface {
6161
void finalize_impl(){/*Do nothing*/};
6262

6363
private:
64+
// Output extra mam4xx diagnostics.
65+
bool extra_mam4_diags_ = false;
66+
6467
// The orbital year, used for zenith angle calculations:
6568
// If > 0, use constant orbital year for duration of simulation
6669
// If < 0, use year from timestamp for orbital parameters

0 commit comments

Comments
 (0)