Skip to content

Commit

Permalink
EAMxx: Modify microphysics interface to include sethet (washout rates…
Browse files Browse the repository at this point in the history
…) computations.
  • Loading branch information
odiazib committed Nov 19, 2024
1 parent 0af3b66 commit d0f2a50
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ void MAMMicrophysics::set_grids(
// surface albedo shortwave, direct
add_field<Required>("sfc_alb_dir_vis", scalar2d, nondim, grid_name);

//----------- Variables from microphysics scheme -------------

// Evaporation from stratiform rain [kg/kg/s]
add_field<Required>("nevapr", scalar3d_mid, kg / kg / s, grid_name);

// Stratiform rain production rate [kg/kg/s]
add_field<Required>("precip_total_tend", scalar3d_mid, kg / kg / s,
grid_name);

// ---------------------------------------------------------------------
// These variables are "updated" or inputs/outputs for the process
// ---------------------------------------------------------------------
Expand Down Expand Up @@ -512,6 +521,9 @@ void MAMMicrophysics::initialize_impl(const RunType run_type) {

const int photo_table_len = get_photo_table_work_len(photo_table_);
work_photo_table_ = view_2d("work_photo_table", ncol_, photo_table_len);
const int sethet_work_len = mam4::mo_sethet::get_total_work_len_sethet();
work_set_het_ = view_2d("work_set_het_array", ncol_, sethet_work_len);
cmfdqr_ = view_1d("cmfdqr_", nlev_);

// here's where we store per-column photolysis rates
photo_rates_ = view_3d("photo_rates", ncol_, nlev_, mam4::mo_photo::phtcnt);
Expand Down Expand Up @@ -565,6 +577,14 @@ void MAMMicrophysics::run_impl(const double dt) {
Kokkos::parallel_for("preprocess", scan_policy, preprocess_);
Kokkos::fence();

//----------- Variables from microphysics scheme -------------

// Evaporation from stratiform rain [kg/kg/s]
const auto& nevapr = get_field_in("nevapr").get_view<const Real **>();

// Stratiform rain production rate [kg/kg/s]
const auto& prain = get_field_in("precip_total_tend").get_view<const Real **>();

const auto wet_geometric_mean_diameter_i =
get_field_in("dgnumwet").get_view<const Real ***>();
const auto dry_geometric_mean_diameter_i =
Expand Down Expand Up @@ -733,6 +753,8 @@ 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 auto& cmfdqr = cmfdqr_;
const auto& work_set_het =work_set_het_;
// loop over atmosphere columns and compute aerosol microphyscs
Kokkos::parallel_for(
policy, KOKKOS_LAMBDA(const ThreadTeam &team) {
Expand Down Expand Up @@ -798,6 +820,9 @@ 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);
const auto nevapr_icol = ekat::subview(nevapr, icol);
const auto prain_icol = ekat::subview(prain, icol);
const auto work_set_het_icol = ekat::subview(work_set_het, icol);
// Note: All variables are inputs, except for progs, which is an
// input/output variable.
mam4::microphysics::perform_atmospheric_chemistry_and_microphysics(
Expand All @@ -811,7 +836,12 @@ void MAMMicrophysics::run_impl(const double dt) {
linoz_cariolle_pscs_icol, eccf, adv_mass_kg_per_moles, 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,
dry_atm.phis(icol),
cmfdqr,
prain_icol,
nevapr_icol,
work_set_het_icol);
}); // parallel_for for the column loop
Kokkos::fence();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ class MAMMicrophysics final : public scream::AtmosphereProcess {
view_1d acos_cosine_zenith_;

view_int_2d index_season_lai_;
// // dq/dt for convection [kg/kg/s]
view_1d cmfdqr_;
view_2d work_set_het_;

}; // MAMMicrophysics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ initial_conditions:
dgnum: [1.246662106183775E-007, 4.081134799487888E-008, 1.103139143795796E-006, 1.000000011686097E-007]
dgnumwet: [2.367209731605067E-007, 6.780643470563889E-008, 3.028011448344027E-006, 1.000000096285154E-007]
wetdens: [1038.67760516297, 1046.20002003441, 1031.74623165457, 1086.79731859184]

nevapr: 0.0
precip_total_tend: 0.0
# The parameters for I/O control
Scorpio:
output_yaml_files: ["output.yaml"]
Expand Down

0 comments on commit d0f2a50

Please sign in to comment.