Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Bug Fixes
- Fixes inaccurate normalizations scales that could be computed for certain equilibria which had m=1 n=0 R and m=-1 n=0 Z components much smaller than their actual average minor radius, see [GH issue](https://github.com/PlasmaControl/DESC/issues/1954)
- [Fix bug in ``PlasmaCoilSetMinDistance`` that occured using a ``FourierRZToroidalSurface`` object without passing in an the evaluation grid](https://github.com/PlasmaControl/DESC/pull/2013)
- Equilibrium profile assignments are now guaranteed to be consistent with the equilibrium resolution—automatically increasing lower-resolution profiles to match the equilibrium (while keeping higher-resolution profiles untouched)—meaning users who relied on lower-resolution profiles to implicitly restrict optimization must now explicitly use the `FixParameters` constraint.
- Allow ``desc.vmec.VMECIO.load`` to load wout files that lack ``lrfp__logical__``, like those outputted by VMEC++. This change assumes that those output files don't have poloidal flux label.


Backend
-------
Expand Down
12 changes: 7 additions & 5 deletions desc/vmec.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@
+ " while DESC is only designed for compatibility with VMEC version"
+ " 9. Some data may not be loaded correctly."
)

assert float(file.variables["lrfp__logical__"][0]) == 0, (
"DESC currently does not support poloidal flux label, "
"and so cannot load this VMEC wout, which has LRFP=T"
)
if "lrfp__logical__" in file.variables:

Check warning on line 98 in desc/vmec.py

View check run for this annotation

Codecov / codecov/patch

desc/vmec.py#L98

Added line #L98 was not covered by tests
# guard against the wout not having it, as VMEC++ does not save
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does VMEC++ always output without poloidal flux label?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Ahh yeah, sorry for the inconsistency. I hope it is not too inconvenient for you guys to have to work around that. We probably should add these wout variables to VMEC++, even if they would just be static values, as in the case of lrfp__logical__. Or maybe we'll even see a PR adding these some time 🤞 ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the reply @jonathanschilling ! I think the current workaround is fine (as long as a user gives an output with poloidal flux label that doesn't have this attribute).

# all the flags that VMEC does
assert float(file.variables["lrfp__logical__"][0]) == 0, (

Check warning on line 101 in desc/vmec.py

View check run for this annotation

Codecov / codecov/patch

desc/vmec.py#L101

Added line #L101 was not covered by tests
"DESC currently does not support poloidal flux label, "
"and so cannot load this VMEC wout, which has LRFP=T"
)

# parameters
inputs["Psi"] = float(file.variables["phi"][-1])
Expand Down
Loading