FEMDocumentation`
FEMDocumentation`

# BoundaryUnitNormal

BoundaryUnitNormal[x,y,]

represents an outward-pointing unit normal vector on a region.

# Details and Options

• BoundaryUnitNormal can be used to construct partial differential equation boundary conditions that depend on the unit normal vector of the boundary.
• • BoundaryUnitNormal can be used with NeumannValue, DirichletCondition and NIntegrate.
• BoundaryUnitNormal can be generated by boundary conditions like AcousticAbsorbingValue, HeatFluxValue or MassOutflowValue.
• BoundaryUnitNormal can be used to specify a tangential on the boundary.
• BoundaryUnitNormal will evaluate to a vector of length of the embedding dimension of the region when the boundary condition is discretized.
• Components of the boundary unit normal can be accessed with Indexed.
• For finite element approximations, the PDE is multiplied with a test function and integrated over . Integration by parts gives . The integrand in the boundary integral is replaced with the NeumannValue .
• When a PDE specifies the Neumann value as , BoundaryUnitNormal can be used to model instead by specifying the NeumannValue as .
• Conversely, when a PDE specifies the Neumann value as , BoundaryUnitNormal can be used to model instead by specifying the NeumannValue as .
• At internal boundaries of a region, the boundary unit normal is not uniquely defined.
• The value of the boundary unit normal will be computed by solving with a Dirichlet condition of on all boundaries including internal boundaries over the entire region . The boundary unit normal is then the gradient of normalized with .

# Examples

open allclose all

## Basic Examples(1)

Solve a Poisson equation on a unit Disk:

Visualize the solution:

Compute the total flux through the boundary of the region through a second-order approximation of the boundary region:

Compute the total flux through the boundary of a subregion:

## Scope(6)

Solve a Poisson equation on a unit Disk:

Compute the total flux through the outer boundary:

Compute the total flux through the boundary of the region through a second-order approximation of the boundary region:

Specify a differential equation and a region:

On the left, set up a NeumannValue with a boundary unit normal and solve the equation:

Visualize the solution:

For this domain, the equivalent of the BoundaryUnitNormal at the left is :

Show that the solutions are equal:

Create a tangential for a NeumannValue:

Make use of a Indexed component of a BoundaryUnitNormal to compute a NeumannValue:

Solve a Poisson equation on a geometry:

Plot the solution:

Compute the total flux through the boundary:

Set up a NeumannValue with a boundary normal:

Use a Neumann 0 boundary condition and solve the equation again:

Inspect how the solutions start to differ over time:

For this domain, the equivalent of the BoundaryUnitNormal at the left is :

Check that the solutions are the same:

## Applications(1)

The following example considers a Stokes flow with prescribed traction boundary conditions in an annulus region. On the outer edge, at , there are no-slip boundary conditions. These set the fluid velocity in the and directions to 0, . On the inner boundary, at , a traction is prescribed. The traction with the stress vector is given as: Here, is the radial unit vector given as and is the tangent unit vector given as . and are the Cartesian unit vectors in the and directions, respectively. For this example, the traction is set in normal direction to and the tangential traction is set to . In other words, at the inner boundary the velocity is not specified, only the traction is specified.

The fluid stress tensor is given by: Stokes equation is given by: and the continuity equation: .

Set up parameters, geometry and refined mesh:

Set up a Stokes flow operator:

Set up a no-slip condition on the outer boundary:

On the inner surface, you can compute the tangent unit normal from the outward-pointing unit normal with a cross product. Use a cross product to compute the unit tangent from the unit normal vector :

To extract the first and second components of the cross product for the and directions, respectively, Indexed is used.

Set up the traction boundary conditions:

Equivalently, note that the tangent unit normal can also be given as because the unit normal vector on the inner surface is and the unit tangent then is :

Without specifying a boundary condition for the pressure, the pressure value will be floating and NDSolve will give a warning that not enough boundary conditions are specified: Visualize the pressure solution and the velocity field: To verify that the traction boundary condition works, you can compute radial and tangential components of the velocities and plot them at for all . For the radial velocity, a solution proportional to is expected, and for the tangential velocity, a solution proportional to is expected.

Define a function to compute the radial and tangential components of the velocities:

Plot the radial component of the velocities and a function proportional to :

Plot the tangential component of the velocities and a function proportional to :

Next, compute the normal stress and the shear at the inner boundary and check that they match the prescribed traction boundary conditions. The stress tensor is given by: .

The normal and tangential components of the traction vector can be computed by and .

Create a function to compute the stress tensor :

Compute the unit normal vector:

Define a function for the tangent vector:

Define a function to compute the normal stress:

Define a function to compute the shear stress:

Visualize the computed normal and shear stress at :

Visualize the difference of the normal and shear stress at from the boundary conditions:

## Properties & Relations(2)

Compute the boundary unit normal field:

Visualize the boundary unit normal:

Visualize the boundary unit normal on the boundary only:

The boundary unit normal is computed by solving a Poisson equation over the region and specifying 0 Dirichlet conditions. Compute a Poisson equation over a unit Disk:

Compute the normalized gradient of the potential:

Visualize the unit normal:

This is the same as computing the boundary unit normal of an ElementMesh: