4. Managing the fluxes¶
4.1. Introduction¶
As said previoulsy, we do not develop the way how to compute the solution of a Riemann problem. It is assumed that this point is known. In this section we will indicate how to manage the fluxes to avoid extra calculations and thus save computing time. The basis of this section is the equation Eq.1.5 reminded here :
4.2. Scalar equation in 1D code¶
Let’s consider here 1D mesh with the characteristics of the one depicted in Figure 2.4. For the cell i, the face cell number 2 is between cell i and i+1, the face cell number 4 is between cell i and i-1. The fluxes must obey the property established in Chapter 1 and given by Eq.1.5.
Let’s consider the scalar equation of mass conservation in its discrete form (from Eq.1.6) in cell i :
In 1D, there are only 2 faces, namely 2 and 4. The flux of the density is \(\rho^* u^* \vec{n}_{i,k}\) then the previous equation is then
Consider now the cell i+1. Both cell i and i+1 have a face in common which face i,2 or i+1,4. On this face, the summation of the fluxes must be equal to zero on this face and that is expressed by:
Whatever the face \({\rho_{i,k}^*\vec{u}}_{i,k}^*.{\vec{n}}_{i,k} = \rho_{i,k}^* u_{i,k}^*\) and obviously \(A_{i,2} = A_{i+1,4}\) :
Hint
Eq.4.1 means that there si no need to calculate the flux in cell i+1 at face 4: this one has been already computed in cell i. Actually, on face 4, the flux must be computed only once at the boundary condition (the number of the cell is depending on the numbering…). That remarks allows a substantial cpu time saving.
4.3. Vectorial equation in 2D code¶
A scalar flux is managed the same way as given by Eq.4.1 whatever the space dimension. Vectorial fluxes required more attention because of projection in 2 local frames. Let’s consider the cell loacted at (i,j)=I and its neighbour (i+1,j)=J. Then according to Figure 2.3 the common face is the face number 2 for cell I and 4 for cell J as depicted in the Figure Figure 4.2.
Obviously, both frames obey :
Then, the flux property :
is developped with \(F_k^*(\rho\vec{u})=\left(\rho_k^\ast{\vec{u}}_k^\ast{\vec{u}}_k^\ast+p_k^\ast{\bar{\bar{I}}}_d\right)\) to lead :
The projection of the velocity in the local frames :
Using of the property Eq.4.2 leads to the following relations :
Hint
Eq.4.3 means that in 2D saving CPU time thanks this property is not negligible: we compute only fluxes for faces 2 and 1 (1 in each direction), the others are obtained by directly affecting the data.