In Ubermag, boundary conditions are set by passing bc
argument to the mesh. The value of the bc
argument is a string. The following boudary conditions (BC) are allowed:
bc=''
)bc='x'
, bc='xy'
, bc='xyz'
, bc='y'
,...) assuming that the names of geometric dimensions are 'x'
, 'y'
, and 'z'
bc='neumann'
) - experimentalbc='dirichlet'
) - experimentalTo demonstrate boundary conditions, we are going to use the following mesh:
import discretisedfield as df
p1 = (0, 0, 0)
p2 = (100e-9, 50e-9, 20e-9)
n = (20, 10, 4)
region = df.Region(p1=p1, p2=p2)
mesh = df.Mesh(region=region, n=n)
By default, boudary conditions are open (empty string):
mesh.bc
''
Now, let us define a mesh with periodic boundary conditions. The periodic boudary conditions are defined by passing a string to bc
. When the geometric dimensions are x, y, and z, the string can consist of characters 'x'
, 'y'
, and/or 'z'
, depending on the directions in which the mesh is periodic. For instance, if our mesh is periodic in x and y directions, we pass bc='xy'
.
mesh = df.Mesh(region=region, n=n, bc="xy")
Neumann and Dirichlet BC are defined by passing bc='neumann'
or bc='dirichet'
, respectively.
IMPORTANT: At the moment, only Neumann BC with zero value are supported and defining BC in a more general way will be included in the future releases of discretisedfield
.
Here we just include an example of defining Neumann BC:
$$\frac{df}{d\mathbf{n}} = 0$$mesh = df.Mesh(region=region, n=n, bc="neumann")
mesh