diff --git a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp index b0ab232c255c..7ed05940ee4b 100644 --- a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp +++ b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp @@ -1,5 +1,5 @@ #include - +#include // impl namespace for some driver level functions for microphysics #include "readfiles/photo_table_utils.cpp" @@ -545,10 +545,12 @@ void MAMMicrophysics::initialize_impl(const RunType run_type) { // RUN_IMPL // ================================================================ void MAMMicrophysics::run_impl(const double dt) { + const int ncol = ncol_; + const int nlev = nlev_; const auto scan_policy = ekat::ExeSpaceUtils< - KT::ExeSpace>::get_thread_range_parallel_scan_team_policy(ncol_, nlev_); + KT::ExeSpace>::get_thread_range_parallel_scan_team_policy(ncol, nlev); const auto policy = - ekat::ExeSpaceUtils::get_default_team_policy(ncol_, nlev_); + ekat::ExeSpaceUtils::get_default_team_policy(ncol, nlev); // preprocess input -- needs a scan for the calculation of atm height Kokkos::parallel_for("preprocess", scan_policy, preprocess_); @@ -691,7 +693,7 @@ void MAMMicrophysics::run_impl(const double dt) { // then deep copied to a device view. // Now use solar declination to calculate zenith angle for all points - for(int i = 0; i < ncol_; i++) { + for(int i = 0; i < ncol; i++) { Real lat = col_latitudes_host(i) * M_PI / 180.0; // Convert lat/lon to radians Real lon = col_longitudes_host(i) * M_PI / 180.0; @@ -722,6 +724,9 @@ void MAMMicrophysics::run_impl(const double dt) { clsmap_4[i] = mam4::gas_chemistry::clsmap_4[i]; permute_4[i] = mam4::gas_chemistry::permute_4[i]; } + const mam4::seq_drydep::Data drydep_data = mam4::seq_drydep::set_gas_drydep_data(); + const auto qv = wet_atm_.qv; + const int month = timestamp().get_month(); // 1-based // loop over atmosphere columns and compute aerosol microphyscs Kokkos::parallel_for( policy, KOKKOS_LAMBDA(const ThreadTeam &team) { @@ -787,20 +792,47 @@ void MAMMicrophysics::run_impl(const double dt) { ekat::subview(linoz_dPmL_dO3col, icol); const auto linoz_cariolle_pscs_icol = ekat::subview(linoz_cariolle_pscs, icol); - // Note: All variables are inputs, except for progs, which is an - // input/output variable. + + // All of these need to be filled with valid data: + const Real sfc_temp = 250; + const Real air_temp = atm.temperature(nlev-1); + const Real spec_hum = qv(ncol, nlev-1); + const Real tv = mam4::conversions::virtual_temperature_from_temperature(air_temp, spec_hum); + const Real pressure_sfc = atm.pressure(nlev-1); + const Real pressure_10m = 1010; // Millibars? + const Real wind_speed = 0; + const Real rain = 0; + const Real snow = 0; + const Real solar_flux = 1.0; // ? + const Real mmr[gas_pcnst] = {}; + const Real fraction_landuse[mam4::mo_drydep::n_land_type] = {.5, .5, .5, .5, .5}; + const int col_index_season[mam4::mo_drydep::n_land_type] = {1,2,3,4,5,6,7,8,9}; + // These output values need to be put somewhere: + Real dvel[gas_pcnst] = {}; + Real dflx[gas_pcnst] = {}; + + // Output: values are dvel, dvlx + // Input/Output: progs::stateq, progs::qqcw mam4::microphysics::perform_atmospheric_chemistry_and_microphysics( - team, dt, rlats, cnst_offline_icol, forcings_in, atm, progs, + team, dt, rlats, month, + sfc_temp, air_temp, tv, + pressure_sfc, pressure_10m, spec_hum, + wind_speed, rain, snow, + solar_flux, + cnst_offline_icol, forcings_in, atm, photo_table, chlorine_loading, config.setsox, config.amicphys, config.linoz.psc_T, zenith_angle(icol), d_sfc_alb_dir_vis(icol), o3_col_dens_i, photo_rates_icol, extfrc_icol, invariants_icol, work_photo_table_icol, linoz_o3_clim_icol, linoz_t_clim_icol, linoz_o3col_clim_icol, linoz_PmL_clim_icol, linoz_dPmL_dO3_icol, linoz_dPmL_dT_icol, linoz_dPmL_dO3col_icol, - linoz_cariolle_pscs_icol, eccf, adv_mass_kg_per_moles, clsmap_4, + linoz_cariolle_pscs_icol, eccf, adv_mass_kg_per_moles, + mmr, fraction_landuse, col_index_season, clsmap_4, permute_4, offset_aerosol, config.linoz.o3_sfc, config.linoz.o3_tau, config.linoz.o3_lbl, - dry_diameter_icol, wet_diameter_icol, wetdens_icol); + dry_diameter_icol, wet_diameter_icol, wetdens_icol, + drydep_data, + dvel, dflx, progs); }); // parallel_for for the column loop Kokkos::fence(); diff --git a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.hpp b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.hpp index 6b1dd33dfaa2..8144ccc1a5df 100644 --- a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.hpp +++ b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.hpp @@ -32,6 +32,9 @@ class MAMMicrophysics final : public scream::AtmosphereProcess { // Constructor MAMMicrophysics(const ekat::Comm &comm, const ekat::ParameterList ¶ms); + // Virtual Destructor + virtual ~MAMMicrophysics() {} + // -------------------------------------------------------------------------- // AtmosphereProcess overrides (see share/atm_process/atmosphere_process.hpp) // -------------------------------------------------------------------------- @@ -40,7 +43,7 @@ class MAMMicrophysics final : public scream::AtmosphereProcess { AtmosphereProcessType type() const override; // The name of the subcomponent - std::string name() const { return "mam_aero_microphysics"; } + std::string name() const override { return "mam_aero_microphysics"; } // grid void set_grids( @@ -57,7 +60,7 @@ class MAMMicrophysics final : public scream::AtmosphereProcess { void run_impl(const double dt) override; // Finalize - void finalize_impl(){/*Do nothing*/}; + void finalize_impl() override {/*Do nothing*/}; private: // number of horizontal columns and vertical levels diff --git a/externals/mam4xx b/externals/mam4xx index aae46807bf58..c952d3626357 160000 --- a/externals/mam4xx +++ b/externals/mam4xx @@ -1 +1 @@ -Subproject commit aae46807bf58d6ffcbc6db620c27568450b2d040 +Subproject commit c952d3626357cfc3b1e9f6ef9d2848f966ace40c