Skip to content

Commit

Permalink
Merge pull request #4758 from yut23/fix-boxlib-1d-cyl
Browse files Browse the repository at this point in the history
ENH: allow boxlib frontend to read 1D cylindrical datasets
  • Loading branch information
neutrinoceros authored Jan 12, 2024
2 parents fe7eb3a + 63665d9 commit d1903de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 2 additions & 4 deletions yt/frontends/boxlib/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,8 @@ def _parse_index(self):
default_ybounds = (0.0, 1.0)
default_zbounds = (0.0, 1.0)
elif self.ds.geometry == "cylindrical":
# Now we check for dimensionality issues
if self.dimensionality != 2:
raise RuntimeError("yt needs cylindrical to be 2D")
self.level_dds[:, 2] = 2 * np.pi
default_ybounds = (0.0, 1.0)
default_zbounds = (0.0, 2 * np.pi)
elif self.ds.geometry == "spherical":
# BoxLib only supports 1D spherical, so ensure
Expand Down Expand Up @@ -892,7 +890,7 @@ def _parse_header_file(self):
self.geometry = Geometry(geom_str)

if self.geometry == "cylindrical":
dre = self.domain_right_edge
dre = self.domain_right_edge.copy()
dre[2] = 2.0 * np.pi
self.domain_right_edge = dre

Expand Down
5 changes: 5 additions & 0 deletions yt/frontends/boxlib/tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ def test_CastroDataset_2():
assert isinstance(data_dir_load("castro_sod_x_plt00036"), CastroDataset)


@requires_file("castro_sedov_1d_cyl_plt00150")
def test_CastroDataset_3():
assert isinstance(data_dir_load("castro_sedov_1d_cyl_plt00150"), CastroDataset)


@requires_file(plasma)
def test_WarpXDataset():
assert isinstance(data_dir_load(plasma), WarpXDataset)
Expand Down
6 changes: 6 additions & 0 deletions yt/sample_data_registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,12 @@
"load_name": "c5.h5m",
"url": "https://yt-project.org/data/c5.tar.gz"
},
"castro_sedov_1d_cyl_plt00150.tar.gz": {
"hash": "c96a8fdf3cd43563a88e34569a6b37e57a0349692a9100ea65252506a167f08f",
"load_kwargs": {},
"load_name": "",
"url": "https://yt-project.org/data/castro_sedov_1d_cyl_plt00150.tar.gz"
},
"castro_sedov_2d_cyl_in_cart_plt00150.tar.gz": {
"hash": "8b73a37a0503dba593af65f8bf16dfcc11ac825d671f11e5a364a2dee63c9047",
"load_kwargs": {},
Expand Down

0 comments on commit d1903de

Please sign in to comment.