3.24 Example of building a matrix equation
The previous sections describe methods to
discretise derivative and other terms in order to build a matrix
equation for a given physical equation. Let us demonstrate the
construction of a matrix equation, using the momentum conservation
equation from Sec. 3.23
as an example. It is
a vector equation, so produces 3 matrix equations for ,
and
.
The first term, the time derivative , might be
discretised with the Euler scheme Eq. (3.21
). Matrix equations are
constructed in extensive
form as discussed in Sec. 3.6
. Hence, the
contributions from Eq. (3.21
) to matrix coefficients
and source vector
are scaled by cell volume
, i.e.
and
, respectively, as
illustrated below.
![PIC](img/example-matrix-time-derivative.png)
![eqn](img/index1529x.png)
![eqn](img/index1530x.png)
![eqn](img/index1531x.png)
The transported might be discretised
using the linear upwind scheme described in Sec. 3.14
. The scheme first applies
upwind discretisation, which contributes outgoing positive fluxes
to
diagonal coefficients and negative fluxes
to off-diagonals. It
then adds an explicit contribution based on an extrapolated
gradient
(see Sec. 3.14
). The gradient
is
usually calculated by Eq. (3.18
) with gradient
limiting from Sec. 3.16
.
![PIC](img/example-matrix-advection.png)
![eqn](img/index1537x.png)
![eqn](img/index1538x.png)
![eqn](img/index1539x.png)
![eqn](img/index1540x.png)
![eqn](img/index1541x.png)
![eqn](img/index1542x.png)
![PIC](img/example-matrix-laplacian.png)
![eqn](img/index1543x.png)
![eqn](img/index1544x.png)
![eqn](img/index1545x.png)
![eqn](img/index1546x.png)
![eqn](img/index1547x.png)
![eqn](img/index1548x.png)
![eqn](img/index1549x.png)
![eqn](img/index1550x.png)
![eqn](img/index1551x.png)
![PIC](img/example-matrix-gradient.png)