time_grid

Define time grid.

class time_grid.TimeGrid(params, x, dz, DT_funx, default_parameters, logger)[source]

Bases: object

Store time-related parameters.

Variables:
  • th (float) – Simulation time in h.

  • ts (float) – Simulation time in s.

  • dt_multiplier (float) – Factor by which default time step is multiplied (see make_time_steps()).

  • dt (float) – Time step size in s.

  • nt (int) – Number of time steps (positions in time sequence), including 0.

  • num_out (int) – Number of time steps where simulation results are stored and saved on file.

  • saved_steps (list of int) – Steps for which simulation results are stored and saved in log.

  • saved_th (list of float) – Times in h for which simulation results are stored and saved in log.

  • default_params (dict) – Parameters used when not specified in user input.

  • logger (log_utils.CustomLogger) – Logger.

__init__(params, x, dz, DT_funx, default_parameters, logger)[source]

Class constructor.

The time step dt is calculated to ensure the stability of explicit schemes, with Fourier given in default_parameters. The DT value is calculated from the initial atom fraction profile. The time step can be made smaller using the user-specified dt_multiplier or nt_multiplier.

Parameters:
  • params (dict) – Time-related input parameters.

  • x (dict of 1D array) – Initial atom fraction profile.

  • dz (1D array) – Initial space step.

  • DT_funx (function) – Calculates tracer diffusion coefficients.

  • default_parameters (dict) – Parameters used when not specified in user input.

  • logger (log_utils.CustomLogger) – Logger.

Raises:
make_time_steps(x, dz, DT_funx)[source]

Calculate time steps.

make_saved_steps(params)[source]

Add list of time steps where simulation results will be saved to file.

The time steps are determined based on the num_out parameter.