Skip to content

Commit 49f78b3

Browse files
authored
Correction to EB volume fraction for anisotropic grids (#4587)
## Summary - This is a complementary PR to PR #4586 by @nataraj2, for enabling EB capabilities of AMReX for anisotropic grids. - This PR makes changes to the implementation of volume fraction and boundary centroid to extend them for anisotropic cases. - These changes are backward compatible with isotropic grids, therefore, it is safe for users of isotropic grids. ## Additional background The use of anisotropic grids is significant in ERF applications. ## Checklist The proposed changes: - [x] fix a bug or incorrect behavior in AMReX - [ ] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
1 parent 96d629b commit 49f78b3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Src/EB/AMReX_EB2_3D_C.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ void set_eb_data (const int i, const int j, const int k,
109109
Real aay = 0.5_rt*(aym+ayp);
110110
Real aaz = 0.5_rt*(azm+azp);
111111
Real B0 = aax + aay + aaz;
112-
Real Bx = -nx*aax + ny*(aym*fcy(i,j,k,0)-ayp*fcy(i,j+1,k,0))
113-
+ nz*(azm*fcz(i,j,k,0)-azp*fcz(i,j,k+1,0));
114-
Real By = -ny*aay + nx*(axm*fcx(i,j,k,0)-axp*fcx(i+1,j,k,0))
115-
+ nz*(azm*fcz(i,j,k,1)-azp*fcz(i,j,k+1,1));
116-
Real Bz = -nz*aaz + nx*(axm*fcx(i,j,k,1)-axp*fcx(i+1,j,k,1))
117-
+ ny*(aym*fcy(i,j,k,1)-ayp*fcy(i,j+1,k,1));
112+
Real Bx = -nx*aax + ny*(aym*fcy(i,j,k,0)-ayp*fcy(i,j+1,k,0)) * dx[0]/dx[1]
113+
+ nz*(azm*fcz(i,j,k,0)-azp*fcz(i,j,k+1,0)) * dx[0]/dx[2];
114+
Real By = -ny*aay + nx*(axm*fcx(i,j,k,0)-axp*fcx(i+1,j,k,0)) * dx[1]/dx[0]
115+
+ nz*(azm*fcz(i,j,k,1)-azp*fcz(i,j,k+1,1)) * dx[1]/dx[2];
116+
Real Bz = -nz*aaz + nx*(axm*fcx(i,j,k,1)-axp*fcx(i+1,j,k,1)) * dx[2]/dx[0]
117+
+ ny*(aym*fcy(i,j,k,1)-ayp*fcy(i,j+1,k,1)) * dx[2]/dx[1];
118118

119119
vfrac(i,j,k) = 0.5_rt*(B0 + nx*Bx + ny*By + nz*Bz);
120120

0 commit comments

Comments
 (0)