Skip to content

Commit

Permalink
Fix MOST BCs (#1494)
Browse files Browse the repository at this point in the history
* The compute flux functions are needed to fill BC vals and/or tau_{13/23}.

* Quiet unused var warnings with ignore_unused.

---------

Co-authored-by: Aaron Lattanzi <[email protected]>
  • Loading branch information
AMLattanzi and Aaron Lattanzi authored Mar 13, 2024
1 parent bf29f21 commit c866153
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 27 deletions.
47 changes: 24 additions & 23 deletions Source/BoundaryConditions/ABLMost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,6 @@ ABLMost::compute_most_bcs (const int& lev,

#ifdef ERF_EXPLICIT_MOST_STRESS
Real dz1 = (zphys_arr) ? ( zphys_arr(i,j,klo+1) - zphys_arr(i,j,klo) ) : dz_no_terrain;

// This is the _kinematic_ heat flux [K m/s]
Real Tflux = flux_comp.compute_t_flux(i, j, k, n, icomp, dz, dz1,
cons_arr, velx_arr, vely_arr,
umm_arr, tm_arr, u_star_arr, t_star_arr, t_surf_arr,
Expand Down Expand Up @@ -293,17 +291,18 @@ ABLMost::compute_most_bcs (const int& lev,
Real dz = (zphys_arr) ? ( zphys_arr(i,j,klo) - zphys_arr(i,j,klo-1) ) : dz_no_terrain;
#ifdef ERF_EXPLICIT_MOST_STRESS
Real dz1 = (zphys_arr) ? ( zphys_arr(i,j,klo+1) - zphys_arr(i,j,klo) ) : dz_no_terrain;
//Real Qflux = flux_comp.compute_q_flux(i, j, k, n, icomp, dz, dz1,
// cons_arr, velx_arr, vely_arr,
// umm_arr, tm_arr, u_star_arr, q_star_arr, t_surf_arr,
// dest_arr);
Real Qflux = flux_comp.compute_q_flux(i, j, k, n, icomp, dz, dz1,
cons_arr, velx_arr, vely_arr,
umm_arr, tm_arr, u_star_arr, q_star_arr, t_surf_arr,
dest_arr);
#else
//Real Qflux = flux_comp.compute_q_flux(i, j, k, n, icomp, dz,
// cons_arr, velx_arr, vely_arr,
// eta_arr,
// umm_arr, tm_arr, u_star_arr, q_star_arr, t_surf_arr,
// dest_arr);
Real Qflux = flux_comp.compute_q_flux(i, j, k, n, icomp, dz,
cons_arr, velx_arr, vely_arr,
eta_arr,
umm_arr, tm_arr, u_star_arr, q_star_arr, t_surf_arr,
dest_arr);
#endif
amrex::ignore_unused(Qflux);
});
}

Expand All @@ -326,12 +325,13 @@ ABLMost::compute_most_bcs (const int& lev,
if (t31_arr) t31_arr(i,j,klo) = -stressx;
}
#else
//Real stressx = flux_comp.compute_u_flux(i, j, k, icomp, dz,
// cons_arr, velx_arr, vely_arr,
// eta_arr,
// umm_arr, um_arr, u_star_arr,
// dest_arr);
Real stressx = flux_comp.compute_u_flux(i, j, k, icomp, dz,
cons_arr, velx_arr, vely_arr,
eta_arr,
umm_arr, um_arr, u_star_arr,
dest_arr);
#endif
amrex::ignore_unused(stressx);
});

} else if (var_idx == Vars::yvel) {
Expand All @@ -353,12 +353,13 @@ ABLMost::compute_most_bcs (const int& lev,
if (t32_arr) t32_arr(i,j,klo) = -stressy;
}
#else
//Real stressy = flux_comp.compute_v_flux(i, j, k, icomp, dz,
// cons_arr, velx_arr, vely_arr,
// eta_arr,
// umm_arr, vm_arr, u_star_arr,
// dest_arr);
Real stressy = flux_comp.compute_v_flux(i, j, k, icomp, dz,
cons_arr, velx_arr, vely_arr,
eta_arr,
umm_arr, vm_arr, u_star_arr,
dest_arr);
#endif
amrex::ignore_unused(stressy);
});
}
} // var_idx
Expand All @@ -373,9 +374,9 @@ ABLMost::time_interp_sst (const int& lev,
Real dT = m_bdy_time_interval;
Real time_since_start = time - m_start_bdy_time;
int n_time = static_cast<int>( time_since_start / dT);
amrex::Real alpha = (time_since_start - n_time * dT) / dT;
Real alpha = (time_since_start - n_time * dT) / dT;
AMREX_ALWAYS_ASSERT( alpha >= 0. && alpha <= 1.0);
amrex::Real oma = 1.0 - alpha;
Real oma = 1.0 - alpha;
AMREX_ALWAYS_ASSERT( (n_time >= 0) && (n_time < (m_sst_lev[lev].size()-1)));

// Populate t_surf
Expand Down
1 change: 1 addition & 0 deletions Source/BoundaryConditions/MOSTAverage.H
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public:
}
}

