From a741cca778cbb7550ec57da77fe881177ba0ea2f Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Mon, 29 Apr 2024 18:49:09 -0700 Subject: [PATCH] Cleanup part 4 --- Src/EB/AMReX_EB2_3D_C.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index aa86c8d0749..c2de520e7a1 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -38,12 +38,6 @@ void set_eb_data (const int i, const int j, const int k, Array4 const& bnorm, Real small_volfrac, bool& is_small_cell, bool& is_multicut) noexcept { - const Real axmt = apx(i ,j ,k )*dx[1]*dx[2]; - const Real axpt = apx(i+1,j ,k )*dx[1]*dx[2]; - const Real aymt = apy(i ,j ,k )*dx[0]*dx[2]; - const Real aypt = apy(i ,j+1,k )*dx[0]*dx[2]; - const Real azmt = apz(i ,j ,k )*dx[0]*dx[1]; - const Real azpt = apz(i ,j ,k+1)*dx[0]*dx[1]; const Real axm = apx(i,j,k); const Real axp = apx(i+1,j,k); const Real aym = apy(i,j,k); @@ -69,12 +63,12 @@ void set_eb_data (const int i, const int j, const int k, // We know there are no multiple cuts on faces by now. // We need to check the case that there are two cuts // at the opposite corners. - bool multi_cuts = (axmt >= 0.5_rt*dx[1]*dx[2] && axmt < dx[1]*dx[2] && - axpt >= 0.5_rt*dx[1]*dx[2] && axpt < dx[1]*dx[2] && - aymt >= 0.5_rt*dx[0]*dx[1] && aymt < dx[0]*dx[1] && - aypt >= 0.5_rt*dx[0]*dx[1] && aypt < dx[0]*dx[1] && - azmt >= 0.5_rt*dx[1]*dx[2] && azmt < dx[1]*dx[2] && - azpt >= 0.5_rt*dx[1]*dx[2] && azpt < dx[1]*dx[2]); + bool multi_cuts = (axm >= 0.5_rt && axm < 1.0_rt && + axp >= 0.5_rt && axp < 1.0_rt && + aym >= 0.5_rt && aym < 1.0_rt && + ayp >= 0.5_rt && ayp < 1.0_rt && + azm >= 0.5_rt && azm < 1.0_rt && + azp >= 0.5_rt && azp < 1.0_rt); if (multi_cuts) { set_covered(i, j, k, cell, vfrac, vcent, barea, bcent, bnorm); @@ -82,9 +76,9 @@ void set_eb_data (const int i, const int j, const int k, return; } - Real dapx = axmt - axpt; - Real dapy = aymt - aypt; - Real dapz = azmt - azpt; + Real dapx = (axm - axp)*(dx[1]*dx[2]); + Real dapy = (aym - ayp)*(dx[0]*dx[2]); + Real dapz = (azm - azp)*(dx[0]*dx[1]); const Real apnorm = std::sqrt(dapx*dapx+dapy*dapy+dapz*dapz) + 1.e-30_rt*std::sqrt(dx[0]*dx[1]*dx[2]); if (apnorm == 0.0_rt) { bool maybe_multi_cuts = (axm == 0.0_rt && axp == 0.0_rt) || @@ -108,7 +102,7 @@ void set_eb_data (const int i, const int j, const int k, bnorm(i,j,k,0) = nx; bnorm(i,j,k,1) = ny; bnorm(i,j,k,2) = nz; - barea(i,j,k) = (nx*dapx/dx[1]/dx[2] + ny*dapy/dx[0]/dx[2] + nz*dapz/dx[0]/dx[1]); + barea(i,j,k) = (nx*dapx/(dx[1]*dx[2]) + ny*dapy/(dx[0]*dx[2]) + nz*dapz/(dx[0]*dx[1])); Real aax = 0.5_rt*(axm+axp); Real aay = 0.5_rt*(aym+ayp);