## Boundary Conditions

### Basics

Boundary conditions, which exist in the form of mathematical equations, exert a set of additional constraints to the problem on specified boundaries. The concept of boundary conditions applies to both ordinary and partial differential equations. There are five types of boundary conditions: Dirichlet, Neumann, Robin, Mixed, and Cauchy, within which Dirichlet and Neumann are predominant. To understand the difference, let us take a look at an ordinary differential equation $\frac{du}{dx} +u=0$ in the domain$\left[{\rm a,b}\right]$ We have the Dirichlet boundary condition when the boundary prescribes a value to the dependent variable(s). A Dirichlet boundary condition for the above ODE looks like \[y\left({\rm a}\right)={\rm A}\] \[y\left({\rm b}\right)={\rm B}\] For example, in a 1D heat transfer problem, when both ends of a wire are maintained in a water bath with constant temperatures, the above boundary condition will be appropriate. In the Neumann boundary condition, the derivative of the dependent variable is known in all parts of the boundary: \[y'\left({\rm a}\right)={\rm \alpha }\] and \[y'\left({\rm b}\right)={\rm \beta }\] In the above heat transfer example, if heaters exist at both ends of the wire, via which energy would be added at a constant rate, the Neumann boundary condition will apply. The Robin boundary condition is a weighted combination of the Dirichlet boundary and the Neumann boundary condition in all the parts of the boundary: \[{\rm \chi }_{{\rm 1}} \cdot y\left({\rm a}\right)+{\rm \chi }_{2} \cdot y'\left({\rm a}\right)={\rm A}_{\alpha } \] \[{\rm \chi }_{{\rm 1}} \cdot y\left({\rm b}\right)+{\rm \chi }_{2} \cdot y'\left({\rm b}\right)={\rm B}_{\beta } \] where ${\rm \chi }_{i} $'s are constants representing the weights. The Dirichlet, Neumann, and Robin are also called the first-type, second-type and third-type boundary condition, respectively. The mixed boundary condition refers to the cases in which Dirichlet boundary conditions are prescribed in some parts of the boundary while Neumann boundary conditions exist in the others. Accordingly, for the above ODE, the following is a typical mixed boundary condition: \[y\left({\rm a}\right)={\rm A}\] \[y'\left({\rm b}\right)={\rm \beta }\] In the above 1D heat transfer problem, this corresponds to the condition that one end of the wire is placed in a water bath while the other end is connected to a heater with constant heat transfer rate. While being less common, Cauchy boundary conditions are also used in second-order differential equations, in which one may specify the value of the function $y$ and the value of the derivative $y'$at a given point: \[u\left({\rm a}\right)={\rm A}\] \[u'\left({\rm a}\right)={\rm \alpha }\] Therefore, the Cauchy boundary conditions correspond to imposing a Dirichlet and a Neumann boundary conditions simultaneously.

### Multi-dimensional BCs

In 2D and 3D, there is more than one direction and the derivative is generalized into the gradient as introduced in previous sections. Therefore, theoretically, we now have the freedom to assign a value to each component of the gradient. This also happens in real simulations. However, a more common scenario in multiphysics simulation is that we introduce the directional derivative, which defines the projection of the gradient in a prescribed direction: \[\frac{\partial u}{\partial n} =\left(\nabla u\right)\cdot n, \] where $u$ is the dependent variable which can be a tensor of any order and $n$ is the prescribed direction. In general, this boundary condition is utilized to represent the flux across the boundary. The flux can usually be correlated to the gradient of the dependent variable. Therefore, $n$ is usually the outward normal direction of the boundary. It is noticed that $n$ is not necessarily unchanged from point to point. Detailed examples will be given in the sections for monolithic physics.