From 29d83eba554da13a41dc590ea4354c2585d1686d Mon Sep 17 00:00:00 2001 From: James Overfelt Date: Tue, 30 Jul 2024 11:15:57 -0600 Subject: [PATCH] Revert "Changes due to code review feedback." This reverts commit 8fd0eae1ad3d3ae389b10e1e685d4061714e256d. There are fields that need to be in the FieldManager since this is still in the evaluation stage. --- .../eamxx_mam_wetscav_process_interface.cpp | 38 +++++++++++++------ .../eamxx_mam_wetscav_process_interface.hpp | 12 +----- .../mam/p3_mam4_wetscav/output.yaml | 4 ++ .../mam/shoc_cldfrac_p3_wetscav/output.yaml | 4 ++ .../single-process/mam/wet_scav/output.yaml | 4 ++ 5 files changed, 39 insertions(+), 23 deletions(-) diff --git a/components/eamxx/src/physics/mam/eamxx_mam_wetscav_process_interface.cpp b/components/eamxx/src/physics/mam/eamxx_mam_wetscav_process_interface.cpp index 81f13fd6ae9..2a81c1a9c42 100644 --- a/components/eamxx/src/physics/mam/eamxx_mam_wetscav_process_interface.cpp +++ b/components/eamxx/src/physics/mam/eamxx_mam_wetscav_process_interface.cpp @@ -47,6 +47,10 @@ void MAMWetscav::set_grids( // layout for 2D (1d horiz X 1d vertical) variables FieldLayout scalar2d = m_grid->get_2d_scalar_layout(); + // layout for 3D (ncol, nmodes, nlevs) + FieldLayout scalar3d_mid_nmodes = + m_grid->get_3d_vector_layout(true, nmodes, "nmodes"); + // layout for 2D (ncol, pcnst) FieldLayout scalar2d_pconst = m_grid->get_2d_vector_layout(pcnst, "num_phys_constants"); @@ -201,6 +205,22 @@ void MAMWetscav::set_grids( // ------------------------------------------------------------- // These variables are "Computed" or outputs for the process // ------------------------------------------------------------- + static constexpr auto m3 = m * m * m; + + // Aerosol dry particle diameter [m] + add_field("dgncur_a", scalar3d_mid_nmodes, m, grid_name); + + // Wet aerosol density [kg/m3] + add_field("wetdens", scalar3d_mid_nmodes, kg / m3, grid_name); + + // Aerosol water [kg/kg] + add_field("qaerwat", scalar3d_mid_nmodes, kg / kg, grid_name); + + // Wet aerosol diameter [m] + add_field("dgnumwet", scalar3d_mid_nmodes, m, grid_name); + + // Fraction of transported species that are insoluble [fraction] + add_field("fracis", scalar3d_mid, nondim, grid_name); // Aerosol wet deposition (interstitial) [kg/m2/s] add_field("aerdepwetis", scalar2d_pconst, kg / m2 / s, grid_name); @@ -332,14 +352,6 @@ void MAMWetscav::initialize_impl(const RunType run_type) { } } - const int nmodes = mam4::AeroConfig::num_modes(); - - // Aerosol dry particle diameter [m] - dgncur_a_ = view_3d("dgncur_a", ncol_, nmodes, nlev_); - wetdens_ = view_3d("wetdens", ncol_, nmodes, nlev_); - qaerwat_ = view_3d("qaerwat", ncol_, nmodes, nlev_); - dgnumwet_ = view_3d("dgnumwet", ncol_, nmodes, nlev_); - // Allocate work array const int work_len = mam4::wetdep::get_aero_model_wetdep_work_len(); work_ = view_2d("work", ncol_, work_len); @@ -463,10 +475,12 @@ void MAMWetscav::run_impl(const double dt) { const auto aerdepwetis = get_field_out("aerdepwetis").get_view(); const auto aerdepwetcw = get_field_out("aerdepwetcw").get_view(); - const auto wet_geometric_mean_diameter_i = dgnumwet_; - const auto dry_geometric_mean_diameter_i = dgncur_a_; - const auto qaerwat = qaerwat_; - const auto wetdens = wetdens_; + const auto wet_geometric_mean_diameter_i = + get_field_out("dgnumwet").get_view(); + const auto dry_geometric_mean_diameter_i = + get_field_out("dgncur_a").get_view(); + const auto qaerwat = get_field_out("qaerwat").get_view(); + const auto wetdens = get_field_out("wetdens").get_view(); const auto policy = ekat::ExeSpaceUtils::get_default_team_policy(ncol_, nlev_); diff --git a/components/eamxx/src/physics/mam/eamxx_mam_wetscav_process_interface.hpp b/components/eamxx/src/physics/mam/eamxx_mam_wetscav_process_interface.hpp index 3c3dec6cc62..9d1dc20bc88 100644 --- a/components/eamxx/src/physics/mam/eamxx_mam_wetscav_process_interface.hpp +++ b/components/eamxx/src/physics/mam/eamxx_mam_wetscav_process_interface.hpp @@ -23,7 +23,6 @@ namespace scream { class MAMWetscav : public scream::AtmosphereProcess { using KT = ekat::KokkosTypes; using view_2d = typename KT::template view_2d; - using view_3d = typename KT::template view_3d; // a thread team dispatched to a single vertical column using ThreadTeam = mam4::ThreadTeam; @@ -161,18 +160,9 @@ class MAMWetscav : public scream::AtmosphereProcess { // Work arrays view_2d work_; - // Aerosol dry particle diameter [m] - // Dimensions: [cols, modes, levels] - view_3d dgncur_a_; - // Wet aerosol density [kg/m3] - view_3d wetdens_; - // Aerosol water [kg/kg] - view_3d qaerwat_; - // Wet aerosol diameter [m] - view_3d dgnumwet_; - // TODO: Following variables are from convective parameterization (not // implemented yet in EAMxx), so should be zero for now + view_2d sh_frac_; // Deep convective cloud fraction [fraction] diff --git a/components/eamxx/tests/multi-process/physics_only/mam/p3_mam4_wetscav/output.yaml b/components/eamxx/tests/multi-process/physics_only/mam/p3_mam4_wetscav/output.yaml index 049dcdad35a..c26db8eb681 100644 --- a/components/eamxx/tests/multi-process/physics_only/mam/p3_mam4_wetscav/output.yaml +++ b/components/eamxx/tests/multi-process/physics_only/mam/p3_mam4_wetscav/output.yaml @@ -56,6 +56,10 @@ Field Names: - num_c4 - aerdepwetis - aerdepwetcw + - dgnumwet + - dgncur_a + - wetdens + - qaerwat output_control: Frequency: ${NUM_STEPS} frequency_units: nsteps diff --git a/components/eamxx/tests/multi-process/physics_only/mam/shoc_cldfrac_p3_wetscav/output.yaml b/components/eamxx/tests/multi-process/physics_only/mam/shoc_cldfrac_p3_wetscav/output.yaml index c38bafaa65e..1ae53e6c1c3 100644 --- a/components/eamxx/tests/multi-process/physics_only/mam/shoc_cldfrac_p3_wetscav/output.yaml +++ b/components/eamxx/tests/multi-process/physics_only/mam/shoc_cldfrac_p3_wetscav/output.yaml @@ -90,6 +90,10 @@ Field Names: - num_c4 - aerdepwetis - aerdepwetcw + - dgnumwet + - dgncur_a + - wetdens + - qaerwat output_control: Frequency: ${NUM_STEPS} frequency_units: nsteps diff --git a/components/eamxx/tests/single-process/mam/wet_scav/output.yaml b/components/eamxx/tests/single-process/mam/wet_scav/output.yaml index 75172823870..9cd0a16bc41 100644 --- a/components/eamxx/tests/single-process/mam/wet_scav/output.yaml +++ b/components/eamxx/tests/single-process/mam/wet_scav/output.yaml @@ -7,6 +7,10 @@ Fields: Field Names: - aerdepwetis - aerdepwetcw + - dgnumwet + - dgncur_a + - wetdens + - qaerwat - bc_c1 - bc_c3 - bc_c4