libs.simulation package

Subpackages

Submodules

libs.simulation.MagneticField module

class libs.simulation.MagneticField.MagneticField

Bases: object

Metaclass for magnetic fields. The virtual methods a magnetic field must provide to be able to communicate with the other classes of the application are specified in this class.

abstract create_field(data_handler, t: float) None

Method to initialize the magnetic field and perform the necessary calculations.

Parameters:
  • data_handler (DataHandler) – Object of the Data class containing all simulation relevant data.

  • t (float) – Current time stamp:

abstract draw() None

Method to draw the magnetic field.

abstract get_b_field(x: ndarray, y: ndarray, z: ndarray) ndarray | None

Method to extract the magnetic flux density on positions defined by a grid on x, y and z.

Parameters:
  • x (numpy.ndarray) – x grid.

  • y (numpy.ndarray) – y grid.

  • z (numpy.ndarray) – z grid.

Returns:

Magnetic flux density on the grid passed.

Return type:

Union[np.ndarray, None]

abstract get_h_field(x: ndarray, y: ndarray, z: ndarray) ndarray | None

Method to extract the magnetic field strength on positions defined by a grid on x, y and z.

Parameters:
  • x (numpy.ndarray) – x grid.

  • y (numpy.ndarray) – y grid.

  • z (numpy.ndarray) – z grid.

Returns:

Magnetic field strength on the grid passed.

Return type:

Union[np.ndarray, None]

libs.simulation.MagneticFieldFactory module

class libs.simulation.MagneticFieldFactory.MagneticFieldFactory

Bases: object

Class handles the initialisation of the magnetic field based on the existing implementations.

static init_field(field_type: str, data_handler: DataHandler) NGField

Initialize an object of the MagneticField class based on a subclass.

Parameters:
  • field_type (string) – Specifies the requested implementation.

  • data_handler (DataHandler) – Object of the Data class containing all simulation relevant data.

Returns:

Object of a certain magnetic field subclass.

Return type:

NGField

libs.simulation.SimulationHandler module

class libs.simulation.SimulationHandler.SimulationHandler

Bases: object

static draw(multiprocessing_tasks, data_stack: List[DataHandler], gui_handler: GUIHandler, idx: int) None | Future
static draw_process(data_handler: DataHandler)
static draw_thread(multiprocessing_tasks, data_stack: List[DataHandler], gui_handler: GUIHandler, idx: int) None

Method updates the data handler with the entries in the gui, performs a simulation of the frame at t0 and draws the result in the netgen gui

static run(multiprocessing_tasks, data_stack: List[DataHandler], config_handler: ConfigHandler, gui_handler: GUIHandler, idx: int | None = None) None | Future

Method updates the data handler with the entries in the gui and performs the simulation

static run_process(data_handler: DataHandler, max_memory: float, shared_list: Manager, queue: Queue) None
static run_thread(multiprocessing_tasks, data_stack: List[DataHandler], config_handler: ConfigHandler, gui_handler: GUIHandler, idx: int | None = None) None

Module contents