Coverage for python/gsfit/database_readers/freegsnke/setup_wall.py: 100%
13 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-14 15:25 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-14 15:25 +0000
1import typing
2from typing import TYPE_CHECKING
4import numpy as np
5import numpy.typing as npt
6from freegsnke.equilibrium_update import Equilibrium as FreeGsnkeEquilibrium
7from gsfit_rs import Wall
9if TYPE_CHECKING:
10 from . import DatabaseReader
13def setup_wall(
14 self: "DatabaseReader",
15 pulseNo: int,
16 settings: dict[str, typing.Any],
17 time: npt.NDArray[np.float64],
18 freegsnke_eqs: list[FreeGsnkeEquilibrium],
19) -> Wall:
20 """
21 This method initialises the Rust `Wall` class.
23 :param pulseNo: Pulse number, used to read from the database
24 :param settings: Dictionary containing the JSON settings read from the `settings` directory
25 :param time: Measured time vector
26 :param freegsnke_eqs: List of FreeGSNKE equilibrium objects, one for each time-slice
28 **This method is specific to FreeGSNKE.**
30 See `python/gsfit/database_readers/interface.py` for more details on how a new database_reader should be implemented.
31 """
33 # Vacuum vessel contour, which bounds the region the plasma is allowed to occupy.
34 # FreeGSNKE describes the wall with a single contour, so there are no separate tile units
35 freegsnke_tokamak = freegsnke_eqs[0].tokamak # assume static data does not change in time
36 vacuum_vessel_r = np.array(freegsnke_tokamak.limiter.R)
37 vacuum_vessel_z = np.array(freegsnke_tokamak.limiter.Z)
39 # Initialise the Wall Rust class
40 wall = Wall()
42 # `unit(0)` must be the vacuum vessel contour: the solver reads the limiter units by
43 # position, and uses the first one, and only the first one, as the region the plasma is
44 # allowed to occupy. Every unit contributes candidate limit points
45 wall.add_limiter_unit(name="vacuum_vessel", r=vacuum_vessel_r, z=vacuum_vessel_z)
47 return wall