From dbd582d8bdf3b95b5ac6b426332ee3ea129b3292 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Tue, 26 Aug 2025 17:20:52 -0400 Subject: [PATCH 1/8] update yt to work with riot. Still need to check on diffusion groups --- yt/frontends/parthenon/data_structures.py | 5 +---- yt/frontends/parthenon/io.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/yt/frontends/parthenon/data_structures.py b/yt/frontends/parthenon/data_structures.py index ccbfbb4919a..b7d1283f3bf 100644 --- a/yt/frontends/parthenon/data_structures.py +++ b/yt/frontends/parthenon/data_structures.py @@ -164,10 +164,7 @@ def __init__( self.geometry = _geom_map[self._handle["Info"].attrs["Coordinates"]] - if self.geometry is Geometry.CYLINDRICAL: - axis_order = ("r", "theta", "z") - else: - axis_order = None + axis_order = None Dataset.__init__( self, diff --git a/yt/frontends/parthenon/io.py b/yt/frontends/parthenon/io.py index 0880abdbf2e..d6274fb03ba 100644 --- a/yt/frontends/parthenon/io.py +++ b/yt/frontends/parthenon/io.py @@ -52,7 +52,10 @@ def _read_fluid_selection(self, chunks, selector, fields, size): for gs in grid_sequences(chunk.objs): start = gs[0].id - gs[0]._id_offset end = gs[-1].id - gs[-1]._id_offset + 1 - data = ds[start:end, fdi, :, :, :].transpose() + if len(ds.shape) == 4: + data = ds[start:end, :, :, :].transpose() + else: + data = ds[start:end, fdi, :, :, :].transpose() for i, g in enumerate(gs): ind += g.select(selector, data[..., i], rv[field], ind) last_dname = dname @@ -72,7 +75,10 @@ def _read_chunk_data(self, chunk, fields): for gs in grid_sequences(chunk.objs): start = gs[0].id - gs[0]._id_offset end = gs[-1].id - gs[-1]._id_offset + 1 - data = ds[start:end, fdi, :, :, :].transpose() + if len(ds.shape) == 4: + data = ds[start:end, :, :, :].transpose() + else: + data = ds[start:end, fdi, :, :, :].transpose() for i, g in enumerate(gs): rv[g.id][field] = np.asarray(data[..., i], "=f8") return rv From 62a52892b0baa84f4b3c8ff5ae58a2bed162ea16 Mon Sep 17 00:00:00 2001 From: Philipp Grete Date: Fri, 5 Sep 2025 18:16:01 +0200 Subject: [PATCH 2/8] Add RIOT skeleton --- yt/frontends/parthenon/tests/test_outputs.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/yt/frontends/parthenon/tests/test_outputs.py b/yt/frontends/parthenon/tests/test_outputs.py index 6c5e0ee7db2..9475216a5f0 100644 --- a/yt/frontends/parthenon/tests/test_outputs.py +++ b/yt/frontends/parthenon/tests/test_outputs.py @@ -179,3 +179,15 @@ def test_load_cylindrical(): # Check that the domain edges match r in [0.5,2.0], theta in [0, 2pi] assert_equal(ds.domain_left_edge.in_units("code_length").v[:2], (0.5, 0)) assert_equal(ds.domain_right_edge.in_units("code_length").v[:2], (2.0, 2 * np.pi)) + + +# Sedov blast wave with curvlinear coords run with RIOT +riot_sedov_curvlinear = "riot_sedoc_curvlinear/sedov.out1.final.phdf" + + +@requires_file(riot_sedov_curvlinear) +def test_load_riot_curvilinear(): + # Load a cylindrical dataset of a full disk + ds = data_dir_load(riot_sedov_curvlinear) + + assert ("parthenon", "c.c.bulk.pressure") in ds.field_list From ad28ef0d0f3af31d6dcf897ecfeafab1082bb9ff Mon Sep 17 00:00:00 2001 From: Philipp Grete Date: Fri, 5 Sep 2025 18:34:28 +0200 Subject: [PATCH 3/8] Fix typi --- yt/frontends/parthenon/tests/test_outputs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt/frontends/parthenon/tests/test_outputs.py b/yt/frontends/parthenon/tests/test_outputs.py index 9475216a5f0..fd9340ac906 100644 --- a/yt/frontends/parthenon/tests/test_outputs.py +++ b/yt/frontends/parthenon/tests/test_outputs.py @@ -182,7 +182,7 @@ def test_load_cylindrical(): # Sedov blast wave with curvlinear coords run with RIOT -riot_sedov_curvlinear = "riot_sedoc_curvlinear/sedov.out1.final.phdf" +riot_sedov_curvlinear = "riot_sedov_curvlinear/sedov.out1.final.phdf" @requires_file(riot_sedov_curvlinear) From f7d27e7afb503aedae4d4c8011257070a2fe37a4 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Sat, 13 Sep 2025 18:39:21 -0400 Subject: [PATCH 4/8] added more concrete tests --- yt/frontends/parthenon/data_structures.py | 4 ---- yt/frontends/parthenon/tests/test_outputs.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/yt/frontends/parthenon/data_structures.py b/yt/frontends/parthenon/data_structures.py index b7d1283f3bf..3b13ff03e44 100644 --- a/yt/frontends/parthenon/data_structures.py +++ b/yt/frontends/parthenon/data_structures.py @@ -53,10 +53,6 @@ def _setup_dx(self): id = self.id - self._id_offset LE, RE = self.index.grid_left_edge[id, :], self.index.grid_right_edge[id, :] self.dds = self.ds.arr((RE - LE) / self.ActiveDimensions, "code_length") - if self.ds.dimensionality < 2: - self.dds[1] = 1.0 - if self.ds.dimensionality < 3: - self.dds[2] = 1.0 self.field_data["dx"], self.field_data["dy"], self.field_data["dz"] = self.dds def retrieve_ghost_zones(self, n_zones, fields, all_levels=False, smoothed=False): diff --git a/yt/frontends/parthenon/tests/test_outputs.py b/yt/frontends/parthenon/tests/test_outputs.py index fd9340ac906..a83bce78d55 100644 --- a/yt/frontends/parthenon/tests/test_outputs.py +++ b/yt/frontends/parthenon/tests/test_outputs.py @@ -191,3 +191,13 @@ def test_load_riot_curvilinear(): ds = data_dir_load(riot_sedov_curvlinear) assert ("parthenon", "c.c.bulk.pressure") in ds.field_list + + ad = ds.all_data() + dr = ad["index", "dr"] + dth = ad["index", "dtheta"] + dz = ad["index", "dz"] + + assert np.all(np.abs(dth - 2 * np.pi) <= 1e-12) + + total_mass = (ad["parthenon", "c.c.bulk.rho"] * ad["index", "cell_volume"]).sum() + assert np.all(np.abs(total_mass.value - 0.169646) <= 1e-8) From fd336c3bfcc1fc47b2f75965f5bbafe3f94ddf4e Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Sat, 13 Sep 2025 18:41:33 -0400 Subject: [PATCH 5/8] more clean --- yt/frontends/parthenon/tests/test_outputs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yt/frontends/parthenon/tests/test_outputs.py b/yt/frontends/parthenon/tests/test_outputs.py index a83bce78d55..71fdd02e728 100644 --- a/yt/frontends/parthenon/tests/test_outputs.py +++ b/yt/frontends/parthenon/tests/test_outputs.py @@ -193,11 +193,11 @@ def test_load_riot_curvilinear(): assert ("parthenon", "c.c.bulk.pressure") in ds.field_list ad = ds.all_data() - dr = ad["index", "dr"] dth = ad["index", "dtheta"] - dz = ad["index", "dz"] + vol = ad["index", "cell_volume"] + rho = ad["parthenon", "c.c.bulk.rho"] assert np.all(np.abs(dth - 2 * np.pi) <= 1e-12) - total_mass = (ad["parthenon", "c.c.bulk.rho"] * ad["index", "cell_volume"]).sum() + total_mass = (rho * vol).sum() assert np.all(np.abs(total_mass.value - 0.169646) <= 1e-8) From d7453aef525188183cee4ee7f015af7b21c9d8eb Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Thu, 9 Oct 2025 13:45:21 -0400 Subject: [PATCH 6/8] Update yt/frontends/parthenon/data_structures.py Co-authored-by: Chris Havlin --- yt/frontends/parthenon/data_structures.py | 1 - 1 file changed, 1 deletion(-) diff --git a/yt/frontends/parthenon/data_structures.py b/yt/frontends/parthenon/data_structures.py index 3b13ff03e44..e41e7991734 100644 --- a/yt/frontends/parthenon/data_structures.py +++ b/yt/frontends/parthenon/data_structures.py @@ -160,7 +160,6 @@ def __init__( self.geometry = _geom_map[self._handle["Info"].attrs["Coordinates"]] - axis_order = None Dataset.__init__( self, From 2b3b9b3906b1364679db298129172156fe6f1db5 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Fri, 10 Oct 2025 17:32:31 -0400 Subject: [PATCH 7/8] remove reference to axis order in init --- yt/frontends/parthenon/data_structures.py | 1 - 1 file changed, 1 deletion(-) diff --git a/yt/frontends/parthenon/data_structures.py b/yt/frontends/parthenon/data_structures.py index e41e7991734..99c3c8d276c 100644 --- a/yt/frontends/parthenon/data_structures.py +++ b/yt/frontends/parthenon/data_structures.py @@ -168,7 +168,6 @@ def __init__( units_override=units_override, unit_system=unit_system, default_species_fields=default_species_fields, - axis_order=axis_order, ) if storage_filename is None: storage_filename = self.basename + ".yt" From 25038785f4d70ce39a374720c4c1969f8a61c28a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 14:03:31 +0000 Subject: [PATCH 8/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- yt/frontends/parthenon/data_structures.py | 1 - 1 file changed, 1 deletion(-) diff --git a/yt/frontends/parthenon/data_structures.py b/yt/frontends/parthenon/data_structures.py index 99c3c8d276c..13da4076080 100644 --- a/yt/frontends/parthenon/data_structures.py +++ b/yt/frontends/parthenon/data_structures.py @@ -160,7 +160,6 @@ def __init__( self.geometry = _geom_map[self._handle["Info"].attrs["Coordinates"]] - Dataset.__init__( self, filename,