Skip to content

Commit

Permalink
add PBL qualifier throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
mahf708 committed May 14, 2024
1 parent be0c10e commit d2ebe4e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion components/eamxx/src/diagnostics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(DIAGNOSTIC_SRCS
aodvis.cpp
number_path.cpp
aerocom_cld.cpp
entrainment_budget.cpp
pbl_entrainment_budget.cpp
)

add_library(diagnostics ${DIAGNOSTIC_SRCS})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include "diagnostics/entrainment_budget.hpp"
#include "diagnostics/pbl_entrainment_budget.hpp"

#include "diagnostics/entrainment_budget_util.hpp"
#include "diagnostics/pbl_entrainment_budget_util.hpp"
#include "ekat/ekat_workspace.hpp"
#include "ekat/kokkos/ekat_kokkos_utils.hpp"
#include "share/util/scream_universal_constants.hpp"

namespace scream {

EntrainmentBudget::EntrainmentBudget(const ekat::Comm &comm,
PBLEntrainmentBudget::PBLEntrainmentBudget(const ekat::Comm &comm,
const ekat::ParameterList &params)
: AtmosphereDiagnostic(comm, params) {
// Nothing to do here
}

void EntrainmentBudget::set_grids(
void PBLEntrainmentBudget::set_grids(
const std::shared_ptr<const GridsManager> grids_manager) {
using namespace ekat::units;
using namespace ShortFieldTagsNames;
Expand All @@ -24,7 +24,7 @@ void EntrainmentBudget::set_grids(
const auto nondim = Units::nondimensional();

// Set the index map and units map
EntrainmentBudgetDiagUtil eadu;
PBLEntrainmentBudgetDiagUtil eadu;
m_index_map = eadu.index_map;
m_units_map = eadu.units_map;
m_ndiag = eadu.size;
Expand All @@ -45,12 +45,12 @@ void EntrainmentBudget::set_grids(
// Ensure m_index_map and m_units_map match
EKAT_REQUIRE_MSG(
m_index_map.size() == m_units_map.size(),
"Error! Some inconsistency in EntrainmentBudget: index and units "
"Error! Some inconsistency in PBLEntrainmentBudget: index and units "
"maps do not match!\n");
// Ensure m_index_map and m_ndiag match
EKAT_REQUIRE_MSG(
static_cast<int>(m_index_map.size()) == m_ndiag,
"Error! Some inconsistency in EntrainmentBudget: m_ndiag and index "
"Error! Some inconsistency in PBLEntrainmentBudget: m_ndiag and index "
"map do not match!\n");

m_ncols = grid->get_num_local_dofs();
Expand All @@ -76,7 +76,7 @@ void EntrainmentBudget::set_grids(
add_field<Required>("LW_flux_up", scalar2d_layout, W / m * m, grid_name);

// Construct and allocate the output field
FieldIdentifier fid("EntrainmentBudget", vector1d_layout, nondim, grid_name);
FieldIdentifier fid("PBLEntrainmentBudget", vector1d_layout, nondim, grid_name);
m_diagnostic_output = Field(fid);
m_diagnostic_output.allocate_view();

Expand All @@ -91,7 +91,7 @@ void EntrainmentBudget::set_grids(
}
}

void EntrainmentBudget::initialize_impl(const RunType /*run_type*/) {
void PBLEntrainmentBudget::initialize_impl(const RunType /*run_type*/) {
// Field qt will have units and layout similar to qc, qv
const auto &qv = get_field_in("qv");
const auto &qvid = qv.get_header().get_identifier();
Expand All @@ -110,7 +110,7 @@ void EntrainmentBudget::initialize_impl(const RunType /*run_type*/) {
m_prev_tl.allocate_view();
}

void EntrainmentBudget::calc_tl_qt(const view_2d &tm_v, const view_2d &pm_v,
void PBLEntrainmentBudget::calc_tl_qt(const view_2d &tm_v, const view_2d &pm_v,
const view_2d &qv_v, const view_2d &qc_v,
const view_2d &tl_v, const view_2d &qt_v) {
int ncols = m_ncols;
Expand All @@ -126,7 +126,7 @@ void EntrainmentBudget::calc_tl_qt(const view_2d &tm_v, const view_2d &pm_v,
});
}

void EntrainmentBudget::init_timestep(const util::TimeStamp &start_of_step) {
void PBLEntrainmentBudget::init_timestep(const util::TimeStamp &start_of_step) {
m_start_t = start_of_step;

const auto &tm_v = get_field_in("T_mid").get_view<Real **>();
Expand All @@ -140,7 +140,7 @@ void EntrainmentBudget::init_timestep(const util::TimeStamp &start_of_step) {
calc_tl_qt(tm_v, pm_v, qv_v, qc_v, m_prev_tl_v, m_prev_qt_v);
}

void EntrainmentBudget::compute_diagnostic_impl() {
void PBLEntrainmentBudget::compute_diagnostic_impl() {
using PC = scream::physics::Constants<Real>;
using KT = KokkosTypes<DefaultDevice>;
using MT = typename KT::MemberType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
namespace scream {

/*
* This diagnostic will compute entrainment budget terms.
* This diagnostic will compute pbl entrainment budget terms.
*/

class EntrainmentBudget : public AtmosphereDiagnostic {
class PBLEntrainmentBudget : public AtmosphereDiagnostic {
public:
using PF = scream::PhysicsFunctions<DefaultDevice>;
using KT = KokkosTypes<DefaultDevice>;
using view_2d = typename KT::template view_2d<Real>;

// Constructors
EntrainmentBudget(const ekat::Comm &comm, const ekat::ParameterList &params);
PBLEntrainmentBudget(const ekat::Comm &comm, const ekat::ParameterList &params);

// The name of the diagnostic
std::string name() const { return "EntrainmentBudget"; };
std::string name() const { return "PBLEntrainmentBudget"; };

// Set the grid
void set_grids(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#ifndef EAMXX_ENTRAINMENT_BUDGET_DIAG_UTIL
#define EAMXX_ENTRAINMENT_BUDGET_DIAG_UTIL
#ifndef EAMXX_PBL_ENTRAINMENT_BUDGET_DIAG_UTIL
#define EAMXX_PBL_ENTRAINMENT_BUDGET_DIAG_UTIL

#include <map>

namespace scream {
class EntrainmentBudgetDiagUtil {
class PBLEntrainmentBudgetDiagUtil {
public:
std::map<std::string, int> index_map;
std::map<std::string, std::string> units_map;
int size;
std::string pblinvalg;

EntrainmentBudgetDiagUtil() {
PBLEntrainmentBudgetDiagUtil() {
// Start (post) incrementing size from 0
size = 0;

Expand Down Expand Up @@ -45,4 +45,4 @@ class EntrainmentBudgetDiagUtil {
};
} // namespace scream

#endif // EAMXX_ENTRAINMENT_BUDGET_DIAG_UTIL
#endif // EAMXX_PBL_ENTRAINMENT_BUDGET_DIAG_UTIL
4 changes: 2 additions & 2 deletions components/eamxx/src/diagnostics/register_diagnostics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "diagnostics/aodvis.hpp"
#include "diagnostics/number_path.hpp"
#include "diagnostics/aerocom_cld.hpp"
#include "diagnostics/entrainment_budget.hpp"
#include "diagnostics/pbl_entrainment_budget.hpp"

namespace scream {

Expand Down Expand Up @@ -54,7 +54,7 @@ inline void register_diagnostics () {
diag_factory.register_product("AerosolOpticalDepth550nm",&create_atmosphere_diagnostic<AODVis>);
diag_factory.register_product("NumberPath",&create_atmosphere_diagnostic<NumberPathDiagnostic>);
diag_factory.register_product("AeroComCld",&create_atmosphere_diagnostic<AeroComCld>);
diag_factory.register_product("EntrainmentBudget",&create_atmosphere_diagnostic<EntrainmentBudget>);
diag_factory.register_product("PBLEntrainmentBudget",&create_atmosphere_diagnostic<PBLEntrainmentBudget>);
}

} // namespace scream
Expand Down
2 changes: 1 addition & 1 deletion components/eamxx/src/diagnostics/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if (NOT SCREAM_ONLY_GENERATE_BASELINES)

# Test Extra ACI diags
GetInputFile(cam/scam/iop/DYCOMSrf02_iopfile_4scam.nc)
CreateDiagTest(entrainment_budget "entrainment_budget_test.cpp"
CreateDiagTest(pbl_entrainment_budget "pbl_entrainment_budget_test.cpp"
EXE_ARGS "--ekat-test-params iop_file=${SCREAM_INPUT_ROOT}/atm/cam/scam/iop/DYCOMSrf02_iopfile_4scam.nc")

endif()
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ TEST_CASE("entrainment_budget") {

// Create and set up the diagnostic
ekat::ParameterList params;
auto diag = diag_factory.create("EntrainmentBudget", comm, params);
auto diag = diag_factory.create("PBLEntrainmentBudget", comm, params);
diag->set_grids(gm);
diag->set_required_field(qc);
diag->set_required_field(qv);
Expand Down

0 comments on commit d2ebe4e

Please sign in to comment.