HASEonGPU.Simulation

class HASEonGPU.Simulation(gainMedium, pump, phiASE, timeIntegrationSolver, timeStep, crossSections=None, endTime=None, constants=<factory>, updateTerminalLevel=True)

Bases: object

High-level pump, ASE, fluorescence, and time-integration loop.

Register onInit or beforeStep callbacks when a function needs the live Simulation object and may inspect or mutate it. Register onStep callbacks when a function needs the completed TimeStepState snapshot produced by each step.

Parameters:
gainMedium: GainMedium

Geometry, material data, and current beta arrays.

pump: PumpProperties

Pump model that adds population to betaCells.

phiASE: PhiASE

ASE configuration and execution handle.

timeIntegrationSolver: TimeIntegrationSolver

Solver object that advances betaCells using d beta / dt.

timeStep: float

Physical time increment per step, in seconds.

crossSections: CrossSectionData | None = None

Shared spectra used by pump and ASE when not set on either object.

endTime: float | None = None

Optional target physical time for runUntil().

constants: Constants

Physical constants used by the pump integrator.

updateTerminalLevel: bool = True

Whether the last z-level beta values are advanced by the solver.

onStep(callback)

Register callback(state) to run after every completed step.

state is a TimeStepState containing copied result arrays such as betaCells, betaVolume, phiAse, dndtPump, and dndtAse. Callback return values are ignored.

onInit(callback)

Register callback(simulation) to run once before the first step.

The callback receives this live Simulation object, so it can read or change gainMedium, pump, phiASE, timeStep, and other simulation settings before any derivative is evaluated.

beforeStep(callback)

Register callback(simulation) to run before every step.

The callback receives this live Simulation object at the current time and stepIndex. Use this for controlled changes to inputs before the next time-step update.

runUntil(endtime=None, endTime=None)

Advance steps until the configured or supplied end time is reached.

runSteps(steps)

Run exactly steps calls to step() and return self.

step()

Advance one time step and return the completed TimeStepState.

getResults()

Return all stored TimeStepState snapshots in step order.

property time

Current physical simulation time in seconds.

property stepIndex

Number of completed time steps.