Skip to content

Add restart.change_grid function#56

Merged
johnomotani merged 9 commits into
masterfrom
restart_change_grid
Jan 6, 2022
Merged

Add restart.change_grid function#56
johnomotani merged 9 commits into
masterfrom
restart_change_grid

Conversation

@bendudson

Copy link
Copy Markdown
Contributor

Converts restart files from one input grid to another, by interpolating in the R-Z plane. Intended for doing resolution scans with axisymmetric simulations.

Only works for nz=1 for now, as testing for axisymmetric simulations.
Asserts that nz=1, and could be extended in future, perhaps by interpolating one Z slice at a time.

Only works for nz=1 for now, as testing for axisymmetric simulations.
Asserts that nz=1, and could be extended in future, perhaps by
interpolating one Z slice at a time.

@johnomotani johnomotani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks pretty good to me, just a few minor suggestions.

Comment thread boutdata/restart.py Outdated
Comment thread boutdata/restart.py
Comment thread boutdata/restart.py Outdated
Comment thread boutdata/restart.py
Comment on lines +1049 to +1052
from_Rxy = extrapolate_yguards(from_Rxy, copy_data["MYG"])
from_Zxy = extrapolate_yguards(from_Zxy, copy_data["MYG"])
to_Rxy = extrapolate_yguards(to_Rxy, copy_data["MYG"])
to_Zxy = extrapolate_yguards(to_Zxy, copy_data["MYG"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What if the grid file contains y-boundary cells? It gets a bit complicated to deal with, especially allowing for an upper divertor, so suggest just adding some check like

if g.get("y_boundary_guards", 0) != 0:
    raise ValueError("Support for grid files with y-boundary cells not implemented yet")

when opening the grid files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks @johnomotani for the suggestions, and happy New Year!

bendudson and others added 6 commits January 5, 2022 11:38
Co-authored-by: johnomotani <john.omotani@ukaea.uk>
Co-authored-by: johnomotani <john.omotani@ukaea.uk>
Co-authored-by: johnomotani <john.omotani@ukaea.uk>
Not currently supported, so raise error if encountered.
Ensure that 3D inputs are 3D in the output, and that the BOUT_VERSION
and MZ variables are in the outputs. This allows the output to be
collected, and used as input to another interpolation if needed.

@johnomotani johnomotani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice! Thanks @bendudson

@johnomotani johnomotani merged commit 20dfb76 into master Jan 6, 2022
@johnomotani johnomotani deleted the restart_change_grid branch January 6, 2022 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants