Step 4: Generate a Weak Form

The first question to ask when presented with a partial differential equation (PDE) that governs a problem's physics is: "How do I solve this equation?" The MOOSE answer to this question is to use Galerkin's Method, which involves expressing the strong form of a governing PDE in its weak form.

In this step, the relevance of the so-called "weak form" of a PDE as it pertains to creating an application and how to derive it from the equation's strong form will be discussed. The diffusion equation of the previous two steps shall be revisited. In addition, the reader shall begin to consider the next phase of the tutorial by deriving the weak form of Darcy's pressure equation, which was given on the Problem Statement page.

warningwarning:This is not an introduction to the Finite Element Method.

For a complete introduction to the FEM, please refer to the myriad of literature on it. The information presented here introduces the concepts as simply as possible for the purpose of demonstrating the development of a MOOSE-base application. Please visit the Finite Element Concepts page for more information.

The Method of Weighted Residuals

The Method of Mean Weighted Residuals assumes that the solutions to PDEs are well approximated by a finite sum of test functions, which are denoted by . It involves rearranging the strong form of a PDE so that all terms are on one side of the equation, with zero on the other, and then multiplying by all . For the Laplace equation, this method is an attempt to find such that

(1)

The left-hand side of Eq. (1) is called the residual and the coefficient is arbitrary, except for requiring that it satisfy homogeneous boundary conditions.

There is a general procedure for expressing a residual as one that is readily solved with MOOSE. First, integrate with respect to the problem domain :

(2)

Next, recall that the product rule of differentiation implies that

(3)

Substituting the right-hand side of Eq. (3) results in integration by parts of Eq. (2):

(4)

Finally, notice that the second term in Eq. (4) is a volume integral whose integrand is the divergence of the field . Therefore, it is possible to apply the divergence theorem and integrate the magnitude of this field along the volume's surface normal with respect to that surface's domain , i.e.,

(5)

This is the weak form of the Laplace equation. From an application developer's perspective, it is convenient to express a weak form using inner product notation, and to identify the MOOSE class that each residual term shall inherit from:

(6)

Procedure for Generating Weak Forms

The general procedure for expressing the weak form of a PDE is as follows:

  1. Write down the strong form of the equation.

  2. Rearrange terms so that all are on one side of the equals sign, with zero on the other.

  3. Multiply the whole equation by a test function .

  4. Integrate the whole equation over the domain and apply the integrand sum rule to separate the terms.

  5. Integrate by parts (use the product of rule of differentiation) any divergence, or higher-order derivatives, of the primary variable multiplied by . Repeat this step until the appropriate order of the differential functions is achieved.

  6. Apply the divergence theorem to generate boundary integrals, if necessary and/or possible.

  7. Express the final weak form using inner product notation, if desired.

The Galerkin Finite Element Method

In general, the FEM assumes that solutions to PDEs take on simple analytical forms called shape functions, e.g., a polynomial. This assumption enables difficult analytical derivative expressions to be directly integrated in a piecewise-continuous fashion. The Galerkin FEM is one that uses the same functions to approximate the solution of a PDE as those used for test functions . There are many approaches to achieve solutions using the FEM, but the Galerkin approach is particularly useful for multiphysics applications, because it is a purely numerical one whose effectiveness is independent of the underlying physics.

Demonstration

Consider the zero-gravity, divergence-free form of Darcy's Pressure law, as it was given on the Problem Statement page, over the domain enclosed by the pipe between the two pressure vessels:

(7)

The Procedure for Generating Weak Forms shall now be applied to this equation. The result of each step will be provided here, but the reader should make their own attempt and then verify their conclusions.

  1. Write down the strong form: Eq. (7)

  2. Rearrange terms: done

  3. Multiply the equation by :

  4. Integrate the equation over :

  5. Integrate by parts:

  6. Apply the divergence theorem:

  7. Express the final weak form using inner product notation:

    It is important to become comfortable with this notation for weak form expressions as it shall henceforth be used exclusively.