Skip to content

Commit

Permalink
Added the overset mask (mask_cell) to non-linear error calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
itopcuoglu committed Sep 30, 2024
1 parent 5ae6bcd commit 508bd25
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions amr-wind/utilities/console_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ void print_nonlinear_residual(
const auto& mesh = sim.mesh();

const auto& velocity_new = sim.pde_manager().icns().fields().field;
const auto& oset_mask = sim.repo().get_int_field("mask_cell");

const int ncomp = AMREX_SPACEDIM;

for (int lev = 0; lev < nlevels; ++lev) {
Expand All @@ -244,12 +246,19 @@ void print_nonlinear_residual(
const auto& velstar_arr = vel_star(lev).const_arrays();
const auto& veldiff_arr = vel_diff(lev).arrays();
const auto& levelmask_arr = level_mask.const_arrays();
const auto& osetmask_arr = oset_mask(lev).const_arrays();

amrex::ParallelFor(
velocity_new(lev), amrex::IntVect(0), AMREX_SPACEDIM,
[=] AMREX_GPU_DEVICE(int nbx, int i, int j, int k, int n) noexcept {
veldiff_arr[nbx](i, j, k, n) = (velnew_arr[nbx](i, j, k, n) -
velstar_arr[nbx](i, j, k, n)) *
levelmask_arr[nbx](i, j, k);
if (osetmask_arr[nbx](i, j, k) == 0) {
veldiff_arr[nbx](i, j, k, n) = 0.;
} else {
veldiff_arr[nbx](i, j, k, n) =
(velnew_arr[nbx](i, j, k, n) -
velstar_arr[nbx](i, j, k, n)) *
levelmask_arr[nbx](i, j, k);
}
});
}

Expand Down

0 comments on commit 508bd25

Please sign in to comment.