-
Notifications
You must be signed in to change notification settings - Fork 125
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
Included PolarGrid class. right now it assumes no ghost cells #136
Open
ssagynbayeva
wants to merge
23
commits into
python-hydro:main
Choose a base branch
from
ssagynbayeva:polar-coords
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+137
−0
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e0b136f
Included PolarGrid class. right now it assumes no ghost cells
ssagynbayeva 982e449
Merge remote-tracking branch 'upstream/main' into polar-coords
ssagynbayeva eb71efc
Update pyro/mesh/patch.py
ssagynbayeva b716ca3
Update pyro/mesh/patch.py
ssagynbayeva 196e9df
added A_x and A_y
ssagynbayeva f2367c1
Merge remote-tracking branch 'upstream/main' into polar-coords
ssagynbayeva 7466128
Merge branch 'main' into polar-coords
zingale bbe762d
fixed the areas. They are now using self.xr and self.yr instead of ce…
ssagynbayeva f9afaa6
Merge branch 'polar-coords' of https://github.com/ssagynbayeva/pyro2 …
ssagynbayeva a8f9b65
Merge branch 'main' into polar-coords
ssagynbayeva c377f3b
removed _init_
ssagynbayeva f0f089b
Merge branch 'polar-coords' of https://github.com/ssagynbayeva/pyro2 …
ssagynbayeva 7405339
changed areas and the cell volume
ssagynbayeva d2d5712
Merge branch 'main' into polar-coords
ssagynbayeva df648dc
fixed flake8 errors
ssagynbayeva f98abf7
Merge branch 'polar-coords' of https://github.com/ssagynbayeva/pyro2 …
ssagynbayeva 8e8e0d6
added a line before main
ssagynbayeva ffdce53
Merge branch 'main' into polar-coords
zingale 55c8377
recomputed areas
ssagynbayeva d076961
Merge branch 'polar-coords' of https://github.com/ssagynbayeva/pyro2 …
ssagynbayeva 8fa6b97
ASCII picture
ssagynbayeva 54ecf2d
added unit tests for the PolarGrid()
ssagynbayeva 6173abd
changes
ssagynbayeva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 |
---|---|---|
|
@@ -884,5 +884,66 @@ def do_demo(): | |
mydata.pretty_print("a") | ||
|
||
|
||
# **c checking | ||
class PolarGrid(Grid2d): | ||
""" | ||
the 2-d grid class. The grid object will contain the coordinate | ||
information (at various centerings). | ||
|
||
A basic representation of the layout is:: | ||
|
||
*---* \theta_{i+1/2} | ||
/ | | ||
/ | | ||
/ * \theta_i | ||
/ | | ||
/ | | ||
*____*____* \theta_{i-1/2} | ||
r_{i-1/2} r_i r_{i+1/2} | ||
|
||
The '*' marks represent the vertices; i index is the data location. | ||
""" | ||
|
||
# pylint: disable=too-many-instance-attributes | ||
|
||
def area_x(self): | ||
""" | ||
Return an array of the face areas. | ||
The shape of the returned array is (ni, nj). | ||
""" | ||
r1, t1 = np.meshgrid(self.xr, self.yr) | ||
r0, t0 = np.meshgrid(self.xl, self.yl) | ||
|
||
# ** this is just 1/2*r*d\theta | ||
|
||
area = 0.5 * r0 * (t1 - t0) | ||
return area | ||
|
||
def area_y(self): | ||
""" | ||
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 should be the area through a y face, which is just dr 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. but y face is dtheta |
||
Return an array of the face areas. | ||
The shape of the returned array is (ni, nj). | ||
""" | ||
r1, t1 = np.meshgrid(self.xr, self.yr) | ||
r0, t0 = np.meshgrid(self.xl, self.yl) | ||
|
||
# ** this is just dr | ||
|
||
area = r1 - r0 | ||
return area | ||
|
||
def cell_volumes(self): | ||
""" | ||
Return an array of the cell volume data for the given coordinate box | ||
The shape of the returned array is (ni, nj). | ||
""" | ||
r1, t1 = np.meshgrid(self.xr, self.yr) | ||
r0, t0 = np.meshgrid(self.xl, self.yl) | ||
|
||
# ** this is just the face area | ||
|
||
return 0.5 * (r1 ** 2 - r0 ** 2) * (t1 - t0) | ||
|
||
|
||
if __name__ == "__main__": | ||
do_demo() |
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
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.
this is the area through a y (theta) face.
area_x()
should return the area through the x faces, which is r_{i-1/2} dtheta