diff --git a/Src/EB/AMReX_EB_FluxRedistribute.cpp b/Src/EB/AMReX_EB_FluxRedistribute.cpp index d5d2b22c0c7..cf48f034f20 100644 --- a/Src/EB/AMReX_EB_FluxRedistribute.cpp +++ b/Src/EB/AMReX_EB_FluxRedistribute.cpp @@ -42,7 +42,9 @@ amrex_flux_redistribute ( amrex::Abort("apply_eb_redistribution(): grid spacing must be uniform"); } - const Box dbox = geom.growPeriodicDomain(2); + const Box dbox1 = geom.growPeriodicDomain(1); + const Box dbox2 = geom.growPeriodicDomain(2); + const Box& grown1_bx = amrex::grow(bx,1); const Box& grown2_bx = amrex::grow(bx,2); @@ -75,10 +77,9 @@ amrex_flux_redistribute ( // AMREX_FOR_3D(grown2_bx, i, j, k, { - mask(i,j,k) = (dbox.contains(IntVect(AMREX_D_DECL(i,j,k)))) ? 1.0 : 0.0; + mask(i,j,k) = (dbox2.contains(IntVect(AMREX_D_DECL(i,j,k)))) ? 1.0 : 0.0; }); - //LOOK AT THIS // // Init to zero tmp array // @@ -107,7 +108,7 @@ amrex_flux_redistribute ( for (int jj = -1; jj <= 1; jj++) { for (int ii = -1; ii <= 1; ii++) { if ( (ii != 0 || jj != 0 || kk != 0) && flag(i,j,k).isConnected(ii,jj,kk) && - dbox.contains(IntVect(AMREX_D_DECL(i+ii,j+jj,k+kk)))) + dbox2.contains(IntVect(AMREX_D_DECL(i+ii,j+jj,k+kk)))) { Real wted_frac = vfrac(i+ii,j+jj,k+kk) * wt(i+ii,j+jj,k+kk) * mask(i+ii,j+jj,k+kk); vtot += wted_frac; @@ -142,7 +143,7 @@ amrex_flux_redistribute ( for (int jj = -1; jj <= 1; jj++) { for (int ii = -1; ii <= 1; ii++) { if ( (ii != 0 || jj != 0 || kk != 0) && flag(i,j,k).isConnected(ii,jj,kk) && - dbox.contains(IntVect(AMREX_D_DECL(i+ii,j+jj,k+kk)))) + dbox2.contains(IntVect(AMREX_D_DECL(i+ii,j+jj,k+kk)))) { Real unwted_frac = vfrac(i+ii,j+jj,k+kk) * mask(i+ii,j+jj,k+kk); vtot += unwted_frac; @@ -219,7 +220,7 @@ amrex_flux_redistribute ( ( (i >= bx_ilo) && (i <= bx_ihi) && (j >= bx_jlo) && (j <= bx_jhi) && (k >= bx_klo) && (k <= bx_khi) ); #endif if (inside) { as_fine_valid_cell = true; } - as_fine_ghost_cell = (levmsk(i,j,k) == level_mask_not_covered); // not covered by other grids + as_fine_ghost_cell = (levmsk(i,j,k) == level_mask_not_covered); // not covered by other grids at this level } #if (AMREX_SPACEDIM == 2) @@ -264,12 +265,12 @@ amrex_flux_redistribute ( } } - if (as_fine_valid_cell && !valid_dst_cell) + if (as_fine_valid_cell && !valid_dst_cell && dbox1.contains(IntVect(AMREX_D_DECL(iii,jjj,kkk)))) { Gpu::Atomic::Add(&dm_as_fine(iii,jjj,kkk,n), dt*drho*vfrac(iii,jjj,kkk)); } - if (as_fine_ghost_cell && valid_dst_cell) + if (as_fine_ghost_cell && valid_dst_cell && dbox1.contains(IntVect(AMREX_D_DECL(i,j,k)))) { Gpu::Atomic::Add(&dm_as_fine(i,j,k,n), -dt*drho*vfrac(iii,jjj,kkk)); } diff --git a/Src/EB/AMReX_EB_StateRedistItracker.cpp b/Src/EB/AMReX_EB_StateRedistItracker.cpp index 538a917c72a..e0efee68bbb 100644 --- a/Src/EB/AMReX_EB_StateRedistItracker.cpp +++ b/Src/EB/AMReX_EB_StateRedistItracker.cpp @@ -27,16 +27,17 @@ MakeITracker ( Box const& bx, const Box domain = lev_geom.Domain(); - // Note that itracker has 4 components and all are initialized to zero - // We will add to the first component every time this cell is included in a merged neighborhood, - // either by merging or being merged - // We identify the cells in the remaining three components with the following ordering + // Note that itracker has 4 components -- the first component stores the + // number of neighbors and each additional component stores where that neighbor is + // + // We identify the neighbors with the following ordering // // ^ 6 7 8 // | 4 5 // j 1 2 3 // i ---> + // Note the first component of imap/jmap should never be used Array imap{0,-1,0,1,-1,1,-1,0,1}; Array jmap{0,-1,-1,-1,0,0,1,1,1}; @@ -241,10 +242,10 @@ MakeITracker ( Box const& bx, const Box domain = lev_geom.Domain(); - // Note that itracker has 8 components and all are initialized to zero - // We will add to the first component every time this cell is included in a merged neighborhood, - // either by merging or being merged - // We identify the cells in the remaining three components with the following ordering + // Note that itracker has 8 components -- the first component stores the + // number of neighbors and each additional component stores where that neighbor is + // + // We identify the neighbors with the following ordering // // at k-1 | at k | at k+1 // @@ -253,7 +254,7 @@ MakeITracker ( Box const& bx, // j 9 10 11 | 1 2 3 | 18 19 20 // i ---> // - // Note the first component of each of these arrays should never be used + // Note the first component of imap/jmap/kmap should never be used Array imap{0,-1, 0, 1,-1, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1}; Array jmap{0,-1,-1,-1, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1}; Array kmap{0, 0, 0, 0, 0, 0, 0, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; @@ -331,6 +332,7 @@ MakeITracker ( Box const& bx, } else { itracker(i,j,k,1) = 2; } + // z-component of normal is greatest } else { if (nz > 0) { @@ -571,6 +573,7 @@ MakeITracker ( Box const& bx, } else { itracker(i,j,k,7) = 18; } + } else { // nz <= 0 itracker(i,j,k,4) = 13;