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
8 changes: 3 additions & 5 deletions python/gvec/util/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,9 @@ def power_series(kind: str) -> bool:
if not np.isnan(v) and v != 0.0:
params[gvec_key][m, n] = values[m - m0, n - n0]

if "rbs" in nml or "zbc" in nml:
# LASYM = T lets the equilibrium break the symmetry even from a symmetric initial boundary,
# e.g. a free boundary in an up-down asymmetric coil field
if "rbs" in nml or "zbc" in nml or not stellsym:
if stellsym:
logger.warning(
"VMEC namelist contains 'RBS' or 'ZBC' but is supposed to be stellarator symmetric. Assuming asymmetry."
Expand All @@ -731,10 +733,6 @@ def power_series(kind: str) -> bool:
params["X2_sin_cos"] = "_sincos_"
params["LA_sin_cos"] = "_sincos_"
else:
if not stellsym:
logger.warning(
"VMEC namelist does not contain 'RBS' or 'ZBC' but is supposed to be non-stellarator symmetric. Assuming symmetry."
)
params["X1_sin_cos"] = "_cos_"
params["X2_sin_cos"] = "_sin_"
params["LA_sin_cos"] = "_sin_"
Expand Down
14 changes: 14 additions & 0 deletions test-CI/unit-pygvec/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ def test_parameters_from_vmec_accepts_sparse_boundary_arrays():
}


def test_parameters_from_vmec_lasym_with_symmetric_boundary():
"""LASYM = T keeps the asymmetric modes when the initial boundary is symmetric."""
import f90nml

nml = f90nml.reads(
"&INDATA\n LASYM = T\n RBC(0, 0) = 1.7 RBC(0, 1) = 0.6 ZBS(0, 1) = 1.0\n/\n"
)["indata"]

parameters = util.parameters_from_vmec(nml, "lasym")

for q in ("X1", "X2", "LA"):
assert parameters[f"{q}_sin_cos"] == "_sincos_"


def test_parameters_from_vmec_reads_legacy_and_scalar_axis():
"""VMEC copies nonzero RAXIS and ZAXIS entries into RAXIS_CC and ZAXIS_CS."""
import f90nml
Expand Down