-
Couldn't load subscription status.
- Fork 129
Included PolarGrid class. right now it assumes no ghost cells #136
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
base: main
Are you sure you want to change the base?
Changes from all commits
e0b136f
982e449
eb71efc
b716ca3
196e9df
f2367c1
7466128
bbe762d
f9afaa6
a8f9b65
c377f3b
f0f089b
7405339
d2d5712
df648dc
f98abf7
8e8e0d6
ffdce53
55c8377
d076961
8fa6b97
54ecf2d
6173abd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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() | ||
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