@@ -207,6 +207,8 @@ MAMMicrophysics::set_grids(const std::shared_ptr<const GridsManager> grids_manag
207207 true , mam_coupling::gas_pcnst (), " num_gas_aerosol_constituents" );
208208
209209 const FieldLayout vector2d_nmodes = grid_->get_2d_vector_layout (nmodes, " nmodes" );
210+ const FieldLayout vector2d_pcnst = grid_->get_2d_vector_layout (
211+ mam_coupling::gas_pcnst (), " num_gas_aerosol_constituents" );
210212
211213 // Diagnostics: tendencies due to gas phase chemistry [mixed units: kg/kg/s or #/kg/s]
212214 add_field<Computed>(" mam4_microphysics_tendency_gas_phase_chemistry" ,
@@ -243,6 +245,8 @@ MAMMicrophysics::set_grids(const std::shared_ptr<const GridsManager> grids_manag
243245 vector3d_num_gas_aerosol_constituents, nondim, grid_name);
244246 add_field<Computed>(" mam4_microphysics_tendency_renaming_cloud_borne" ,
245247 vector3d_num_gas_aerosol_constituents, nondim, grid_name);
248+ constexpr auto cm2 = m*m/10000 ;
249+ add_field<Computed>(" mam4_gas_dry_deposition_flux" , vector2d_pcnst, 1 /cm2/s, grid_name);
246250 }
247251
248252 // Creating a Linoz reader and setting Linoz parameters involves reading data
@@ -559,6 +563,8 @@ void MAMMicrophysics::initialize_impl(const RunType run_type) {
559563 {" mam4_microphysics_tendency_renaming_cloud_borne" ,
560564 " MAM4xx microphysics tendencies due to gas aerosol exchange (renaming cloud borne) [mixed units: mol/mol/s or #/mol/s]" },
561565
566+ {" mam4_gas_dry_deposition_flux" ,
567+ " MAM4xx microphysics deposition flux [units: 1/cm^2/s]" },
562568 };
563569 // Add docstring to the fields with mixed units
564570 add_io_docstring_to_fields_with_mixed_units (mixed_units_fields);
@@ -708,7 +714,7 @@ void MAMMicrophysics::run_impl(const double dt) {
708714 get_field_in (" snow_depth_land" ).get_view <const Real *>();
709715
710716 // - dvmr/dt: Tendencies for mixing ratios [kg/kg/s]
711- view_2d dqdt_so4_aqueous_chemistry, dqdt_h2so4_uptake;
717+ view_2d dqdt_so4_aqueous_chemistry, dqdt_h2so4_uptake, gas_dry_deposition_flux ;
712718 view_3d gas_phase_chemistry_dvmrdt, aqueous_chemistry_dvmrdt;
713719 view_3d aqso4_incloud_mmr_tendency, aqh2so4_incloud_mmr_tendency;
714720 view_3d gas_aero_exchange_condensation, gas_aero_exchange_renaming,
@@ -727,6 +733,7 @@ void MAMMicrophysics::run_impl(const double dt) {
727733 gas_aero_exchange_nucleation = get_field_out (" mam4_microphysics_tendency_nucleation" ).get_view <Real***>();
728734 gas_aero_exchange_coagulation = get_field_out (" mam4_microphysics_tendency_coagulation" ).get_view <Real***>();
729735 gas_aero_exchange_renaming_cloud_borne = get_field_out (" mam4_microphysics_tendency_renaming_cloud_borne" ).get_view <Real***>();
736+ gas_dry_deposition_flux = get_field_out (" mam4_gas_dry_deposition_flux" ).get_view <Real**>();
730737 }
731738
732739
@@ -988,7 +995,7 @@ void MAMMicrophysics::run_impl(const double dt) {
988995 const auto nevapr_icol = ekat::subview (nevapr, icol);
989996 const auto prain_icol = ekat::subview (prain, icol);
990997 const auto work_set_het_icol = ekat::subview (work_set_het, icol);
991-
998+ view_1d diag_arrays_gas_dry_deposition_flux;
992999 mam4::MicrophysDiagnosticArrays diag_arrays;
9931000 if (extra_mam4_aero_microphys_diags) {
9941001 diag_arrays.dqdt_so4_aqueous_chemistry = ekat::subview (dqdt_so4_aqueous_chemistry, icol);
@@ -1004,6 +1011,7 @@ void MAMMicrophysics::run_impl(const double dt) {
10041011 diag_arrays.gas_aero_exchange_nucleation = ekat::subview (gas_aero_exchange_nucleation, icol);
10051012 diag_arrays.gas_aero_exchange_coagulation = ekat::subview (gas_aero_exchange_coagulation, icol);
10061013 diag_arrays.gas_aero_exchange_renaming_cloud_borne = ekat::subview (gas_aero_exchange_renaming_cloud_borne, icol);
1014+ diag_arrays_gas_dry_deposition_flux = ekat::subview (gas_dry_deposition_flux, icol);
10071015 }
10081016 // Wind speed at the surface
10091017 const Real wind_speed =
@@ -1047,8 +1055,8 @@ void MAMMicrophysics::run_impl(const double dt) {
10471055 }
10481056 }
10491057 // These output values need to be put somewhere:
1050- Real dflx_col[num_gas_aerosol_constituents] = {}; // deposition velocity [1/cm/s]
1051- Real dvel_col[num_gas_aerosol_constituents] = {}; // deposition flux [1/cm^2 /s]
1058+ Real dflx_col[num_gas_aerosol_constituents] = {}; // deposition flux [1/cm^2 /s]
1059+ Real dvel_col[num_gas_aerosol_constituents] = {}; // deposition velocity [1/cm/s]
10521060 // Output: values are dvel, dflx
10531061 // Input/Output: progs::stateq, progs::qqcw
10541062 team.team_barrier ();
@@ -1075,6 +1083,11 @@ void MAMMicrophysics::run_impl(const double dt) {
10751083 Kokkos::parallel_for (Kokkos::TeamVectorRange (team, offset_aerosol, pcnst), [&](int ispc) {
10761084 constituent_fluxes (icol, ispc) -= dflx_col[ispc - offset_aerosol];
10771085 });
1086+ if (diag_arrays_gas_dry_deposition_flux.size ()) {
1087+ Kokkos::parallel_for (Kokkos::TeamVectorRange (team, pcnst), [&](int ispc) {
1088+ diag_arrays_gas_dry_deposition_flux[ispc] = dflx_col[ispc];
1089+ });
1090+ }
10781091 }); // parallel_for for the column loop
10791092 Kokkos::fence ();
10801093
0 commit comments