pyopensn.solver.TransientSolver

class pyopensn.solver.TransientSolver

Transient solver.

Wrapper of opensn::TransientSolver.

Advance(self: pyopensn.solver.TransientSolver) None

Advance the solver by a single timestep.

Notes

You must call Initialize() before calling Advance() or Execute().

ComputeBalanceTable(self: pyopensn.solver.TransientSolver) dict

Compute and return the global balance table using the solver’s normalization. This is a collective operation and must be called on all ranks.

Returns:

Dictionary with the following entries:

  • absorption_rate: Global absorption rate, approximately integral sigma_a * phi dV summed over groups and the full domain.

  • production_rate: Global volumetric production/source rate used by the solver, approximately integral Q dV summed over groups and the full domain.

  • inflow_rate: Global incoming boundary contribution integrated over incoming angular flux on boundaries.

  • outflow_rate: Global outgoing boundary contribution accumulated from face outflow tallies.

  • balance: Rate balance, production_rate + inflow_rate - absorption_rate - outflow_rate.

  • initial_inventory: Total particle inventory at the start of the timestep, computed as integral (1 / v_g) * phi_old dV summed over groups and the full domain.

  • final_inventory: Total particle inventory at the end of the timestep, computed as integral (1 / v_g) * phi_new dV summed over groups and the full domain.

  • predicted_inventory_change: Inventory change predicted by the current timestep balance, computed as dt * balance.

  • actual_inventory_change: Measured change in total particle inventory over the timestep, computed as final_inventory - initial_inventory.

  • inventory_residual: Mismatch between the measured and predicted timestep inventory changes, computed as actual_inventory_change - predicted_inventory_change.

Return type:

dict

Notes

This solver applies no extra normalization to the balance table.

The transient inventory terms currently use the end-of-step rate balance to estimate the timestep inventory change.

Execute(self: pyopensn.solver.Solver) None

Execute the solver.

Initialize(self: pyopensn.solver.Solver) None

Initialize the solver.

SetPostAdvanceCallback(*args, **kwargs)

Overloaded function.

  1. SetPostAdvanceCallback(self: pyopensn.solver.TransientSolver, arg0: Callable[[], None]) -> None

    Register a callback that runs after each advance within Execute().

    callbackOptional[Callable[[], None]]

    Function invoked after the solver advances a timestep. Pass None to clear.

  2. SetPostAdvanceCallback(self: pyopensn.solver.TransientSolver, arg0: None) -> None

Clear the PostAdvance callback by passing None.

SetPreAdvanceCallback(*args, **kwargs)

Overloaded function.

  1. SetPreAdvanceCallback(self: pyopensn.solver.TransientSolver, arg0: Callable[[], None]) -> None

    Register a callback that runs before each advance within Execute().

    callbackOptional[Callable[[], None]]

    Function invoked before the solver advances a timestep. Pass None to clear. If the callback modifies the timestep, the new value is used for the upcoming step.

  2. SetPreAdvanceCallback(self: pyopensn.solver.TransientSolver, arg0: None) -> None

Clear the PreAdvance callback by passing None.

SetTheta(self: pyopensn.solver.TransientSolver, arg0: float) None

Set the theta parameter used by Advance().

Parameters:

theta (float) – Theta value between 1.0e-16 and 1.

SetTimeStep(self: pyopensn.solver.TransientSolver, arg0: float) None

Set the timestep size used by Advance().

Parameters:

dt (float) – New timestep size.

__init__(self: pyopensn.solver.TransientSolver, **kwargs) None

Construct a transient solver.

Parameters:
  • pyopensn.solver.DiscreteOrdinatesProblem (DiscreteOrdinatesProblem) – Existing discrete ordinates problem instance.

  • dt (float, optional, default=2.0e-3) – Time step size used during the simulation.

  • stop_time (float, optional, default=0.1) – Simulation end time.

  • theta (float, optional, default=0.5) – Time differencing scheme parameter.

  • initial_state (str, optional, default="existing") – Initial state for the transient solve. Allowed values: existing, zero. In “zero” mode, scalar flux vectors are reset to zero.

  • verbose (bool, optional, default=True) – Enable verbose logging.