Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't get domain dimensions from cparam file for Boxlib frontend. #3470

Merged
merged 2 commits into from
Aug 24, 2021
Merged
Changes from 1 commit
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
14 changes: 1 addition & 13 deletions yt/frontends/boxlib/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,19 +743,7 @@ def _parse_cparams(self):
param, vals = (s.strip() for s in line.split("="))
except ValueError:
continue
if param == "amr.n_cell":
vals = self.domain_dimensions = np.array(vals.split(), dtype="int32")

# For 1D and 2D simulations in BoxLib usually only the relevant
# dimensions have a specified number of zones, but yt requires
# domain_dimensions to have three elements, with 1 in the additional
# slots if we're not in 3D, so append them as necessary.

if self.dimensionality == 1:
vals = self.domain_dimensions = np.array([vals[0], 1, 1])
elif self.dimensionality == 2:
vals = self.domain_dimensions = np.array([vals[0], vals[1], 1])
elif param == "amr.ref_ratio":
if param == "amr.ref_ratio":
vals = self.refine_by = int(vals[0])
elif param == "Prob.lo_bc":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work when we specify several different ref_ratios for different jumps between levels? e.g.

amr.ref_ratio = 2 4 2 2 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It "works" in the sense that it will not crash if you give it vector - it takes the first value for the ref_ratio between levels 0 and 1. But I don't think yt itself supports different ref_ratios between different levels.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think (hope) it does, since we use it with that all the time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, it's not supported yet.
Maybe you'd want to have a warning here in this case, because it's not necessarily obvious from the user standpoint

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, this PR doesn't change anything about the way ref_ratio is handled, so perhaps this could be sorted out in a different issue / pull request?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree. That just caught my eye.

vals = tuple(p == "1" for p in vals.split())
Expand Down