Skip to content

Commit

Permalink
fix omp capture and change name.
Browse files Browse the repository at this point in the history
  • Loading branch information
AMLattanzi committed Oct 28, 2024
1 parent e39c0f6 commit d6dedda
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
17 changes: 8 additions & 9 deletions Source/SourceTerms/ERF_buoyancy_utils.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
AMREX_GPU_HOST
AMREX_FORCE_INLINE
amrex::Real
buoyancy_dry_default (int& i,
int& j,
int& k,
amrex::Real const& grav_gpu,
amrex::Real const& rd_over_cp,
const amrex::Array4<const amrex::Real>& p0_arr,
const amrex::Array4<const amrex::Real>& r0_arr,
const amrex::Array4<const amrex::Real>& cell_data)
buoyancy_dry_anelastic (int& i,
int& j,
int& k,
amrex::Real const& grav_gpu,
amrex::Real const& rd_over_cp,
const amrex::Array4<const amrex::Real>& p0_arr,
const amrex::Array4<const amrex::Real>& r0_arr,
const amrex::Array4<const amrex::Real>& cell_data)
{
amrex::Real rt0_hi = getRhoThetagivenP(p0_arr(i,j,k));
amrex::Real t0_hi = getTgivenPandTh(p0_arr(i,j,k), rt0_hi/r0_arr(i,j,k), rd_over_cp);
Expand All @@ -37,7 +37,6 @@ amrex::Real
buoyancy_moist_anelastic (int& i,
int& j,
int& k,
const int& klo,
amrex::Real const& grav_gpu,
amrex::Real const& rv_over_rd,
const amrex::Array4<const amrex::Real>& p0_arr,
Expand Down
17 changes: 8 additions & 9 deletions Source/SourceTerms/ERF_make_buoyancy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ void make_buoyancy (Vector<MultiFab>& S_data,

Real rd_over_cp = solverChoice.rdOcp;
Real rv_over_rd = R_v/R_d;
Real c_p = solverChoice.c_p;

if (anelastic == 1) {
#ifdef _OPENMP
Expand All @@ -73,17 +72,17 @@ void make_buoyancy (Vector<MultiFab>& S_data,
if (solverChoice.moisture_type == MoistureType::None) {
ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k)
{
buoyancy_fab(i, j, k) = buoyancy_dry_default(i,j,k,
grav_gpu[2],rd_over_cp,
p0_arr,r0_arr,cell_data);
buoyancy_fab(i, j, k) = buoyancy_dry_anelastic(i,j,k,
grav_gpu[2],rd_over_cp,
p0_arr,r0_arr,cell_data);
});
} else {
// NOTE: For decomposition in the vertical direction, klo may not
// reside in the valid box and this call will yield an out
// of bounds error since it depends upon the surface theta_l
ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k)
{
buoyancy_fab(i, j, k) = buoyancy_moist_anelastic(i,j,k,klo,
buoyancy_fab(i, j, k) = buoyancy_moist_anelastic(i,j,k,
grav_gpu[2],rv_over_rd,
p0_arr,r0_arr,cell_data);
});
Expand All @@ -97,11 +96,11 @@ void make_buoyancy (Vector<MultiFab>& S_data,
// ******************************************************************************************
if (solverChoice.moisture_type == MoistureType::None)
{
int n_q_dry = 0;
if (solverChoice.buoyancy_type == 1) {
#ifdef _OPENMP
#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
#endif
int n_q_dry = 0;
for ( MFIter mfi(buoyancy,TilingIfNotGPU()); mfi.isValid(); ++mfi)
{
Box tbz = mfi.tilebox();
Expand Down Expand Up @@ -151,9 +150,9 @@ void make_buoyancy (Vector<MultiFab>& S_data,

ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k)
{
buoyancy_fab(i, j, k) = buoyancy_dry_default(i,j,k,
grav_gpu[2],rd_over_cp,
p0_arr,r0_arr,cell_data);
buoyancy_fab(i, j, k) = buoyancy_dry_anelastic(i,j,k,
grav_gpu[2],rd_over_cp,
p0_arr,r0_arr,cell_data);
});
} // mfi
} // buoyancy_type
Expand Down

0 comments on commit d6dedda

Please sign in to comment.