Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyro/mesh/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ class SphericalPolar(Grid2d):
def __init__(self, nx, ny, *, ng=1,
xmin=0.2, xmax=1.0, ymin=0.0, ymax=1.0):

super().__init__(nx, ny, ng=ng, xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax)

# Make sure theta is within [0, PI]
assert ymin >= 0.0 and ymax <= np.pi, "y or \u03b8 should be within [0, \u03c0]."

# Make sure the ghost cells doesn't extend out negative x(r)
assert xmin - ng*(xmax-xmin)/nx >= 0.0, \
assert xmin - ng*self.dx >= 0.0, \
"xmin (r-direction), must be large enough so ghost cell doesn't have negative x."

super().__init__(nx, ny, ng=ng, xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax)

self.coord_type = 1

# Length of the side along r-direction, dr
Expand Down
14 changes: 14 additions & 0 deletions pyro/simulation_null.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import h5py
import numpy as np

import pyro.mesh.boundary as bnd
import pyro.util.profile_pyro as profile
Expand Down Expand Up @@ -52,6 +53,19 @@ def grid_setup(rp, ng=1):
ymin=ymin, ymax=ymax,
ng=ng)

# Make sure y-boundary condition is reflect when
# ymin = 0 and ymax = pi

if grid_type == "SphericalPolar":
if ymin <= 0.05:
rp.set_param("mesh.ylboundary", "reflect")
msg.warning("With SphericalPolar grid," +
" mesh.ylboundary auto set to reflect when ymin ~ 0")
if abs(np.pi - ymax) <= 0.05:
rp.set_param("mesh.yrboundary", "reflect")
msg.warning("With SphericalPolar grid," +
" mesh.yrboundary auto set to reflect when ymax ~ pi")

return my_grid


Expand Down