pymgrit.advection package

Submodules

pymgrit.advection.advection_1d module

Vector and application class for the 1D advection problem

class pymgrit.advection.advection_1d.Advection1D(*args, **kwargs)

Bases: pymgrit.core.application.Application

Application class for the advection problem in 1D space,

u_t + c * u_t = 0,

subject to periodic boundary conditions in space and initial condition u(x, 0) = exp(-x^2).

compute_matrix()

Define spatial discretization matrix for advection problem.

Discretization is first-order upwind in space.

initialise()
Set the initial condition of the 1D advection problem

u(x,0) = exp(-x^2)

step(u_start: pymgrit.advection.advection_1d.VectorAdvection1D, t_start: float, t_stop: float)
Time integration routine for 1D advection problem:

Backward Euler

Parameters
  • u_start – approximate solution for the input time t_start

  • t_start – time associated with the input approximate solution u_start

  • t_stop – time to evolve the input approximate solution to

Returns

approximate solution for the input time t_stop

class pymgrit.advection.advection_1d.VectorAdvection1D(size)

Bases: pymgrit.core.vector.Vector

Vector class for the 1D advection problem

clone()

Initialize vector object with same values

clone_rand()

Initialize vector object with random values

clone_zero()

Initialize vector object with zeros

get_values()

Get vector data

norm()

Norm of a vector object

pack()

Specifying communication data

set_values(values)

Set vector data

unpack(values)

Unpacking communication data

Module contents