Skip to content

Commit

Permalink
EAMxx:Adds loop to update file read for marine organics, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
singhbalwinder committed Oct 31, 2024
1 parent 9850df6 commit 74b92ec
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 103 deletions.
2 changes: 0 additions & 2 deletions components/eamxx/cime_config/namelist_defaults_scream.xml
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ be lost if SCREAM_HACK_XML is not enabled.
<!-- CA RRM grid -->
<topography_filename hgrid="ne0np4_CAx32v1">${DIN_LOC_ROOT}/atm/cam/topo/USGS-gtopo30_CA_ne32_x32_v1_pg2_16xdel2.nc</topography_filename>

<restart_casename>${CASE}.scream</restart_casename>
<!-- Fields that we need to initialize, but are not in an initial condition file need to be inited here -->
<surf_evap>0.0</surf_evap> <!-- TODO, Delete this when the IC fixes come in -->
<precip_liq_surf_mass>0.0</precip_liq_surf_mass>
Expand Down Expand Up @@ -634,7 +633,6 @@ be lost if SCREAM_HACK_XML is not enabled.
<Scorpio>
<output_yaml_files type="array(string)"/>
<model_restart>
<filename_prefix>./${CASE}.scream</filename_prefix>
<iotype>default</iotype>
<output_control locked="true">
<Frequency>${REST_N}</Frequency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -267,7 +267,7 @@ void MAMSrfOnlineEmiss::set_grids(
const std::vector<std::string> 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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

// For MAM4 aerosol configuration
#include <physics/mam/mam_coupling.hpp>
#include <physics/mam/online_emission.hpp>
#include <physics/mam/srf_emission.hpp>

// For reading marine organics file
Expand Down Expand Up @@ -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<Real, DefaultDevice>;
using onlineEmiss = mam_coupling::onlineEmissions<Real, DefaultDevice>;
// For reading marine organics file
using marineOrganicsFunc =
marine_organics::marineOrganicsFunctions<Real, DefaultDevice>;

Expand Down
88 changes: 0 additions & 88 deletions components/eamxx/src/physics/mam/online_emission.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ marineOrganicsFunctions<S, D>::create_data_reader(
const std::shared_ptr<AbstractRemapper> &horiz_remapper,
const std::string &data_file) {
std::vector<Field> 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<AtmosphereInput>(data_file, io_grid, io_fields, true);
Expand Down Expand Up @@ -126,9 +126,16 @@ void marineOrganicsFunctions<S, D>::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<const Real *>();
#endif

for(int ifld = 0; ifld < horiz_interp.get_num_fields(); ++ifld) {
auto sector = horiz_interp.get_tgt_field(ifld).get_view<const Real *>();
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");
Expand Down
3 changes: 0 additions & 3 deletions components/eamxx/src/physics/mam/srf_emission_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ void srfEmissFunctions<S, D>::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<ExeSpace>;

// Gather time stamp info
auto &t_now = time_state.t_now;
auto &t_beg = time_state.t_beg_month;
Expand Down

0 comments on commit 74b92ec

Please sign in to comment.