bluemira.codes.plasmod.api._setup

Defines the ‘Setup’ stage of the plasmod solver.

Classes

Setup

Setup task for a plasmod solver.

Module Contents

class bluemira.codes.plasmod.api._setup.Setup(params: bluemira.codes.plasmod.params.PlasmodSolverParams, problem_settings: dict[str, Any], plasmod_input_file: str)

Bases: bluemira.codes.interface.CodesSetup

Inheritance diagram of bluemira.codes.plasmod.api._setup.Setup

Setup task for a plasmod solver.

On run, this task writes a plasmod input file using the input values defined in this class.

Parameters:
  • params (bluemira.codes.plasmod.params.PlasmodSolverParams) – The bluemira parameters for the task. Note that this task does not apply any mappings to the ParameterFrame, so they should already be set. Most likely by a solver.

  • problem_settings (dict[str, Any]) – Any non-bluemira parameters that should be passed to plasmod.

  • plasmod_input_file (str) – The path where the plasmod input file should be written.

params: bluemira.codes.plasmod.params.PlasmodSolverParams
inputs
plasmod_input_file
run()

Run plasmod setup.

mock()

Run plasmod setup in mock mode.

No need to generate an input file as results will be mocked.

read()

Run plasmod setup in read mode.

No need to generate an input file as results will be read from file.

update_inputs(new_inputs: dict[str, float | enum.Enum] | None = None)

Update plasmod inputs using the given values.

This also pulls input values from the task’s ParameterFrame and uses them to update the inputs attributes. The inputs to this method take precedence over inputs in the ParameterFrame.

Parameters:

new_inputs (dict[str, float | enum.Enum] | None) – The new inputs to update with.

Notes

Updates this class’s inputs attribute.

static _remove_non_plasmod_inputs(_inputs: dict[str, Any]) dict[str, Any]

Remove non-plasmod inputs from a dictionary. Warn that the removed inputs will be ignored.

This copies the original dictionary, the input dictionary is not modified.

Parameters:

_inputs (dict[str, Any])

Return type:

dict[str, Any]

_write_input()

Write inputs to file to be read by plasmod.

Raises:

CodesError – Cannot write input file