D-Example - Finite Difference Method (FDM) h left. Geometry A = m 2 = m ents 4m q right x 2. Permeability k f = 5 m/s 3. Boundary Conditions q right = 4 m/s y m 2 3 4 5 h left = 5 m x x x x home/baumann/d_beispiel/folie.tex. p./9
D-Example - Finite Difference Method (FDM) Continuity equation (mass balance equation for an incompressible fluid): v q = Momentum balance equation Darcy equation (with all necessary assumptions): v = k f h with h = p ρg + z If we insert the Darcy equation into the continuity equation and then rewrite it in a one dimensional form, we get Assumptions: ( k f h) q = and D x ( k f No sinks or sources inside the tube, incompressible flow, and (Re ). h x ) q =. home/baumann/d_beispiel/folie2.tex. p.2/9
D-Example - Finite Difference Method (FDM) Goal: Direct transfer from the partial differential equation to the difference equation (algebraic equation). Finite Difference Approximation h PSfrag replacements ĥ i ĥ i+ () ĥ i (2) (3) =.[m] i i i+ x home/baumann/d_beispiel/folie3.tex. p.3/9
D-Example - Finite Difference Method (FDM) (e.g. from the Taylor ex- We can write the finite difference formulation for dh and d2 h dx dx 2 pansion) «dh dx i+ «dh dx i «dh dx i d 2 h dx 2 = d dx = h i+ h i = h i h i = h i+ h i «dh dx = forward difference () backward difference (2) central difference (3) " «dh dx i+ «# dh dx i d 2 h dx = 2 hi+ h i h i h i «= h i+ 2h i + h i 2 home/baumann/d_beispiel/folie4.tex. p.4/9
D-Example - Finite Difference Method (FDM) Calculation of the flow balance at the nodes: Node is our known boundary condition h left h left = h or k f h 2 h = q () Node 2 is calculated according to the presented scheme k f h i+ 2h i + h i 2 q 2 =, h i is known, k f h 2h 2 + h 3 2 q 2 =, with q 2 =, k f 2 (, 2, ) (h, h 2, h 3 ) T = with h as boundary condition. home/baumann/d_beispiel/folie5.tex. p.5/9
D-Example - Finite Difference Method (FDM) Node 3 and node 4 are calculated accordingly: k f h 4 2h 3 + h 2 2 q 3 = k f 2 (, 2, ) (h 4, h 3, h 2 ) T =, k f h 5 2h 4 + h 3 2 q 4 = k f 2 (, 2, ) (h 5, h 4, h 3 ) T =. Node 5 is a boundary node with the prescribed flux q right. This boundary condition will be used directly as the last equation k f h 5 h 4 = q right k f (, ) ((h 5, h 4 ) T = q right. home/baumann/d_beispiel/folie6.tex. p.6/9
D-Example - Finite Difference Method (FDM) Assemble the equations for the piezometric heads in matrix form 2 2 B C B @ 2 A @ h h 2 h 3 h 4 h 5 C A = k f q B @ C A k f q left. As h is known, we can delete the corresponding row and column and transfer h to the right hand side of the equation. 2 2 B C B @ 2 A @ h 2 h 3 h 4 h 5 C A = B @ h left k f q right C A home/baumann/d_beispiel/folie7.tex. p.7/9
D-Example: Integral Finite Difference Method (IFDM) Given: H left. Geometry A = z y = m 2 x = m ents h 2 A 4 m CV A Q right x 2. Permeability k f = 5 m/s 3. Boundary conditions Q right = 4 m 3 /s H left = 5 m 2 3 4 z y x x x x x home/baumann/d_beispiel/element.tex. p.8/9
D-Example: Starting equations (IFDM) Continuity equation: Z A (v n) da Z CV q dω = Momentum equation (Darcy equation): v = k f h Inserting the momentum equation into the continuity equation yields: Z A ( k f h) n da Z CV q dω =. If only one control volume is considered one obtains X Z CV A CV ( k f h) n da Z «q dω =. CV CV home/baumann/d_beispiel/starting equation.tex. p.9/9
D: Considering the second control volume (IFDM) Writing the integral over the boundary of the control volume as the sums over the interfaces, the first term can be written as: Z A CV ( k f h) n da = X i ( k fi h i )A i = X i Q i with i =, 2 for D. For a d problem each control volume has two interfaces. For the second control volume we have to take two fluxes into account. The source- and sinkterm R q dω, which CV describes extraction or injection of water inside of the domain, e.g. by a well, equals zero, as no water is extracted or injected inside of the second control volume. PSfrag replacements n 2 n x X ( k fi h i )A i = Q 2 + Q 2 3 = i home/baumann/d_beispiel/one_element.tex. p./9
D-Example - Calculating the fluxes (IFDM) The fluxes can now be approximated in the following way. Q 2 is the flux over the boundary of control volume two (CV 2) into control volume one (CV ). An inflow into CV 2 and an outflow out of CV 2 have positive and negative signs, respectively. Q 2 = h h 2 Q 2 3 = h 3 h 2 k f A k f A Inserting these fluxes into the balance equation for CV 2 yields Q 2 + Q 2 3 = h h 2 + h 3 h 2 «k f A = «h 2h 2 + h 3 k f A =. home/baumann/d_beispiel/fluxes.tex. p./9
D-Example - on the side: averaging (IFDM) What happens if k f k f2? How can k f2 be determined? 2 x In principle there are two possibilities arithmetic mean k f +k f2 2, harmonic mean 2k f k f2 k f +k f2. It stands to reason to proceed from the extreme case. What would happen if one of the permeabilities would be zero, which means one domain would be impermeable? As the system is one-dimensional, this domain would be a barrier and there would be no flow. The harmonic mean fulfills this criterion and is here the correct averaging method. home/baumann/d_beispiel/averaging.tex. p.2/9
D-Example - Stiffness matrix I (IFDM) In order to determine the unknowns, in this case the piezometric heads, all equations (one for each control volume) have to be solved. This leads to a system of equations, which can be written in a matrix - vector product. The matrix is called stiffness matrix analogous to structural mechanics. It consists of the factors in front of the piezometric heads and the structural parameters, such as cross sectional area and permeability. The solution vector contains the piezometric heads and on the right hand side are all the known values as well as the inflow and outflow of the system. S ij {z} h i {z} 2 = q j. {z} 3. Control volume matrix or stiffness matrix 2. Vector of unknowns 3. (right hand side) source and sink terms, boundary conditions home/baumann/d_beispiel/stiffnessmat.tex. p.3/9
D-Example - Stiffness matrix II (IFDM) The matrix form of the equation for the second control volume has the following shape: (h 2h 2 + h 3 )k f A = k f A(h 2h 2 + h 3 ) = k f A, 2, = k f A S CV Depending on the system, the different permeabilities are included into the stiffness matrix or, in case they are identical, they can be factored out and moved to the right hand side. In our example this is the case: h T CV B @ h h 2 h 3 C A S ij h T i = k f A Q j. home/baumann/d_beispiel/stiffnessmat2.tex. p.4/9
D-Example - Stiffness matrix III (IFDM) If we assemble all the equations in the system matrix, we yield the following result: 3 2 B C B @ 2 A @ h h 2 h 3 h 4 C A = B @ 2H left Q right k f A. C A In no control volume water is extracted or injected. In the first row the known piezometric head is moved to the boundary conditions on the right hand side. In the last row we can insert the other boundary condition directly into the flow equation. As it is known, it can be moved to the right hand side. On the next pages there will be further explanation about including boundary conditions. home/baumann/d_beispiel/stiffnessmat3.tex. p.5/9
D-Example - Boundary conditions I (IFDM) Dirichlet boundary condition: PSfrag replacements H left A further unknown (h ) enters the balance equation for the CV. In this case h is coupled with h via the boundary condition. As H left has to be constant, and we assume a linear piezometric head distribution, we can express H left as the arithmetic mean of the neighbouring piezometric heads. H left = h + h 2 h = 2H left h If we put this into our balance equation for CV, we get Q + Q 2 = «h 2h + h 2 k f A = «2Hleft 3h + h 2 k f A =. home/baumann/d_beispiel/boundary conditions.tex. p.6/9
D-Example - Solution I (IFDM) The system of equations could be solved e.g. using the Thomas-algorithm or the socalled double sweep procedure. On the next two slides the depenencies of the variables will be set up on the left hand side. On the right hand side we will insert the values back, and the values will be calculated from bottom to top. 3h + h 2 = 2H left h = 2H left h 2 3 h = 2 3 H left + 3 h 2 h 2h 2 + h 3 = h = 45m h = 2 3 5m + 3 35m 7 h 2 = 35m h 2 = h h 3 2 = 2 6 H left + 6 h 2 + 2 h 3 h 2 = 2 5 H left + 3 5 h 3 h 2 = 3 5 25m + 2 5 5m home/baumann/d_beispiel/solution.tex. p.7/9
D-Example - Solution II (IFDM) 2 h 2 2h 3 + h 4 = h 3 = h 2 h 4 2 = 5 H left + 3 h 3 + 2 h 4 6 h 3 = 25m h 3 = 2 7 H left + 5 7 h 4 h 3 = 5 7 5m + 2 7 5m 3 h 3 h 4 = Q k f A h 4 = Q k f A + h 3 = Q k f A + 5 7 h 4 + 2 7 H left 5 h 4 = 5m h 4 = 7 Q 2 k f A + H left = 4 h 4 = 7 4 m 3 /s m 2 5 m/s m 2 + 5m This yields the following distribution of piezometric heads: h = 45m ; h 2 = 35m ; h 3 = 25m ; h 4 = 5m. home/baumann/d_beispiel/solution_ii.tex. p.8/9