bluemira.codes.process._teardown ================================ .. py:module:: bluemira.codes.process._teardown .. autoapi-nested-parse:: PROCESS teardown functions Classes ------- .. autoapisummary:: bluemira.codes.process._teardown.Teardown bluemira.codes.process._teardown._MFileWrapper Functions --------- .. autoapisummary:: bluemira.codes.process._teardown._raise_on_infeasible_solution Module Contents --------------- .. py:class:: Teardown(params: bluemira.codes.process.params.ProcessSolverParams, run_directory: str, read_directory: str) Bases: :py:obj:`bluemira.codes.interface.CodesTeardown` .. autoapi-inheritance-diagram:: bluemira.codes.process._teardown.Teardown :parts: 1 :private-bases: Teardown task for PROCESS solver. :param params: The parameters for this task. :param run_directory: The directory in which to run PROCESS. Used in run, and runinput functions. :param read_directory: The directory to read PROCESS output files from. Used in read, readall, and mock functions. .. py:attribute:: params :type: bluemira.codes.process.params.ProcessSolverParams .. py:attribute:: MOCK_JSON_NAME :value: 'mockPROCESS.json' .. py:attribute:: run_directory .. py:attribute:: read_directory .. py:attribute:: _mfile_wrapper :type: _MFileWrapper :value: None .. py:attribute:: ordered_radial_build .. py:method:: run() Teardown the PROCESS solver. This loads the MFile in the run directory and maps its outputs to bluemira parameters. .. py:method:: runinput() Teardown the PROCESS solver. This loads the MFile in the run directory and maps its outputs to bluemira parameters. .. py:method:: read() Teardown the PROCESS solver. This loads the MFile in the read directory and maps its outputs to bluemira parameters. .. py:method:: readall() Teardown the PROCESS solver. This loads the MFile in the read directory and maps its outputs to bluemira parameters. .. py:method:: 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. .. py:method:: get_raw_outputs(params: collections.abc.Iterable | str) -> list[float] Get raw variables from an MFILE. Mapped bluemira parameters will have bluemira names. :param params: Names of parameters to access. :rtype: The parameter values. :raises CodesError: Cannot read output before creation or cannot get mapping .. py:method:: _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``. .. py:method:: _read_mfile(path: str) Read an MFile, applying the given mappings, and performing unit conversions. .. py:method:: _get_output_or_raise(external_outputs: dict[str, Any], parameter_name: str) .. py:class:: _MFileWrapper(file_path: str, name: str = 'PROCESS') Utility class to wrap a PROCESS MFile, and map its data to bluemira parameters. :param file_path: Path to an MFile. .. py:attribute:: _name :value: 'PROCESS' .. py:attribute:: file_path .. py:attribute:: mfile .. py:attribute:: data .. py:attribute:: ordered_radial_build .. py:method:: read() -> dict Read the data from the PROCESS MFile. Store the result in ``data`` attribute. .. py:method:: _load_ordered_radial_build_vector() Read the data from the PROCESS MFile. Store the result in ``ordered_radial_build`` attribute. .. py:method:: _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 .. rubric:: 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. .. py:function:: _raise_on_infeasible_solution(m_file: _MFileWrapper) Check that PROCESS found a feasible solution. :param m_file: The PROCESS MFILE to check for a feasible solution :raises CodesError: If a feasible solution was not found.