Skip to content

Conversation

@mikekryjak
Copy link
Collaborator

@mikekryjak mikekryjak commented Dec 17, 2025

tokamak_example.py is a precious resource because it can generate example grids of all topologies. We need this for all kinds of tests in Hermes-3, xBOUT and xHermes.

Unfortunately, the COCOS convention is such that you get warnings about negative J due to a negative dx when you run with the grids.

This PR adds the flag --reverse-current to tokamak_example.py which passes it to the yaml input file. This flips the psi direction and allows it to be run.

This PR changes the default current direction in the YAML files for the examples. There is now a new flag --original-cocos to disable reverse_current. There is also a new flag called --no-guards to generate a grid without guard cells.

  • Add feature
  • Updated doc/whats-new.md with a summary of the changes

Copy link
Collaborator

@johnomotani johnomotani left a comment

Choose a reason for hiding this comment

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

Looks good to me. @mikekryjak up to you if you want to address the comment.

parser.add_argument("--ny", type=int, default=65)
parser.add_argument("--np", "--number-of-processors", type=int, default=-1)
parser.add_argument("--no-plot", action="store_true", default=False)
parser.add_argument("--reverse-current", action="store_true", default=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this example only works properly with the current reversed, maybe we want to default to doing this, so make the command line flag --no-reverse-current and reverse the current unless the user passes this flag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't want to break anything else that this example is used for. If you can't think of anything, then happy to do this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

As far as I know this example isn't used in production for anything, or for tests (apart from a test that it runs at all), so I think it should be fine. Anyway, better to have a more usable solution than stick to the existing one just for historical consistency - something like this I think is low risk and if it affects anyone they can raise an issue.

@johnomotani
Copy link
Collaborator

Added a new commit, mostly to trigger the CI jobs (which had been suspended due to inactivity on the repo). Added the option to manually trigger CI, which would have been useful now!

@mikekryjak
Copy link
Collaborator Author

@johnomotani I fixed the flake issues but there seems to be a spurious CI failure. Are we OK to merge? Is there a way to re-trigger the CI to see if it's spurious?

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.

3 participants