Mesh boundary conditions#

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:

  1. open BC (bc='')

  2. periodic BC (bc='x', bc='xy', bc='xyz', bc='y',…) assuming that the names of geometric dimensions are 'x', 'y', and 'z'

  3. Neumann BC (bc='neumann') - experimental

  4. Dirichlet BC (bc='dirichlet') - experimental

To demonstrate boundary conditions, we are going to use the following mesh:

[1]:
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):

[2]:
mesh.bc
[2]:
''

Periodic boundary conditions#

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'.

[3]:
mesh = df.Mesh(region=region, n=n, bc="xy")

Experimental: Neumann and Dirichet boundary conditions#

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\]
[4]:
mesh = df.Mesh(region=region, n=n, bc="neumann")
mesh
[4]:
Mesh
  • Region
    • pmin = [0.0, 0.0, 0.0]
    • pmax = [1e-07, 5e-08, 2e-08]
    • dims = ['x', 'y', 'z']
    • units = ['m', 'm', 'm']
  • n = [20, 10, 4]
  • bc = neumann