---
title: "InitializeBoundaryConditions"
language: "en"
type: "Symbol"
summary: "InitializeBoundaryConditions[vd, sd, {{bc11, ...}, {bc21, \\ ...}, ...}] initializes the system of boundary conditions beqni in accordance with variable data vd and solution data sd to generate a BoundaryConditionData object."
keywords: 
- Boundary
- Initialize
- Initialize Boundary
- InitializeBoundary
- Boundary conditions
- Boundary values
- Dirichlet
- Neumann
- Robin
- Generalized Neumann
- Dirichlet condition
- Neumann condition
- Robin condition
- Neumann value
- Robin value
- Generalized Neumann condition
- PDE
- PDE boundary
- PDE boundary condition
- PDE boundary conditions
- Partial differential equation
- partial differential equation boundary
- partial differential equation boundary condition
canonical_url: "https://reference.wolfram.com/language/FEMDocumentation/ref/InitializeBoundaryConditions.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Finite Element Method"
    link: "https://reference.wolfram.com/language/FEMDocumentation/guide/FiniteElementMethodGuide.en.md"
related_tutorials: 
  - 
    title: "Finite Element Programming"
    link: "https://reference.wolfram.com/language/FEMDocumentation/tutorial/FiniteElementProgramming.en.md"
  - 
    title: "NDSolve Finite Element Options"
    link: "https://reference.wolfram.com/language/FEMDocumentation/tutorial/FiniteElementOptions.en.md"
---
## NDSolve\`FEM\`

# InitializeBoundaryConditions

InitializeBoundaryConditions[vd, sd, {{bc11, …}, {bc21, …}, …}] initializes the system of boundary conditions beqni in accordance with variable data vd and solution data sd to generate a BoundaryConditionData object.

## Details and Options

* The boundary conditions ``bcij`` can either be ``DirichletCondition``, ``NeumannValue`` or ``PeriodicBoundaryCondition``.

* The ``i``$$^{\text{th}}$$ set of boundary conditions ``bcij`` is associated with the ``i``$$^{\text{th}}$$ equation from:

[image]

* The boundary conditions can be functions of space and time.

* Variable data ``vd`` and solution data ``sd`` are corresponding lists of variables and values. Templates for ``vd`` and ``sd`` may be generated using ``NDSolve\`VariableData`` and ``NDSolve\`SolutionData``, and components may be set using ``NDSolve\`SetSolutionDataComponent``.

* ``InitializeBoundaryConditions`` verifies and optimizes the boundary conditions in accordance with variable data ``vd`` and solution data ``sd``.

* The ``"Space"`` component of ``vd`` and ``sd`` should be set to the spatial variables and the spatial mesh represented as a ``NumericalRegion`` object, respectively.

* The ``"DependentVariables"`` component of ``vd`` should be set to the list of unknown function names without arguments.

* For time-dependent problems, the ``"Time"`` component of ``vd`` and ``sd`` should be set to the temporal variable and the initial time, respectively.

* For parametric problems, the ``"Parameters"`` component of ``vd`` and ``sd`` should be set to the parametric variables and the initial parametric values, respectively.

* The following options can be given:

|                      |           |                                                                        |
| -------------------- | --------- | ---------------------------------------------------------------------- |
| "BoundaryTolerance"  | Automatic | tolerance for boundary condition predicate                             |
| "ScaleFactor"        | Automatic | scaling factor for transient handling of Dirichlet boundary conditions |

* Setting the option from ``NDSolve`` and related functions is explained in [NDSolve Finite Element Options](https://reference.wolfram.com/language/FEMDocumentation/tutorial/FiniteElementOptions.en.md).

---

## Examples (4)

### Basic Examples (1)

Load the finite element package:

```wl
In[1]:= Needs["NDSolve`FEM`"]
```

Set up a ``NumericalRegion`` :

```wl
In[2]:= nr = ToNumericalRegion[Rectangle[{0, 0}, {1, 1 / 2}]]

Out[2]= NumericalRegion[FullRegion[2], {{0, 1}, {0, (1/2)}}]
```

Set up variable and solution data:

```wl
In[3]:=
vd = NDSolve`VariableData[{"DependentVariables", "Space"} -> {{u}, {x, y}}];
sd = NDSolve`SolutionData[{"Space"} -> {nr}];
```

Initialize a boundary condition:

```wl
In[4]:= InitializeBoundaryConditions[vd, sd, {{DirichletCondition[u[x, y] == 0., x == 0]}}]

