Skip to content

Commit 1ca9b3c

Browse files
committed
fix: preserve plasma flux interpolator updates
1 parent 85ba24c commit 1ca9b3c

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

freegsnke/equilibrium_update.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ def __init__(self, *args, **kwargs):
6565
float
6666
)
6767

68+
def _updatePlasmaPsi(self, plasma_psi):
69+
"""Update plasma flux while retaining the checked FreeGSNKE interpolator."""
70+
super()._updatePlasmaPsi(plasma_psi)
71+
self.psi_func_interp = self.__dict__.pop("psi_func")
72+
6873
def update_machine_description(
6974
self,
7075
active_coils_data=None,

freegsnke/tests/test_static_solver.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ def test_static_solve(create_machine):
175175
assert np.allclose(
176176
eq.psi(), test_psi, atol=(np.max(test_psi) - np.min(test_psi)) * 0.003
177177
), "Psi map differs significantly from the test map"
178+
assert np.allclose(
179+
eq.psi_func(eq.R, eq.Z, grid=False), eq.plasma_psi
180+
), "Plasma-flux interpolator is stale after the solve"
178181

179182

180183
def test_second_order_static_solve(create_machine):

0 commit comments

Comments
 (0)