Skip to content

Docs: Boundary Conditions

Patrick Eastham edited this page Oct 2, 2019 · 5 revisions

To find the boundary names of your mesh:

getBoundaries(mesh)

There are currently three boundary conditions that can be implemented: Dirichlet, Neumann, and Robin.

To define which nodes have which boundary condition types, use the following notation (in this example, we use a square mesh, which has boundary names :left, :right, :top, and :bottom)

dNodes = Dirichlet(:left,:right)

nNodes = Neumann(:top,:bottom)

Nodes = [dNodes,nNodes]

This sets up the left and right boundaries to have Dirichlet BC, and the top and bottom boundary nodes to have Neumann BC (to be assigned later).

Once the nodes are assigned, the functional boundary condition must be given. Using the same example as above, this is done like so:

dBCf = Dirichlet((x,y) -> d(x,y) )

nBCf = Neumann((x,y) -> n(x,y) )

ff = Forcing((x,y) -> f(x,y) )

bcfun = [dBCf,nBCf,ff]

where d(x,y), n(x,y) and f(x,y) are all defined somewhere else. These boundary conditions are then loaded into the Problem object by

prob = Problem(mesh,Nodes,bcfun,OperatorType)

where OperatorType is defined somewhere else.