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

Utility to convert UEDGE to BOUT++ grids #2602

Closed
wants to merge 5 commits into from
Closed

Conversation

bendudson
Copy link
Contributor

@bendudson bendudson commented Nov 1, 2022

Uses a combination of code adapted from INGRID (MIT license) and Hypnotoad (GPL-3)

Tested on one SN grid and two DN grids.

Uses a combination of code adapted from INGRID (MIT license) and
Hypnotoad (GPL-3)
@bendudson bendudson added work in progress Not ready for merging auxiliary-tools For items relating to the tools that come along with BOUT++ rather than the core library labels Nov 1, 2022
@johnomotani
Copy link
Contributor

Is this a thing we could add to hypnotoad? Even if just as a standalone script? Then we could use the CI setup to test that it at least keeps running without errors.

[I have no idea about licences, but maybe that's a thing we'd have to worry about??]

@bendudson
Copy link
Contributor Author

Hey @johnomotani I was unsure where the best place to put this would be. Talking to Mike it sounds like B2 grids are very similar to UEDGE grids, so it may be possible to make something more general that works for both. If put into hypnotoad, might it possible to load in a mesh and reuse the hypnotoad code to generate outputs? This script currently duplicates some of that code e.g metric tensor calculation.

@ZedThree
Copy link
Member

ZedThree commented Nov 1, 2022

Getting it into hypnotoad sounds like a good idea. Would that make it possible to do the reverse conversion too?

@bendudson
Copy link
Contributor Author

Hey @ZedThree ! The reverse conversion is probably easier, as long as we have the cell corner locations and B field components at those corners.

Only tested on one DN case and one SN case. YMMV.
Prevents calculating metric components in tiny boundary cells.

Also added "-i" flag to ignore error checks and continue.
@johnomotani
Copy link
Contributor

hypnotoad does have cell corner positions. Not sure if Bp, Bt are calculated at the cell corners already, but that should be easy to do.

bendudson and others added 2 commits November 22, 2022 14:19
UEDGE grids are not necessarily quite flux-surface aligned, so dx
as calculated across the cell may not agree with dx between cell
centers. In some pathological cases these calculations can have
different signs. This version works for the small number of cases
tried so far.
@bendudson bendudson removed the work in progress Not ready for merging label Nov 22, 2022
@bendudson
Copy link
Contributor Author

Closing, putting script into Hypnotoad instead boutproject/hypnotoad#136

@bendudson bendudson closed this Nov 22, 2022
@bendudson bendudson deleted the gridue-to-bout branch November 22, 2022 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auxiliary-tools For items relating to the tools that come along with BOUT++ rather than the core library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants