Included PolarGrid class. right now it assumes no ghost cells#136
Included PolarGrid class. right now it assumes no ghost cells#136ssagynbayeva wants to merge 23 commits intopython-hydro:mainfrom
Conversation
pyro/mesh/patch.py
Outdated
| t1 = y[+1:, +1:] | ||
|
|
||
| return (r1 ** 3 - r0 ** 3) * (np.cos(t1) - np.cos(t0)) * (-2.0 * np.pi) / 3.0 | ||
| # return r1 |
There was a problem hiding this comment.
r**3 makes this a volume, not a face area, right? shouldn't this just be
dr * r (t1 - t0) ?
for the area of a wedge in the r-theta polar plane?
:)
There was a problem hiding this comment.
sorry, that would be the volume
for the area, you should have an area_x and area_y function
and those should give just r*theta and dr respectively.
There was a problem hiding this comment.
This function computes dr and dtheta. :)
pyro/mesh/patch.py
Outdated
| # return r1 | ||
|
|
||
| def cell_vertices(self): | ||
| """ |
There was a problem hiding this comment.
isn't this already what self.xl and self.xr provide?
:)
There was a problem hiding this comment.
I did not really understand what they are, and decided to write my own function. ;)
pyro/mesh/patch.py
Outdated
| # pylint: disable=too-many-instance-attributes | ||
|
|
||
| def __init__(self, nx, ny, ng=1, | ||
| xmin=0.0, xmax=1.0, ymin=0.0, ymax=1.0): |
There was a problem hiding this comment.
I don't think you need init, since it looks the same as the base class
There was a problem hiding this comment.
I left if for later if it will be needed to be changed.
There was a problem hiding this comment.
It might be better to call super().__init__(nx, ny, ...) in that case
Co-authored-by: Eric T. Johnson <yut23@users.noreply.github.com>
Co-authored-by: Eric T. Johnson <yut23@users.noreply.github.com>
|
you should only need to add 3 functions to Grid2d: area_x() it might also be good to add an assertion on the angle (y) the ghost cells should be handled just fine by what is already in the class |
pyro/mesh/patch.py
Outdated
| The shape of the returned array is (ni, nj). | ||
| """ | ||
| tr = lambda arr: arr.transpose(1, 2, 0) | ||
| x = self.cell_vertices()[:,0] |
There was a problem hiding this comment.
can you use the data in the class instead of recomputing the vertices yourself?
…into polar-coords
…into polar-coords
…into polar-coords
|
|
||
| # pylint: disable=too-many-instance-attributes | ||
|
|
||
| def area_x(self): |
There was a problem hiding this comment.
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
| return area | ||
|
|
||
| def area_y(self): | ||
| """ |
There was a problem hiding this comment.
this should be the area through a y face, which is just dr

No description provided.