Out[4]= BoundaryConditionData[<1,2>]
```

### Scope (2)

Set up variable and solution data for a system of two equations:

```wl
In[1]:=
vd2 = NDSolve`VariableData[{"DependentVariables", "Space"} -> {{u, v}, {x, y}}];
sd = NDSolve`SolutionData[{"Space"} -> {nr}];
```

Initialize the boundary conditions:

```wl
In[2]:= InitializeBoundaryConditions[vd2, sd, {{DirichletCondition[u[x, y] == 0., x == 0]}, {DirichletCondition[v[x, y] == 0., x == 0], NeumannValue[-1, x == 1]}}]

Out[2]= BoundaryConditionData[<2,2>]
```

---

Initialize Dirichlet conditions for ``u`` and ``v`` for the first equation and a Dirichlet condition for ``v`` and a Neumann condition for the second equation:

```wl
In[1]:= InitializeBoundaryConditions[vd2, sd, {{DirichletCondition[u[x, y] == 0., x == 0], DirichletCondition[v[x, y] == 0., x == 1]}, {DirichletCondition[v[x, y] == 0., x == 0], NeumannValue[-1, x == 1]}}]

Out[1]= BoundaryConditionData[<2,2>]
```

### Options (1)

#### "BoundaryTolerance" (1)

Initialize boundary conditions that are inconsistent:

```wl
In[1]:= bcdata = InitializeBoundaryConditions[vd, sd, {{DirichletCondition[u[x, y] == 0., x == 0], DirichletCondition[u[x, y] == 1., y == 0]}}, "BoundaryTolerance" -> None]

Out[1]= BoundaryConditionData[<1,2>]
```

During the boundary condition discretization stage, a warning will be issued if ``DirichletCondition`` boundary conditions are inconsistent:

```wl
In[2]:=
mdata = InitializePDEMethodData[vd, sd];
dbc = DiscretizeBoundaryConditions[bcdata, mdata, sd];
```

DiscretizeBoundaryConditions::bcincd: Inconsistent multiple Dirichlet boundary conditions specified at points {{0.,0.}}.

The default ``"BoundaryTolerance"`` is ``Automatic`` and does not warn about inconsistent boundary conditions but will eliminate duplicate boundary conditions that may come up during the inconsistent boundary condition analysis. Setting ``"BoundaryTolerance"`` to ``Infinity`` will not perform any inconsistency check.

---

## See Also

* [`DirichletCondition`](https://reference.wolfram.com/language/ref/DirichletCondition.en.md)
* [`NeumannValue`](https://reference.wolfram.com/language/ref/NeumannValue.en.md)
* [BoundaryConditionData](https://reference.wolfram.com/language/FEMDocumentation/ref/BoundaryConditionData.en.md)
* [InitializePDEMethodData](https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDEMethodData.en.md)
* [InitializePDEMethodData](https://reference.wolfram.com/language/FEMDocumentation/ref/InitializePDEMethodData.en.md)
* [DiscretizeBoundaryConditions](https://reference.wolfram.com/language/FEMDocumentation/ref/DiscretizeBoundaryConditions.en.md)
* [DeployBoundaryConditions](https://reference.wolfram.com/language/FEMDocumentation/ref/DeployBoundaryConditions.en.md)
* [ToNumericalRegion](https://reference.wolfram.com/language/FEMDocumentation/ref/ToNumericalRegion.en.md)
* [ToElementMesh](https://reference.wolfram.com/language/FEMDocumentation/ref/ToElementMesh.en.md)

## Tech Notes

* [Finite Element Programming](https://reference.wolfram.com/language/FEMDocumentation/tutorial/FiniteElementProgramming.en.md)
* [NDSolve Finite Element Options](https://reference.wolfram.com/language/FEMDocumentation/tutorial/FiniteElementOptions.en.md)

## Related Guides

* [Finite Element Method](https://reference.wolfram.com/language/FEMDocumentation/guide/FiniteElementMethodGuide.en.md)