coffee.solvers package

Submodules

coffee.solvers.solvers module

This module contains the abstract base class for solvers as well as several default implementations.

This default implementations all assume that tslice.TimeSlice objects can be operated on by numerically (e.g. addition, multiplication, subtraction).

class coffee.solvers.solvers.ABCSolver(system, *args, **kwds)[source]

Bases: object

The ABSolver abstract base class.

This class provides the interface that is assumed of all other solvers. These methods are called in the ibvp.IBVP class.

abstract advance(t, u, dt)[source]

Returns a tslice.TimeSlice containing data at time t + dt.

Parameters:
  • t (float) – The current time.

  • u (tslice.TimeSlice) – The current tslice.TimeSlice. Note that the time in the timeslice is the time for the data in the timeslice, but not necessarily equal to t.

  • dt (float) – The step in time required.

Returns:

Contains the data at time t+dt.

Return type:

tslice.TimeSlice

abstract property name

This should return a name associated to the subclass.

The name will need to be defined in the subclasses constructor. The name is used to identify the instantiated class in the logger.

Returns:

A string name for the class. This defaults to ABCSolver.

Return type:

string

class coffee.solvers.solvers.Euler(system, *args, **kwds)[source]

Bases: ABCSolver

An implementation of the first order Euler method.

advance(t, u, dt)[source]

An Euler method implementation of ABCSolver.

See the ABCSolver.advance method for documentation.

name = 'Euler'
class coffee.solvers.solvers.ImplicitEuler(system, *args, **kwds)[source]

Bases: ABCSolver

An implementation of the first order implicit Euler method.

advance(t, u, dt)[source]

An implicit Euler method implementation of ABCSolver.

See the ABCSolver.advance method for documentation.

name = 'ImplicitEuler'
class coffee.solvers.solvers.RungeKutta4(*args, **kwds)[source]

Bases: ABCSolver

A RungeKutta4 implementation of ABCSolver.

advance(t0, u0, dt)[source]

See the ABCSolver.advance method for documentation.

Very simple minded implementation of the standard 4th order Runge-Kutta method to solve an ODE of the form fdot = rhs(t,f)

name = 'RK4'
class coffee.solvers.solvers.RungeKutta4Dirichlet(**kwds)[source]

Bases: ABCSolver

An implementation of the Runge Kutta 4 routine that calls system.dirichlet_boundary.

advance(t0, u0, dt)[source]

See the ABCSolver.advance method for documentation.

Very simple minded implementation of the standard 4th order Runge-Kutta method to solve an ODE of the form fdot = rhs(t,f) that allows for the implementation of Dirichlet conditions during evaluation.

Ensure that the corresponding system file has a method called, “dirichlet_boundary”.

Module contents