Skip to content

Commit

Permalink
Merge pull request #3120 from eagles-project/oscar/sethet_interface
Browse files Browse the repository at this point in the history
EAMxx: Modify microphysics interface to include sethet (washout rates)
  • Loading branch information
jgfouca authored Nov 20, 2024
2 parents 0af3b66 + af3343b commit f7a7ad6
Show file tree
Hide file tree
Showing 5 changed files with 93 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,62 @@ Fields:
Physics:
Field Names:
- T_mid
- O3
- H2O2
- H2SO4
- SO2
- DMS
- SOAG
- bc_a1
- bc_a3
- bc_a4
- dst_a1
- dst_a3
- so4_a1
- so4_a2
- so4_a3
- pom_a1
- pom_a3
- pom_a4
- soa_a1
- soa_a2
- soa_a3
- nacl_a1
- nacl_a2
- nacl_a3
- mom_a1
- mom_a2
- mom_a3
- mom_a4
- num_a1
- num_a2
- num_a3
- num_a4
- bc_c1
- bc_c3
- bc_c4
- dst_c1
- dst_c3
- so4_c1
- so4_c2
- so4_c3
- pom_c1
- pom_c3
- pom_c4
- soa_c1
- soa_c2
- soa_c3
- nacl_c1
- nacl_c2
- nacl_c3
- mom_c1
- mom_c2
- mom_c3
- mom_c4
- num_c1
- num_c2
- num_c3
- num_c4
# To save these fields make sure to turn on
# OUTPUT_TRACER_FIELDS
#- oxi_fields
Expand Down

0 comments on commit f7a7ad6

Please sign in to comment.