freegsnke.picard module
Legacy routines for solving the nonlinear part of the Grad-Shafranov equation.
This inherited standalone solver is not used or supported by FreeGSNKE. Use the static or evolutive solvers provided by FreeGSNKE instead. The module is currently retained for compatibility while the legacy API is reviewed.
Copyright 2024 Nicola C. Amorisco, Adriano Agnello, George K. Holt, Ben Dudson.
This file is part of FreeGSNKE.
FreeGSNKE is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
FreeGSNKE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with FreeGSNKE. If not, see <http://www.gnu.org/licenses/>.
- freegsnke.picard.solve(eq: object, profiles: object, constrain: Callable[[object], None] | None = None, verbose: bool = False, rtol: float = 0.001, atol: float = 1e-10, blend: float = 0.0, show: bool = False, axis: object | None = None, pause: float = 0.0001, psi_bndry: float | None = None, maxits: int | None = 50, convergenceInfo: bool = False) tuple[ndarray, ndarray] | None[source]
Perform the inherited standalone Picard iteration.
Notes
This is not a supported FreeGSNKE backend entry point. In particular, the original inverse workflow using
freegsnke.controlis known not to satisfy its inherited regression setup.- Parameters:
eq (object) – Equilibrium object (equilibrium.py).
profiles (object) – Profile object for the toroidal current (jtor.py).
constrain (Callable[[object], None] or None, optional) – Called with
eqto adjust the coil currents (e.g. to place X-points) before and during the iteration.verbose (bool, optional) – If True, print the iteration log.
rtol (float, optional) – Relative tolerance, (change in psi) / (max(psi) - min(psi)).
atol (float, optional) – Absolute tolerance on the change in psi.
blend (float, optional) – Blending of previous and next psi solution, psi{n+1} <- psi{n+1} * (1-blend) + blend * psi{n}.
show (bool, optional) – If True, plot the plasma equilibrium at each nonlinear step.
axis (object or None, optional) – Matplotlib axis to plot onto. If None, a new figure is created.
pause (float, optional) – Delay between output plots. If negative, waits for the window to be closed.
psi_bndry (float or None, optional) – Poloidal flux at the plasma boundary, passed to
eq.solve.maxits (int or None, optional) – Maximum number of iterations. None means no limit.
convergenceInfo (bool, optional) – If True, return the per-iteration convergence history.
- Returns:
If
convergenceInfois True, the maximum absolute change in psi and the relative change in psi for each iteration; otherwise None.- Return type:
tuple[np.ndarray, np.ndarray] or None
- Raises:
RuntimeError – If
maxitsis exceeded before convergence.