The Soap Bubble Problem

A soap film bounded by a wire frame has the shape determined by the
minimization of its internal energy. The shape of the film is described
by the heightu(x,y) over a given domain.
The height is fixed at the domain boundary, by the height of
the wire frame g
If the film is homogeneous, minimizing the internal energy is equivalent
to minimizing its area, the integral of
s(u) = sqrt(1+|grad(u)|^2)
This in its turn is equivalent to finding u such that

-div( grad(u)/s(u) ) = 0, inside the domain

u(x,y) = g(x,y), on the domain boundary

In this example you look at a wire frame with two circular components.
The inner frame is at height 0 while the outer frame is given by
g(x,y) = x^2.

The wire frame for a soap bubble. The computational domain

Geometry

First you draw the domain which is an annulus (a two-dimensional doughnut),
i.e. the region between two concentric circles:

An annulus obtained by subtracting the small disk from the
large one. This is expressed by the set formula C1-C2

Boundary conditions

Next you set the boundary conditions, u = 0 on the inner frame, and
u(x,y) = x^2 on the outer frame:

Boundary conditions dialog box.

PDE Coefficients

Setting the equation coefficients amounts to typing in MATLAB statements.
These can be constants, expressions containing the space variables
x and , y ,
the unknown u , its partial derivatives
ux and uy , or even
user-defined functions. The general
form of the time-independent, elliptic, scalar PDE is-div( c*grad(u) ) + a*u = f

In the soap bubble problem, you have a = f = 0 and
c = 1./sqrt(1+ux.^2+uy.^2).

Mesh generation

The mesh generator initializes a coarse mesh.
Further refinements of the mesh
are necessary to obtain a reasonable solution.

A triangularization of the domain

Mesh generation is done automatically, but it you can also steer it
by setting parameters. In this example the default mesh is initialized
and then uniformly refined. The fine mesh contains 590 nodes and
1096 triangles.

Solvers

The Finite Element Method discretization is performed. Linear problems
are solved by MATLAB's internal solver. However,
the soap bubble equation is nonlinear, and you have to tell that to the
solver. After setting the nonlinear option among the Solve
parameters, the equations are discretized and solved.
A damped Gauss-Newton iterative is employed. Set the Jacobian option to
Full. While the solver works, you can see the reduction of the
residual in your workspace window.