-
Notifications
You must be signed in to change notification settings - Fork 54
Adds MAM4xx Surface emissions process interface for EAMxx #2944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ambrad
merged 65 commits into
E3SM-Project:master
from
eagles-project:singhbalwinder/branch_mjs/mam4xx/emissionsIntegration
Sep 4, 2024
Merged
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
0ae7719
Adds surface and online emission interface and a test
singhbalwinder 0223b78
Adds some inputs and preprocess struct, test works now
singhbalwinder 30f0494
Adds some notes for the integration
singhbalwinder 2bdad85
A working test in new single-process test folder
singhbalwinder 9948fa8
Adds horiz wind vector and some cleanup; test is working
singhbalwinder c9f8c52
get scream in correct place for emissions
mjschmidt271 407c5f3
compiling and running test
mjschmidt271 b30d5fd
reading files but scorpio issues with freeing file
mjschmidt271 79b88b7
surface and online emissions data files successfull read in
mjschmidt271 f5da245
Horizontal remapper create_horiz_remapper works with so2 srf file
singhbalwinder 261ea39
Adds srfmiss input
singhbalwinder cb28902
Adds a call to create_srfEmiss_data_reader
singhbalwinder 7a37ccf
update_srfEmiss_data_from_file call in initialize_impl works
singhbalwinder 7b2c9b2
enables update_srfEmiss_timestate in run_impl
singhbalwinder 0827262
Implements the main routine to do the interpolation in run_impl
singhbalwinder d01af51
Adds so2_fields array as an arg, removes iop code
singhbalwinder f7c7e77
Adds a template arg for string arrays carrying field names
singhbalwinder b9e7e3d
Adds code to remove explict mention of specie names
singhbalwinder 0de559d
Removed emissions sector names from all files
singhbalwinder 3d8c98c
Removes extra codes and kept code only for reading file
singhbalwinder 2d616f7
Removes hardwired num sectors
singhbalwinder 343bfc3
Creates a function to init srf emiss data structures
singhbalwinder 4ae7b5a
Sums up all emission sectors
singhbalwinder 9769a95
Adds bc_a4 and dms emmisions
singhbalwinder 14e944f
Adds all the emission files
singhbalwinder b073225
Computes emissions flux and adds use of molecular weights for unit co…
singhbalwinder 89ec5e5
Removes num_sectors from the arg list
singhbalwinder 5db0b8a
Partial implementation of a vector for surface emissions
singhbalwinder fecc309
The vector for surface emissions is working in a for loop
singhbalwinder 4f81656
Fixes compilation issues in previous commit
singhbalwinder f3aad49
Updates constituent flux array with the righ units
singhbalwinder 5b35e31
Adds constituent flixes interface and a test
singhbalwinder b8ff360
Adds code to create progs and atm datastructures
singhbalwinder 552a785
A working end-to-end code
singhbalwinder a3c0ab9
Verified change in DMS conc before and after update, moved aci rpdel …
singhbalwinder 3496c7d
Cleanup of some unused hpp file includes and some variables
singhbalwinder 4048ae8
Removes unused variables
singhbalwinder 0b9b81d
Cleanup - removed unused codes and added kokkos reduction loop
singhbalwinder 0c258d4
Adds output fileds to yaml and also change the location of emissions …
singhbalwinder c29bab5
Some GPU fixes but needs some cleanup
singhbalwinder e4b0aa2
Reworked logic to add fluxes only at the surface level-needs cleanup
singhbalwinder 4c5f58c
Fixes pm-gpu build and run-needs cleanup
singhbalwinder 209ba3d
Moved Kokkos - loop outside of interface and verified that gas and ae…
singhbalwinder d4c9e2f
Fixes some GPU errors and warnings
singhbalwinder 6f1e5d7
Fix some compile warnings that are really errors.
overfelt 9c2fb65
Fixes a warning for a size type for a string vector
singhbalwinder c45a86a
Clang format
singhbalwinder 245571a
Store size in local in to avoid declaring long size_type datatype
singhbalwinder 029ba9c
clang format
singhbalwinder a816871
Revert "Merge branch 'master' into singhbalwinder/branch_mjs/mam4xx/e…
singhbalwinder a7e7191
Rebases and update mam4 submodule to point to its latest master
singhbalwinder f1b2ab6
Adds a multi-process test with srf emiss and constituent fluxes
singhbalwinder 2bf2661
Adds testmods and files for ne4pg2 CIME simulation
singhbalwinder 5879c57
Revertes codes that were changed after the rebase
singhbalwinder 1d796b4
Changes emission files that use conservative mapping
singhbalwinder 7316181
Fixes multi process test a typo in aci interface
singhbalwinder c0a608e
Adds ne30pg2 emissions files and mapping files for fine resolutions
singhbalwinder 4fa577e
Removes debug print statements
singhbalwinder 87ea43c
Edits and adds some comments to provide clarity and TODOs
singhbalwinder 050d149
Fixes namelist to enable fine grid simulations
singhbalwinder d8d89e6
Update shell_commands to remove spa
singhbalwinder 4b57352
Adds units for mass and number ofr constituent fluxes
singhbalwinder 215d225
Fixes path for files and change c-style strings to std::strings
singhbalwinder b1fbda1
Replaces preprocess interface code
singhbalwinder c6d0711
Removes preprocess function from hpp and a calls from cpp interface f…
singhbalwinder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...g/testdefs/testmods_dirs/scream/mam4xx/srf_online_emiss_constituent_fluxes/shell_commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
#!/bin/sh | ||
#------------------------------------------------------ | ||
# MAM4xx adds additionaltracers to the simulation | ||
# Increase number of tracers for MAM4xx simulations | ||
#------------------------------------------------------ | ||
|
||
$CIMEROOT/../components/eamxx/cime_config/testdefs/testmods_dirs/scream/mam4xx/update_eamxx_num_tracers.sh -b | ||
|
||
#------------------------------------------------------ | ||
#Update IC file and add the processes | ||
#------------------------------------------------------ | ||
$CIMEROOT/../components/eamxx/scripts/atmchange initial_conditions::Filename='$DIN_LOC_ROOT/atm/scream/init/screami_mam4xx_ne4np4L72_c20240208.nc' -b | ||
$CIMEROOT/../components/eamxx/scripts/atmchange physics::atm_procs_list="mam4_constituent_fluxes,mac_aero_mic,rrtmgp,mam4_srf_online_emiss" -b | ||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
components/eamxx/src/physics/mam/eamxx_mam_constituent_fluxes_functions.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#ifndef EAMXX_MAM_CONSTITUTE_FLUXES_FUNCTIONS_HPP | ||
#define EAMXX_MAM_CONSTITUTE_FLUXES_FUNCTIONS_HPP | ||
|
||
#include <mam4xx/mam4.hpp> | ||
#include <physics/mam/eamxx_mam_constituent_fluxes_interface.hpp> | ||
|
||
namespace scream { | ||
|
||
namespace { | ||
|
||
void update_gas_aerosols_using_constituents( | ||
const int ncol, const int nlev, const double dt, | ||
const mam_coupling::DryAtmosphere &dry_atm, | ||
const MAMConstituentFluxes::const_view_2d &constituent_fluxes, | ||
// output | ||
const mam_coupling::AerosolState &wet_aero) { | ||
using C = physics::Constants<Real>; | ||
static constexpr auto gravit = C::gravit; // Gravity [m/s2] | ||
static constexpr int pcnst = mam4::aero_model::pcnst; | ||
|
||
// Declare local variables | ||
const int surface_lev = nlev - 1; | ||
|
||
// get the start index for gas species in the state_q array | ||
int istart = mam4::utils::gasses_start_ind(); | ||
|
||
// number of constituents to update (currently updating only MAM4xx | ||
// constituents) | ||
const int nconstituents = pcnst - istart; | ||
|
||
// Create a policy to loop over columns annd number of constituents | ||
// to update | ||
// FIXME: TODO:We don't need a team for "nconstituents", so we can make the | ||
// kookos_for simple by using just ncols | ||
const auto policy = ekat::ExeSpaceUtils<MAMConstituentFluxes::KT::ExeSpace>:: | ||
get_default_team_policy(ncol, nconstituents); | ||
|
||
// Loop through all columns to update tracer mixing rations | ||
Kokkos::parallel_for( | ||
policy, KOKKOS_LAMBDA(const haero::ThreadTeam &team) { | ||
const int icol = team.league_rank(); | ||
|
||
//---------------------------------------------------------------------- | ||
// To form EAM like state%q array, we need prognostics (gas and aerosol | ||
// mmrs) atmosphere (qv, qc, nc, ni, etc.) | ||
//---------------------------------------------------------------------- | ||
|
||
// Get prognostics | ||
mam4::Prognostics progs_at_col = | ||
mam_coupling::aerosols_for_column(wet_aero, // output | ||
icol); // input | ||
// Get atmospheric quantities | ||
const haero::Atmosphere haero_atm = | ||
atmosphere_for_column(dry_atm, // output | ||
icol); // input | ||
|
||
// Form state%q like array at surface level | ||
Real state_q_at_surf_lev[pcnst] = {}; | ||
mam4::utils::extract_stateq_from_prognostics( | ||
progs_at_col, haero_atm, // input | ||
state_q_at_surf_lev, // output | ||
surface_lev); // input | ||
|
||
// Compute the units conversion factor (kg/m2/s to kg/kg) | ||
EKAT_KERNEL_ASSERT_MSG(dry_atm.p_del(icol, surface_lev) != 0, | ||
"Error! dry_atm.pdel must be non-zero!\n"); | ||
const Real rpdel = 1.0 / dry_atm.p_del(icol, surface_lev); | ||
const Real unit_factor = dt * gravit * rpdel; | ||
|
||
// Update state vector with constituent fluxes | ||
for(int icnst = istart; icnst < pcnst; ++icnst) { | ||
state_q_at_surf_lev[icnst] += | ||
constituent_fluxes(icol, icnst) * unit_factor; | ||
} | ||
mam4::utils::inject_stateq_to_prognostics(state_q_at_surf_lev, // input | ||
progs_at_col, // output | ||
surface_lev); // input | ||
}); // icol loop | ||
} | ||
|
||
} // namespace | ||
} // namespace scream | ||
|
||
#endif // ifdef EAMXX_MAM_CONSTITUTE_FLUXES_FUNCTIONS_HPP |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.