Skip to content

Commit

Permalink
Merge pull request seahorce-scidac#286 from hklion/fix_bcs
Browse files Browse the repository at this point in the history
fix netcdf BCs so we aren't applying BCs to the entire box
  • Loading branch information
hklion authored Nov 7, 2024
2 parents 0c87665 + 51af8fe commit a3b8886
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Source/BoundaryConditions/BoundaryConditions_netcdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const
Box xlo_edge = xlo; xlo_edge.setSmall(0,ubound(xlo).x); xlo_edge.setBig(0,ubound(xlo).x);
Box xhi_edge = xhi; xhi_edge.setSmall(0,lbound(xhi).x); xhi_edge.setBig(0,lbound(xhi).x);
Box ylo_edge = ylo; ylo_edge.setSmall(1,ubound(ylo).y); ylo_edge.setBig(1,ubound(ylo).y);
Box yhi_edge = yhi; yhi_edge.setSmall(1,lbound(ylo).y); yhi_edge.setBig(1,lbound(ylo).y);
Box yhi_edge = yhi; yhi_edge.setSmall(1,lbound(yhi).y); yhi_edge.setBig(1,lbound(yhi).y);

Box xlo_ghost = xlo; xlo_ghost.setBig(0,ubound(xlo).x-1);
Box xhi_ghost = xhi; xhi_ghost.setSmall(0,lbound(xhi).x+1);
Box ylo_ghost = ylo; ylo_ghost.setBig(1,ubound(ylo).y-1);
Box yhi_ghost = yhi; yhi_ghost.setSmall(1,lbound(ylo).y+1);
Box yhi_ghost = yhi; yhi_ghost.setSmall(1,lbound(yhi).y+1);

const Array4<Real>& dest_arr = mf_to_fill.array(mfi);
const Array4<const Real>& mask_arr = mf_mask.array(mfi);
Expand Down Expand Up @@ -233,7 +233,7 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const
});
ParallelFor(grow(xlo_ghost,IntVect(0,-1,0)), [=] AMREX_GPU_DEVICE (int i, int j, int k)
{
dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(dom_lo.x+mf_index_type[0]-1,j,k,icomp+icomp_to_fill);
dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(ubound(xlo).x,j,k,icomp+icomp_to_fill);
});
}

Expand Down Expand Up @@ -291,7 +291,7 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const
});
ParallelFor(grow(xhi_ghost,IntVect(0,-1,0)), [=] AMREX_GPU_DEVICE (int i, int j, int k)
{
dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(dom_hi.x-mf_index_type[0]+1,j,k,icomp+icomp_to_fill);
dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(lbound(xhi).x,j,k,icomp+icomp_to_fill);
});
}

Expand Down Expand Up @@ -350,7 +350,7 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const
});
ParallelFor(grow(ylo_ghost,IntVect(-1,0,0)), [=] AMREX_GPU_DEVICE (int i, int j, int k)
{
dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(i,dom_lo.y+mf_index_type[1]-1,k,icomp+icomp_to_fill);
dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(i,ubound(ylo).y,k,icomp+icomp_to_fill);
});
}

Expand Down Expand Up @@ -409,7 +409,7 @@ REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill, const MultiFab& mf_mask, const
});
ParallelFor(grow(yhi_ghost,IntVect(-1,0,0)), [=] AMREX_GPU_DEVICE (int i, int j, int k)
{
dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(i,dom_hi.y-mf_index_type[1]+1,k,icomp+icomp_to_fill);
dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(i,lbound(ylo).y,k,icomp+icomp_to_fill);
});

}
Expand Down
2 changes: 0 additions & 2 deletions Source/Initialization/REMORA_init_bcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ void REMORA::init_bcs ()

m_bc_extdir_vals[BCVars::ubar_bc][ori] = 0.0_rt; // default
m_bc_extdir_vals[BCVars::vbar_bc][ori] = 0.0_rt;
m_bc_extdir_vals[BCVars::u2d_simple_bc][ori] = 0.0_rt;
m_bc_extdir_vals[BCVars::v2d_simple_bc][ori] = 0.0_rt;
}

// Whether to specify boundary conditions by variable (then side).
Expand Down

0 comments on commit a3b8886

Please sign in to comment.