Weak Forms of Equations

Each term in a weak equation is written using the Integral operator, which takes three arguments: a CellFilter to specify the domain, an Expr specifying the integrand, and a QuadratureFamily object to indicate how the integration is to be done.

Each term must be a valid term in a weak equation, i.e., it must contains exactly one test function.

For example, the weak form of Laplace's equation

\[ \nabla^2\phi=0 \]

on the interior of a domain with Robin boundary condition

\[ \frac{\partial \phi}{\partial n} = \frac{1}{L}(x-\phi) \]

on an inflow surface, is written as

// create first and second order Gaussian quadrature objects
QuadratureFamily quad1 = new GaussianQuadrature(1);
QuadratureFamily quad2 = new GaussianQuadrature(2);

// write the weak form. The interior term can use order 1 quadrature,
// but the surface term involves quadratic functions and must use
// order 2 quadrature
Expr eqn = Integral(interior, (grad*phiHat)*(grad*phi), quad1)
        + Integral(in, phiHat*(x-phi)/L, quad2) ;

Dirichlet boundary conditions are not usually written in terms of Integral operators; see the page on boundary conditions for more information on that subject.

See the pages on linear problems and nonlinear problems for information on how to use symbolic weak forms in setting up problems to solve.

Site Contact