implementations.problem_classes.Van_der_Pol_implicit module¶
- class vanderpol(u0=None, mu=5.0, newton_maxiter=100, newton_tol=1e-09, stop_at_nan=True, crash_at_maxiter=True, relative_tolerance=False)[source]¶
Bases:
Problem
This class implements the stiff Van der Pol oscillator given by the equation
\[\frac{d^2 u(t)}{d t^2} - \mu (1 - u(t)^2) \frac{d u(t)}{dt} + u(t) = 0.\]- Parameters:
u0 (sequence of array_like, optional) – Initial condition.
mu (float, optional) – Stiff parameter \(\mu\).
newton_maxiter (int, optional) – Maximum number of iterations for Newton’s method to terminate.
newton_tol (float, optional) – Tolerance for Newton to terminate.
stop_at_nan (bool, optional) – Indicate whether Newton’s method should stop if
nan
values arise.crash_at_maxiter (bool, optional) – Indicates whether Newton’s method should stop if maximum number of iterations
newton_maxiter
is reached.relative_tolerance (bool, optional) – Use a relative or absolute tolerance for the Newton solver
- work_counters¶
Counts different things, here: Number of evaluations of the right-hand side in
eval_f
and number of Newton calls in each Newton iterations are counted.- Type:
- dtype_f¶
alias of
mesh
- dtype_u¶
alias of
mesh
- eval_f(u, t)[source]¶
Routine to compute the right-hand side for both components simultaneously.
- Parameters:
u (dtype_u) – Current values of the numerical solution.
t (float) – Current time at which the numerical solution is computed (not used here).
- Returns:
f – The right-hand side (contains 2 components).
- Return type:
dtype_f
- solve_system(rhs, dt, u0, t)[source]¶
Simple Newton solver for the nonlinear system.
- Parameters:
rhs (dtype_f) – Right-hand side for the nonlinear system.
dt (float) – Abbrev. for the node-to-node stepsize (or any other factor required).
u0 (dtype_u) – Initial guess for the iterative solver.
t (float) – Current time (e.g. for time-dependent BCs).
- Returns:
u – The solution u.
- Return type:
dtype_u
- u_exact(t, u_init=None, t_init=None)[source]¶
Routine to approximate the exact solution at time t by
SciPy
or give initial conditions when called at \(t=0\).- Parameters:
t (float) – Current time.
u_init (pySDC.problem.vanderpol.dtype_u) – Initial conditions for getting the exact solution.
t_init (float) – The starting time.
- Returns:
me – Approximate exact solution.
- Return type:
dtype_u