amrex::ignore_unused(found);
AMREX_ASSERT_WITH_MESSAGE(found, "MOSTAverage: Height above terrain not found, try increasing z_ref!");

const amrex::RealVect lx((xp - plo[0])*dxi[0] + 0.5,
Expand Down
2 changes: 2 additions & 0 deletions Source/Diffusion/DiffusionSrcForState_N.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ DiffusionSrcForState_N (const amrex::Box& bx, const amrex::Box& domain,
{
BL_PROFILE_VAR("DiffusionSrcForState_N()",DiffusionSrcForState_N);

amrex::ignore_unused(use_most);

const Real dx_inv = cellSizeInv[0];
const Real dy_inv = cellSizeInv[1];
const Real dz_inv = cellSizeInv[2];
Expand Down
2 changes: 2 additions & 0 deletions Source/Diffusion/DiffusionSrcForState_T.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ DiffusionSrcForState_T (const amrex::Box& bx, const amrex::Box& domain,
{
BL_PROFILE_VAR("DiffusionSrcForState_T()",DiffusionSrcForState_T);

amrex::ignore_unused(use_most);

const Real dx_inv = cellSizeInv[0];
const Real dy_inv = cellSizeInv[1];
const Real dz_inv = cellSizeInv[2];
Expand Down
10 changes: 6 additions & 4 deletions Source/IO/ERF_Write1DProfiles_stag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ ERF::write_1D_profiles_stag(Real time)
Real uuface = 0.5*(h_avg_uu[k] + h_avg_uu[k-1]);
Real uvface = 0.5*(h_avg_uv[k] + h_avg_uv[k-1]);
Real vvface = 0.5*(h_avg_vv[k] + h_avg_vv[k-1]);
Real w_cc = 0.5*(h_avg_w[k-1] + h_avg_w[k]);
Real uw_cc = 0.5*(h_avg_uw[k-1] + h_avg_uw[k]);
Real vw_cc = 0.5*(h_avg_vw[k-1] + h_avg_vw[k]);
Real ww_cc = 0.5*(h_avg_ww[k-1] + h_avg_ww[k]);
w_cc = 0.5*(h_avg_w[k-1] + h_avg_w[k]);
uw_cc = 0.5*(h_avg_uw[k-1] + h_avg_uw[k]);
vw_cc = 0.5*(h_avg_vw[k-1] + h_avg_vw[k]);
ww_cc = 0.5*(h_avg_ww[k-1] + h_avg_ww[k]);
amrex::ignore_unused(uvface);
data_log2 << std::setw(datwidth) << std::setprecision(timeprecision) << time << " "
<< std::setw(datwidth) << std::setprecision(datprecision) << z << " "
<< h_avg_uu[k] - h_avg_u[k]*h_avg_u[k] << " " // u'u'
Expand Down Expand Up @@ -179,6 +180,7 @@ ERF::write_1D_profiles_stag(Real time)
Real uuface = 1.5*h_avg_uu[k-1] - 0.5*h_avg_uu[k-2];
Real uvface = 1.5*h_avg_uv[k-1] - 0.5*h_avg_uv[k-2];
Real vvface = 1.5*h_avg_vv[k-1] - 0.5*h_avg_vv[k-2];
amrex::ignore_unused(uvface);
data_log2 << std::setw(datwidth) << std::setprecision(timeprecision) << time << " "
<< std::setw(datwidth) << std::setprecision(datprecision) << k * dx[2] << " "
<< 0 << " " // u'u'
Expand Down
1 change: 1 addition & 0 deletions Source/TimeIntegration/ERF_advance_dycore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void ERF::advance_dycore(int level,
(tc.pbl_type != PBLType::None) );

const bool use_most = (m_most != nullptr);
amrex::ignore_unused(use_most);

const BoxArray& ba = state_old[IntVars::cons].boxArray();
const BoxArray& ba_z = zvel_old.boxArray();
Expand Down

0 comments on commit c866153

Please sign in to comment.