DirichletCondition

DirichletCondition[beqn,pred]

represents a Dirichlet boundary condition given by equation beqn, satisfied on the part of the boundary of the region given to NDSolve and related functions where pred is True.

Details

  • DirichletCondition is used together with differential equations to describe boundary conditions in functions such as DSolve, NDSolve, DEigensystem, NDEigensystem, and GreenFunction.
  • In NDSolve[eqns,{u1,u2,},{x1,x2,}Ω], xi are the independent variables, uj are the dependent variables, and Ω is the region with boundary Ω.
  • Locations where Dirichlet conditions might be specified are shown in blue. They appear (in light blue) on the boundary Ω of the region Ω and also possibly (in dark blue) on interior boundaries of Ω, and they specify that solution values at those points satisfy the condition beqn.
  • DirichletCondition expressions should be included with the equations eqns.
  • Any logical combination of equalities and inequalities in the independent variables x1, may be used for the predicate pred.
  • DirichletCondition[u1r,pred] is used to prescribe that values of ui on the boundary Ω should be r. In general, the boundary equation beqn needs to be affine linear in the dependent variables, i.e. h1 u1+r, where hi and r can depend on any of the independent variables {x1,x2,}.
  • For time-dependent equations, both beqn and pred may depend on time, and pred is only considered for spatial boundaries.
  • Typically, at least one Dirichlet-type boundary condition needs to be specified to make the differential equation uniquely solvable. Dirichlet conditions are also called essential boundary conditions.
  • Dirichlet conditions are enforced at each point in the discretization of Ω where pred is True.
  • DirichletCondition[{eqn1,eqn2,},pred] is equivalent to {DirichletCondition[eqn1,pred],DirichletCondition[eqn2,pred],}.
  • DirichletCondition[eqn,{pred1,pred2,}] is equivalent to {DirichletCondition[eqn,pred1],DirichletCondition[eqn,pred2],}.

Examples

open allclose all

Basic Examples  (2)

Solve on the unit disk with Dirichlet boundary condition :

Specify multiple Dirichlet conditions for and for :

Solve symbolically on the unit disk with Dirichlet boundary condition :

Scope  (3)

Specify a region with a hole:

Set multiple Dirichlet conditions, on the inner boundary and on the outer boundary, and solve the Laplace equation over the region:

Solve TemplateBox[{{(, {{(, , {{2,  , y}, ; , {x,  , 3}}, , )},  , .,  , TemplateBox[{{u, (, {x, ,, y}, )}, {{, {x, ,, y}, }}, InactiveTraditional}, InactiveGrad]}, )}, {{, {x, ,, y}, }}, InactiveTraditional}, InactiveDiv]=0 on a region with a hole and Dirichlet conditions. Specify the region:

Solve the equation:

Plot the density of the solution:

Find the wave equation Green function constrained to 0 at the endpoints on an interval of length d:

Applications  (11)

1D Problems  (1)

Specify a differential equation over a region from to with Dirichlet boundary conditions at and :

Plot the solution:

2D Problems  (1)

Specify a Poisson equation on a unit disk with 0 Dirichlet boundary values on all of the boundary:

3D Problems  (1)

Solve on the unit ball with Dirichlet boundary condition :

Time-Dependent Problems  (4)

Solve a time-dependent problem with initial and boundary conditions:

Solve the time-dependent problem with boundary conditions specified as Dirichlet boundary conditions:

Solve a time-dependent problem with initial and time-dependent boundary conditions:

Solve a 2D time-dependent heat flow problem with initial and boundary conditions specification:

Plot temperature distribution at t==0.5:

Viewed over time, the temperature distribution rapidly dissipates toward zero:

Find the vibrations of a circular drumhead clamped down at the edges:

Visualize the vibrations:

Multiple Boundary Conditions  (1)

Specify a region by boundaries:

Show the region and the boundaries:

Solve a Laplace equation with a temperature set on the red and blue boundaries and a flux over the green boundary:

Boundary Conditions for Coupled Systems  (3)

Specify coupled differential equations:

Specify Dirichlet boundary conditions for both equations:

Solve the system of equations:

Plot the solutions:

Specify coupled equations and :

Specify two Dirichlet boundary conditions for each dependent variable:

Solve coupled equations over a disk:

Specify a plane stress operator with Young's modulus Y and Poison's ratio ν over a bar:

Compute the deformation of a rod that is fixated at the left edge and moved to a negative position in the direction at the right edge but held at its direction:

Contour plot the deformation of the bar in the direction:

Contour plot the deformation of the bar in the direction:

Visualize the deformation of the bar:

Properties & Relations  (1)

Satisfy boundary conditions through the shooting method:

Solve the same equation with the finite element method:

Specify the boundary conditions as Dirichlet conditions:

Possible Issues  (5)

Specifying at least one Dirichlet-type boundary condition is essential:

Specifying a Dirichlet condition gives the expected result:

Specifying a Robin boundary condition as an essential condition can be sufficient:

When boundary conditions have no intersection with the boundary, a warning is generated and the non-intersecting boundary, when possible, is ignored:

Adjusting the boundary corrects this:

Specifying True as a predicate will apply the value of a DirichletCondition at all boundaries, including internal material boundaries.

Generate and visualize a mesh with an internal boundary:

Set up an equation for a multi-material domain:

Solve the equation where all values of the dependent variable at all the boundaries are set to zero:

Visualize the solution:

Solve the equation where values of the dependent variable at the outer boundaries are set to zero:

Visualize the solution:

Specifying True as a predicate will apply the value of a DirichletCondition at all spatial boundaries:

Inspect that the boundary conditions are satisfied at both ends. The initial condition is also satisfied. There is no boundary condition at , since the time domain is not considered as a spatial boundary:

NDSolve by default treats this PDE as a time-dependent problem. A purely spatial discretization can be specified using Method->{"PDEDiscretization"->"FiniteElement"}:

When solving the same PDE as a purely spatial problem, the DirichletCondition has been applied at all of the boundaries:

Introduced in 2014
 (10.0)
 |
Updated in 2016
 (11.0)