-
Notifications
You must be signed in to change notification settings - Fork 355
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
add geometric terms for spherical 2D support. #4141
add geometric terms for spherical 2D support. #4141
Conversation
LGTM |
Src/Base/AMReX_CoordSys.cpp
Outdated
@@ -461,7 +513,10 @@ CoordSys::Volume (const Real xlo[AMREX_SPACEDIM], | |||
*(xhi[2]-xlo[2])); | |||
#if (AMREX_SPACEDIM==2) | |||
case RZ: | |||
return static_cast<Real>(0.5*TWOPI)*(xhi[1]-xlo[1])*(xhi[0]*xhi[0]-xlo[0]*xlo[0]); | |||
return static_cast<Real>(0.5*TWOPI)*(xhi[1]-xlo[1])*(xhi[0]+xlo[0])*(xhi[0]-xlo[0]); |
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.
this will cause roundoff diffs when merged
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.
should I change it back?
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.
Yes, that would be better.
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.
okay, I changed it back.
this looks good to me too, but I don't really understand where getEdgeVolCoord is used. |
Src/Base/AMReX_CoordSys.cpp
Outdated
@@ -164,6 +164,7 @@ CoordSys::UpperIndex(const Real* point) const noexcept | |||
IntVect ix; | |||
for (int k = 0; k < AMREX_SPACEDIM; k++) | |||
{ | |||
// +1 for UpperIndex? |
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.
btw, I was wondering if UpperIndex
should have a +1
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.
it looks like it should, but it also appears that this isn't used anywhere
@@ -164,7 +164,7 @@ CoordSys::UpperIndex(const Real* point) const noexcept | |||
IntVect ix; | |||
for (int k = 0; k < AMREX_SPACEDIM; k++) | |||
{ | |||
ix[k] = (int) ((point[k]-offset[k])/dx[k]); |
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.
Maybe we should do +1 to the int, not the real number before the cast.
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.
I moved the +1 outside int()
For you 2D, spherical, you might need to modify interpolaters for better accuracy. |
You want to make sure CellConservativeLinear does conserve mass in 2d spherical coordinates. |
Summary
This adds the appropriate geometric terms (area and volume) for spherical 2D geometry. We assume dx[0]=dr, and dx[1]=d$\theta$ .
Additional background
This intended to deal with issue #3670
Checklist
The proposed changes: