implementations.problem_classes.FastWaveSlowWave_0D module

class swfw_scalar(lambda_s=-1, lambda_f=-1000, u0=1)[source]

Bases: ptype

This class implements the fast-wave-slow-wave scalar problem fully investigated in [1]. It is defined by

\[\frac{d u(t)}{dt} = \lambda_f u(t) + \lambda_s u(t),\]

where \(\lambda_f\) denotes the part of the fast wave, and \(\lambda_s\) is the part of the slow wave with \(\lambda_f \gg \lambda_s\). Let \(u_0\) be the initial condition to the problem, then the exact solution is given by

\[u(t) = u_0 \exp((\lambda_f + \lambda_s) t).\]
Parameters:
  • lambda_s (np.1darray, optional) – Part of the slow wave \(\lambda_s\).

  • lambda_f (np.1darray, optional) – Part of the fast wave \(\lambda_f\).

  • u0 (np.1darray, optional) – Initial condition of the problem.

References

dtype_f

alias of imex_mesh

dtype_u

alias of mesh

eval_f(u, t)[source]

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

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

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

Returns:

f – The right-hand side divided into two parts.

Return type:

dtype_f

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

Simple im=nversion of \((1 - \Delta t \cdot \lambda)\vec{u} = \vec{rhs}\).

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

  • factor (float) – Abbrev. for the node-to-node stepsize (or any other factor required).

  • u0 (dtype_u) – Initial guess for the iterative solver (not used here so far).

  • t (float) – Current time (e.g. for time-dependent BCs).

Returns:

me – The solution as mesh.

Return type:

dtype_u

u_exact(t)[source]

Routine to compute the exact solution at time \(t\).

Parameters:

t (float) – Time of the exact solution.

Returns:

me – The exact solution.

Return type:

dtype_u