-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3d anisotropic eb #3907
Merged
asalmgren
merged 21 commits into
AMReX-Codes:development
from
jmsexton03:jmsexton03/aniso_3deb
Apr 30, 2024
Merged
3d anisotropic eb #3907
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e131eed
3d eb aniso test
jmsexton03 5288c46
test input files
jmsexton03 25f109b
fix apy to apz
jmsexton03 904ce75
Fix dx factors for bcent
jmsexton03 c49edca
tweak bcent factor
jmsexton03 97eeda5
Remove prints
jmsexton03 38f7eae
Hack out warnings for almostequal
jmsexton03 ca44087
Fix bcent
jmsexton03 c13b6ab
Reconcile barea with bainv update
jmsexton03 b59f1ac
updated barea, remove other tests
jmsexton03 bba5554
Remove prints
jmsexton03 e981a2f
Fix style
jmsexton03 24d0de1
Remove unneeded scaling factors
jmsexton03 fc443a3
Remove prints and fix style
jmsexton03 057bf56
Fix barea factors to match orig
jmsexton03 76dfadc
Cleanup
jmsexton03 3baed63
Cleanup part 2
jmsexton03 0ea4e06
Change apnorm to use formula instead of hypot
jmsexton03 1d7562d
Cleanup part 3
jmsexton03 e2bd893
Remove redefinition
jmsexton03 a741cca
Cleanup part 4
jmsexton03 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,18 +32,18 @@ void set_eb_data (const int i, const int j, const int k, | |
Array4<Real const> const& fcx, Array4<Real const> const& fcy, | ||
Array4<Real const> const& fcz, Array4<Real const> const& m2x, | ||
Array4<Real const> const& m2y, Array4<Real const> const& m2z, | ||
GpuArray<Real,AMREX_SPACEDIM> const& dx, | ||
Array4<Real> const& vfrac, Array4<Real> const& vcent, | ||
Array4<Real> const& barea, Array4<Real> const& bcent, | ||
Array4<Real> const& bnorm, Real small_volfrac, | ||
bool& is_small_cell, bool& is_multicut) noexcept | ||
{ | ||
Real axm = apx(i,j,k); | ||
Real axp = apx(i+1,j,k); | ||
Real aym = apy(i,j,k); | ||
Real ayp = apy(i,j+1,k); | ||
Real azm = apz(i,j,k); | ||
Real azp = apz(i,j,k+1); | ||
|
||
const Real axm = apx(i,j,k); | ||
const Real axp = apx(i+1,j,k); | ||
const Real aym = apy(i,j,k); | ||
const Real ayp = apy(i,j+1,k); | ||
const Real azm = apz(i,j,k); | ||
const Real azp = apz(i,j,k+1); | ||
// Check for small cell first | ||
if (((axm == 0.0_rt && axp == 0.0_rt) && | ||
(aym == 0.0_rt && ayp == 0.0_rt) && | ||
|
@@ -76,10 +76,10 @@ void set_eb_data (const int i, const int j, const int k, | |
return; | ||
} | ||
|
||
Real dapx = axm - axp; | ||
Real dapy = aym - ayp; | ||
Real dapz = azm - azp; | ||
Real apnorm = std::sqrt(dapx*dapx+dapy*dapy+dapz*dapz); | ||
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) || | ||
(aym == 0.0_rt && ayp == 0.0_rt) || | ||
|
@@ -96,10 +96,13 @@ void set_eb_data (const int i, const int j, const int k, | |
Real nx = dapx * apnorminv; | ||
Real ny = dapy * apnorminv; | ||
Real nz = dapz * apnorminv; | ||
const Real bareascaling = std::sqrt( (nx*dx[0])*(nx*dx[0]) + | ||
(ny*dx[1])*(ny*dx[1]) + | ||
(nz*dx[2])*(nz*dx[2]) ); | ||
bnorm(i,j,k,0) = nx; | ||
bnorm(i,j,k,1) = ny; | ||
bnorm(i,j,k,2) = nz; | ||
barea(i,j,k) = nx*dapx + ny*dapy + nz*dapz; | ||
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); | ||
|
@@ -121,7 +124,7 @@ void set_eb_data (const int i, const int j, const int k, | |
return; | ||
} | ||
|
||
Real bainv = 1.0_rt/barea(i,j,k); | ||
Real bainv = bareascaling*bareascaling/apnorm; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only place bareascaling is used. barescaling is computed with std::sqrt(..). So maybe sqrt is unnecessary. |
||
bcent(i,j,k,0) = bainv * (Bx + nx*vfrac(i,j,k)); | ||
bcent(i,j,k,1) = bainv * (By + ny*vfrac(i,j,k)); | ||
bcent(i,j,k,2) = bainv * (Bz + nz*vfrac(i,j,k)); | ||
|
@@ -310,6 +313,7 @@ void set_eb_cell (int i, int j, int k, | |
Array4<Real const> const& fcx, Array4<Real const> const& fcy, | ||
Array4<Real const> const& fcz, Array4<Real const> const& m2x, | ||
Array4<Real const> const& m2y, Array4<Real const> const& m2z, | ||
GpuArray<Real,AMREX_SPACEDIM> const& dx, | ||
Array4<Real> const& vfrac, Array4<Real> const& vcent, | ||
Array4<Real> const& barea, Array4<Real> const& bcent, | ||
Array4<Real> const& bnorm, Real small_volfrac, | ||
|
@@ -341,7 +345,7 @@ void set_eb_cell (int i, int j, int k, | |
barea(i,j,k) = 0.0_rt; | ||
} else { | ||
set_eb_data(i, j , k, cell, apx, apy, apz, fcx, fcy, fcz, m2x, m2y, m2z, | ||
vfrac, vcent, barea, bcent, bnorm, small_volfrac, | ||
dx, vfrac, vcent, barea, bcent, bnorm, small_volfrac, | ||
is_small_cell, is_multicut); | ||
} | ||
} | ||
|
@@ -773,6 +777,7 @@ void build_cells (Box const& bx, Array4<EBCellFlag> const& cell, | |
Array4<Real const> const& fcx, Array4<Real const> const& fcy, | ||
Array4<Real const> const& fcz, Array4<Real const> const& m2x, | ||
Array4<Real const> const& m2y, Array4<Real const> const& m2z, | ||
GpuArray<Real,AMREX_SPACEDIM> const& dx, | ||
Array4<Real> const& vfrac, Array4<Real> const& vcent, | ||
Array4<Real> const& barea, Array4<Real> const& bcent, | ||
Array4<Real> const& bnorm, Array4<EBCellFlag> const& ctmp, | ||
|
@@ -790,7 +795,7 @@ void build_cells (Box const& bx, Array4<EBCellFlag> const& cell, | |
bool is_small_cell = false; | ||
bool is_multicut = false; | ||
set_eb_cell(i, j, k, cell, apx, apy, apz, fcx, fcy, fcz, m2x, m2y, m2z, | ||
vfrac, vcent, barea, bcent, bnorm, small_volfrac, | ||
dx, vfrac, vcent, barea, bcent, bnorm, small_volfrac, | ||
is_small_cell, is_multicut); | ||
if (is_small_cell) { | ||
Gpu::Atomic::Add(dp, 1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second term has a different units than the first. The first term is L^2, whereas the second is L^(3/2).