diff --git a/components/eamxx/cime_config/namelist_defaults_scream.xml b/components/eamxx/cime_config/namelist_defaults_scream.xml index 038e99fd395..9ad6a560334 100644 --- a/components/eamxx/cime_config/namelist_defaults_scream.xml +++ b/components/eamxx/cime_config/namelist_defaults_scream.xml @@ -548,7 +548,6 @@ be lost if SCREAM_HACK_XML is not enabled. ${DIN_LOC_ROOT}/atm/cam/topo/USGS-gtopo30_CA_ne32_x32_v1_pg2_16xdel2.nc - ${CASE}.scream 0.0 0.0 @@ -634,7 +633,6 @@ be lost if SCREAM_HACK_XML is not enabled. - ./${CASE}.scream default ${REST_N} diff --git a/components/eamxx/src/physics/mam/eamxx_mam_srf_and_online_emissions_process_interface.cpp b/components/eamxx/src/physics/mam/eamxx_mam_srf_and_online_emissions_process_interface.cpp index f849595ff34..190dc1da27d 100644 --- a/components/eamxx/src/physics/mam/eamxx_mam_srf_and_online_emissions_process_interface.cpp +++ b/components/eamxx/src/physics/mam/eamxx_mam_srf_and_online_emissions_process_interface.cpp @@ -247,7 +247,7 @@ void MAMSrfOnlineEmiss::set_grids( // Field to be read from file const std::string soil_erod_fld_name = "mbl_bsn_fct_geo"; - // Dimensions of the filed + // Dimensions of the field const std::string soil_erod_dname = "ncol"; // initialize the file read @@ -267,7 +267,7 @@ void MAMSrfOnlineEmiss::set_grids( const std::vector marine_org_fld_name = { "TRUEPOLYC", "TRUEPROTC", "TRUELIPC"}; - // Dimensions of the filed + // Dimensions of the field const std::string marine_org_dname = "ncol"; // initialize the file read @@ -526,6 +526,7 @@ void MAMSrfOnlineEmiss::run_impl(const double dt) { constituent_fluxes(icol, species_index) = fluxes_in_mks_units(icol); }); } // for loop for species + Kokkos::fence(); } // run_impl ends // ============================================================================= } // namespace scream \ No newline at end of file diff --git a/components/eamxx/src/physics/mam/eamxx_mam_srf_and_online_emissions_process_interface.hpp b/components/eamxx/src/physics/mam/eamxx_mam_srf_and_online_emissions_process_interface.hpp index 063efad22d4..b1cba682bb6 100644 --- a/components/eamxx/src/physics/mam/eamxx_mam_srf_and_online_emissions_process_interface.hpp +++ b/components/eamxx/src/physics/mam/eamxx_mam_srf_and_online_emissions_process_interface.hpp @@ -6,7 +6,6 @@ // For MAM4 aerosol configuration #include -#include #include // For reading marine organics file @@ -62,9 +61,8 @@ class MAMSrfOnlineEmiss final : public scream::AtmosphereProcess { const_view_1d soil_erodibility_; public: + // For reading surface emissions and marine organics file using srfEmissFunc = mam_coupling::srfEmissFunctions; - using onlineEmiss = mam_coupling::onlineEmissions; - // For reading marine organics file using marineOrganicsFunc = marine_organics::marineOrganicsFunctions; diff --git a/components/eamxx/src/physics/mam/online_emission.hpp b/components/eamxx/src/physics/mam/online_emission.hpp deleted file mode 100644 index c8318dcc05c..00000000000 --- a/components/eamxx/src/physics/mam/online_emission.hpp +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef ONLINE_EMISSION_HPP -#define ONLINE_EMISSION_HPP - -#include "share/util/scream_timing.hpp" - -namespace scream::mam_coupling { -template struct onlineEmissions { - using Device = DeviceType; - using KT = KokkosTypes; - using MemberType = typename KT::MemberType; - static constexpr int pcnst = mam4::aero_model::pcnst; - - struct onlineEmissData { - // Basic spatial dimensions of the data - int ncols; - view_2d flux_data; - // local copy of main fluxes array - view_2d cfluxes; - // FIXME: read this from elsewhere? input? - const std::vector spec_names = { - "ncl_a1", "ncl_a2", "ncl_a3", "mom_a1", "mom_a2", "mom_a4", - "num_a1", "num_a2", "num_a3", "num_a4", "dst_a1", "dst_a3"}; - // FIXME: change this when/if the above is dynamically-determined - int nspec = spec_names.size(); - const std::string root_IC_str = "online_emis_IC_"; - - onlineEmissData() = default; - onlineEmissData(const int ncol_, const int nspec_) - : ncols(ncol_), nspec(nspec_) { - init(ncols, nspec, true); - } - - onlineEmissData(const int ncol_) : ncols(ncol_) { - init(ncols, nspec, true); - } - - // overloads of init() in case npsec is not hard-coded, or if you want to - // control allocation via bool flag - void init(const int ncol_, const int nspec_, const bool allocate_) { - ncols = ncol_; - nspec = nspec_; - if (allocate_) { - flux_data = view_2d("onlineEmissData", nspec, ncols); - cfluxes = view_2d("onlineEmisLocalCflux", ncols, pcnst); - } - } // onlineEmissData init - void init(const int ncol_, const bool allocate_) { - ncols = ncol_; - if (allocate_) { - flux_data = view_2d("onlineEmissData", nspec, ncols); - cfluxes = view_2d("onlineEmisLocalCflux", ncols, pcnst); - } - } // onlineEmissData init - void init(const int ncol_) { - ncols = ncol_; - flux_data = view_2d("onlineEmissData", nspec, ncols); - cfluxes = view_2d("onlineEmisLocalCflux", ncols, pcnst); - } // onlineEmissData init - }; // onlineEmissData - - onlineEmissData online_emis_data; - - // --------------------------------------------------------------------------- - // Online emissions routines - // --------------------------------------------------------------------------- - void init_from_input_file(const ekat::ParameterList ¶ms) { - const int nspec = online_emis_data.nspec; - const int ncols = online_emis_data.ncols; - using ExeSpace = typename KT::ExeSpace; - using ESU = ekat::ExeSpaceUtils; - const auto policy = ESU::get_default_team_policy(ncols, nspec); - // Read from input file - // FIXME: currently reading a single placeholder scalar--should be - // ncols-sized array when we know what the input data looks like - for (int ispec = 0; ispec < nspec; ++ispec) { - Real init_cond_val = - params.get(online_emis_data.root_IC_str + online_emis_data.spec_names[ispec]); - // TODO: is this overkill?--i.e., would a mirror/deep_copy make more sense? - Kokkos::parallel_for( - policy, KOKKOS_LAMBDA(const MemberType &team) { - const int jcol = team.league_rank(); // column index - online_emis_data.flux_data(ispec, jcol) = init_cond_val; - }); - } - } // end init_from_input_file() -}; // struct onlineEmissions -} // namespace scream::mam_coupling -#endif // ONLINE_EMISSION_HPP diff --git a/components/eamxx/src/physics/mam/readfiles/marine_organics_impl.hpp b/components/eamxx/src/physics/mam/readfiles/marine_organics_impl.hpp index 100b432cb74..6eda3a47e72 100644 --- a/components/eamxx/src/physics/mam/readfiles/marine_organics_impl.hpp +++ b/components/eamxx/src/physics/mam/readfiles/marine_organics_impl.hpp @@ -85,8 +85,8 @@ marineOrganicsFunctions::create_data_reader( const std::shared_ptr &horiz_remapper, const std::string &data_file) { std::vector io_fields; - for(int i = 0; i < horiz_remapper->get_num_fields(); ++i) { - io_fields.push_back(horiz_remapper->get_src_field(i)); + for(int ifld = 0; ifld < horiz_remapper->get_num_fields(); ++ifld) { + io_fields.push_back(horiz_remapper->get_src_field(ifld)); } const auto io_grid = horiz_remapper->get_src_grid(); return std::make_shared(data_file, io_grid, io_fields, true); @@ -126,9 +126,16 @@ void marineOrganicsFunctions::update_marine_organics_data_from_file( "field"); // Recall, the fields are registered in the order: // Read the field from the file -#if 0 - input = horiz_interp.get_tgt_field(0).get_view(); -#endif + + for(int ifld = 0; ifld < horiz_interp.get_num_fields(); ++ifld) { + auto sector = horiz_interp.get_tgt_field(ifld).get_view(); + const auto emiss = Kokkos::subview(marineOrganics_input.data.emiss_sectors, + ifld, Kokkos::ALL()); + Kokkos::deep_copy(emiss, sector); + } + + Kokkos::fence(); + stop_timer( "EAMxx::marineOrganics::update_marine_organics_data_from_file::get_" "field"); diff --git a/components/eamxx/src/physics/mam/srf_emission_impl.hpp b/components/eamxx/src/physics/mam/srf_emission_impl.hpp index 4e7f7c14424..fa037dc281d 100644 --- a/components/eamxx/src/physics/mam/srf_emission_impl.hpp +++ b/components/eamxx/src/physics/mam/srf_emission_impl.hpp @@ -102,9 +102,6 @@ void srfEmissFunctions::perform_time_interpolation( // NOTE: we *assume* data_beg and data_end have the *same* hybrid v coords. // IF this ever ceases to be the case, you can interp those too. - using ExeSpace = typename KT::ExeSpace; - using ESU = ekat::ExeSpaceUtils; - // Gather time stamp info auto &t_now = time_state.t_now; auto &t_beg = time_state.t_beg_month;