bluemira.codes.plasmod.api._solver ================================== .. py:module:: bluemira.codes.plasmod.api._solver .. autoapi-nested-parse:: The API for the plasmod solver. Classes ------- .. autoapisummary:: bluemira.codes.plasmod.api._solver.RunMode bluemira.codes.plasmod.api._solver.Solver Module Contents --------------- .. py:class:: RunMode(*args, **kwds) Bases: :py:obj:`bluemira.codes.interface.BaseRunMode` .. autoapi-inheritance-diagram:: bluemira.codes.plasmod.api._solver.RunMode :parts: 1 :private-bases: RunModes for plasmod .. py:attribute:: RUN .. py:attribute:: READ .. py:attribute:: MOCK .. py:class:: Solver(params: dict | bluemira.base.parameter_frame.ParameterFrame, build_config: dict[str, Any] | None = None) Bases: :py:obj:`bluemira.codes.interface.CodesSolver` .. autoapi-inheritance-diagram:: bluemira.codes.plasmod.api._solver.Solver :parts: 1 :private-bases: Plasmod solver class. :param params: ParameterFrame for plasmod. :param build_config: Build configuration dictionary. Expected keys include: - binary: str, path to the plasmod binary. - problem_settings: Dict[str, Any], any plasmod specific parameters (i.e., parameters that bluemira does not have direct mappings to through the ParameterFrame). - input_file: str, the path to write the plasmod input file to, this can be a relative path. - output_file: str, the path to write the plasmod scalar output file to. - profiles_file: str, the path to write the plasmod profiles output file to. .. py:attribute:: name :value: 'PLASMOD' The name of the solver. In the base class, this is used to find mappings and specialise error messages for the concrete solver. .. py:attribute:: setup_cls Class defining the run modes for the setup stage of the solver. Typically, this class performs parameter mappings for some external code, or derives dependent parameters. But it can also define any required non-computational set up. .. py:attribute:: run_cls Class defining the run modes for the computational stage of the solver. This class is where computations should be defined. This may be something like calling a bluemira problem, or executing some external code or process. .. py:attribute:: teardown_cls Class defining the run modes for the teardown stage of the solver. This class should perform any clean-up operations required by the solver. This may be deleting temporary files, or could involve mapping parameters from some external code to bluemira parameters. .. py:attribute:: run_mode_cls Class enumerating the run modes for this solver. Common run modes are RUN, MOCK, READ, etc,. .. py:attribute:: DEFAULT_INPUT_FILE :value: 'plasmod_input.dat' .. py:attribute:: DEFAULT_OUTPUT_FILE :value: 'plasmod_output.dat' .. py:attribute:: DEFAULT_PROFILES_FILE :value: 'plasmod_profiles.dat' .. py:attribute:: _setup :type: bluemira.codes.plasmod.api._setup.Setup .. py:attribute:: _run :type: bluemira.codes.plasmod.api._run.Run .. py:attribute:: _teardown :type: bluemira.codes.plasmod.api._teardown.Teardown .. py:attribute:: params .. py:attribute:: build_config .. py:attribute:: binary .. py:attribute:: problem_settings .. py:attribute:: input_file .. py:attribute:: output_file .. py:attribute:: profiles_file .. py:attribute:: run_directory .. py:attribute:: read_directory .. py:method:: execute(run_mode: str | RunMode) -> bluemira.base.parameter_frame.ParameterFrame Execute this plasmod solver. This solver: 1. writes a plasmod input file using the given bluemira and problem parameters. 2. processes that file using a shell call to plasmod. 3. reads the plasmod output files, and updates this object's ParameterFrame with the results. :param run_mode: The mode to execute this solver in. .. py:method:: _scale_x_profile() .. py:method:: _from_phi_to_psi(profile_data) Convert the profile to the magnetic coordinate sqrt((psi - psi_ax)/(psi_b - psi_ax)) .. py:method:: get_profile(profile: str | bluemira.codes.plasmod.mapping.Profiles) -> numpy.ndarray Get a single plasmod profile. :param profile: A profile to get the data for. :rtype: A plasmod profile. .. rubric:: Notes pprime and ffprime profiles from PLASMOD are currently inconsistent with the output jpar profile, even if isawt=FULLY_RELAXED. This is a known issue, and is under investigation. In the meantime, a crude rescaling of the flux functions is provided here. .. py:method:: get_profiles(profiles: collections.abc.Iterable[str | bluemira.codes.plasmod.mapping.Profiles]) -> dict[bluemira.codes.plasmod.mapping.Profiles, numpy.ndarray] Get a dictionary of plasmod profiles. :param profiles: An iterable of Profiles enum values. :rtype: A dictionary mapping profile enum to values. .. py:method:: plasmod_outputs() -> bluemira.codes.plasmod.api._outputs.PlasmodOutputs Return a structure of unmapped plasmod outputs. Use :code:`params` attribute for mapped outputs. :rtype: The scalar plasmod outputs. :raises CodesError: plasmod must be run before there are outputs