Skip to content

Hypnotoad fixes#1487

Merged
bendudson merged 4 commits intomasterfrom
hypnotoad-fixes
Jan 14, 2019
Merged

Hypnotoad fixes#1487
bendudson merged 4 commits intomasterfrom
hypnotoad-fixes

Conversation

@bendudson
Copy link
Contributor

Some important fixes for Hypnotoad, mainly found by @HarukiST . Particularly important for people using proportional density and temperature profiles, since the old code gave the wrong pressure profile.

Emphasises the need for:

  1. More (some) testing of input grid generation code (definitely)
  2. Splitting hypnotoad out into a separate repository (probably)

bendudson and others added 2 commits January 10, 2019 13:10
Re-used the variable `ind` rather than `primary_opt`, leading to wrong
results in some cases.
When input equilibria do not specify separate density and temperature
profiles, there are several options for how these should be set. One
of these options (3 in hypnotoad) is to keep the same shape for both
profiles. This code had a bug, which resulted in the output pressure
profiles being proportional to the square of the input pressure
profiles.

This bug affected both hypnotoad and the pdb2bout.pro processing used
for input from DSKGATO or ELITE inputs.

Thanks to Seto-san for finding.
@johnomotani
Copy link
Contributor

Re-used the variable ind rather than primary_opt, leading to wrong results in some cases.

The change looks fine, and probably makes the code easier to read, but I can't see how the old code could lead to wrong results? I can't see anywhere that would change ind after primary_opt = ind is set. Not important, I'm just curious.

@bendudson
Copy link
Contributor Author

After primary_opt = ind is set on line 269 (https://github.com/boutproject/BOUT-dev/blob/master/tools/tokamak_grids/gridgen/analyse_equil.pro#L269), ind could be modified by line 324 (https://github.com/boutproject/BOUT-dev/blob/master/tools/tokamak_grids/gridgen/analyse_equil.pro#L324). It's not obvious because MIN modifies its second argument, but I'm surprised it didn't cause more problems.

Copy link
Contributor

@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.

@bendudson bendudson merged commit ca09b3a into master Jan 14, 2019
@bendudson bendudson deleted the hypnotoad-fixes branch January 14, 2019 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants