Skip to content

Commit

Permalink
Merge pull request #4815 from matthewturk/athena_mutable
Browse files Browse the repository at this point in the history
BUG: Assign domain dims after updates in Athena
  • Loading branch information
cphyc authored Feb 21, 2024
2 parents c148f72 + dd0e536 commit 56346fb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions yt/frontends/athena/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,15 @@ def _parse_index(self):
self.dataset.domain_center = 0.5 * (
self.dataset.domain_left_edge + self.dataset.domain_right_edge
)
self.dataset.domain_dimensions = np.round(
self.dataset.domain_width / gdds[0]
).astype("int64")
domain_dimensions = np.round(self.dataset.domain_width / gdds[0]).astype(
"int64"
)

if self.dataset.dimensionality <= 2:
self.dataset.domain_dimensions[2] = 1
domain_dimensions[2] = 1
if self.dataset.dimensionality == 1:
self.dataset.domain_dimensions[1] = 1
domain_dimensions[1] = 1
self.dataset.domain_dimensions = domain_dimensions

dle = self.dataset.domain_left_edge
dre = self.dataset.domain_right_edge
Expand Down Expand Up @@ -556,9 +557,7 @@ def _parse_parameter_file(self):
)
self.domain_right_edge = -self.domain_left_edge
self.domain_width = self.domain_right_edge - self.domain_left_edge
self.domain_dimensions = np.round(self.domain_width / grid["dds"]).astype(
"int32"
)
domain_dimensions = np.round(self.domain_width / grid["dds"]).astype("int32")
refine_by = None
if refine_by is None:
refine_by = 2
Expand All @@ -569,11 +568,12 @@ def _parse_parameter_file(self):
if grid["dimensions"][1] == 1:
dimensionality = 1
if dimensionality <= 2:
self.domain_dimensions[2] = np.int32(1)
domain_dimensions[2] = np.int32(1)
if dimensionality == 1:
self.domain_dimensions[1] = np.int32(1)
domain_dimensions[1] = np.int32(1)
if dimensionality != 3 and self.nprocs > 1:
raise RuntimeError("Virtual grids are only supported for 3D outputs!")
self.domain_dimensions = domain_dimensions
self.dimensionality = dimensionality
self.current_time = grid["time"]
self.cosmological_simulation = False
Expand Down

0 comments on commit 56346fb

Please sign in to comment.