DirichletBC¶
-
class
dolfin.fem.bcs.
DirichletBC
(*args, **kwargs)¶ Bases:
dolfin.cpp.fem.DirichletBC
This class specifies the interface for setting (strong) Dirichlet boundary conditions for partial differential equations,
\[u = g \hbox{ on } G,\]where \(u\) is the solution to be computed, \(g\) is a function and \(G\) is a sub domain of the mesh.
A DirichletBC is specified by the function g, the function space (trial space) and boundary indicators on (a subset of) the mesh boundary.
The boundary indicators may be specified in a number of different ways.
The simplest approach is to specify the boundary by a
SubDomain
object, using the inside() function to specify on which facets the boundary conditions should be applied. The boundary facets will then be searched for and marked only on the first call to apply. This means that the mesh could be moved after the first apply and the boundary markers would still remain intact.Alternatively, the boundary may be specified by a
MeshFunction
over facets labeling all mesh facets together with a number that specifies which facets should be included in the boundary.The third option is to attach the boundary information to the mesh. This is handled automatically when exporting a mesh from for example VMTK.
The ‘method’ variable may be used to specify the type of method used to identify degrees of freedom on the boundary. Available methods are: topological approach (default), geometric approach, and pointwise approach. The topological approach is faster, but will only identify degrees of freedom that are located on a facet that is entirely on the boundary. In particular, the topological approach will not identify degrees of freedom for discontinuous elements (which are all internal to the cell). A remedy for this is to use the geometric approach. In the geometric approach, each dof on each facet that matches the boundary condition will be checked. To apply pointwise boundary conditions e.g. pointloads, one will have to use the pointwise approach. The three possibilities are “topological”, “geometric” and “pointwise”.
Note: when using “pointwise”, the boolean argument on_boundary in SubDomain::inside will always be false.
The ‘check_midpoint’ variable can be used to decide whether or not the midpoint of each facet should be checked when a user-defined
SubDomain
is used to define the domain of the boundary condition. By default, midpoints are always checked. Note that this variable may be of importance close to corners, in which case it is sometimes important to check the midpoint to avoid including facets “on the diagonal close” to a corner. This variable is also of importance for curved boundaries (like on a sphere or cylinder), in which case it is important not to check the midpoint which will be located in the interior of a domain defined relative to a radius.Overloaded versions
DirichletBC(V, g, sub_domain, method=”topological”, check_midpoint=true)
Create boundary condition for subdomain
- Arguments
- V (
FunctionSpace
) The function space.
- g (
GenericFunction
) The value.
- sub_domain (
SubDomain
) The subdomain.
- method (str)
Optional argument: A string specifying the method to identify dofs.
- V (
DirichletBC(V, g, sub_domain, method=”topological”, check_midpoint=true)
Create boundary condition for subdomain
- Arguments
- V (
FunctionSpace
) The function space
- g (
GenericFunction
) The value
- sub_domain (
SubDomain
) The subdomain
- method (str)
Optional argument: A string specifying the method to identify dofs
- V (
DirichletBC(V, g, sub_domains, sub_domain, method=”topological”)
Create boundary condition for subdomain specified by index
- Arguments
- V (
FunctionSpace
) The function space.
- g (
GenericFunction
) The value.
- sub_domains (
MeshFunction
) Subdomain markers
- sub_domain (int)
The subdomain index (number)
- method (str)
Optional argument: A string specifying the method to identify dofs.
- V (
DirichletBC(V, g, sub_domains, sub_domain, method=”topological”)
Create boundary condition for subdomain specified by index
- Arguments
- V (
FunctionSpace
) The function space.
- g (
GenericFunction
) The value.
- sub_domains (
MeshFunction
) Subdomain markers
- sub_domain (int)
The subdomain index (number)
- method (str)
Optional argument: A string specifying the method to identify dofs.
- V (
DirichletBC(V, g, sub_domain, method=”topological”)
Create boundary condition for boundary data included in the mesh
- Arguments
- V (
FunctionSpace
) The function space.
- g (
GenericFunction
) The value.
- sub_domain (int)
The subdomain index (number)
- method (str)
Optional argument: A string specifying the method to identify dofs.
- V (
DirichletBC(V, g, sub_domain, method=”topological”)
Create boundary condition for boundary data included in the mesh
- Arguments
- V (
FunctionSpace
) The function space.
- g (
GenericFunction
) The value.
- sub_domain (int)
The subdomain index (number)
- method (str)
Optional argument: A string specifying the method to identify dofs.
- V (
DirichletBC(V, g, markers, method=”topological”)
Create boundary condition for subdomain by boundary markers (cells, local facet numbers)
- Arguments
- V (
FunctionSpace
) The function space.
- g (
GenericFunction
) The value.
- markers (numpy.array(int))
Subdomain markers (facet index local to process)
- method (str)
Optional argument: A string specifying the method to identify dofs.
- V (
DirichletBC(bc)
Copy constructor
- Arguments
- bc (
DirichletBC
) The object to be copied.
- bc (