3.5 Matrix construction

The construction of each matrix equation involves building the matrix and source coefficients from the terms in the equation being solved, with further adjustments for boundary conditions.

The figure below illustrates the process of building a matrix equation for a field eqn from an equation including advection, diffusion and source eqn.

PIC
Coefficients for matrix eqn and source eqn are calculated for each individual term in the equation, e.g. eqn, eqn, etc. using the discretisation methods described in this chapter.

The overall coefficients are calculated as the sum of coefficients for each term in the the equation. Most terms contribute to both the matrix and source coefficients, although this depends on the choice of discretisation scheme.

Finally, boundary conditions are incorporated into the equation through further adjustments to coefficients in eqn and eqn as shown below. The adjustments, principally from the advection and diffusion terms, are applied to coefficients corresponding to cells at the domain boundary.

PIC

Implicit and explicit

The equation for a field eqn on the previous page is discretised to form the matrix equation eqn. The discretisation of a term is implicit when it contributes to coefficients in eqn by treating eqn as the solved field eqn.

Explicit discretisation calculates coefficients in eqn only, using current values of fields. When solving an equation for eqn, derivatives without eqn must be explicit. Terms with eqn could be treated explicitly by using current values of eqn, but they generally are not, since explicit solutions are unstable beyond a limiting time step as described in Sec. 3.17 . A notable exception to this are the terms discussed in Sec. 3.20 .

The curl derivative, e.g. eqn, includes terms in eqn and eqn in the decoupled matrix equation for eqn. These terms must be treated explicitly since they do not include eqn itself. The situation for eqn and eqn is the same, so the curl derivative can be explicit only.

This leaves the following terms which are generally treated implicitly:3

  • time derivative eqn;
  • diffusion (Laplacian) eqn;
  • advection eqn;
  • implicit linear function eqn, where eqn is a scalar.

This chapter details: the discretisation of these terms, which are generally treated implicitly; and, other terms such as divergence eqn and gradient eqn which can only be discretised explicitly within a segregated solution.


3also equivalent terms including density, e.g. eqn, eqn

Notes on CFD: General Principles - 3.5 Matrix construction