Parallel SDC (parallel_sdc)¶
- class pypint.solvers.parallel_sdc.ParallelSdc(**kwargs)[source]¶
Bases: pypint.solvers.i_iterative_time_solver.IIterativeTimeSolver, pypint.solvers.i_parallel_solver.IParallelSolver
Spectral Deferred Corrections method for solving first order ODEs.
The Spectral Deferred Corrections (SDC) method is described in [Minion2003] (Equation 2.7)
Default Values:
-
- max_threshold: 10
- min_threshold: 1e-7
- conditions: ('residual', 'iterations')
num_nodes: 3
Given the total number of time steps \(T_{max}\), number of integration nodes per time step \(N\), current time step \(t \in [0,T_{max})\) and the next integration node to consider \(n \in [0, N)\). Let \([a,b]\) be the total time interval to integrate over. For \(T_{max}=3\) and \(N=4\), this can be visualized as:
a b | | | . . | . . | . . | t 0 0 0 0 1 1 1 2 2 2 n 0 1 2 3 1 2 3 1 2 3 i 0 1 2 3 4 5 6 7 8 9
In general, the value at \(a\) (i.e. \(t=n=i=0\)) is the initial value.
See also
- IIterativeTimeSolver :
- implemented interface
- IParallelSolver :
- mixed-in interface
- _init_new_interval(start)[source]¶
Initializes a new work interval
Parameters: start (float) – start point of new interval Returns: has_work – True if new interval have been initialized; False if no new interval have been initialized (i.e. new interval end would exceed end of time given by problem) Return type: bool
- _init_new_state()[source]¶
Initialize a new state for a work task
Usually, this starts a new work task. The previous state, if applicable, is stored in a stack.
- init(problem, integrator, **kwargs)[source]¶
Initializes SDC solver with given problem and integrator.
Parameters: - num_time_steps (int) – Number of time steps to be used within the time interval of the problem.
- num_nodes (int) – (otional) number of nodes per time step
- nodes_type (INodes) – (optional) Type of integration nodes to be used (class name, NOT instance).
- weights_type (IWeightFunction) – (optional) Integration weights function to be used (class name, NOT instance).
- classic (bool) – (optional) Flag for specifying the type of the SDC sweep. True: (default) For the classic SDC as known from the literature; False: For the modified SDC as developed by Torbjörn Klatt.
Raises: ValueError –
- if given problem is not an IInitialValueProblem
- if number of nodes per time step is not given; neither through num_nodes, nodes_type nor integrator
See also
- IIterativeTimeSolver.init()
- overridden method (with further parameters)
- IParallelSolver.init()
- mixed in overridden method (with further parameters)
- run(core, **kwargs)[source]¶
Applies SDC solver to the initialized problem setup.
Solves the given problem with the explicit SDC algorithm.
Parameters: - core (SdcSolverCore) – core solver stepping method
- dt (float) – width of the interval to work on; this is devided into the number of given time steps this solver has been initialized with
See also
IIterativeTimeSolver.run() : overridden method
- classic[source]¶
Read-only accessor for the type of SDC
Returns: is_classic – True if it’s the classic SDC as known from papers; False if it’s the modified SDC by Torbjörn Klatt Return type: bool
- num_nodes[source]¶
Accessor for the number of integration nodes per time step.
Returns: number_of_nodes – Number of integration nodes used within one time step. Return type: int
- num_time_steps[source]¶
Accessor for the number of time steps within the interval.
Returns: number_time_steps – Number of time steps within the problem-given time interval. Return type: int
- state[source]¶
Read-only accessor for the sovler’s state
Returns: state Return type: ISolverState
-