pde.grids.boundaries.axes module

This module handles the boundaries of all axes of a grid. It only defines Boundaries, which acts as a list of BoundaryAxisBase.

class Boundaries(boundaries)[source]

Bases: list

class that bundles all boundary conditions for all axes

initialize with a list of boundaries

check_value_rank(rank: int) None[source]

check whether the values at the boundaries have the correct rank


rank (int) – The tensorial rank of the field for this boundary condition


RuntimeError: if any value does not have rank rank

copy() Boundaries[source]

create a copy of the current boundaries

extract_component(*indices) Boundaries[source]

extracts the boundary conditions of the given component of the tensor.


*indices – One or two indices for vector or tensor fields, respectively

classmethod from_data(grid: GridBase, boundaries, rank: int = 0) Boundaries[source]

Creates all boundaries from given data

  • grid (GridBase) – The grid with which the boundary condition is associated

  • boundaries (str or list or tuple or dict) –

    Data that describes the boundaries. This can either be a list of specifications for each dimension or a single one, which is then applied to all dimensions. The boundary for a dimensions can be specified by one of the following formats:

    • string specifying a single type for all boundaries

    • dictionary specifying the type and values for all boundaries

    • tuple pair specifying the low and high boundary individually

  • rank (int) – The tensorial rank of the field for this boundary condition

classmethod get_help() str[source]

Return information on how boundary conditions can be set

get_mathematical_representation(field_name: str = 'C') str[source]

return mathematical representation of the boundary condition

grid: GridBase

GridBase: The grid for which the boundaries are defined

make_ghost_cell_setter() Callable[[...], None][source]

return function that sets the ghost cells on a full array

property periodic: List[bool]

a boolean array indicating which dimensions are periodic according to the boundary conditions



set_ghost_cells(data_full: ndarray, *, args=None) None[source]

set the ghost cells for all boundaries

  • data_full (ndarray) – The full field data including ghost points

  • args – Additional arguments that might be supported by special boundary conditions.