implementations.problem_classes.TestEquation_0D module

class testequation0d(lambdas=None, u0=0.0, useGPU=False)[source]

Bases: ptype

This class implements the simple test equation of the form

\[\frac{d u(t)}{dt} = A u(t)\]

for \(A = diag(\lambda_1, .. ,\lambda_n)\).

Parameters:
  • lambdas (sequence of array_like, optional) – List of lambda parameters.

  • u0 (sequence of array_like, optional) – Initial condition.

A

Diagonal matrix containing \(\lambda_1,..,\lambda_n\).

Type:

scipy.sparse.csc_matrix

dtype_f

alias of mesh

dtype_u

alias of mesh

eval_f(u, t)[source]

Routine to evaluate the right-hand side of the problem.

Parameters:
  • u (dtype_u) – Current values of the numerical solution.

  • t (float) – Current time of the numerical solution is computed.

Returns:

f – The right-hand side of the problem.

Return type:

dtype_f

classmethod setup_GPU()[source]

Switch to GPU modules

solve_system(rhs, factor, u0, t)[source]

Simple linear solver for \((I-factor\cdot A)\vec{u}=\vec{rhs}\).

Parameters:
  • rhs (dtype_f) – Right-hand side for the linear system.

  • factor (float) – Abbrev. for the local 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:

me – The solution as mesh.

Return type:

dtype_u

u_exact(t, u_init=None, t_init=None)[source]

Routine to compute the exact solution at time t.

Parameters:
  • t (float) – Time of the exact solution.

  • u_init (pySDC.problem.testequation0d.dtype_u) – Initial solution.

  • t_init (float) – The initial time.

Returns:

me – The exact solution.

Return type:

dtype_u

xp = <module 'numpy' from '/home/runner/micromamba/envs/pySDC/lib/python3.12/site-packages/numpy/__init__.py'>
xsp = <module 'scipy.sparse' from '/home/runner/micromamba/envs/pySDC/lib/python3.12/site-packages/scipy/sparse/__init__.py'>