Skip to content

Commit

Permalink
Check for WRF use_theta_m flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ewquon committed Feb 28, 2025
1 parent ca66757 commit 2383aa6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Source/IO/ERF_ReadFromWRFInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ read_from_wrfinput (int lev,
FArrayBox& NC_fab,
const std::string& NC_name,
Geometry& geom,
int& use_theta_m,
int& success)
{
if (ParallelDescriptor::IOProcessor()) {
Expand All @@ -24,6 +25,7 @@ read_from_wrfinput (int lev,
std::vector<int> attr;
ncf.get_attr("WEST-EAST_GRID_DIMENSION", attr); NC_nx = attr[0];
ncf.get_attr("SOUTH-NORTH_GRID_DIMENSION", attr); NC_ny = attr[0];
ncf.get_attr("USE_THETA_M", attr); use_theta_m = attr[0];
}
{ // Global Attributes (Real)
std::vector<Real> attr;
Expand Down
8 changes: 5 additions & 3 deletions Source/Initialization/ERF_InitFromWRFInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ read_from_wrfinput (int lev,
FArrayBox& NC_fab,
const std::string& NC_name,
Geometry& geom,
int& use_theta_m,
int& success);

Real
Expand Down Expand Up @@ -163,9 +164,10 @@ ERF::init_from_wrfinput (int lev)
for (int ivar = 0; ivar < nvar; ++ ivar) {
Print() << "Reading variable " << NC_names[ivar] << " ...";

int success;
int success, use_theta_m;
read_from_wrfinput(lev, boxes_at_level[lev][idx], nc_init_file[lev][idx],
NC_fab_var_file[idx][ivar], NC_names[ivar], geom[lev], success);
NC_fab_var_file[idx][ivar], NC_names[ivar], geom[lev],
use_theta_m, success);

auto var_name = NC_names[ivar];
auto& var_fab = NC_fab_var_file[idx][ivar];
Expand Down Expand Up @@ -246,7 +248,7 @@ ERF::init_from_wrfinput (int lev)
if (success) {
cur_fab->template copy<RunOn::Device>(var_fab, 0, icomp, 1);
if (mult_rho) { cur_fab->template mult<RunOn::Device>(cons_fab, Rho_comp, icomp, 1); }
if (NC_names[ivar] == "QVAPOR") {
if (use_theta_m && (NC_names[ivar] == "QVAPOR")) {
// Now, we can calculate theta = thm / (1 + R_v/R_d * Qv)
var_fab.template mult<RunOn::Device>(R_v/R_d);
var_fab.template plus<RunOn::Device>(1.0);
Expand Down

0 comments on commit 2383aa6

Please sign in to comment.