freegsnke.build_machine module
Functions that build tokamak objects in FreeGSNKE (from file or otherwise).
Copyright 2025 UKAEA, UKRI-STFC, and The Authors, as per the COPYRIGHT and README files.
This file is part of FreeGSNKE.
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.
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.
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.build_machine.build_active_coil_dict(active_coils)[source]
Create vectorised version of the active coil properties in a dictionary for use throughout FreeGSNKE.
- Parameters:
active_coils (dict, optional) – Dictionary containing the active coil data.
- Returns:
coils_dict – Dictionary with vectorised properties of all active coils.
- Return type:
dict
- freegsnke.build_machine.build_actives(active_coils)[source]
Build the coils (and any circuits) in FreeGSNKE using the MultiCoil and Circuit functionality from FreeGS4E.
- Parameters:
active_coils (dict, optional) – Dictionary containing the active coil data.
- Returns:
coils – List of coils and circuits to be ingested by FreeGSNKE/FreeGS4E.
- Return type:
list
- freegsnke.build_machine.build_passives(passive_coils, coil_circuits, coils_dict, coil_names, refine_mode)[source]
Build the passive structures in FreeGSNKE using the PassiveStructure function.
- Parameters:
passive_coils (dict) – Dictionary containing data for passive coils.
coil_circuits (list) – List of coil circuit objects.
coils_dict (dict) – Dictionary of coil data.
coil_names (list) – List of circuitcoil names and passive structures.
refine_mode (str, optional) – Choose the refinement mode for extended passive structures (input as polygons), by default ‘G’ for ‘grid’ (use ‘LH’ for alternative mode using a Latin Hypercube implementation).
- Returns:
coil_circuits (list) – List of coil circuit objects.
coils_dict (dict) – Dictionary of coil data.
coil_names (list) – List of circuitcoil names and passive structures.
- freegsnke.build_machine.load_data_dicts(active_coils_data=None, passive_coils_data=None, limiter_data=None, wall_data=None, active_coils_path=None, passive_coils_path=None, limiter_path=None, wall_path=None)[source]
Load the standarised input data required to build the tokamak machine.
These dictionaries/lists/arrays can either be provided directly or loaded from pickle files.
- Parameters:
active_coils_data (dict, optional) – Dictionary containing the active coil data.
passive_coils_data (dict, optional) – Dictionary containing the passive structure data.
limiter_data (dict, optional) – Dictionary containing the limiter data.
wall_data (dict, optional) – Dictionary containing the wall data.
active_coils_path (str, optional) – Path to the pickle file containing the active coil data.
passive_coils_path (str, optional) – Path to the pickle file containing the passive structure data.
limiter_path (str, optional) – Path to the pickle file containing the limiter data.
wall_path (str, optional) – Path to the pickle file containing the wall data.
- Returns:
active_coils_data (dict) – Dictionary containing active coil data.
passive_coils_data (dict) – Dictionary containing passive structure data.
limiter_data (dict) – Dictionary containing the limiter data.
wall_data (dict) – Dictionary containing the wall data.
- freegsnke.build_machine.tokamak(active_coils_data=None, passive_coils_data=None, limiter_data=None, wall_data=None, magnetic_probe_data=None, active_coils_path=None, passive_coils_path=None, limiter_path=None, wall_path=None, magnetic_probe_path=None, refine_mode='G')[source]
Load the standarised input data required to build the tokamak machine.
These dictionaries/lists/arrays can either be provided directly or loaded from pickle files.
At minimum, the tokamak requires active coil data and a limiter (to contain the plasma). The passives, the wall, and the magnetic probes are optional.
- Parameters:
active_coils_data (dict, optional) – Dictionary containing the active coil data.
passive_coils_data (dict, optional) – Dictionary containing the passive structure data.
limiter_data (dict, optional) – Dictionary containing the limiter data.
wall_data (dict, optional) – Dictionary containing the wall data.
magnetic_probe_data (dict, optional) – Dictionary containing the magnetic probes data.
active_coils_path (str, optional) – Path to the pickle file containing the active coil data.
passive_coils_path (str, optional) – Path to the pickle file containing the passive structure data.
limiter_path (str, optional) – Path to the pickle file containing the limiter data.
wall_path (str, optional) – Path to the pickle file containing the wall data.
magnetic_probe_path (str, optional) – Path to the pickle file containing the magnetic probe data.
refine_mode (str, optional) – Choose the refinement mode for extended passive structures (input as polygons), by default ‘G’ for ‘grid’ (use ‘LH’ for alternative mode using a Latin Hypercube implementation).
- Returns:
tokamak – Returns an object containing the tokamak machine decsription.
- Return type:
class