-
Notifications
You must be signed in to change notification settings - Fork 54
MAM4xx Dry Deposition process interface for EAMxx #2894
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
bartgol
merged 93 commits into
E3SM-Project:master
from
eagles-project:singhbalwinder/dry-dep
Aug 13, 2024
Merged
Changes from 92 commits
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
ecc0b52
Minimal set of additions for drydep interface
singhbalwinder 0f58dca
Adds a simple minimal test and it works
singhbalwinder 7eeb63c
Adds required variables and the initial condition file
singhbalwinder 2dd3d73
Adds variables to the init and run functions
singhbalwinder 9c7e8f5
Implement the MAMDryDep::run_impl() function.
overfelt a6b550c
Forgot to add updated test file.
overfelt 9f59dcb
Fixes for Cuda build.
overfelt 959c9b7
Fixes for Cuda build.
overfelt 05fe0fb
Remove old comment as per code review.
overfelt 76ca087
Add p_int (pressure at interface) to DryAtmosphere structure.
overfelt c2ad201
Merge pull request #2 from eagles-project/singhbalwinder/jroverf/dry-dep
overfelt 1301356
Merge branch 'master' into singhbalwinder/dry-dep
overfelt fc4acc1
Merge branch 'master' into singhbalwinder/dry-dep
overfelt 778b6ac
Remove add_field() calls that are not needed by the Dry Deposition pr…
overfelt dd2b0c9
Fix some input/output arrays as suggested by Balwinder.
overfelt 2450b4d
Merge branch 'master' into singhbalwinder/dry-dep
overfelt 7197f50
More code cleanup.
overfelt 724217f
Merge branch 'master' into singhbalwinder/dry-dep
overfelt 476a38c
Moves around code to match previous mam4xx processes
singhbalwinder d0c6d2c
Moves variables to match I/O
singhbalwinder 880ce7d
Moves Updated vars above computed
singhbalwinder 1e76a7d
Some more i/o variable movements in initialize impl
singhbalwinder 2443c69
Adds a new file and remove that code the the cpp file
singhbalwinder 518ab80
Removes the commented out code that is moved to a new file
singhbalwinder 86954a8
Removes qtracer from the output and allocate it locally
singhbalwinder bd91719
Removes d_qtracers_dt_ as output and allocate it as a local var
singhbalwinder e69425b
Commented out code with some new variables-code compiles fine
singhbalwinder c1bbdf5
Adds new vars and allocate
singhbalwinder 0532e27
added as args
singhbalwinder 33202be
Submodule change, commented out code but compiles
singhbalwinder 309f2d2
subm changes, All func args are in, compiles fine
singhbalwinder 8dca5fa
Subm change; a working aero_model_drydep call
singhbalwinder 17c09a0
Remove compute tends to drydep.hpp from drydep interface
singhbalwinder 0dd177a
Cleanup, subm changed, Use ColumnView for some views
singhbalwinder e9f52c0
Cleanup-makes dgn wet size a input and other cleanup
singhbalwinder 67200f9
Teases out i/o for func
singhbalwinder 90eaa58
A lot of cleanup-Removes vars from hpp, cleans i/o for functions
singhbalwinder f12a600
Reduces vlc_trb to real from view_1d and other cleanup
singhbalwinder 8fc5d8f
All the printouts for thevalidation
singhbalwinder d3a1ebc
More prints for validation
singhbalwinder 123ec08
Cleaned some prints and adds new comments
singhbalwinder 8b9b3f0
Adds a CIME test and fixed FIXME comments and removed prinouts
singhbalwinder 074493f
Merge branch 'master' into singhbalwinder/dry-dep
singhbalwinder a4a5798
Fixes single process test and some merge master fixes
singhbalwinder f508702
Removes commented-out scorpio error message code
singhbalwinder 9e4978b
Fix GPU tests: Do not use host pointers on device.
overfelt 4a0e4d9
Fixes np1 vs npX tests and clang format
singhbalwinder b86b4df
Adds 2d fields from land model and updates mam4xx sub to point to main
singhbalwinder ed2e0ea
Adds shoc+drydep unit test
singhbalwinder 9b937f9
Add ustar and obklen to FM
tcclevenger 3baa1b1
Uses shoc output variables for obklen and ustar in drydep
singhbalwinder cc0c4ce
Adds missing links for obklen and ustar in shoc
singhbalwinder f25ec79
Fixes a typo
singhbalwinder 45af3b5
Adds a multi-process test with dynamics
singhbalwinder f130c27
Adds variables for drydep only CIME simulation
singhbalwinder 076bf91
Fixes dimensions of dry dep flux variables and fixes input.yaml for a…
singhbalwinder eabd0fe
Changes due to code review feedback.
overfelt ffe22ad
read in IOP lev data before surface pressure adjustment is applied
3a6fcc9
add minimum threshold when checking lat and lon relative error for IO…
613beff
change ekat::impl::max instances to std::max and remove unneeded m_he…
bbad185
cast minimum lat/lon threshold as a real
861565c
fix capture this warning in mam micro
mahf708 44be059
Add ums and ums002 to load libunwind 1.6.2
dqwu 08fb2d1
Add <cstdint> to scream_scorpio_types.hpp to use std::int64_t
dqwu ac7280c
Explicitly add gcc/12.2.0 lib path to CMAKE_EXE_LINKER_FLAGS
dqwu bcf0a02
add output variable for rain effective diameter
hassanbeydoun e55a121
Add ustar and obklen to FM
tcclevenger 4d4fc74
Remove obklen postcondition check
tcclevenger 237c7f5
Fix how IOP reads time
tcclevenger e00561f
filter aodvis by day indices
mahf708 7d8d166
remove sunlit sync to host
mahf708 5230b60
rename pyeamxx to pyscream
mahf708 a6f14a9
more renaming
mahf708 8c81c69
skip cosp when building python
mahf708 ae7dfed
Add geo_data_source
mahf708 a38380b
dump fields and reorg things
mahf708 2c8d6a7
fix minor typo in def dumpfields
mahf708 fc7b9e6
add geo data source
mahf708 c1344ad
Port scream_rrtmgp_interface to new pattern
jgfouca 8677a1f
Builds and runs
jgfouca 5c83491
Everything working
jgfouca b7e006d
cleanup
jgfouca f1e2d98
subview_2dk bug fix
jgfouca 23f89ce
More fixes
jgfouca 8cae9b1
Set to correct rrtmgp branch
jgfouca 0eddf30
Add buffer views should be unmanaged
jgfouca 5efd49e
Build fixes for yakl mode
jgfouca dd83e12
Remove overuse of templates
jgfouca 39b29da
Merge branch 'master' into singhbalwinder/dry-dep
overfelt 8240735
Merge branch 'master' into singhbalwinder/dry-dep
overfelt 408e876
Fix a couple of FIXME comments from code review.
overfelt fc26235
Adds a CIME drydep test
singhbalwinder c35785d
Fixes an array index in scream coupler F90 file
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
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
components/eamxx/cime_config/testdefs/testmods_dirs/scream/mam4xx/drydep/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 drydep process | ||
#------------------------------------------------------ | ||
$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="mac_aero_mic,rrtmgp,mam4_drydep" -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
205 changes: 205 additions & 0 deletions
205
components/eamxx/src/physics/mam/eamxx_mam_dry_deposition_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,205 @@ | ||
#ifndef EAMXX_MAM_DRY_DEPOSITION_FUNCTIONS_HPP | ||
#define EAMXX_MAM_DRY_DEPOSITION_FUNCTIONS_HPP | ||
|
||
#include <ekat/kokkos/ekat_subview_utils.hpp> | ||
#include <mam4xx/aero_config.hpp> | ||
#include <mam4xx/convproc.hpp> | ||
#include <mam4xx/mam4.hpp> | ||
|
||
namespace scream { | ||
|
||
namespace { | ||
void compute_tendencies( | ||
// inputs | ||
const int ncol, const int nlev, const double dt, | ||
const MAMDryDep::const_view_1d obklen, | ||
const MAMDryDep::const_view_1d surfric, | ||
const MAMDryDep::const_view_1d landfrac, | ||
const MAMDryDep::const_view_1d icefrac, | ||
const MAMDryDep::const_view_1d ocnfrac, | ||
const MAMDryDep::const_view_1d friction_velocity, | ||
const MAMDryDep::const_view_1d aerodynamical_resistance, | ||
MAMDryDep::view_3d qtracers, MAMDryDep::view_2d fraction_landuse_, | ||
const MAMDryDep::const_view_3d dgncur_awet_, | ||
const MAMDryDep::const_view_3d wet_dens_, | ||
const mam_coupling::DryAtmosphere dry_atm, | ||
const mam_coupling::AerosolState dry_aero, | ||
|
||
// input-outputs | ||
MAMDryDep::view_3d qqcw_, | ||
|
||
// outputs | ||
MAMDryDep::view_3d ptend_q, MAMDryDep::view_2d aerdepdrycw, | ||
MAMDryDep::view_2d aerdepdryis, | ||
|
||
// work arrays | ||
MAMDryDep::view_2d rho_, MAMDryDep::view_4d vlc_dry_, | ||
MAMDryDep::view_3d vlc_trb_, MAMDryDep::view_4d vlc_grv_, | ||
MAMDryDep::view_3d dqdt_tmp_) { | ||
static constexpr int num_aero_modes = mam_coupling::num_aero_modes(); | ||
const auto policy = | ||
ekat::ExeSpaceUtils<MAMDryDep::KT::ExeSpace>::get_default_team_policy( | ||
ncol, nlev); | ||
|
||
// Parallel loop over all the columns | ||
Kokkos::parallel_for( | ||
policy, KOKKOS_LAMBDA(const MAMDryDep::KT::MemberType &team) { | ||
static constexpr int num_aero_species = | ||
mam_coupling::num_aero_species(); | ||
|
||
const int icol = team.league_rank(); | ||
// Parallel loop over all the levels to populate qtracers array using | ||
// dry_aero | ||
Kokkos::parallel_for( | ||
Kokkos::TeamVectorRange(team, nlev), [&](const int lev) { | ||
for(int mode = 0; mode < num_aero_modes; ++mode) { | ||
int icnst = mam4::ConvProc::numptrcw_amode(mode); | ||
qtracers(icol, lev, icnst) = | ||
dry_aero.int_aero_nmr[mode](icol, lev); | ||
for(int species = 0; species < num_aero_species; ++species) { | ||
icnst = mam4::ConvProc::lmassptrcw_amode(species, mode); | ||
if(-1 < icnst) { | ||
qtracers(icol, lev, icnst) = | ||
dry_aero.int_aero_mmr[mode][species](icol, lev); | ||
} | ||
} | ||
} | ||
}); // parallel_for for nlevs | ||
team.team_barrier(); | ||
|
||
// Create atm and progs objects | ||
mam4::Atmosphere atm = atmosphere_for_column(dry_atm, icol); | ||
mam4::Prognostics progs = aerosols_for_column(dry_aero, icol); | ||
|
||
// Extract column data (or 1d view) from 2d views of data | ||
mam4::ConstColumnView dgncur_awet[num_aero_modes]; | ||
mam4::ConstColumnView wet_dens[num_aero_modes]; | ||
|
||
for(int i = 0; i < num_aero_modes; ++i) { | ||
dgncur_awet[i] = ekat::subview(dgncur_awet_, icol, i); | ||
wet_dens[i] = ekat::subview(wet_dens_, icol, i); | ||
} | ||
|
||
mam4::ColumnView rho; | ||
rho = ekat::subview(rho_, icol); | ||
|
||
static constexpr int n_land_type = MAMDryDep::n_land_type; | ||
Real fraction_landuse[n_land_type]; | ||
for(int i = 0; i < n_land_type; ++i) { | ||
fraction_landuse[i] = fraction_landuse_(i, icol); | ||
} | ||
|
||
static constexpr int nmodes = mam4::AeroConfig::num_modes(); | ||
mam4::ColumnView vlc_dry[nmodes][MAMDryDep::aerosol_categories_]; | ||
mam4::ColumnView vlc_grv[nmodes][MAMDryDep::aerosol_categories_]; | ||
Real vlc_trb[nmodes][MAMDryDep::aerosol_categories_]; | ||
|
||
for(int i = 0; i < nmodes; ++i) { | ||
for(int j = 0; j < MAMDryDep::aerosol_categories_; ++j) { | ||
vlc_dry[i][j] = ekat::subview(vlc_dry_, i, j, icol); | ||
vlc_trb[i][j] = vlc_trb_(i, j, icol); | ||
vlc_grv[i][j] = ekat::subview(vlc_grv_, i, j, icol); | ||
} | ||
} | ||
static constexpr int pcnst = mam4::aero_model::pcnst; | ||
mam4::ColumnView qqcw[pcnst]; | ||
mam4::ColumnView dqdt_tmp[pcnst]; | ||
for(int i = 0; i < pcnst; ++i) { | ||
qqcw[i] = ekat::subview(qqcw_, i, icol); | ||
dqdt_tmp[i] = ekat::subview(dqdt_tmp_, i, icol); | ||
} | ||
// Extract qqcw from Prognostics | ||
Kokkos::parallel_for(Kokkos::TeamVectorRange(team, nlev), [&](int kk) { | ||
for(int m = 0; m < nmodes; ++m) { | ||
qqcw[mam4::ConvProc::numptrcw_amode(m)][kk] = progs.n_mode_c[m][kk]; | ||
for(int a = 0; a < mam4::AeroConfig::num_aerosol_ids(); ++a) | ||
if(-1 < mam4::ConvProc::lmassptrcw_amode(a, m)) | ||
qqcw[mam4::ConvProc::lmassptrcw_amode(a, m)][kk] = | ||
progs.q_aero_c[m][a][kk]; | ||
} | ||
}); // parallel_for nlevs | ||
team.team_barrier(); | ||
bool ptend_lq[pcnst]; // currently unused | ||
mam4::aero_model_drydep( | ||
// inputs | ||
team, fraction_landuse, atm.temperature, atm.pressure, | ||
atm.interface_pressure, atm.hydrostatic_dp, | ||
ekat::subview(qtracers, icol), dgncur_awet, wet_dens, obklen[icol], | ||
surfric[icol], landfrac[icol], icefrac[icol], ocnfrac[icol], | ||
friction_velocity[icol], aerodynamical_resistance[icol], dt, | ||
// input-outputs | ||
qqcw, | ||
// outputs | ||
ekat::subview(ptend_q, icol), ptend_lq, | ||
ekat::subview(aerdepdrycw, icol), ekat::subview(aerdepdryis, icol), | ||
// work arrays | ||
rho, vlc_dry, vlc_trb, vlc_grv, dqdt_tmp); | ||
}); // parallel_for for ncols | ||
} // Compute_tendencies ends | ||
|
||
// Update interstitial aerosols using ptend_q tendencies | ||
void update_interstitial_mmrs(const MAMDryDep::view_3d ptend_q, const double dt, | ||
const int ncol, const int nlev, | ||
// output | ||
const mam_coupling::AerosolState dry_aero) { | ||
const auto policy = | ||
ekat::ExeSpaceUtils<MAMDryDep::KT::ExeSpace>::get_default_team_policy( | ||
ncol, nlev); | ||
static constexpr int nmodes = mam4::AeroConfig::num_modes(); | ||
Kokkos::parallel_for( | ||
policy, KOKKOS_LAMBDA(const MAMDryDep::KT::MemberType &team) { | ||
const int icol = team.league_rank(); | ||
Kokkos::parallel_for(Kokkos::TeamVectorRange(team, nlev), [&](int kk) { | ||
for(int m = 0; m < nmodes; ++m) { | ||
dry_aero.int_aero_nmr[m](icol, kk) += | ||
ptend_q(icol, kk, mam4::ConvProc::numptrcw_amode(m)) * dt; | ||
for(int a = 0; a < mam4::AeroConfig::num_aerosol_ids(); ++a) | ||
if(-1 < mam4::ConvProc::lmassptrcw_amode(a, m)) | ||
dry_aero.int_aero_mmr[m][a](icol, kk) += | ||
ptend_q(icol, kk, mam4::ConvProc::lmassptrcw_amode(a, m)) * | ||
dt; | ||
} | ||
}); // parallel_for nlevs | ||
}); // parallel_for icol | ||
} // Update interstitial aerosols ends | ||
|
||
// Update cloud borne aerosols using qqcw | ||
void update_cloudborne_mmrs(const MAMDryDep::view_3d qqcw, const double dt, | ||
const int nlev_, | ||
// output | ||
const mam_coupling::AerosolState dry_aero) { | ||
for(int m = 0; m < mam_coupling::num_aero_modes(); ++m) { | ||
Kokkos::deep_copy(dry_aero.cld_aero_nmr[m], | ||
ekat::subview(qqcw, mam4::ConvProc::numptrcw_amode(m))); | ||
for(int a = 0; a < mam_coupling::num_aero_species(); ++a) { | ||
if(dry_aero.cld_aero_mmr[m][a].data()) { | ||
Kokkos::deep_copy( | ||
dry_aero.cld_aero_mmr[m][a], | ||
ekat::subview(qqcw, mam4::ConvProc::lmassptrcw_amode(a, m))); | ||
} | ||
} | ||
} | ||
} // Update cloud borne aerosols ends | ||
|
||
// FIXME: remove the following function after implementing file read for landuse | ||
void populated_fraction_landuse(MAMDryDep::view_2d flu, const int ncol) { | ||
kaizhangpnl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Kokkos::parallel_for( | ||
"populated_fraction_landuse", 1, KOKKOS_LAMBDA(int) { | ||
static constexpr int n_land_type = MAMDryDep::n_land_type; | ||
const Real temp[n_land_type] = { | ||
0.28044346587077795E-003, 0.26634987180780171E-001, | ||
0.16803558403621365E-001, 0.18076055155371872E-001, | ||
0.00000000000000000E+000, 0.00000000000000000E+000, | ||
0.91803784897907303E+000, 0.17186036997038400E-002, | ||
0.00000000000000000E+000, 0.00000000000000000E+000, | ||
0.18448503115578840E-001}; | ||
for(int i = 0; i < n_land_type; ++i) | ||
for(int j = 0; j < ncol; ++j) flu(i, j) = temp[i]; | ||
}); | ||
Kokkos::fence(); | ||
} | ||
|
||
} // namespace | ||
} // namespace scream | ||
|
||
#endif |
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.