ogstools.core.native_simulation_controller module#

class ogstools.core.native_simulation_controller.OGSNativeController[source]#

Bases: SimulationController

Controller for batch execution of OGS simulations.

Runs OGS as a separate process and waits for completion. Does not support stepwise execution or intermediate state inspection. Suitable for standard production runs. Objects should be used as read-only.

Initialize a native simulation controller.

Parameters:
  • model_ref (ogstools.Model) – The ogstools.Model to simulate.

  • sim_output (Path | str | None) – Optional path for simulation output directory.

  • overwrite (bool | None) – If True, overwrite existing output directory.

__init__(model_ref, sim_output=None, overwrite=None)[source]#

Initialize a native simulation controller.

Parameters:
  • model_ref (ogstools.Model) – The ogstools.Model to simulate.

  • sim_output (Path | str | None) – Optional path for simulation output directory.

  • overwrite (bool | None) – If True, overwrite existing output directory.

terminate()[source]#

Terminate the simulation if it is running.

Attempts to gracefully terminate the OGS process and all child processes. If graceful termination fails, forcefully kills them.

Return type:

bool

Returns:

True if the run was terminated successfully, False otherwise.

run(target=None, id=None)[source]#

Wait for the simulation to complete and return a Simulation object.

Blocks until the OGS process finishes.

Parameters:
  • target (Path | str | None) – Optional path for the simulation output directory.

  • id (str | None) – Optional identifier for the resulting Simulation.

Return type:

ogstools.Simulation

Returns:

A ogstools.Simulation object containing the completed simulation.

status_str()[source]#

Get a human-readable status description.

Return type:

str

Returns:

String describing the current simulation state and runtime.

property status: SimulationStatus#

Get the current simulation status.

Queries the process state to determine if the simulation is running, completed, or encountered an error.

Returns:

Current SimulationStatus.