gvec.core.run#
run gvec from python
- class gvec.core.run.Run(params: Mapping, state: Path | State | None = None, redirect_gvec_stdout: bool = True, quiet: bool = True, parameter_format: Literal['toml', 'yaml'] = 'toml')#
Bases:
object- plot_diagnostics_current_profiles()#
- plot_diagnostics_minimization()#
- plot_diagnostics_run()#
- run(keep_intermediates: Literal['all', 'stages'] | None = None)#
Sequentially run the stages of the Run object.
- Parameters:
keep_intermediates (Literal["all", "stages"] | None, optional) – Whether to keep intermediate results of GVEC. With “all”, all intermediate results are kept. With “stages”, only the final restarts from each stage are kept. With None, all intermediate results are deleted. The default is None.
- Returns:
The final state (gvec.State) and the diagnostics dataset (xr.DataSet)
- Return type:
tuple
- Raises:
ValueError – If keep_intermediates is not None, “stages” or “all”
ValueError – If stages are set when ‘picard_current=”auto”’
KeyError – If ‘iota_tol’ is not specified when ‘I_tor’ is provided.
ValueError – If ‘picard_current.target’ is not properly specified.
- run_single_minimization()#
Run a single GVEC energy minimization using the current parameters. The run-state is updated after the run.
- gvec.core.run.auto_generate_stages(minimize_target: float, iota_target: float)#
Generate stages for ‘picard_current’ by ramping ‘minimize_tol’ and ‘iota_target’. The first stage always targets ‘iota’, the other stages target ‘iota_and_force’
- Parameters:
minimize_target (float) – Final ‘minimize_tol’, i.e. the MHD force tolerance.
iota_target (float) – Final ‘iota_tol’, i.e. the rms. tolerance on the targeted ‘I_tor’ profile.
- Returns:
stages – List of dicts containing the changed parameters for each stage.
- Return type:
list
- gvec.core.run.fortran_run(parameterfile: str | Path, restartfile: str | Path | None = None, MPIcomm: int | None = None, stdout_path: str | Path | None = 'stdout.txt')#
Run gvec from python
- Parameters:
parameterfile (str) – Path to / name of parameter file
restartfile (str) – Path to / name of GVEC restart file, optional
MPIcomm (int) – MPI communicator, optional (default in GVEC (if compiled with MPI) is MPI_COMM_WORLD)
stdout_path (str) – Path to / name of file to redirect the standard output of GVEC. Optional, default is “stdout.txt”. If set to None, stdout is not redirected
- gvec.core.run.run(parameters: Mapping | Path | str, restartstate: Path | None = None, runpath: str | Path | None = None, redirect_gvec_stdout: bool = True, quiet: bool = False, parameter_format: Literal['toml', 'yaml'] = 'toml', keep_intermediates: Literal['all', 'stages'] | None = None, loglevel: Literal['WARNING', 'INFO', 'DEBUG'] = 'WARNING')#
Run GVEC with the provided parameters.
- Parameters:
parameters (Mapping | Path | str) – GVEC parameter dictionary or parameter file.
restartstate (Path | None, optional) – Path to restart file or restart State object, by default None
runpath (Path | str | None, optional) – Path to the directory where GVEC is executed. Overwrites existing directories or cerates a new directory if it does not exist. The default is None.
redirect_gvec_stdout (bool, optional) – Whether to redirect GVEC’s stdout. The default is True.
quiet (bool, optional) – Whether to suppress all output. The default is False.
parameter_format (Literal["toml", "yaml"], optional) – Format of the parameter file automatically generated if picard_current=”auto”, by default “toml”
keep_intermediates (Literal["all", "stages"] | None, optional) – Whether to keep intermediate results of GVEC. With “all”, all intermediate results are kept. With “stages”, only the final restarts from each stage are kept. With None, all intermediate results are deleted. The default is None.
verbosity (Literal["WARNING", "INFO", "DEBUG"], optional) – Verbosity level of the screen output. The default is “quiet”.
- Returns:
Run-object containing history and current state of the GVEC run.
- Return type:
gvec.Run