bluemira.codes.process._teardown
PROCESS teardown functions
Classes
Teardown task for PROCESS solver. |
|
Utility class to wrap a PROCESS MFile, and map its data to bluemira |
Functions
|
Check that PROCESS found a feasible solution. |
Module Contents
- class bluemira.codes.process._teardown.Teardown(params: bluemira.codes.process.params.ProcessSolverParams, run_directory: str, read_directory: str)
Bases:
bluemira.codes.interface.CodesTeardownTeardown task for PROCESS solver.
- Parameters:
params (bluemira.codes.process.params.ProcessSolverParams) – The parameters for this task.
run_directory (str) – The directory in which to run PROCESS. Used in run, and runinput functions.
read_directory (str) – The directory to read PROCESS output files from. Used in read, readall, and mock functions.
- MOCK_JSON_NAME = 'mockPROCESS.json'
- run_directory
- read_directory
- _mfile_wrapper: _MFileWrapper = None
- ordered_radial_build
- run()
Teardown the PROCESS solver.
This loads the MFile in the run directory and maps its outputs to bluemira parameters.
- runinput()
Teardown the PROCESS solver.
This loads the MFile in the run directory and maps its outputs to bluemira parameters.
- read()
Teardown the PROCESS solver.
This loads the MFile in the read directory and maps its outputs to bluemira parameters.
- readall()
Teardown the PROCESS solver.
This loads the MFile in the read directory and maps its outputs to bluemira parameters.
- mock()
Mock teardown the PROCESS solver.
This loads a mockProcess.json file from the run directory and loads the values into this task’s params.
- get_raw_outputs(params: collections.abc.Iterable | str) list[float]
Get raw variables from an MFILE.
Mapped bluemira parameters will have bluemira names.
- Parameters:
params (collections.abc.Iterable | str) – Names of parameters to access.
- Return type:
The parameter values.
- Raises:
CodesError – Cannot read output before creation or cannot get mapping
- _load_mfile(path: str, *, recv_all: bool)
Load the MFile at the given path, and update this object’s params with the MFile’s values.
If recv_all, then ignore existing mappings and update all the params that correspond to a PROCESS output. If recv_all is False, then only update a parameter if its mapping has
recv == True.- Parameters:
path (str)
recv_all (bool)
- _read_mfile(path: str)
Read an MFile, applying the given mappings, and performing unit conversions.
- Parameters:
path (str)
- _get_output_or_raise(external_outputs: dict[str, Any], parameter_name: str)
- Parameters:
external_outputs (dict[str, Any])
parameter_name (str)
- class bluemira.codes.process._teardown._MFileWrapper(file_path: str, name: str = 'PROCESS')
Utility class to wrap a PROCESS MFile, and map its data to bluemira parameters.
- Parameters:
file_path (str) – Path to an MFile.
name (str)
- _name = 'PROCESS'
- file_path
- mfile
- data
- ordered_radial_build
- read() dict
Read the data from the PROCESS MFile.
Store the result in
dataattribute.- Return type:
dict
- _load_ordered_radial_build_vector()
Read the data from the PROCESS MFile.
Store the result in
ordered_radial_buildattribute.
- _derive_radial_build_params(data: dict) dict[str, float]
Derive radial build parameters that PROCESS does not directly calculate.
- Returns:
The derived parameters
- Raises:
CodesError – Cannot derive required parameters from data
- Parameters:
data (dict)
- Return type:
dict[str, float]
Notes
The PROCESS radial build is taken along the diagonal (maximum length) of the TF coil, so this must be taken into consideration when translating the geometry into the mid-plane.
- bluemira.codes.process._teardown._raise_on_infeasible_solution(m_file: _MFileWrapper)
Check that PROCESS found a feasible solution.
- Parameters:
m_file (_MFileWrapper) – The PROCESS MFILE to check for a feasible solution
- Raises:
CodesError – If a feasible solution was not found.