4.2.1.5. pde.grids.boundaries.local module¶
This module contains classes for handling a single boundary of a non-periodic axis. Since an axis has two boundary, we simply distinguish them by a boolean flag upper, which is True for the side of the axis with the larger coordinate.
The module currently supports different boundary conditions:
DirichletBC
: Imposing the value of a field at the boundaryNeumannBC
: Imposing the derivative of a field in the outward normal direction at the boundaryMixedBC
: Imposing the derivative of a field in the outward normal direction proportional to its value at the boundaryCurvatureBC
: Imposing the second derivative (curvature) of a field at the boundary
There are also additional classes that impose boundary conditions only for the normal
components of fields, which can be important for vector and tensor fields. The classes
corresponding to the ones listed above are
DirichletNormalBC
,
NeumannNormalBC
,
MixedNormalBC
, and
CurvatureNormalBC
.
Note that derivatives are generally given in the direction of the outward normal vector, such that positive derivatives correspond to a function that increases across the boundary.
- class BCBase(grid: GridBase, axis: int, upper: bool, *, rank: int = 0)[source]¶
Bases:
object
represents a single boundary in an BoundaryPair instance
- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
- 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
- classmethod from_data(grid: GridBase, axis: int, upper: bool, data: Union[Dict, str, BCBase], rank: int = 0) BCBase [source]¶
create boundary 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
upper (bool) – Indicates whether this boundary condition is associated with the upper or lower side of the axis.
rank (int) – The tensorial rank of the field for this boundary condition
- Returns
the instance created from the data
- Return type
- Throws:
ValueError if data cannot be interpreted as a boundary condition
- classmethod from_dict(grid: GridBase, axis: int, upper: bool, data: dict, rank: int = 0) BCBase [source]¶
create boundary from data given in dictionary
- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Indicates whether this boundary condition is associated with the upper or lower side of the axis.
data (dict) – The dictionary defining the boundary condition
rank (int) – The tensorial rank of the field for this boundary condition
- classmethod from_str(grid: GridBase, axis: int, upper: bool, condition: str, rank: int = 0, **kwargs) BCBase [source]¶
creates boundary from a given string identifier
- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Indicates whether this boundary condition is associated with the upper or lower side of the axis.
condition (str) – Identifies the boundary condition
rank (int) – The tensorial rank of the field for this boundary condition
**kwargs – Additional arguments passed to the constructor
- make_ghost_cell_setter() Callable[[...], None] [source]¶
return function that sets the ghost cells for this boundary
- abstract set_ghost_cells(data_full: numpy.ndarray, *, args=None) None [source]¶
set the ghost cell values for this boundary
- exception BCDataError[source]¶
Bases:
ValueError
exception that signals that incompatible data was supplied for the BC
- class ConstBC1stOrderBase(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.ConstBCBase
represents a single boundary in an BoundaryPair instance
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur. However, the function is safe when value cannot be an arbitrary string.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or
ndarray
) – a value stored with the boundary condition. The interpretation of this value depends on the type of boundary condition. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
- get_data(idx: Tuple[int, ...]) Tuple[float, Dict[int, float]] [source]¶
sets the elements of the sparse representation of this condition
- get_virtual_point(arr, idx: Optional[Tuple[int, ...]] = None) float [source]¶
calculate the value of the virtual point outside the boundary
- Parameters
arr (array) – The data values associated with the grid
idx (tuple) – The index of the point to evaluate. This is a tuple of length grid.num_axes with the either -1 or dim as the entry for the axis associated with this boundary condition. Here, dim is the dimension of the axis. The index is optional if dim == 1.
- Returns
Value at the virtual support point
- Return type
- make_adjacent_evaluator() Callable[[numpy.ndarray, int, Tuple[int, ...]], float] [source]¶
returns a function evaluating the value adjacent to a given point
- Returns
A function with signature (arr_1d, i_point, bc_idx), where arr_1d is the one-dimensional data array (the data points along the axis perpendicular to the boundary), i_point is the index into this array for the current point and bc_idx are the remaining indices of the current point, which indicate the location on the boundary plane. The result of the function is the data value at the adjacent point along the axis associated with this boundary condition in the upper (lower) direction when upper is True (False).
- Return type
function
- make_virtual_point_evaluator() Callable[[...], float] [source]¶
returns a function evaluating the value at the virtual support point
- Returns
A function that takes the data array and an index marking the current point, which is assumed to be a virtual point. The result is the data value at this point, which is calculated using the boundary condition.
- Return type
function
- set_ghost_cells(data_full: numpy.ndarray, *, args=None) None [source]¶
set the ghost cell values for this boundary
- Parameters
data_full (
ndarray
) – The full field data including ghost pointsargs – Additional arguments that might be supported by special boundary conditions.
- class ConstBC2ndOrderBase(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.ConstBCBase
abstract base class for boundary conditions of 2nd order
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur. However, the function is safe when value cannot be an arbitrary string.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or
ndarray
) – a value stored with the boundary condition. The interpretation of this value depends on the type of boundary condition. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
- get_data(idx: Tuple[int, ...]) Tuple[float, Dict[int, float]] [source]¶
sets the elements of the sparse representation of this condition
- get_virtual_point(arr, idx: Optional[Tuple[int, ...]] = None) float [source]¶
calculate the value of the virtual point outside the boundary
- Parameters
arr (array) – The data values associated with the grid
idx (tuple) – The index of the point to evaluate. This is a tuple of length grid.num_axes with the either -1 or dim as the entry for the axis associated with this boundary condition. Here, dim is the dimension of the axis. The index is optional if dim == 1.
- Returns
Value at the virtual support point
- Return type
- abstract get_virtual_point_data() Tuple[Any, Any, int, Any, int] [source]¶
return data suitable for calculating virtual points
- Returns
the data associated with this virtual point
- Return type
- make_adjacent_evaluator() Callable[[numpy.ndarray, int, Tuple[int, ...]], float] [source]¶
returns a function evaluating the value adjacent to a given point
- Returns
A function with signature (arr_1d, i_point, bc_idx), where arr_1d is the one-dimensional data array (the data points along the axis perpendicular to the boundary), i_point is the index into this array for the current point and bc_idx are the remaining indices of the current point, which indicate the location on the boundary plane. The result of the function is the data value at the adjacent point along the axis associated with this boundary condition in the upper (lower) direction when upper is True (False).
- Return type
function
- make_virtual_point_evaluator() Callable[[...], float] [source]¶
returns a function evaluating the value at the virtual support point
- Returns
A function that takes the data array and an index marking the current point, which is assumed to be a virtual point. The result is the data value at this point, which is calculated using the boundary condition.
- Return type
function
- set_ghost_cells(data_full: numpy.ndarray, *, args=None) None [source]¶
set the ghost cell values for this boundary
- Parameters
data_full (
ndarray
) – The full field data including ghost pointsargs – Additional arguments that might be supported by special boundary conditions.
- class ConstBCBase(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.BCBase
base class representing a boundary whose virtual point is set from constants
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur. However, the function is safe when value cannot be an arbitrary string.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or
ndarray
) – a value stored with the boundary condition. The interpretation of this value depends on the type of boundary condition. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
- copy(upper: Optional[bool] = None, rank: int = None, value: Optional[Union[float, numpy.ndarray, str]] = None) ConstBCBase [source]¶
return a copy of itself, but with a reference to the same grid
- extract_component(*indices)[source]¶
extracts the boundary conditions for the given component
- Parameters
*indices – One or two indices for vector or tensor fields, respectively
- link_value(value: numpy.ndarray)[source]¶
link value of this boundary condition to external array
- property value: numpy.ndarray¶
- class CurvatureBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.ConstBC2ndOrderBase
represents a boundary condition imposing the 2nd normal derivative at the boundary
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur. However, the function is safe when value cannot be an arbitrary string.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or
ndarray
) – a value stored with the boundary condition. The interpretation of this value depends on the type of boundary condition. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
- get_virtual_point_data() Tuple[numpy.ndarray, numpy.ndarray, int, numpy.ndarray, int] [source]¶
return data suitable for calculating virtual points
- Returns
the data structure associated with this virtual point
- Return type
- class CurvatureNormalBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.CurvatureBC
represents a boundary condition imposing the 2nd normal derivative at the boundary only on the normal component of the tensor field
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur. However, the function is safe when value cannot be an arbitrary string.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or
ndarray
) – a value stored with the boundary condition. The interpretation of this value depends on the type of boundary condition. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
- class DirichletBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.ConstBC1stOrderBase
represents a boundary condition imposing the value
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur. However, the function is safe when value cannot be an arbitrary string.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or
ndarray
) – a value stored with the boundary condition. The interpretation of this value depends on the type of boundary condition. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
- get_virtual_point_data(compiled: bool = False) Tuple[Any, Any, int] [source]¶
return data suitable for calculating virtual points
- Parameters
compiled (bool) – Flag indicating whether a compiled version is required, which automatically takes updated values into account when it is used in numba-compiled code.
- Returns
the data structure associated with this virtual point
- Return type
BC1stOrderData
- class DirichletNormalBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.DirichletBC
represents a boundary condition imposing the normal component of a value
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur. However, the function is safe when value cannot be an arbitrary string.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or
ndarray
) – a value stored with the boundary condition. The interpretation of this value depends on the type of boundary condition. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
- class ExpressionBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, str] = 0, target: str = 'virtual_point')[source]¶
Bases:
pde.grids.boundaries.local.BCBase
represents a boundary whose virtual point is calculated from an expression
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str) – An expression that determines the value of the boundary condition.
target (str) – Selects which value is actually set. Possible choices include value, derivative, and virtual_point.
- copy(upper: Optional[bool] = None, rank: int = None) ExpressionBC [source]¶
return a copy of itself, but with a reference to the same grid
- extract_component(*indices)[source]¶
extracts the boundary conditions for the given component
- Parameters
*indices – One or two indices for vector or tensor fields, respectively
- make_virtual_point_evaluator() Callable[[...], float] [source]¶
returns a function evaluating the value at the virtual support point
- Returns
A function that takes the data array and an index marking the current point, which is assumed to be a virtual point. The result is the data value at this point, which is calculated using the boundary condition.
- Return type
function
- set_ghost_cells(data_full: numpy.ndarray, *, args=None) None [source]¶
set the ghost cell values for this boundary
- Parameters
data_full (
ndarray
) – The full field data including ghost pointsargs – Additional arguments that might be supported by special boundary conditions.
- class ExpressionDerivativeBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, str] = 0, target: str = 'derivative')[source]¶
Bases:
pde.grids.boundaries.local.ExpressionBC
represents a boundary whose outward derivative is calculated from an expression
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str) – An expression that determines the value of the boundary condition.
target (str) – Selects which value is actually set. Possible choices include value, derivative, and virtual_point.
- class ExpressionValueBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, str] = 0, target: str = 'value')[source]¶
Bases:
pde.grids.boundaries.local.ExpressionBC
represents a boundary whose value is calculated from an expression
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str) – An expression that determines the value of the boundary condition.
target (str) – Selects which value is actually set. Possible choices include value, derivative, and virtual_point.
- class MixedBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0, const: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.ConstBC1stOrderBase
represents a mixed (or Robin) boundary condition imposing a derivative in the outward normal direction of the boundary that is given by an affine function involving the actual value:
\[\partial_n c + \gamma c = \beta\]Here, \(c\) is the field to which the condition is applied, \(\gamma\) quantifies the influence of the field and \(\beta\) is the constant term. Note that \(\gamma = 0\) corresponds to Dirichlet conditions imposing \(\beta\) as the derivative. Conversely, \(\gamma \rightarrow \infty\) corresponds to imposing a zero value on \(c\).
This condition can be enforced by using one of the following variants
bc = {'mixed': VALUE} bc = {'type': 'mixed', 'value': VALUE, 'const': CONST}
where VALUE corresponds to \(\gamma\) and CONST to \(\beta\).
- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or array) – The parameter \(\gamma\) quantifying the influence of the field onto its normal derivative. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
const (float or
ndarray
or str) – The parameter \(\beta\) determining the constant term for the boundary condition. Supports the same input as value.
- copy(upper: Optional[bool] = None, rank: int = None, value: Optional[Union[float, numpy.ndarray, str]] = None, const: Optional[Union[float, numpy.ndarray, str]] = None) MixedBC [source]¶
return a copy of itself, but with a reference to the same grid
- get_virtual_point_data(compiled: bool = False) Tuple[Any, Any, int] [source]¶
return data suitable for calculating virtual points
- Parameters
compiled (bool) – Flag indicating whether a compiled version is required, which automatically takes updated values into account when it is used in numba-compiled code.
- Returns
the data structure associated with this virtual point
- Return type
BC1stOrderData
- class MixedNormalBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0, const: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.MixedBC
represents a mixed (or Robin) boundary condition imposing a derivative in the outward normal direction of the boundary only for the normal component
- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or array) – The parameter \(\gamma\) quantifying the influence of the field onto its normal derivative. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
const (float or
ndarray
or str) – The parameter \(\beta\) determining the constant term for the boundary condition. Supports the same input as value.
- class NeumannBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.ConstBC1stOrderBase
represents a boundary condition imposing the derivative in the outward normal direction of the boundary
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur. However, the function is safe when value cannot be an arbitrary string.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or
ndarray
) – a value stored with the boundary condition. The interpretation of this value depends on the type of boundary condition. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.
- get_virtual_point_data(compiled: bool = False) Tuple[Any, Any, int] [source]¶
return data suitable for calculating virtual points
- Parameters
compiled (bool) – Flag indicating whether a compiled version is required, which automatically takes updated values into account when it is used in numba-compiled code.
- Returns
the data structure associated with this virtual point
- Return type
BC1stOrderData
- class NeumannNormalBC(grid: GridBase, axis: int, upper: bool, *, rank: int = 0, value: Union[float, numpy.ndarray, str] = 0)[source]¶
Bases:
pde.grids.boundaries.local.NeumannBC
represents a boundary condition imposing the derivative in the outward normal direction of the boundary only on the normal component of the tensor field
Warning
This implementation uses
exec()
and should therefore not be used in a context where malicious input could occur. However, the function is safe when value cannot be an arbitrary string.- Parameters
grid (
GridBase
) – The grid for which the boundary conditions are definedaxis (int) – The axis to which this boundary condition is associated
upper (bool) – Flag indicating whether this boundary condition is associated with the upper side of an axis or not. In essence, this determines the direction of the local normal vector of the boundary.
rank (int) – The tensorial rank of the field for this boundary condition
value (float or str or
ndarray
) – a value stored with the boundary condition. The interpretation of this value depends on the type of boundary condition. If value is a single value (or tensor in case of tensorial boundary conditions), the same value is applied to all points. Inhomogeneous boundary conditions are possible by supplying an expression as a string, which then may depend on the axes names of the respective grid.