Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OOB in ActuatorSourceTagging #1173

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions amr-wind/physics/ActuatorSourceTagging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ void ActuatorSourceTagging::post_init_actions()

if (m_has_act_src) {
m_act_src = &(m_repo.get_field("actuator_src_term"));
AMREX_ALWAYS_ASSERT(m_act_src->num_grow() <= m_tracer->num_grow());
}

if (m_has_iblank) {
m_iblank = &(m_repo.get_int_field("iblank_cell"));
AMREX_ALWAYS_ASSERT(m_iblank->num_grow() <= m_tracer->num_grow());
}
}

Expand All @@ -50,7 +52,7 @@ void ActuatorSourceTagging::post_advance_work()
if (m_has_act_src) {
const auto& src_arrs = (*m_act_src)(lev).const_arrays();
amrex::ParallelFor(
(*m_tracer)(lev), m_tracer->num_grow(),
(*m_tracer)(lev), m_act_src->num_grow(),
[=] AMREX_GPU_DEVICE(int nbx, int i, int j, int k) noexcept {
const auto src = src_arrs[nbx];
const amrex::Real srcmag = std::sqrt(
Expand All @@ -69,7 +71,7 @@ void ActuatorSourceTagging::post_advance_work()
const bool tag_fringe = m_tag_fringe;
const bool tag_hole = m_tag_hole;
amrex::ParallelFor(
(*m_tracer)(lev), m_tracer->num_grow(),
(*m_tracer)(lev), m_iblank->num_grow(),
[=] AMREX_GPU_DEVICE(int nbx, int i, int j, int k) noexcept {
const auto ib = iblank_arrs[nbx](i, j, k);
if ((tag_fringe && (ib == -1)) || (tag_hole && (ib == 0))) {
Expand Down