pymoto.TransientSolve

class pymoto.TransientSolve(dt, end=None, x0=None, theta=1.0, solver=None)

Solves the transient thermal problem \(\mathbf{K}\mathbf{T} + \mathbf{C}\dot{\mathbf{T}} = \mathbf{Q}\)

Solves the transient thermal problem \(\mathbf{K}\mathbf{T} + \mathbf{C}\dot{\mathbf{T}} = \mathbf{Q}\), which becomes \((1-\theta)\mathbf{Q}^{\text{n-1}} + \theta\mathbf{Q}^{\text{n}} = (-\frac{\mathbf{C}}{\Delta t} + (1-\theta)\mathbf{K})\mathbf{T}^{\text{n-1}} + (\frac{\mathbf{C}}{\Delta t} + \theta\mathbf{K})\mathbf{T}^{\text{n}}\) for timestep n using numerical timestepping.

Input Signals:
  • b (dense matrix or vector): Right-hand-side matrix of size (n, Ntimesteps) or vector of size (n)

  • K (dense or sparse matrix): The system matrix \(\mathbf{K}\) of size (n, n)

  • C (dense or sparse matrix): The damping matrix \(\mathbf{C}\) of size (n, n)

Output Signals:
  • state (matrix): Solution matrix of size (n, Ntimesteps)

__init__(dt, end=None, x0=None, theta=1.0, solver=None)

Initialize the transient solver module

Parameters:
  • dt (-) – Size of time step (in seconds)

  • end (-) – End time of simulation (in seconds). If not provided, the number of time steps is deduced from the size of the input matrix b

  • x0 (-) – Initial state of size (n)

  • theta (-) – Time-stepping algorithm, 0.0 for forward Euler, 0.5 for Crank-Nicolson, 1.0 for backward Euler

  • solver (-) – Manually override the linear solver used, instead of the solver from pymoto.solvers.auto_determine_solver()

Methods

__init__(dt[, end, x0, theta, solver])

Initialize the transient solver module

connect(sig_in[, sig_out])

Connect without automatic adding to a function network

get_input_sensitivities([as_list])

get_input_states([as_list])

get_output_sensitivities([as_list])

get_output_states([as_list])

reset()

Reset the state of the sensitivities (they are set to zero or to None)

response()

Calculate the response from sig_in and output this to sig_out

sensitivity()

Calculate sensitivities using backpropagation

Attributes

n_in

Get the number of input signals

n_out

Get the number of output signals

sig_in

sig_out

connect(sig_in: Signal | Iterable[Signal], sig_out: Signal | Iterable[Signal] = None)

Connect without automatic adding to a function network

get_input_sensitivities(as_list=False)
get_input_states(as_list=False)
get_output_sensitivities(as_list=False)
get_output_states(as_list=False)
property n_in: int

Get the number of input signals

property n_out: int

Get the number of output signals

Note: Cannot be used in the initial __call__()

reset()

Reset the state of the sensitivities (they are set to zero or to None)

response()

Calculate the response from sig_in and output this to sig_out

sensitivity()

Calculate sensitivities using backpropagation

Based on the sensitivity we get from sig_out, reverse the process and output the new sensitivities to sig_in

sig_in: List = None
sig_out: List = None