From d0f2a5058196c6b984f89c537709f1794d7e37da Mon Sep 17 00:00:00 2001 From: Oscar Diaz-Ibarra Date: Mon, 18 Nov 2024 17:33:01 -0700 Subject: [PATCH 1/3] EAMxx: Modify microphysics interface to include sethet (washout rates) computations. --- ...mxx_mam_microphysics_process_interface.cpp | 32 ++++++++++++++++++- ...mxx_mam_microphysics_process_interface.hpp | 3 ++ .../mam/aero_microphys/input.yaml | 3 +- externals/mam4xx | 2 +- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp index 57eaf927548..4a674fb094d 100644 --- a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp +++ b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp @@ -146,6 +146,15 @@ void MAMMicrophysics::set_grids( // surface albedo shortwave, direct add_field("sfc_alb_dir_vis", scalar2d, nondim, grid_name); + //----------- Variables from microphysics scheme ------------- + + // Evaporation from stratiform rain [kg/kg/s] + add_field("nevapr", scalar3d_mid, kg / kg / s, grid_name); + + // Stratiform rain production rate [kg/kg/s] + add_field("precip_total_tend", scalar3d_mid, kg / kg / s, + grid_name); + // --------------------------------------------------------------------- // These variables are "updated" or inputs/outputs for the process // --------------------------------------------------------------------- @@ -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); @@ -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(); + + // Stratiform rain production rate [kg/kg/s] + const auto& prain = get_field_in("precip_total_tend").get_view(); + const auto wet_geometric_mean_diameter_i = get_field_in("dgnumwet").get_view(); const auto dry_geometric_mean_diameter_i = @@ -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) { @@ -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( @@ -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(); diff --git a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.hpp b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.hpp index d555fe82024..6ff846d0d0c 100644 --- a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.hpp +++ b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.hpp @@ -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 diff --git a/components/eamxx/tests/single-process/mam/aero_microphys/input.yaml b/components/eamxx/tests/single-process/mam/aero_microphys/input.yaml index 9348a04a21d..7dd28a87f47 100644 --- a/components/eamxx/tests/single-process/mam/aero_microphys/input.yaml +++ b/components/eamxx/tests/single-process/mam/aero_microphys/input.yaml @@ -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"] diff --git a/externals/mam4xx b/externals/mam4xx index e26b5b6faa5..7d7a4a673a1 160000 --- a/externals/mam4xx +++ b/externals/mam4xx @@ -1 +1 @@ -Subproject commit e26b5b6faa5cdf39a5421328165c49bdb728b038 +Subproject commit 7d7a4a673a1f2709986b62c6490c8414829c5212 From 00d55a053819a5ce3b2e13d534f004f9b07fb49a Mon Sep 17 00:00:00 2001 From: Oscar Diaz-Ibarra Date: Tue, 19 Nov 2024 11:07:44 -0700 Subject: [PATCH 2/3] EAMxx: Update mam4xx submodule to fix CUDA test. --- externals/mam4xx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/mam4xx b/externals/mam4xx index 7d7a4a673a1..fdbb0816c5c 160000 --- a/externals/mam4xx +++ b/externals/mam4xx @@ -1 +1 @@ -Subproject commit 7d7a4a673a1f2709986b62c6490c8414829c5212 +Subproject commit fdbb0816c5c0c541265ec17f544908da935d8af6 From af3343b7e0681cc0e392d798b7be3ab261ca5467 Mon Sep 17 00:00:00 2001 From: Oscar Diaz-Ibarra Date: Tue, 19 Nov 2024 19:40:56 -0700 Subject: [PATCH 3/3] EAMxx: Add aerosols and gases outputs to ensure the microscopy baseline test is sensitive to changes in the interface. --- .../mam/aero_microphys/output.yaml | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/components/eamxx/tests/single-process/mam/aero_microphys/output.yaml b/components/eamxx/tests/single-process/mam/aero_microphys/output.yaml index 388781fb8f0..5af90cac547 100644 --- a/components/eamxx/tests/single-process/mam/aero_microphys/output.yaml +++ b/components/eamxx/tests/single-process/mam/aero_microphys/output.yaml @@ -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