finesse.analysis.actions.time module

class finesse.analysis.actions.time.TimeQuasiStatic(*, times: ndarray[float | int] | Iterable[float | int], time_variable: Parameter | None = None, lock_action: Action | None = None, other_analysis: Action | None = None, events: dict[float, Tuple[Action]] | None = None, output_all_steps: bool = True, show_progress: bool = False, name='time_quasi_static')[source]

Bases: Action

Class to represent a quasi-static time domain analysis action that can be applied in a simulation. It progresses finesse.elements.TemporalQuasiStaticElement objects through time steps. The general assumption for this analysis is that the system is quasi-static, optical fields changes are instantaneous and reach a steady state at every time step. This is a somewhat simplified model of the real world, but is applicable for slow changing systems such as thermal drifts or slow mechanical motions which have a time constant significantly larger than any optical time constant in the model.

The analysis allows you to perform other actions at each time step, such as locking the model to keep it on a stable operating point, or to perform other studies such as a frequency domain analysis at each time step.

A simple event system is provided to allow you to perform actions at specific time steps. The action will automatically adjust time steps so that events are hit exactly.

Any event or other analysis action are stored within the main solution for this action, which is a TimeQuasiStaticSolution object.

All detectors outputs are by default evaluated at each time step, and stored in the TimeQuasiStaticSolution.outputs ArraySolution. If you only want the final output, you can set output_all_steps to False.

The action will also update the time variable if one is provided, this accepts a finesse.parameter.Parameter object that will be updated with the current time. This allows components to be time dependent, such a time varying laser power, or mechanical drift.

Parameters

timesUnion[np.ndarray[Union[float, int]], Iterable[Union[float, int]]]

An array or iterable of time points at which the analysis will be performed.

time_variableParameter, optional

The time variable parameter, by default None.

lock_actionAction, optional

An action to lock during the analysis, by default None.

other_analysisAction, optional

Another analysis action to perform, by default None.

eventsdict[float, Tuple[Action]], optional

A dictionary of events with time keys and action tuples, by default None.

output_all_stepsbool, optional

Whether to output all steps, by default True.

show_progressbool, optional

Whether to show progress during the analysis, by default False.

namestr, optional

The name of the action, by default “time_quasi_static”.

Notes

Class to represent a quasi-static time domain analysis action that can be applied in a simulation. It progresses mechanical motions which have a time constant significantly larger than any The _do method performs the time quasi-static analysis by following these steps:

  1. Initialize the solution object and time steps.

  2. Check for events and insert event time steps if necessary.

  3. Initialize the time workspaces.

  4. Perform an initial lock to stabilize the system.

  5. Iterate through each time step:
    • Update the time variable.

    • Check and run any events at the current time.

    • Update the carrier state.

    • Update the time workspaces before the step.

    • Perform the lock action if specified.

    • Save the current state if output_all_steps is True.

    • Perform any other specified analysis.

    • Step forward in time for each workspace.

  6. Update the final output if output_all_steps is False.

  7. Return the solution object.

Raises

TypeError

If lock_action is not an Action object. If other_analysis is not an Action object. If times is not a numpy array, list, or tuple. If times array has zero length. If times array contains non-float or non-integer values.

ValueError

If event times are not floats. If event times are not monotonically increasing.

check_and_run_events(sol: TimeQuasiStaticSolution, state: AnalysisState, T: float)[source]

Check and run events if the current time is close to the event time.

Parameters

solobject

The solution object to which the event solution will be added.

stateobject

The current state object that can apply events.

Tfloat

The current time.

class finesse.analysis.actions.time.TimeQuasiStaticSolution[source]

Bases: BaseSolution

A class to represent a quasi-static solution in time domain analysis.

Attributes

outputsArraySolution, optional

The output solution array.

lock_lossbool, optional

A flag indicating whether lock loss occurred.

iterationsint, optional

The number of iterations performed.

failed_stepsint, optional

The number of failed steps during the solution process.

tnp.ndarray, optional

The time array for the solution.

stateslist, optional

A list of states for each time component at times t that can be used to represent the current state of an object.

failed_steps: int | None = None
iterations: int | None = None
lock_loss: bool | None = None
outputs: ArraySolution | None = None
states: dict[float, Iterable] | None = None
t: ndarray | None = None