@@ -570,7 +570,7 @@ void MAMMicrophysics::run_impl(const double dt) {
570
570
const int team_size=nlev;
571
571
#else
572
572
const int team_size=1 ;
573
- #endif
573
+ #endif
574
574
const auto policy =
575
575
ekat::ExeSpaceUtils<KT::ExeSpace>::get_team_policy_force_team_size (ncol, team_size);
576
576
@@ -802,6 +802,12 @@ void MAMMicrophysics::run_impl(const double dt) {
802
802
const int surface_lev = nlev - 1 ; // Surface level
803
803
const auto &index_season_lai = index_season_lai_;
804
804
const int pcnst = mam4::pcnst;
805
+
806
+ Kokkos::Array<Real, gas_pcnst> molar_mass_g_per_mol_tmp;
807
+ for (int i = 0 ; i < gas_pcnst; ++i) {
808
+ molar_mass_g_per_mol_tmp[i] = mam4::gas_chemistry::adv_mass[i]; // host-only access
809
+ }
810
+
805
811
// NOTE: we need to initialize photo_rates_
806
812
Kokkos::deep_copy (photo_rates_,0.0 );
807
813
// loop over atmosphere columns and compute aerosol microphyscs
@@ -920,7 +926,15 @@ void MAMMicrophysics::run_impl(const double dt) {
920
926
const auto aqh2so4_flx_col = ekat::subview (aqh2so4_flx, icol); // deposition flux of h2so4 [mole/mole/s]
921
927
Real dflx_col[gas_pcnst] = {}; // deposition velocity [1/cm/s]
922
928
Real dvel_col[gas_pcnst] = {}; // deposition flux [1/cm^2/s]
929
+ // mam::microphysics wants the full column of these tendencies
930
+ // TODO: is it better for each column's threadTeam to have its own 3d view,
931
+ // or subview into a 4d view that contains all 'ncol' columns of these?
932
+ view_3d qgcm_tendaa (" diag_tendency-col" , nlev, gas_pcnst, mam4::microphysics::nqtendaa ());
933
+ view_3d qqcwgcm_tendaa (" diag_tendency_cw-col" , nlev, gas_pcnst, mam4::microphysics::nqqcwtendaa ());
934
+ Kokkos::deep_copy (qgcm_tendaa, 0.0 );
935
+ Kokkos::deep_copy (qqcwgcm_tendaa, 0.0 );
923
936
// Output: values are dvel, dflx
937
+ // Diagnostic Output: qgcm_tendaa, qqcwgcm_tendaa
924
938
// Input/Output: progs::stateq, progs::qqcw
925
939
team.team_barrier ();
926
940
mam4::microphysics::perform_atmospheric_chemistry_and_microphysics (
@@ -937,8 +951,9 @@ void MAMMicrophysics::run_impl(const double dt) {
937
951
offset_aerosol, config.linoz .o3_sfc , config.linoz .o3_tau ,
938
952
config.linoz .o3_lbl , dry_diameter_icol, wet_diameter_icol,
939
953
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);
941
-
954
+ work_set_het_icol, drydep_data, aqso4_flx_col, aqh2so4_flx_col,
955
+ dvel_col, dflx_col, qgcm_tendaa, qqcwgcm_tendaa, progs);
956
+
942
957
team.team_barrier ();
943
958
// Update constituent fluxes with gas drydep fluxes (dflx)
944
959
// FIXME: Possible units mismatch (dflx is in kg/cm2/s but
@@ -947,6 +962,7 @@ void MAMMicrophysics::run_impl(const double dt) {
947
962
Kokkos::parallel_for (Kokkos::TeamVectorRange (team, offset_aerosol, pcnst), [&](int ispc) {
948
963
constituent_fluxes (icol, ispc) -= dflx_col[ispc - offset_aerosol];
949
964
});
965
+
950
966
}); // parallel_for for the column loop
951
967
Kokkos::fence ();
952
968
@@ -958,10 +974,6 @@ void MAMMicrophysics::run_impl(const double dt) {
958
974
// NOTE: These indices should match the species in extfrc_lst
959
975
// TODO: getting rid of hard-coded indices
960
976
Kokkos::Array<int , extcnt> extfrc_pcnst_index = {3 , 6 , 14 , 27 , 28 , 13 , 18 , 30 , 5 };
961
- Kokkos::Array<Real, gas_pcnst> molar_mass_g_per_mol_tmp;
962
- for (int i = 0 ; i < gas_pcnst; ++i) {
963
- molar_mass_g_per_mol_tmp[i] = mam4::gas_chemistry::adv_mass[i]; // host-only access
964
- }
965
977
966
978
// Transpose extfrc_ from internal layout [ncol][nlev][extcnt]
967
979
// to output layout [ncol][extcnt][nlev]
0 commit comments