## 6 Numerical Methods and Algorithms
### Models at the Macro-Scale
#### 6.1.1 Discretization in the Space-Time Domain
\begin{array}{c}n\\ j\end{array} \right)}u\left(x+\left(\frac{n}{2}-j\right)h\delta_{j}\right) \tag{100}\]  
where \(\delta_{j}=\left[\delta_{ij}\right]_{i=1,\ldots,n}\). 3. By substituting one of the above approximations to each space derivative operator in \(L(u(x))\), we obtain the so-called space approximated operator \(L_{h}(u(x))\), which can be written generally as a nonlinear algebraic operator as follows: \[L_{h}(u(x))=\sum_{j}^{m}{a_{j}(u)u\left(x+\alpha jh\delta_{j}\right)}\] (101) where \(\alpha\) and \(m\) depend on the type of approximation chosen. 4. The set of the following \(N_{nodes}\) algebraic equations \[L_{h}(u(x_{1}))=f(x_{1}),\;\;I=1,\ldots,N_{nodes}\] (102) which are obtained by evaluating the equation \(L_{h}(u(x))=f(x)\) in each node of finite difference mesh can be written, after the inclusion of boundary conditions, in matrix form as \[\mathbf{M}\mathbf{u}=\mathbf{z},\] (103) where \(\mathbf{M}\), \(\mathbf{u}\), and \(\mathbf{z}\) are, respectively, a matrix and two vectors whose generic elements are \[\mathbf{M}_{i,j} = a_{j}(u(x_{i}))\] \[\mathbf{z}_{i} = z(x_{i})\] \[\mathbf{u}_{i} = u_{h}(x_{i})\] where \(i,j=1,\ldots,N_{nodes}\). Therefore, solving Equation (103) allows us to identify the values at which the approximation \(u_{h}\) takes on the nodal points of the finite element mesh. It is obvious that the accuracy of \(u_{h}\) depends on the type of approximation chosen for the derivative operators that are present in \(L(u(x))\). **Finite Volumes**[127; 138] A space discretization technique called the finite volume approach works well for numerical modeling of several kinds of conservation laws that are represented by PDEs of the form (86) where the linear differential operator \(L(u)\) can be expressed as  
\[L(u(x))=div\;\mathbf{F}(u(x)). \tag{104}\]As for FEM and FDM, the major steps in the finite element formulation and analysis of a typical problem are  
1. Discretization of the domain into a set of selected subdomains. This is accomplished by subdividing the given domain \(\tilde{\Omega}=\Omega\cup\Gamma\) into a set of \(N_{cells}\) subdomains \(\tilde{\Omega}^{c}=\Omega^{c}\cup\Gamma^{c}\) where \(\Gamma=\partial\Omega\) and \(\Gamma^{c}=\partial\Omega^{c}\), called control volumes or cells (see Figure 9b), forming the finite volume mesh. Planar surfaces in 3D or straight edges in 2D define the boundaries of the control volumes. Consequently, flat faces or straight edges are used to approximate the bounding surface, if  
Figure 8: Finite element discretization of a domain (**a**). Linear triangular finite elements (**b**). Global–local correspondence of nodes for the assembly of elements (**c**). Figure 9: (**a**) Finite difference discretization of a 2D rectangular domain \(\Omega=[0,\ L_{x}]\times[0,\ L_{y}]\) by a grid of \(N_{nodes}=N_{x}\times N_{y}\) nodes (distance between two adjacent nodes in the \(x-\) and \(y-\) directions are, respectively, \(\Delta x\) and \(\Delta y\)). If \(h=\Delta x=\Delta y\), nodes are part of a uniform grid mesh. (**b**) Example of a finite volume discretization of a 2D domain. The cell centers \(x^{c}\) of each subdomain \(\Gamma^{c}\) are denoted by squares and enumerated according to the total number of the domains. The \(\Gamma^{c}_{i=1,2,3}\) denotes the faces of each domain \(\Omega^{c}\). it is curved. Cell faces, or just faces, are the names given to these bounding discrete surfaces. 2. Construction of approximation statements needed to identify the approximation function \(u^{h}\) for the actual solution \(u\) of (104). Following the approach described for the FEM framework and based on Weighted Residual Methods, from (88), where the _weight functions_\(w_{i}(x)\) are chosen to be constant and equal to identity, it follows that \[\int_{\Omega^{c}}div\;F(u(x))dx=\int_{\Omega^{c}}f(x)dx\] (105) for each cell \(\Omega^{c}\) of the finite volume mesh.