pyrtid.forward.models.TimeParameters#

class pyrtid.forward.models.TimeParameters(duration: float, dt_init: float, dt_min: Optional[float] = None, dt_max: Optional[float] = None, courant_factor: float = 1.0)[source]#

Bases: object

Class defining the time parameters used in the simulation.

It also handles the variable timestep.

Attributes
  • duration (float) – Desired duration of the simulation.Duration

  • dt (float) – Current timestep in seconds.

  • dt_init (float) – Initial timestep in seconds.

  • dt_min (Optional[float]) – Minimum timestep in seconds.

  • dt_max (Optional[float]) – Maximum timestep in seconds.

  • courant_factor (float) – The timestep is generally limited to some maximum value by the flow and transport models, to assure numerical stability. The Courant-Friedlichs- Lewy-Factor is a relaxation parameter for the maximum timestep. Reactive systems often allow to relax the (very restrictive) maximum timestep, imposed by the transport model. For values greater than 1, the timestep re- striction will be relaxed. On the contrary, the restriction will be tightened for values inferior to 1. Reactive systems often allow to relax the maximum timestep by a factor 5, 10 or even 20. Using this option, however, may be dangerous and possibly lead to failure of the model. Always test the results obtained against a case without this parameter set. The default is 1.0.

  • ldt (List[float]) – List of successive timesteps (in seconds) used in the forward modelling.

  • nts (int) – Number of timesteps in the simulation.

  • nt (int) – Number of times in the simulation (nts + 1).

  • nfpi (int) – Number of fixed point iterations used in the last time iteration.

  • lnfpi – List of the number of fixed point iterations used for each time iteration. This list should have the same length as ldt.

  • times (NDArrayFloat) – Array of times in second from 0 to t_max.”

__init__(duration: float, dt_init: float, dt_min: Optional[float] = None, dt_max: Optional[float] = None, courant_factor: float = 1.0) None[source]#

Initialize the instance.

Methods definition

get_dt_max_cfl(model: ForwardModel, time_index: int) float[source]#

Get the maximum timestep to respect the CFL condition.

reset_to_init() None[source]#

Empty the list of timesteps and set dt to its initial value.

save_dt() None[source]#

Save the current timestep to the list of timesteps.

save_nfpi() None[source]#

Save the current number of fixed point iterations.

update_dt(n_iter: float, dt_max_cfl: float, max_fpi: int) None[source]#

Update the timestep.

Parameters
  • n_iter (int) – Number of iterations required to solve the last timestep.

  • dt_max_cfl (float) – Maximum timestep according to the CFL.

  • max_fpi (int) – Maximum number of fixed point iterations per timestep.

property nt: int#

Number of times (including t0).

It is the number of timesteps (nts) +1.

property nts: int#

Number of timesteps (dt).

It is the number of times (nt) - 1.

property time_elapsed: float#

Time elapsed in the simulation.

property times: ndarray[Any, dtype[float64]]#

Return all the times in second from 0 to t_max.