4.3.10. pde.pdes.wave module

A simple diffusion equation

class WavePDE(speed=1, bc='auto_periodic_neumann')[source]

Bases: PDEBase

A simple wave equation

The mathematical definition,

\[\partial_t^2 u = c^2 \nabla^2 u\]

is implemented as two first-order equations:

\[\begin{split}\partial_t u &= v \\ \partial_t v &= c^2 \nabla^2 u\end{split}\]

where \(u\) is the density field that and \(c\) sets the wave speed.

Parameters:
  • speed (float) – The speed \(c\) of the wave

  • bc (Dict[str, Dict | str | BCBase] | Dict | str | BCBase | Tuple[Dict | str | BCBase, Dict | str | BCBase] | BoundaryAxisBase | Sequence[Dict[str, Dict | str | BCBase] | Dict | str | BCBase | Tuple[Dict | str | BCBase, Dict | str | BCBase] | BoundaryAxisBase]) – The boundary conditions applied to the field. Boundary conditions are generally given as a list with one condition for each axis. For periodic axes, only periodic boundary conditions are allowed (indicated by ‘periodic’ and ‘anti-periodic’). For non-periodic axes, different boundary conditions can be specified for the lower and upper end (using a tuple of two conditions). For instance, Dirichlet conditions enforcing a value NUM (specified by {‘value’: NUM}) and Neumann conditions enforcing the value DERIV for the derivative in the normal direction (specified by {‘derivative’: DERIV}) are supported. Note that the special value ‘natural’ imposes periodic boundary conditions for periodic axis and a vanishing derivative otherwise. More information can be found in the boundaries documentation.

diagnostics: Dict[str, Any]

Diagnostic information (available after the PDE has been solved)

Type:

dict

evolution_rate(state, t=0)[source]

evaluate the right hand side of the PDE

Parameters:
  • state (FieldCollection) – The fields \(u\) and \(v\) distribution

  • t (float) – The current time point

Returns:

Scalar field describing the evolution rate of the PDE

Return type:

FieldCollection

explicit_time_dependence: bool | None = False

Flag indicating whether the right hand side of the PDE has an explicit time dependence.

Type:

bool

property expressions: Dict[str, str]

the expressions of the right hand side of this PDE

Type:

dict

get_initial_condition(u, v=None)[source]

create a suitable initial condition

Parameters:
  • u (ScalarField) – The initial density on the grid

  • v (ScalarField, optional) – The initial rate of change. This is assumed to be zero if the value is omitted.

Returns:

The combined fields u and v, suitable for the simulation

Return type:

FieldCollection