Coverage for python/gsfit/database_readers/freegs/setup_wall.py: 0%

12 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-14 15:25 +0000

1import typing 

2from typing import TYPE_CHECKING 

3 

4import freegs 

5import numpy as np 

6import numpy.typing as npt 

7from gsfit_rs import Wall 

8 

9if TYPE_CHECKING: 

10 from . import DatabaseReader 

11 

12 

13def setup_wall( 

14 self: "DatabaseReader", 

15 pulseNo: int, 

16 settings: dict[str, typing.Any], 

17 time: npt.NDArray[np.float64], 

18 freegs_eqs: list[freegs.equilibrium.Equilibrium], 

19) -> Wall: 

20 """ 

21 This method initialises the Rust `Wall` class. 

22 

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 freegs_eqs: List of FreeGS equilibrium objects, one for each time-slice 

27 

28 **This method is specific to FreeGS.** 

29 

30 See `python/gsfit/database_readers/interface.py` for more details on how a new database_reader should be implemented. 

31 """ 

32 

33 # Vacuum vessel contour, which bounds the region the plasma is allowed to occupy. 

34 # FreeGS describes the wall with a single contour, so there are no separate tile units 

35 vacuum_vessel_r = np.array(freegs_eqs[0].tokamak.wall.R) 

36 vacuum_vessel_z = np.array(freegs_eqs[0].tokamak.wall.Z) 

37 

38 # Initialise the Wall Rust class 

39 wall = Wall() 

40 

41 # `unit(0)` must be the vacuum vessel contour: the solver reads the limiter units by 

42 # position, and uses the first one, and only the first one, as the region the plasma is 

43 # allowed to occupy. Every unit contributes candidate limit points 

44 wall.add_limiter_unit(name="vacuum_vessel", r=vacuum_vessel_r, z=vacuum_vessel_z) 

45 

46 return wall