4.2.1.4. pde.grids.boundaries.axis module¶
This module handles the boundaries of a single axis of a grid. There are
generally only two options, depending on whether the axis of the underlying
grid is defined as periodic or not. If it is periodic, the class
BoundaryPeriodic
should be used, while
non-periodic axes have more option, which are represented by
BoundaryPair
.
- class BoundaryAxisBase(low: BCBase, high: BCBase)[source]¶
Bases:
object
base class for defining boundaries of a single axis in a grid
- Parameters
- get_data(idx: Tuple[int, ...]) Tuple[float, Dict[int, float]] [source]¶
sets the elements of the sparse representation of this condition
- get_mathematical_representation(field_name: str = 'C') Tuple[str, str] [source]¶
return mathematical representation of the boundary condition
- class BoundaryPair(low: BCBase, high: BCBase)[source]¶
Bases:
BoundaryAxisBase
represents the two boundaries of an axis along a single dimension
- Parameters
- check_value_rank(rank: int) None [source]¶
check whether the values at the boundaries have the correct rank
- Parameters
rank (int) – The tensorial rank of the field for this boundary condition
- Throws:
RuntimeError: if the value does not have rank rank
- copy() BoundaryPair [source]¶
return a copy of itself, but with a reference to the same grid
- extract_component(*indices) BoundaryPair [source]¶
extracts the boundary pair of the given index.
- Parameters
*indices – One or two indices for vector or tensor fields, respectively
- classmethod from_data(grid: GridBase, axis: int, data, rank: int = 0, normal: bool = False) BoundaryPair [source]¶
create boundary pair from some data
- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
rank (int) – The tensorial rank of the field for this boundary condition
normal (bool) – Flag indicating whether the condition is only applied in the normal direction.
- Returns
the instance created from the data
- Return type
- Throws:
ValueError if data cannot be interpreted as a boundary pair
- class BoundaryPeriodic(grid: GridBase, axis: int, flip_sign: bool = False)[source]¶
Bases:
BoundaryPair
represent a periodic axis
- Parameters
- check_value_rank(rank: int) None [source]¶
check whether the values at the boundaries have the correct rank
- Parameters
rank (int) – The tensorial rank of the field for this boundary condition
- copy() BoundaryPeriodic [source]¶
return a copy of itself, but with a reference to the same grid
- extract_component(*indices) BoundaryPeriodic [source]¶
extracts the boundary pair of the given extract_component.
- Parameters
*indices – One or two indices for vector or tensor fields, respectively
- get_boundary_axis(grid: GridBase, axis: int, data, rank: int = 0, normal: bool = False) BoundaryAxisBase [source]¶
return object representing the boundary condition for a single axis
- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
data (str or tuple or dict) – Data describing the boundary conditions for this axis
rank (int) – The tensorial rank of the field for this boundary condition
normal (bool) – Flag indicating whether the condition is only applied in the normal direction.
- Returns
Appropriate boundary condition for the axis
- Return type