com1DFA DFA-Kernel numerics¶
Warning
This theory has not been fully reviewed yet.
Mesh and interpolation¶
The numerical method used in com1DFA mixes particle methods and mesh methods. Mass and momentum are tracked using particles but flow depth is tracked using the mesh. The mesh is also to access topographic information (surface elevation, normal vector) as well as for displaying results. Here is a description of the mesh and the interpolation method used to switch from particle to mesh values and the other way around.
Mesh¶
For practical reasons, a 2D rectilinear mesh (grid) is used. Indeed the topographic input information is read from 2D raster files (with \(N_{y}\) and \(N_{x}\) rows and columns) which corresponds exactly to a 2D rectilinear mesh. Moreover, as we will see in the following sections, 2D rectilinear meshes are very convenient for interpolations as well as for particle tracking. The 2D rectilinear mesh is composed of \(N_{y}-1\) and \(N_{x}-1\) rows and columns of square cells (of side length \(csz\)) and \(N_{y}\) and \(N_{x}\) rows and columns of vertices as described in Fig. 8. Each cell has a center and four vertices. The data read from the raster file is affected to the vertices.
Cell normals¶
There are many different methods available for computing normal vectors on a 2D rectilinear mesh. Several options are available in com1DFA.
The first one consists in computing the cross product of the diagonal vectors between four vertices. This defines the normal vector at the cell center. It is then possible to interpolate the normal vector at the vertices from the ones at the cell centers.
The other methods use the plane defined by the different adjacent triangles to a vertex. Each triangle has a normal and the vertices is the average of the triangles normal vectors.
Cell area¶
The cell area can be deduced from the grid cellsize and the cell normal. A cell is a plane (\(z = ax+by+c\)) of same normal as the cell center:
Surface integration over the cell extend leads to the area of the cell:
The same method is used to get the area of a vertex (this does not make any sense…).
Interpolation¶
In the DFA kernel, mass, flow depths, velocity fields can be defined at particle location or on the mesh. We need a method to be able to go from particle property to mesh field values and from mesh values to particle property.
Mesh to particle¶
On a 2D rectilinear mesh, scalar and vector fields defined on mesh vertex and center can be evaluated anywhere within the mesh using a bilinear interpolation between mesh vertices. Evaluating a vector field simply consists in evaluating the three components as scalar fields.
The bilinear interpolation consists in successive linear interpolations in both \(x\) and \(y\) using the four nearest grid points, two linear interpolations in the first direction (in our case in the \(y\) direction in order to evaluated \(f_{0v}\) and \(f_{1v}\)) followed by a second linear interpolation in the second direction (\(x\) in our case to finally evaluate \(f_{uv}\)) as shown on Fig. 10:
and
the \(w\) are the bilinear weights. The example given here is for a unit cell. For no unit cells, the \(u\) and \(v\) simply have to be normalized by the cell size.
Particles to mesh¶
Going from particle property to mesh value is also based on bilinear interpolation and weights but requires a bit more care in order to conserve mass and momentum balance. Flow depth and velocity fields are determined on the mesh using, as intermediate step mass and momentum fields. First, mass and momentum mesh fields can be evaluated by summing particles mass and momentum. This can be donne using the bilinear weights \(w\) defined in the previous paragraph (here \(f\) represents the mass or momentum and \(f_{uv}\) is the particle value. \(f_{ij}\) are the vertex values):
The contribution of each particle to the different mesh points is summed up to finally give the mesh value. This method ensures that the total mass and momentum of the particles is preserved (the mass and momentum on the mesh will sum up to the same total). Flow depth and velocity grid fields can then be deduced from the mass and momentum fields and the cell area (real area of each grid cell).
Neighbor search¶
The SPH flow depth gradient computation is based on particle interactions. It requires, in order to compute the gradient of the flow depth at a particle location, to find all the particles in its surrounding. Considering the number of particles and their density, computing the gradient ends up in computing a lot of interactions and represents the most computationally expensive part of the dense flow avalanche simulation. It is therefore important that the neighbor search is fast and efficient. [IOS+14] describe different rectilinear mesh neighbor search methods. In com1DFA, the simplest method is used. The idea is to locate each particle in a cell, this way, it is possible to keep track of the particles in each cell. To find the neighbors of a particle, one only needs to read the cell in which the particle is located (dark blue cell in Fig. 11) , find the direct adjacent cells in all directions (light blue cells) and simply read all particles within those cells. This is very easily achieved on rectilinear meshes because locating a particle in a cell is straightforward and finding the adjacent cells is also immediate.
SPH gradient¶
SPH method can be used to solve depth integrated equations where a 2D (respectively 3D) equation is reduced to a 1D (respectively 2D) one. This is used in ocean engineering to solve shallow water equations (SWE) in open or closed channels for example. In all these applications, whether it is 1D or 2D SPH, the fluid is most of the time, assumed to move on a horizontal plane (bed elevation is set to a constant). In the case of avalanche flow, the “bed” is sloped and irregular. The aim is to adapt the SPH method to apply it to depth integrated equations on a 2D surface living in a 3D world.
Method¶
The SPH method is used to express a quantity (the flow depth in our case) and its gradient at a certain particle location as a weighted sum of its neighbors properties. The principle of the method is well described in [LL10]. In the case a depth integrated equations (for example SWE), a scalar function \(f\) and its gradient can be expressed as following:
Which gives for the flow depth:
Where \(W\) represents the SPH-Kernel function.
The computation of its gradient depends on the coordinate system used.
Standard method¶
Let us start with the computation of the gradient of a scalar function \(f \colon \mathbb{R}^2 \to \mathbb{R}\) on a horizontal plane. Let \(P_i=\mathbf{x}_i=(x_{i,1},x_{i,2})\) and \(Q_j=\mathbf{x}_j=(x_{j,1},x_{j,2})\) be two points in \(\mathbb{R}^2\) defined by their coordinates in the Cartesian coordinate system \((P_i,\mathbf{e_1},\mathbf{e_2})\). \(\mathbf{r}_{ij}=\mathbf{x}_i-\mathbf{x}_j\) is the vector going from \(Q_j\) to \(P_i\) and \(r_{ij} = \left\Vert \mathbf{r}_{ij}\right\Vert\) the length of this vector. Now consider the kernel function \(W\):
In the case of the spiky kernel, \(W\) reads (2D case):
\(\left\Vert \mathbf{r_{ij}}\right\Vert= \left\Vert \mathbf{x_{i}}-\mathbf{x_{j}}\right\Vert\) represents the distance between particle \(i\) and \(j\) and \(r_0\) the smoothing length.
Using the chain rule to express the gradient of \(W\) in the Cartesian coordinate system \((x_1,x_2)\) leads to:
with,
and
which leads to the following expression for the gradient:
The gradient of \(f\) is then simply:
2.5D SPH method¶
We now want to express a function \(f\) and its gradient on a potentially curved surface and express this gradient in the 3 dimensional Cartesian coordinate system \((P_i,\mathbf{e_1},\mathbf{e_2},\mathbf{e_3})\).
Let us consider a smooth surface \(\mathcal{S}\) and two points \(P_i=\mathbf{x}_i=(x_{i,1},x_{i,2},x_{i,3})\) and \(Q_j=\mathbf{x}_j=(x_{j,1},x_{j,2},x_{j,3})\) on \(\mathcal{S}\). We can define \(\mathcal{TP}\) the tangent plane to \(\mathcal{S}\) in \(P_i\). If \(\mathbf{u}_i\) is the (none zero) velocity of the particle at \(P_i\), it is possible to define the local orthonormal coordinate system \((P_i,\mathbf{V_1},\mathbf{V_2},\mathbf{V_3}=\mathbf{n})\) with \(\mathbf{V_1}=\frac{\mathbf{u}_j}{\left\Vert \mathbf{u}_j\right\Vert}\) and \(\mathbf{n}\) the normal to \(\mathcal{S}\) at \(P_i\). Locally, \(\mathcal{S}\) can be assimilated to \(\mathcal{TP}\) and \(Q_j\) to its projection \(Q'_j\) on \(\mathcal{TP}\). The vector \(\mathbf{r'}_{ij}=\mathbf{x}_i-\mathbf{x'}_j\) going from \(Q'_j\) to \(P_i\) lies in \(\mathcal{TP}\) and can be express in the plane local basis:
It is important to define \(f\) properly and the gradient that will be calculated:
Indeed, since \((x_1,x_2,x_3)\) lies in \(\mathcal{TP}\), \(x_3\) is not independent of \((x_1,x_2)\):
The target is the gradient of \(\tilde{f}\) in terms of the \(\mathcal{TP}\) variables \((v_1,v_2)\). Let us call this gradient \(\mathbf{\nabla}_\mathcal{TP}\). It is then possible to apply the Standard method to compute this gradient:
Which leads to:
This gradient can now be expressed in the Cartesian coordinate system. It is clear that the change of coordinate system was not needed:
The advantage of computing the gradient in the local coordinate system is if the components (in flow direction or in cross flow direction) need to be treated differently.
Artificial viscosity¶
Question: Why add the artificial viscosity at the beginning of the time step? makes no sense
In Governing Equations for the Dense Flow Avalanche, the governing equations for the DFA were derived and all first order or smaller terms where neglected. Among those terms is the lateral shear stress. This term leads toward the homogenization of the velocity field. It means that two neighbor elements of fluid should have similar velocities. The aim behind adding artificial viscosity is to
Where the velocity difference reads \(\mathbf{du} = \mathbf{u} - \mathbf{\bar{u}}\) (\(\mathbf{\bar{u}}\) is the mesh velocity interpolated at the particle position). \(C_{Lat}\) is a coefficient that rules the viscous force. It would be the equivalent of \(C_{Drag}\) in the case of the drag force. The \(C_{Lat}\) is a numerical parameter that depends on the mesh size. Its value is set to 100 and should be discussed and further tested.
Adding the viscous force¶
The viscous force is added implicitly:
Updating the velocity is done in two steps. First adding the explcit term related to the mean mesh velocity and then the implicit term which leads to:
With \(C_{vis} = \frac{1}{2}\rho C_{Lat}\|\mathbf{du}^{old}\| A_{Lat}\frac{dt}{m}\)