D Flow Flexible Mesh Technical Reference Manual Flow_FM_Technical_Reference_Manual FM
User Manual: Pdf D-Flow_FM_Technical_Reference_Manual
Open the PDF directly: View PDF .
Page Count: 166
Download | |
Open PDF In Browser | View PDF |
1D/2D/3D Modelling suite for integral water solutions DR AF T Delft3D Flexible Mesh Suite D-Flow Flexible Mesh Technical Reference Manual DR AF T T DR AF D-Flow Flexible Mesh Technical Reference Manual Released for: Delft3D FM Suite 2018 D-HYDRO Suite 2018 Version: 1.1.0 SVN Revision: 54909 April 18, 2018 DR AF T D-Flow Flexible Mesh, Technical Reference Manual Published and printed by: Deltares Boussinesqweg 1 2629 HV Delft P.O. 177 2600 MH Delft The Netherlands For sales contact: telephone: +31 88 335 81 88 fax: +31 88 335 81 11 e-mail: software@deltares.nl www: https://www.deltares.nl/software telephone: fax: e-mail: www: +31 88 335 82 73 +31 88 335 85 82 info@deltares.nl https://www.deltares.nl For support contact: telephone: +31 88 335 81 00 fax: +31 88 335 81 11 e-mail: software.support@deltares.nl www: https://www.deltares.nl/software Copyright © 2018 Deltares All rights reserved. No part of this document may be reproduced in any form by print, photo print, photo copy, microfilm or any other means, without written permission from the publisher: Deltares. Contents Contents List of Figures vii List of Tables ix List of Symbols xi 1 Problem specification 1.1 The master definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 2 Data structures 2.1 Hierarchy of unstructured nets . . . . . . . . . . 2.2 Implementation details of unstructured nets . . . . 2.3 Improve use of cache . . . . . . . . . . . . . . . 2.3.1 Improved cache use by node renumbering . . . . 3 3 3 3 3 . . . . . . . . . . . . . . . . . 5 5 5 5 5 5 6 8 8 9 12 13 15 16 19 19 20 20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T . . . . DR AF 3 Unstructured grid generation 3.1 Curvilinear grids . . . . . . . . . . . . . . . . . . . . . . . 3.2 Triangular grids . . . . . . . . . . . . . . . . . . . . . . . . 3.3 2D networks . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Grid optimizations . . . . . . . . . . . . . . . . . . . . . . . 3.5 Grid orthogonalization . . . . . . . . . . . . . . . . . . . . 3.5.1 Discretization . . . . . . . . . . . . . . . . . . . . . 3.5.2 Curvilinear-like discretization . . . . . . . . . . . . . 3.6 Grid smoothing . . . . . . . . . . . . . . . . . . . . . . . . 3.6.1 Assigning the node coordinates in computational space 3.6.1.1 Determining the true cell angles . . . . . . 3.6.1.2 Assigning the node coordinates . . . . . . 3.6.2 Computing the operators . . . . . . . . . . . . . . . 3.6.2.1 Node-to-edge operator . . . . . . . . . . . 3.6.2.2 Edge-to-node operator . . . . . . . . . . . 3.6.2.3 Node-to-node operator . . . . . . . . . . . 3.6.3 Computing the mesh monitor matrix . . . . . . . . . 3.6.4 Composing the discretization . . . . . . . . . . . . . 4 Numerical schemes 4.1 Time integration . . . . . . . 4.2 Matrix solver: Gauss and CG 4.2.1 Preparation . . . . . 4.2.2 Solving the matrix . 4.2.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 21 21 21 21 22 5 Conceptual description 5.1 Introduction . . . . . . . . . . . . . . . . . 5.2 General background . . . . . . . . . . . . 5.3 Governing equations . . . . . . . . . . . . 5.4 Boundary conditions . . . . . . . . . . . . 5.5 Turbulence . . . . . . . . . . . . . . . . . 5.6 Secondary flow . . . . . . . . . . . . . . . 5.6.1 Governing equations . . . . . . . . 5.6.1.1 Streamline curvature . . . 5.6.1.2 Spiral flow intensity . . . . 5.6.1.3 Bedload transport direction 5.6.1.4 Dispersion stresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 25 25 25 25 25 26 26 26 27 27 28 Deltares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii D-Flow Flexible Mesh, Technical Reference Manual 5.6.2 Numerical schemes . . . . . . . . . . . . . . . . . 5.6.2.1 Calculation of streamline curvature . . . . 5.6.2.2 Calculation of spiral flow intensity . . . . . 5.6.2.3 Calculation of bedload sediment direction 5.6.2.4 Calculation of dispersion stresses . . . . 5.7 Wave-current interaction . . . . . . . . . . . . . . . . . . 5.8 Heat flux models . . . . . . . . . . . . . . . . . . . . . . 5.9 Tide generating forces . . . . . . . . . . . . . . . . . . . 5.10 Hydraulic structures . . . . . . . . . . . . . . . . . . . . . 5.11 Flow resistance: bedforms and vegetation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 29 31 31 31 31 32 32 32 32 33 33 33 35 36 37 39 56 62 62 65 66 69 73 73 73 74 74 77 77 77 7 Numerical schemes for three-dimensional flows 7.1 Governing equations . . . . . . . . . . . . 7.2 Three-dimensional layers . . . . . . . . . . 7.2.1 sigma-grid . . . . . . . . . . . . . 7.2.2 z-layers . . . . . . . . . . . . . . . 7.3 Connectivity . . . . . . . . . . . . . . . . 7.4 Spatial discretization . . . . . . . . . . . . 7.4.1 Continuity equation . . . . . . . . . 7.4.2 Momentum equation . . . . . . . . 93 93 94 94 94 95 95 96 96 DR AF T 6 Numerical approach 6.1 Topology of the mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.1 Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.2 Bed geometry: bed level types . . . . . . . . . . . . . . . . . . . . 6.2 Spatial discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.1 Continuity equation . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.2 Momentum equation . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 Temporal discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.1 Solving the water level equation . . . . . . . . . . . . . . . . . . . 6.4 Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.1 Virtual boundary "cells": izbndpos . . . . . . . . . . . . . . . . . . 6.4.2 Discretization of the boundary conditions . . . . . . . . . . . . . . . 6.4.3 Imposing the discrete boundary conditions: jacstbnd . . . . . . . . . 6.4.4 Relaxation of the boundary conditions: Tlfsmo . . . . . . . . . . . . 6.4.5 Atmospheric pressure: PavBnd, rhomean . . . . . . . . . . . . . . . 6.4.6 Adjustments of numerical parameters at and near the boundary . . . 6.4.7 Viscous fluxes: irov . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5 Summing up: the whole computational time step . . . . . . . . . . . . . . . 6.6 Flooding and drying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.1 Wet cells and faces: epshu . . . . . . . . . . . . . . . . . . . . . . 6.6.2 Spatial discretization near the wet/dry boundary . . . . . . . . . . . 6.6.3 Spatial discretization of the momentum equation for small water depths: chkadv, trshcorio . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.4 Temporal discretization of the momentum equation near the wet/dry boundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7 Fixed Weirs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7.1 Adjustments to the geometry: oblique weirs and FixedWeirContraction 6.7.2 Adjustment to momentum advection near, but not on the weir . . . . . 6.7.3 Adjustments to the momentum advection on the weir: FixedWeirScheme 6.7.4 Supercritical discharge . . . . . . . . . . . . . . . . . . . . . . . . 6.7.5 Empirical formulas for subgrid modelling of weirs . . . . . . . . . . . 6.7.6 Villemonte model for weirs . . . . . . . . . . . . . . . . . . . . . . 6.7.7 Grid snapping of fixed weirs and thin dams . . . . . . . . . . . . . . iv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 79 80 81 81 82 86 86 87 89 Deltares Contents 7.5 7.6 7.7 7.8 7.9 Temporal discretization . . . . . . . . . . . . Vertical fluxes . . . . . . . . . . . . . . . . . Turbulence closure models . . . . . . . . . . 7.7.1 Constant coefficient model . . . . . . 7.7.2 Algebraic eddy viscosity closure model 7.7.3 k-epsilon turbulence model . . . . . . 7.7.4 k-tau turbulence model . . . . . . . . Baroclinic pressure . . . . . . . . . . . . . . Artificial mixing due to sigma-coordinates . . . 7.9.1 A finite volume method for a sigma-grid 7.9.2 Approximation of the pressure term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 101 102 103 103 103 108 110 113 113 114 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 115 115 117 118 119 119 121 122 122 124 124 137 141 141 DR AF T 8 Parallelization 8.1 Parallel implementation . . . . . . . . . . 8.1.1 Ghost cells . . . . . . . . . . . . 8.1.2 Mesh partitioning with METIS . . . 8.1.3 Communication . . . . . . . . . . 8.1.4 Parallel computations . . . . . . . 8.1.5 Parallel Krylov solver . . . . . . . 8.1.5.1 parallelized Krylov solver 8.1.5.2 PETSc solver . . . . . . 8.2 Test-cases . . . . . . . . . . . . . . . . 8.2.1 Schematic Waal model . . . . . . 8.2.2 esk-model . . . . . . . . . . . . 8.2.3 San Fransisco Delta-Bay model . . 8.3 Governing equations . . . . . . . . . . . 8.4 Spatial discretization . . . . . . . . . . . . . . . . . . . . . . A Analytical conveyance 145 A.1 Conveyance type 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 A.2 Conveyance type 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 References Deltares 149 v DR AF T D-Flow Flexible Mesh, Technical Reference Manual vi Deltares List of Figures List of Figures 3.2 3.3 3.4 3.5 3.6 3.7 DR AF 3.8 Local grid mapping x(ξ, η) around a node for orthogonalization; ξ -lines are dashed; the dual cell is shaded . . . . . . . . . . . . . . . . . . . . . . . Part of the control volume that surrounds edge j (dark shading) and the nodes involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Part of the control volume that surrounds edge j (dark shading) and the nodes involved; quadrilateral grid cells; edges used in Equation (3.12) are coloured blue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Curvilinear coordinate mapping on a planar domain. The tangent and normal vectors are not necessarily up to scale (Van Dam, 2009). . . . . . . . . . . Geometric meaning of the singular value decomposition of Jacobian matrix J (Huang, 2005, fig. 2.2) . . . . . . . . . . . . . . . . . . . . . . . . . . . non-rectangular triangular cell; the dashed cell is an optimal equiangular polygon, while the shaded cell is the resulting cell after scaling in η 0 direction; Φ0 is the angle of the ξ 0 -axis in the (ξ, η)-frame . . . . . . . . . . . . . . . . The stencil for node i formed by the nodes A, . . . , K . Node D and H are rectangular nodes. The node angle is between two subsequent blue edges. . Rectangular triangle cell; additional node angles θrect1 and θrect2 and edge j12 are used to determine optimal angle Φopt . . . . . . . . . . . . . . . . Computational coordinates for one quadrilateral and five triangular cells, one of which is a rectangular (shaded) before transformation to (ξ, η)-coordinates. α = 21 π , β = 41 π and γ = 54 π/4. . . . . . . . . . . . . . . . . . . . . . The circle in Figure 3.10a is squeezed in vertical direction (i.e. ⊥ OM ) to obtain the ellipse in Figure 3.10b. Blue: d(M, 0) = d(M, 1) = d(M, 4) = R0 ; Green: d(0, 1) = d(0, 4) = 1. . . . . . . . . . . . . . . . . . . . . . Control volume for computing the node-to-edge gradient at edge j discrete for the discrete operators Gξ , Gξ . . . . . . . . . . . . . . . . . . . . . . . . Sketch for the computation of the cirumcentre of a triangle . . . . . . . . . Control volume for computing the edge-to-node gradient at the central node for the discrete operators Dξ and Dη , where ξ = ξ 0 = 0 . . . . . . . . . T 3.1 3.9 3.10 3.11 3.12 3.13 5.1 6.1 6.2 6.3 6.4 6.5 6.6 Deltares 6 . 7 . 8 . 9 . 10 . 10 . 11 . 12 . 14 . 14 . 16 . 17 . 19 The flow streamline path and the direction of dispersion stresses. . . . . . . . 28 Definition of the variables on the staggered mesh . . . . . . . . . . . . . . Numbering of cells, faces and nodes, with their orientation to each other. . . Connectivity of cells, faces and nodes . . . . . . . . . . . . . . . . . . . . Flow area Auj and face-based water depth huj . . . . . . . . . . . . . . . Area computation for cell Ω1 . . . . . . . . . . . . . . . . . . . . . . . . Computational cells L(j) and R(j) neighboring face j ; water levels are stored at the cell circumcenters, indicated with the +-sign . . . . . . . . . . . . . 6.7 Nodal interpolation from cell-centered values; contribution from face j to node r(j); the shaded area indicates the control volume Ωn . . . . . . . . . . . . 6.8 Higher-order reconstruction of face-based velocity uuj , from the left . . . . 6.9 Cross sectional bed bathemetry perpendicular to the flow direction. . . . . . 6.10 Virtual boundary "cells" near the shaded boundary; xLj is the virtual "cell" center near boundary face j ; xR(j) is the inner-cell center; bj is the point on face j that is nearest to the inner-cell center . . . . . . . . . . . . . . . . 6.11 Examples of grid snapping for fixed weirs and thin dams. . . . . . . . . . . 6.12 Examples of computation of crest heights. . . . . . . . . . . . . . . . . . 7.1 7.2 7.3 . . . . . . 34 34 34 38 39 . 40 . 46 . 49 . 63 . 65 . 90 . 91 A schematic view of σ - and z -layers. . . . . . . . . . . . . . . . . . . . . . 94 Layer distribution in 3D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Turbulence figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 vii D-Flow Flexible Mesh, Technical Reference Manual 8.1 A.1 116 116 125 130 131 132 132 133 134 136 138 . 143 A schematic view of cross sectional bed bathemetry perpendicular to the flow direction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 A schematic view of flow nodes and the velocity components in two-dimensional case. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 DR AF A.2 . . . . . . . . . . . T Stencil for momentum advection and diffusion; the numbers indicate the level of the neighboring cells . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.2 Ghost cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3 Partitioning of the schematic Waal model with METIS . . . . . . . . . . . . 8.4 Speed-up of the schematic Waal model; Lisa . . . . . . . . . . . . . . . . 8.5 Speed-up of the schematic Waal model; h4 . . . . . . . . . . . . . . . . . 8.6 Speed-up of the schematic Waal model; SDSC’s Gordon; PETSc . . . . . . 8.7 Speed-up of the schematic Waal model; SDSC’s Gordon; CG+MILUD . . . 8.8 Partitioning of the ’esk-model’ with METIS . . . . . . . . . . . . . . . . . . 8.9 Speed-up of the ’esk-model’; Lisa . . . . . . . . . . . . . . . . . . . . . . 8.10 Speed-up of the schematic Waal model; Gordon . . . . . . . . . . . . . . 8.11 Speed-up of the San Fransisco Delta-Bay model; Gordon . . . . . . . . . . 8.12 Stencil for momentum advection and diffusion; the numbers indicate the level of the neighboring cells . . . . . . . . . . . . . . . . . . . . . . . . . . . viii Deltares List of Tables List of Tables 6.3 8.1 8.2 8.3 8.4 8.5 8.6 METIS settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 time-step averaged wall-clock times of the Schematic Waal model; Lisa; note: MPI communication times are not measured for the PETSc solver . . . . . . . 125 time-step averaged wall-clock times of the Schematic Waal model; h4; note: MPI communication times are not measured for the PETSc solver . . . . . . . 126 time-step averaged wall-clock times of the Schematic Waal model; SDSC’s Gordon; note: MPI communication times are not measured for the PETSc solver127 time-step averaged wall-clock times of the Schematic Waal model; SDSC’s Gordon; CG+MILUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 time-step averaged wall-clock times of the ’esk-model’; Lisa; note: MPI communication times are not measured for the PETSc solver . . . . . . . . . . . 129 time-step averaged wall-clock times of the Schematic Waal model; Gordon; note: MPI communication times are not measured for the PETSc solver . . . . 135 time-step averaged wall-clock times of the San Fransisco Delta-Bay model; Gordon; note: MPI communication times are not measured for the PETSc solver139 time-step averaged wall-clock times of the San Fransisco Delta-Bay model; Gordon; non-solver MPI communication times . . . . . . . . . . . . . . . . . 140 DR AF 8.7 Definition of the variables used in Algorithm (4) . . . . . . . . . . . . . . . . 44 Various limiters available in D-Flow FM for the reconstruction of face-based velocities in momentum advection . . . . . . . . . . . . . . . . . . . . . . . 51 Data during a computational time step from tn to tn+1 with Algorithm (32); the translation to D-Flow FM nomenclature is shown in the last column . . . . . . 75 T 6.1 6.2 8.8 8.9 Deltares ix DR AF T D-Flow Flexible Mesh, Technical Reference Manual x Deltares List of Symbols List of Symbols Unit Description ĥj J (k) N (k) ~nj ~uj ~xζk ζk ζuj Auj blk hk i j k L(j) l(j) R(j) r(j) sj,k uj vj Vk wuj zi Ae j Ai j bl1j bl2j m − − − m/s Hydraulic radius at face j Set of faces j of cell k Set of nodes i of cell k Normal vector on face j of an cell, outward direction is positive Complete velocity vector at the velocity point on edge j the coordinates of cell-center k Water level at circumcenter of cell k Water level at the velocity point uj Flow area at face j Bed level at cell k Water depth at cell k (hk = ζk − blk ) Node counter Face counter Cell counter Left cell of face j , giving some orentation to the face Left node of face j , giving some orentation to the face Right cell of face j , giving some orentation to the face Right node of face j , giving some orentation to the face Orientation of face j to cell k Face-normal velocity Tangential velocity component at cell face j Volume of water column at cell k Width of face j Bed level at node i Explict part of the discretization of the advection and diffusion Implict part of the discretization of the advection and diffusion Bed level at left node of face j Bed level at right node of face j - DR AF m m m2 m m − − − − − − − − m/s m/s m3 m m − − m m T Symbol Deltares xi DR AF T D-Flow Flexible Mesh, Technical Reference Manual xii Deltares 1 Problem specification The specification of a problem to be run should resemble the procedure for Delft3D-FLOW, i.e., through a Master Definition Flow file. The Master Definition Unstructured (MDU) file standards are evidently not equal to those for Delft3D (yet?). T The master definition file DR AF 1.1 Deltares 1 of 152 DR AF T D-Flow Flexible Mesh, Technical Reference Manual 2 of 152 Deltares 2 Data structures The data structures used for flow simulations on unstructured meshes are fundamentally different from those on curvilinear meshes, which fit in standard rank-2 arrays. Section 2.1 contains the conceptual hierarchy of mesh and flow data. Section 2.2 contains implementation details of the variables and IO-routines available. 2.1 Hierarchy of unstructured nets 1. Net (domain discretization) (1..NUMK) net link (1D) (1..NUML1D) net link (2D) (NUML1D+1..NUML) T net node 2. Flow data (1D+2D) (1..NDX2D=NUMP) netcell/flow node (1D) (NDX2D+1..NDXI) boundary flow node (NDXI+1..NDX) DR AF netcell/flow node (2D) pressure points: 2D flow node circumcenter/1D flow node flow link 2.2 Implementation details of unstructured nets 2.3 Improve use of cache 2.3.1 1D 2D 1D 2D internal internal open bnd open bnd (1..LNX1D) (LNX1D..LNXI) (LNXI+1..LNX1DBND) (LNX1DBND+1..LNX) Improved cache use by node renumbering The order of nodes in unstructured nets can be arbitrary, as opposed to structured nets, where neighbouring grid points generally lie at offsets ±1 and ±Nx in computer memory. The order of net nodes in memory should not affect the numerical outcomes in any way, so it is safe to apply any permutation to the net- and/or flow nodes. A permutation that puts nodes that are close to each other in the net also close to each other in memory likely improves cache effiency. The basic problem is: given a set of nodes and their adjacency matrix, find a permutation for the nodes such that, when applied, the new adjacency matrix has a smaller bandwidth. The Reverse Cuthill–McKee (RCM) algorithm is a possible way to achieve this. Net nodes can be renumbered, with the net links used as adjacency information. This is only done upon the user’s request (Operations > Renumber net nodes), since net node ordering does not affect the flow simulation times very much. For flow nodes it is done automatically, as part of flow_geominit(). It can be switched off in Various > Change geometry settings. Technical detail: for true efficiency the flow links should be ordered approximately in the same pace as the flow nodes. Specifically: lne is reordered, based on its first node lne(1,:). Other code parts require (assume) that net links are indexed identical to flow links, so kn is Deltares 3 of 152 D-Flow Flexible Mesh, Technical Reference Manual DR AF T reordered in the same way as lne was. 4 of 152 Deltares 3 Unstructured grid generation The grid generation parts in D-Flow FM are standard grid generation techniques for either curvilinear grids, triangular grids or 2D networks. D-Flow FM does not generate a hybrid unstructured net of arbitrary polygons at once, but facilitates easy combination of beforementioned grids and nets in subdomains. It does offer grid optimization over the entire hybrid net, such as orthogonalization, automated removal of small cells and more. Most of this functionality will be moved to RGFGRID. 3.1 Curvilinear grids 3.2 T Curvilinear grid generation is done by (old) code from RGFGRID, within polygons of splines. Triangular grids 3.3 DR AF Unstructured triangular grid generation is done with the Triangle code by J.R. Shewchuk from Berkely. This is an implementation of Delaunay triangulation. In RGFGRID, this will be replaced by SEPRAN routines. 2D networks Two-dimensional (SOBEK-like) networks are interactively clicked by the user. 3.4 Grid optimizations There are two grid optimization procedures: orthogonalization and smoothing. They will be explained in the following sections. 3.5 Grid orthogonalization D-Flow FM adopts a staggered scheme for the discretization of the two-dimensional shallow water equations. Due to our implementation of the staggered scheme, the computational grid needs to be orthogonal. Definition 3.5.1. We say that a grid is orthogonal if its edges are perpendicular to the edges of the dual grid. To this end, we will firstly construct a local grid mapping x(ξ, η) attached to some node i, see Figure 3.1. Since the ξ and η grid lines are aligned with the primary and dual edges, the grid will be orthogonal if the grid mapping satisfies the relation ∂x ∂x • = 0, ∂ξ ∂η (3.1) A grid mapping that satisfies Equation (3.1), also satisfies the scaled Laplace equation ∂ ∂ξ Deltares ∂ 1 ∂x + = 0, ∂η a ∂η T ∂x 1 ∂x ∇• a , =0 ∂ξ a ∂η ∂x a ∂ξ (3.2) (3.3) 5 of 152 D-Flow Flexible Mesh, Technical Reference Manual η T ξ DR AF Figure 3.1: Local grid mapping x(ξ, η) around a node for orthogonalization; ξ -lines are dashed; the dual cell is shaded where a is the aspect ratio defined by: a= ∂x ∂η . ∂x ∂ξ (3.4) Equation (3.2) can be written in the following form, after integration over the controle volume Ω and applying the Divergence theorem: I S ∂x 1 ∂x a , ∂ξ a ∂η T • I ∂x 1 ∂x n dS = a nξ + nη dS = 0, ∂ξ a ∂η S (3.5) where S is the boundary of the control volume Ω in (ξ, η) space and n = (nξ , nη )T is the outward orthonormal vector. 3.5.1 Discretization For the description of the discretization of Equation (3.4) and Equation (3.5) the following nomenclature is used: Definition 3.5.2. Jint is the set of internal primary edges connected to node i and x0 and x1j are the coordinates of that node and of the neighboring node connected through edge j , respectively. Furthermore, xLj and xRj are the left and right neighboring cell-circumcentre coordinates, see Figure 3.2a. Definition 3.5.3. Jbnd is the set of boundary edges (nonempty if node i is on the grid boundary only), xRj∗ are the coordinates of a virtual node and xbcj are boundary node coordinates, see Figure 3.2b. 6 of 152 Deltares Unstructured grid generation x1j = x(1, 0) x1j xLj = x( 12 , 12 ) xLj xbcj xRj = x( 12 , − 12 ) xRj∗ x0 = x(0, 0) x0 (b) Boundary edge; xbcj are the coordinates of a node projected onto the grid boundary, xRj∗ are virtual node coordinates T (a) Internal edge Figure 3.2: Part of the control volume that surrounds edge j (dark shading) and the nodes involved DR AF The discretizations of the aspect ratio for edge j , Equation (3.4), with ∆ξ = ∆η = 1 yields aj ≈ xLj − xRj xLj − xRj ∆ξ = , ∆η kx1j − x0 k kx1j − x0 k j ∈ Jint (3.6) and the discretization of Equation (3.5) yields X kxRj − xLj k (x1j − x0 ) + kx1j − x0 k j∈Ji ( X 1 kxRj∗ − xLj k (x1j − x0 ) 2 kx 1j − x0 k j∈J e + 1 kx1j − x0 k (xRj∗ − xLj ) 2 kxRj∗ − xLj k ) = 0, (3.7) where the second summation in Equation (3.7) accounts for boundary edges. The virtual node xRj∗ is constructed by extrapolation from the circumcenter and boundary nodes, using Equation (3.8) to project the left cell-circumcenter orthogonally onto the grid boundary xbcj : xbcj = x0 + xRj∗ = 2xbcj (x1j − x0 ) • (xLj − x0 ) (x1j − x0 ). kx1j − x0 k2 − xLj , (3.8) (3.9) Remark 3.5.4. We will always assume that the grid is on the left-hand side of a boundary edge. Finally, Equation (3.7) can be put in the following form X j∈Ji Deltares aj (x1j − x0 ) + X 1 l∈Le 2 aj (x1j − x0 ) + 1 kx1j − x0 knj , 2 = 0, 7 of 152 D-Flow Flexible Mesh, Technical Reference Manual (3.10) xR∗ −xLj where nj = kx j∗ −x k is the outward normal at edge j and aj is the aspect ratio of edge Lj R j j , i.e. kxRj − xLj k kx − x k , 1j 0 aj = kxRj∗ − xLj k , kx1j − x0 k 3.5.2 j ∈ Ji , (3.11) j ∈ Je . Curvilinear-like discretization T The previous formulation may lead to distorted quadrilateral grids. This is remedied by mimicking a curvilinear formulation in the quadrilateral parts of the grid. Then, in Equation (3.10) the aspect ratio of Equation (3.11) is replaced by 4 kxRj − xLj k , j ∈ Jint , 2kx1j − x0 k + kx2Rj − x1Rj k + kx2Lj − x1Lj k aj = 2 kxRj∗ − xLj k , j ∈ Jbnd , kx1j − x0 k + kx2Lj − x1Lj k DR AF (3.12) where the nodes involved are depicted in Figure 3.3. x1Rj = x(0, 1) x2Lj = x(1, 1) xLj = x( 21 , 12 ) x0 = x(0, 0) x1j = x(1, 0) xRj = x( 12 , − 21 ) x2Rj = x(1, −1) x1Rj = x(0, −1) Figure 3.3: Part of the control volume that surrounds edge j (dark shading) and the nodes involved; quadrilateral grid cells; edges used in Equation (3.12) are coloured blue 3.6 Grid smoothing Enhancing the smoothness of the grid is performed by means of an elliptic smoother. This work is based on Huang (2001, 2005). In order to prevent grid folds in non-convex domains, the smoother is formulated in terms of a so-called inverse map, i.e. ξ(x, y), and leads to ∇ • G−1 ∇ξ i = 0, i ∈ {1, 2}, (3.13) where G is the monitor function for grid adaptivity which will be explained later (section 3.6.3) and ξ 1 ≡ ξ , ξ 2 ≡ η . Remark 3.6.1. Although the method is based on an inverse mapping ξ(x, y), it is more convenient to work with the direct mapping x(ξ, η). 8 of 152 Deltares Unstructured grid generation ξ = c1 ξ = c2 ∇η = a2 ξ = c3 η = d2 ∇ξ = a1 det(J) xη = a2 η = d1 T xξ = a1 Figure 3.4: Curvilinear coordinate mapping on a planar domain. The tangent and normal vectors are not necessarily up to scale (Van Dam, 2009). DR AF By interchanging the role of dependent and independent variables, Equation (3.13) can be transformed into an expression for the direct grid mapping x(ξ, η): −1 −1 ∂x ∂x 1 ∂ (G ) 1 1 ∂ (G ) 2 a + a + a, a, ∂ξ ∂ξ ∂η ∂ξ −1 −1 ∂x ∂x 2 ∂ (G ) 1 2 ∂ (G ) 2 a, a + a, a ∂ξ ∂η ∂η ∂η ∂ 2x ∂ 2x 1 −1 2 − a1 , G−1 a1 + a , G a + ∂ξ 2 ∂ξ∂η 2 ∂ 2x 2 −1 2 ∂ x 2 −1 1 + a ,G a a ,G a = 0, ∂η∂ξ ∂η 2 (3.14) where by h•, •i an inner product is meant and a1 = ∇ξ and a2 = ∇η are the contravariant base vectors (Figure 3.4), by definition: aα • aβ = δαβ , α, β ∈ {1, 2} (3.15) γ ∈ {1, 2} (3.16) and thus kaγ k = 1 , kaγ k Obviously we need to start by defining the node coordinates in (ξ, η)-space based on their connectivity with neighboring grid nodes. 3.6.1 Assigning the node coordinates in computational space By assigning the node coordinates in computational (ξ, η)-space, we postulate the optimal smooth grid. Compare with a curvi-linear grid in this respect. To see how we have to choose the (ξ, η) coordinates, first consider a linearization of the grid mapping around a node: x = x0 + J(ξ − ξ 0 ) + O kξk2 , (3.17) where x0 and ξ 0 are the node coordinates in physical and computational space respectively and J is the Jacobian matrix of the transformation. Following Huang (2005), the Jacobian Deltares 9 of 152 D-Flow Flexible Mesh, Technical Reference Manual matrix J can be decomposed into (singular value decomposition): J = U ΣV T , (3.18) where V T is a rotation in (ξ, η)-space, Σ a compression/expansion and U a rotation in (x, y)-space, see Figure 3.5. VT ξ -space ξ -space J = U ΣV T U x-space T Σ DR AF x-space Figure 3.5: Geometric meaning of the singular value decomposition of Jacobian matrix J (Huang, 2005, fig. 2.2) Since Equation (3.14) is invariant to rotation of the (ξ, η)-axis, rotation V is irrelevant and we may start by assigning ξ = (0, 0)T to the center node i and ξ = (1, 0)T to an arbitrary neighboring node. We now proceed by considering a cell attached to a node i in coordinate frame (ξ 0 , η 0 ), see Figure 3.6, and define an optimal angle Φopt between two subsequent edges that are connected to node i. η 0 η 0 ξ Φ Φopt Φ0 ξ Figure 3.6: non-rectangular triangular cell; the dashed cell is an optimal equiangular polygon, while the shaded cell is the resulting cell after scaling in η 0 direction; Φ0 is the angle of the ξ 0 -axis in the (ξ, η)-frame Definition 3.6.2. The optimal angle Φopt is the angle between two subsequent edges of a cell, both connected to node i, that would lead to the desired optimal smooth grid cell. 10 of 152 Deltares Unstructured grid generation Remark 3.6.3. In general, the optimal smooth cell is an equiangular polygon, with the exception for rectangular triangles. The optimal angle at a node of a rectangular triangle is either 1 π or 12 π , depending on the grid connectivity. 4 For a non-rectangular triangle this optimal angle would be 13 π . However, by considering a node with five non-rectangular triangles attached, one can easily understand that this angle is unsuitable in general, as five of such angles do not sum up to 2π . Therefore, we define a true angle as follows: Definition 3.6.4. The true angle Φ is the angle between two subsequent edges of a cell, both connected to node i, such that sum of all cell true-angles equals its prescribed value of either 2π (internal nodes), π (boundary nodes) or 21 π (corner nodes). T The true cell is obtained from the optimal cell by scaling the cell, as will be explained later (section 3.6.1.2). DR AF Returning to the optimal angle, we first discriminate between rectangular cells and nonrectangular cells to account for (partly) quadrilateral grids. F E C D G B H i A I J K Figure 3.7: The stencil for node i formed by the nodes A, . . . , K . Node D and H are rectangular nodes. The node angle is between two subsequent blue edges. Definition 3.6.5. The stencil is the set of cells that are connected to node i. A node angle is the angle between two subsequent stencil-boundary edges connected to node i. A rectangular node, not being node i itself, is a node that is connected to three or less non-stencil quadrilateral cells and no other non-stencil nodes. A rectangular cell is a quadrilateral cell or a triangular cell which contains at least one right angle. Note: Each node of a rectangular cell will be called a rectangular node. So one of the optimal angles Φopt of such a cell is rectangular. Rectangular nodes have optimal node angles as indicated in Figure 3.8, which can be 14 π , 21 π , π or 32 π . It will be indicated with the sub-script rect. Deltares 11 of 152 D-Flow Flexible Mesh, Technical Reference Manual θrect2 j12 Φopt θrect1 T Figure 3.8: Rectangular triangle cell; additional node angles θrect1 and θrect2 and edge j12 are used to determine optimal angle Φopt DR AF The rectangular node angles are computed by θrecti 1 (2 − 2 Nnsq ) π, node i is a rectangular internal node, = (1 − 21 Nnsq ) π, node i is a rectangular boundary node, 1 π, node i is a rectangular corner node, 2 (3.19) where Nnsq is the number of non-stencil quadrilaterals connected to node i. The optimal angle Φopt for rectangular nodes is finally determined by (see Figure 3.8) Φ opt = (1 − 1 2 π, 1 4 π, 2 ) π, N N ≥4 N =3 ∨ ∧ ∧ ∧ non-rectangular cell, rectangular cell with two rectangular nodes ’1’ and ’2’ θrect1 + θrect2 = π j12 is not a boundary edge, other, (3.20) where N is the number of nodes that comprise the cell. In the example of Figure 3.8, nodes 1 and 2 are rectangular nodes with angles of π and 12 π respectively and the shaded cell is a rectangular triangle with optimal angle 14 π . 3.6.1.1 Determining the true cell angles Having defined the optimal angles for all cells, we can derive the true angles by demanding that the cells fit in the stencil. To this end, we consider the number and type of cells connected to node i. Definition 3.6.6. The sum of all cell-optimal and true angles are called ΣΦopt and ΣΦ respectively. Furthermore, the sum of all optimal and true angles of quadrilateral cells are called ΣΦopt quad and ΣΦquad respectively. The number of quadrilateral cells is Nquad . The same defopt initions hold for the rectangular triangular cells: ΣΦtrirect , ΣΦtrirect and Ntrirect respectively and for the remaining cells: ΣΦopt rem , ΣΦrem and Nrem respectively. Remark 3.6.7. The remaining cells are not necessarily non-rectangular triangles only, but can also be pentagons and/or hexagons, et cetera. 12 of 152 Deltares Unstructured grid generation Of course holds opt opt ΣΦopt = ΣΦopt quad + ΣΦtrirect + ΣΦrem , N = Nquad + Ntrirect + Nrem . (3.21) (3.22) In a similar fashion, the sum of all true angles should sum up to 2πf , where 1, f = 21 , 1 , 4 internal node, boundary node, (3.23) corner node. In other words, we seek true angles ΣΦquad , ΣΦtrirect and ΣΦrem such that: ΣΦquad + ΣΦtrirect + ΣΦrem = 2πf. T This is achieved by setting ΣΦopt quad , ΣΦquad = µ µtrirect ΣΦopt trirect , opt µrem ΣΦrem . DR AF ΣΦtrirect = µ (3.24) ΣΦrem = µ (3.25) (3.26) (3.27) We give highest precedence to the optimal angles of quadrilateral cells, followed by rectangular triangular cells and lowest precedence to the remaining cells. From the angle left for the remaining cells (non-rectangular triangles, pentagons and hexagons) the coefficient µrem can be determined (with a lower band): opt 2π f − ΣΦopt quad + ΣΦtrirect µrem = max ΣΦopt rem Ntri Φmin , ΣΦopt rem ! , (3.28) If there are remaining cells (Nrem > 0) then µtrirect = 1 and if there are no remaining cells µrem = 1 and ΣΦopt rem = 0 and does not influence the angles available for quads and rectangular triangles. So: µtrirect = 1 max Nrem > 0 2π f − ΣΦopt quad , ΣΦopt trirect Ntrirect Φmin ΣΦopt trirect ! , Nrem = 0, (3.29) At last µ is determined by taken all cells into account µ= Φmin = µrem . 3.6.1.2 ΣΦopt quad 1 π 12 2π f . opt + µtrirect ΣΦopt trirect + µrem ΣΦrem (3.30) is the minimum cell angle, determining a lower band for the factors µtrirect and Assigning the node coordinates With the the optimal angles of the cell defined, the (ξ 0 , η 0 ) coordinates can be assigned to the cell nodes. We require that all edges connected to node i have unit length in computational (ξ, η)-space, which has its consequences for rectangular triangles. Deltares 13 of 152 D-Flow Flexible Mesh, Technical Reference Manual η η0 γ α β γ ξ γ T γ ξ0 DR AF Figure 3.9: Computational coordinates for one quadrilateral and five triangular cells, one of which is a rectangular (shaded) before transformation to (ξ, η)-coordinates. α = 12 π , β = 14 π and γ = 54 π/4. Remark 3.6.8. Since all edges connected to node i are required to have unit length, rectangular triangles may be transformed into non-rectangular triangles, but maintain their cell angle Φopt , see Figure 3.9 for an example. 4 4 3 R0 0 π−θ X M 0 Φ X R0 3 M θ 2 2 1 1 (a) Nodes on circle. (b) Nodes on ellipse. Figure 3.10: The circle in Figure 3.10a is squeezed in vertical direction (i.e. ⊥ OM ) to obtain the ellipse in Figure 3.10b. Blue: d(M, 0) = d(M, 1) = d(M, 4) = R0 ; Green: d(0, 1) = d(0, 4) = 1. Since the cell in (ξ 0 , η 0 ) coordinates is an equiangular polygon in (ξ 0 , η 0 )-space (Figure 3.10a), the coordinates of the ith node is ξ 0 = R0 (1 − cos(i θ)), η 0 = −R0 sin(i θ), 2π θ= N 14 of 152 (3.31) (3.32) (3.33) Deltares Unstructured grid generation where i = 0 corresponds to the center node i and counting counterclockwise, N is the number of nodes that comprise the cell and R0 the radius of the circumcircle, see Figure 3.10a (node ξ i−1 = i − 1 and i = 1, . . . , N ). The circle in Figure 3.10a is squeezed in such a way that the edge from node 0 to node 1 and node 0 to node 4 has length 1 (distance: d(0, 1) = d(0, 4) = 1) and Φ is the true angle, also d(0, X) remains the same R0 (1 − cos θ) = cos( 21 Φ) because the squeezing is perpendicular to the OM -axis (i.e. the ξ 0 -axis). The other edges of the polygon does not have, in general, a length of 1 after squeezing. The radius of the circumcircle read: cos( 12 Φ) R0 = (1 − cos θ) (3.34) A= (1 − cos θ) tan( 21 Φ) , sin θ 2π , N (3.35) with N being the number of nodes that comprise the cell. DR AF where θ = T The cell aspect ratio A is defined as the ratio between the distance d(1, N ) in Figure 3.10b and the distance d(1, N ) in Figure 3.10a, yielding: The coordinates (ξ, η) of the cell nodes are obtained by scaling and rotating the cell in such a way that it fits in the stencil, see Figure 3.6. The transformation from (ξ 0 , η 0 ) to (ξ, η) coordinates read: ξ = cos (Φ0 ) ξ 0 − A sin (Φ0 ) η 0 , η = sin (Φ0 ) ξ 0 + A cos (Φ0 ) η 0 , 3.6.2 (3.36) (3.37) Computing the operators For the solution of Equation (3.14), we approximate X ∂ 2x ≈ Dξ ∂ξ∂η ξ j∈J 0 ∂ 2x at node ξ 0 ∂ξ∂η ! X Gη xi i∈N , (3.38) j ∂ 2x ∂ 2x ∂ 2x and similar for the other derivatives , and , where: ∂ξ 2 ∂η 2 ∂η∂ξ Definition 3.6.9. J is the set of edges attached to node ξ 0 and N is the set of nodes in the stencil of node ξ 0 . Furthermore, Gξ and Gη are the node-to-edge approximations and Dξ and Dη the edge-to-node approximations of the ξ and η derivatives respectively. The discretization is as follows. For some quantity Φ, its gradient can be approximated in the usual finite-volume way 1 ∇ξ Φ ≈ vol(Ωξ ) Deltares I Φ nξ dSξ . (3.39) ∂Ωξ 15 of 152 D-Flow Flexible Mesh, Technical Reference Manual Node-to-edge operator ξ 1j+1 ξ Lj ξ 1j j ξ0 T ξ Rj Figure 3.11: Control volume for computing the node-to-edge gradient at edge j discrete for the discrete operators Gξ , Gξ T For the node-to-edge gradient (Gξ , Gη ) we take the control volume as indicated in Figure 3.11 and obtain for some node-based quantity Φ DR AF 3.6.2.1 (ξ Rj − ξ Lj )⊥ (Φ1j − Φ0 ) − (ξ 1j − ξ 0 )⊥ (ΦRj − ΦLj ) , j ∈ Jint , k(ξ 1j − ξ 0 ) × (ξ Rj − ξ Lj )k T (Gξ , Gη ) Φ = (ξ Rj∗ − ξ Lj )⊥ (Φ1j − Φ0 ) − (ξ 1j − ξ 0 )⊥ (ΦRj∗ − ΦLj ) j , j ∈ Jbnd , k(ξ 1j − ξ 0 ) × (ξ Rj − ξ Lj )k (3.40) where we use similar definitions as Definitions 3.5.2 and 3.5.3, and Remark 3.5.4 also holds. ⊥ ⊥ ⊥ Furthermore, ξ • ξ = 0 ⇒ ξ = (−η, ξ)T , so ξ is parallel to the contravariant vector a2 2 (ξ = a1 and a1 • a = 0) and ξ 0 = 0 by construction. Because the values ξ Lj and ξ Rj are not node based, the value at the circumcentres need to be determined from the node values of that cell. Determine the value at circumcenters The cell circumcenters ξ Lj and ξ Rj can be expressed in general form as ξ Lj = X AiLj ξ i , (3.41) i∈N ξ Rj = ξ Lj−1 , (3.42) Definition 3.6.10. ALj is the left node-to-cell mapping for the cell left from edge j . The above summation is over all nodes, the coefficient AiLj = 0 if the node i does not belong to the left cell of edge j . 16 of 152 Deltares Unstructured grid generation Circumcenter of non triangle For a non-triangle cell k the centroid is taken as an approximation of the circumcenter. So: ALj = 1 , N L(j) = k (3.43) where N is the number of vertices of the cell k . Circumcenter of a triangle For triangular cells on the other hand, the circumcenter is used and computed as follows: ξ Lj = ξ 0 + α(ξ 1j − ξ 0 ) + β(ξ 1j+1 − ξ 0 ), (3.44) ξ Rj = ξ Lj−1 , (3.45) DR AF T ξ 1j+1 ξ Lj θ ξ0 ξ 1j Figure 3.12: Sketch for the computation of the cirumcentre of a triangle where 1 − γ1 c , 2(1 − c2 ) 1 − γc β= , 2(1 − c2 ) α= and γ= c= kξ 1j − ξ 0 k kξ 1j+1 − ξ 0 k (3.46) (3.47) , (ξ 1j − ξ 0 ) • (ξ 1j+1 − ξ 0 ) kξ 1j − ξ 0 k kξ 1j+1 − ξ 0 k (3.48) (= cos θ). (3.49) Remark 3.6.11. The edges j around node i are arranged in counterclockwise order. The circumcenter of a triangle expressed in the vertex coordinates (Equation (3.41)) read: ξ Lj = (1 − α − β)ξ 0 + αξ 1j + βξ 1j+1 , (3.50) ξ Rj = ξ Lj−1 , (3.51) The cell center values Φ in Equation (3.40) are computed in the same manner, i.e.: ΦLj = X AiLj Φi , (3.52) i∈N ΦRj = ΦLj−1 . Deltares (3.53) 17 of 152 D-Flow Flexible Mesh, Technical Reference Manual Operator Gξ and Gη Combining Equation (3.40), Equation (3.52) and Equation (3.53) yields for each internal edges j −(ηR j − ηL j )(Φ1j − Φ0 ) + (η1 j − η0 ) P i∈N Gξ Φ|j = (AiLj−1 Φi − AiLj Φi ) , k(ξ 1j − ξ 0 ) × (ξ Rj − ξ Lj )k j ∈ Jint , (3.54) and (ξR j − ξL j )(Φ1j − Φ0 ) − (ξ1 j − ξ0 ) P i∈N Gη Φ|j = (AiLj−1 Φi − AiLj Φi ) , j ∈ Jint , T k(ξ 1j − ξ 0 ) × (ξ Rj − ξ Lj )k (3.55) and with DR AF Boundary edges are treated in a similar fashion as before, see Equation (3.9), by creating a virtual node: ξ Rj∗ = 2ξ bcj − ξ Lj , (3.56) ΦRj∗ = 2Φbcj − ΦLj , (3.57) ξ bcj = ξ 0 + αξ (ξ 1j − ξ 0 ), (3.58) Φbcj = Φ0 + αx (Φ1j − Φ0 ), (3.59) αξ = (ξ Lj − ξ 0 ) • ξ 1j − ξ 0 kξ 1j − ξ 0 k , (3.60) αx = αξ . (3.61) Remark 3.6.12. Note that αξ = 21 for triangular and quadrilateral cells. The boundary conditions are non-orthogonal, in contrast to Equation (3.8). This maintains the linearity of operators Gξ and Gη . Substitution in Equation (3.40) yields for each boundary edge j −(ηRj∗ − ξLj )(Φ1j − Φ0 ) + (η1 j − η0 )(ΦRj∗ − Gξ Φ|j = P i∈N AiLj Φi ) , k(ξ 1j − ξ 0 ) × (ξ Rj∗ − ξ Lj )k j ∈ Jbnd , (3.62) and (ξRj∗ − ξLj )(Φ1j − Φ0 ) − (ξ1 j − ξ0 )(ΦRj∗ − Gη Φ|j = 18 of 152 k(ξ 1j − ξ 0 ) × (ξ Rj∗ − ξ Lj )k P i∈N AiLj Φi ) , j ∈ Jbnd , (3.63) Deltares Unstructured grid generation 3.6.2.2 Edge-to-node operator For the edge-to-node gradient we take the control volume as indicated in Figure 3.13 ξ 1j+1 ξ Lj ξ 1j j ξ0 T ξ Rj DR AF Figure 3.13: Control volume for computing the edge-to-node gradient at the central node for the discrete operators Dξ and Dη , where ξ = ξ 0 = 0 and obtain (Dξ , Dη )T = 1 dj , V (3.64) where dj = j ∈ Jint , (ξ Rj − ξ Lj )⊥ , ⊥ ⊥ (ξ bcj − ξ Lj ) − (ξ bcj − ξ 0 ) , j ∈ Jbnd , (3.65) and with ξ ∈ IR2 Z Z I 1 1 V = dΩ = ∇ • ξ dΩ = ξ • n dΓ ⇒ 2 Ω 2 ∂Ω Ω 1 X ξ Lj + ξ Rj 1 X ξ Lj + ξ Rj∗ • d • d . V = + j j 2 j∈J 2 2 j∈J 2 int 3.6.2.3 (3.66) (3.67) bnd Node-to-node operator The computation of the Jacobian requires the node-to-node gradient. Definition 3.6.13. Jξ and Jη are the node-to-node approximations of the ξ and η derivatives respectively. They can be constructed as Jξ |i = X j∈Jint Dξ 1 X i (ALj Ji + AiLj−1 Ji ) 2 i∈I int ! + j X j∈Jbnd Dξ 1 (J0 + J1j ) , 2 j j (3.68) Deltares 19 of 152 D-Flow Flexible Mesh, Technical Reference Manual and X Jη |i = Dη j∈Jint ! X 1 1 X i i (ALj Ji + ALj−1 Ji ) + Dη (J0 + J1j ) . 2 i∈I 2 j j j∈J int j bnd (3.69) 3.6.3 Computing the mesh monitor matrix a1 = ( J22 , −J12 )T / det J, 2 T a = (−J21 , J11 ) / det J. T In the discretization of Equation (3.14), we approximate the contravariant base vectors by firstly computing the Jacobian by applying Equation (3.68) and Equation (3.69), and using a1 = ∇ξ and a2 = ∇η : (3.70) (3.71) DR AF The mesh monitor matrix G is computed as explained in Huang (2001). It is based on a solution value at grid nodes, that determines the mesh refinement direction v : v = ∇u, (3.72) which is approximated by firstly smoothing u, and computing v= X a1 Jξ ui + a2 Jη ui . (3.73) i∈N This direction vector is directly inserted in the mesh monitor matrix, see Huang (2001) for details. The obtained mesh monitor matrix is smoothed, after which the inverse G−1 is calculated. 3.6.4 Composing the discretization With the operators Dξ , Dη , Gξ and Gη available, and the contravariant base vectors a1 and a2 and the inverse mesh monitor matrix G−1 computed, the discretization of Equation (3.14) is a straightforward task. We obtain X wi xi = 0, (3.74) i∈N where −1 −1 1 ∂ (G ) 1 1 ∂ (G ) 2 wi = a , a Jξ + a , a Jη + ∂ξ ∂ξ −1 −1 2 ∂ (G ) 1 2 ∂ (G ) 2 a, a Jξ + a , a Jη ∂η ∂η X X Dξ Gη |j + − a1 , G−1 a1 Dξ Gξ |j + a1 , G−1 a2 j∈J j∈J X X ! a2 , G−1 a1 j∈J 20 of 152 Dη Gξ |j + a2 , G−1 a2 Dη Gη |j = 0, (3.75) j∈J Deltares 4 Numerical schemes 4.1 Time integration ... 4.2 Matrix solver: Gauss and CG 1 the routine prepare 2 the routine solve_matrix 4.2.1 Preparation T The implicit part of the discretized PDEs is solved by a combination of Gauss elimination, based on minimum degree, and CG.1 The procedure solves an equation As1 = b, where A is a sparse, diagonally dominant and symmetric matrix. The array s1(1:nodtot) contains the unknown values to be solved. The value of nodtot describes the number of nodal points. The sample program calls two routines: DR AF prepare determines which rows of matrix A, i.e., which nodes, are solved by Gauss elimination and which by CG, based on the nodes’ degree. It need to be applied just once, thereafter solve_matrix can be called as many times as needed. The inputs of prepare are the following arrays and variables: the total number of nodes or unknowns the total number of initial upper-diagonal non-zero entries of the original equation not affected by Gaussian elimination, or the total number of lines between two nodes. maxdgr the maximum degree of a node that is eliminated by Gaussian elimination line(1:lintot,1:2) the adjacency graph of A or the list of the indices of non-zero entries. nodtot lintot The outputs of prepare are the following arrays and variables: the number of nodes that will be eliminated by Gaussian elimination the number of unknowns of the remaining equation to be solved by CG. ijtot the total number of upper-diagonal non-zero entries including the fillins due to Gaussian elimination. ijl(1:lintot) contains the addresses of aij(1:ijtot) (lintot<=ijtot) where the non-zero entries of the original equation are to be stored. noel(1:nogauss) numbers of the nodes that will be eliminated by Gaussian elimination in the order given by noel(1:nogauss). The remaining unknowns, given by noel(nogauss+1:nogauss+nocg), are solved by CG. row(1:nodtot) sparse matrix administration used by solve_matrix (see program listing) nogauss nocg 4.2.2 Solving the matrix The output of prepare is input to solve_matrix. Other input to solve_matrix is given by: 1 The Gauss+CG solver was designed and implemented by Guus Stelling. This section is largely a copy of his original Word document accompanying a test program. Deltares 21 of 152 D-Flow Flexible Mesh, Technical Reference Manual aii(1:nodtot) the main diagonal elements of A aij(ijl(1:lintot)) the non-zero upper-diagonal elements of A bi(1:nodtot) the components of the right hand side vector b s0(1:nodtot) initial estimate of the final solution ipre if ipre=1 then point Jacobi preconditioning is applied otherwise LUD preconditioning will be applied The subroutine does the following steps: 1 call gauss_elimination 2 call cg(ipre) 3 call gauss_substitution Example To illustrate the solve_matrix routine the following example is given: DR AF 4.2.3 T After this the unknown vector s1(1:nodtot) has been found. 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 This is the adjacency graph of a 36×36 matrix A. For this graph nodtot=36 and lintot=60. The graph is described by the following set of lines: (01,02) (07,08) (13,14) (19,20) (25,26) (31,32) (02,03) (08,09) (14,15) (20,21) (26,27) (32,33) (03,04) (09,10) (15,16) (21,22) (27,28) (33,34) (04,05) (10,11) (16,17) (22,23) (28,29) (34,35) (05,06) (11,12) (17,18) (23,24) (29,30) (35,36) (01,07) (07,13) (13,19) (19,25) (25,31) (02,08) (08,14) (14,20) (20,26) (26,32) (03,09) (09,15) (15,21) (21,27) (27,33) (04,10) (10,16) (16,22) (22,28) (28,34) (05,11) (11,17) (17,23) (23,29) (29,35) (06,12) (12,18) (18,24) (24,30) (30,36), as can be verified in the picture. The degree of each node and its connecting node numbers are given by the following table: node node node node node node node node node node node node 22 of 152 1: 2: 3: 4: 5: 6: 7: 8: 9: 10 : 11 : 12 : 2 3 3 3 3 2 3 4 4 4 4 3 2 1 2 3 4 5 8 7 8 9 10 11 7 3 4 5 6 12 1 9 10 11 12 6 8 9 10 11 13 2 3 4 5 18 14 15 16 17 Deltares Numerical schemes 3 4 4 4 4 3 3 4 4 4 4 3 3 4 4 4 4 3 2 3 3 3 3 2 14 13 14 15 16 17 20 19 20 21 22 23 26 25 26 27 28 29 32 31 32 33 34 35 7 15 16 17 18 12 13 21 22 23 24 18 19 27 28 29 30 24 25 33 34 35 36 30 19 8 9 10 11 24 25 14 15 16 17 30 31 20 21 22 23 36 20 21 22 23 26 27 28 29 32 33 34 35 T 13 : 14 : 15 : 16 : 17 : 18 : 19 : 20 : 21 : 22 : 23 : 24 : 25 : 26 : 27 : 28 : 29 : 30 : 31 : 32 : 33 : 34 : 35 : 36 : 26 27 28 29 DR AF node node node node node node node node node node node node node node node node node node node node node node node node If no Gaussian elimination is is applied, but if the equation is solved entirely by CG then this administration is used by the cg subroutine. However if every point up to degree 4 (i.e. maxdgr=5) is eliminated by Gauss then the following table might result: gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss gauss cg cg Deltares 1: 6: 31 : 36 : 2: 4: 7: 12 : 19 : 24 : 32 : 34 : 5: 8: 11 : 15 : 22 : 25 : 26 : 29 : 30 : 35 : 3: 9: 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 6 6 2 5 32 35 3 3 8 11 20 23 33 33 11 9 10 14 21 26 27 28 35 33 9 10 7 12 25 30 8 5 13 18 13 18 26 35 3 14 17 16 23 20 20 30 23 28 10 3 7 10 3 5 25 30 25 28 10 3 18 9 16 13 33 23 18 23 13 14 18 13 3 21 28 33 13 35 28 18 18 13 14 16 17 21 23 of 152 D-Flow Flexible Mesh, Technical Reference Manual cg cg cg cg cg cg cg cg cg cg cg cg 10 : 13 : 14 : 16 : 17 : 18 : 20 : 21 : 23 : 27 : 28 : 33 : 5 6 6 7 5 6 5 7 6 5 6 6 9 14 13 17 16 17 21 20 17 28 27 27 16 3 20 10 18 23 14 27 18 21 33 28 3 20 9 14 23 3 13 14 21 33 21 20 18 9 3 9 10 10 33 16 16 20 23 13 17 33 16 21 3 28 27 9 28 13 16 23 27 21 23 28 33 23 33 28 18 18 DR AF T The corner nodes have the lowest degree so they are eliminated first as the table shows. These are followed by other nodes on the boundary before internal nodes are eliminated. After each elimination step the degree of neighboring points, due to fill-in, might be increased, so minimum degree automatically imposes some kind of colored ordering of the nodal points. Elimination of such points is known to improve the convergence properties of CG, see e.g. ?. The nodes, which are left over for CG, clearly show the increased degree due to fill in. In general the fastest convergence, in terms of number of iterations, is obtained by choosing maxdgr as large as memory allows in combination with LUD pre-conditioning. However in terms of computational time the fastest convergence is obtained by a moderate choice of maxdgr, such that approximately 50 % of the total number of grid points is eliminated by Gauss in combination with point Jacobi preconditioning. 24 of 152 Deltares 5 Conceptual description 5.1 Introduction [yet empty] 5.2 General background [yet empty] 5.3 Governing equations 5.4 Boundary conditions [yet empty] Turbulence DR AF 5.5 T [yet empty] Reynold’s stresses The Reynolds stresses in the horizontal momentum equation are modelled using the eddy viscosity concept, (for details e.g. Rodi (1984)). This concept expresses the Reynolds stress component as the product between a flow as well as grid-dependent eddy viscosity coefficient and the corresponding components of the mean rate-of-deformation tensor. The meaning and the order of the eddy viscosity coefficients differ for 2D and 3D, for different horizontal and vertical turbulence length scales and fine or coarse grids. In general the eddy viscosity is a function of space and time. For 3D shallow water flow the stress tensor is an-isotropic. The horizontal eddy viscosity coefficient, νH , is much larger than the vertical eddy viscosity νV (νH νV ). The horizontal viscosity coefficient may be a superposition of three parts: 1 a part due to “sub-grid scale turbulence”, 2 a part due to “3D-turbulence” see Uittenbogaard et al. (1992) and 3 a part due to dispersion for depth-averaged simulations. In simulations with the depth-averaged momentum and transport equations, the redistribution of momentum and matter due to the vertical variation of the horizontal velocity is denoted as dispersion. In 2D simulations this effect is not simulated as the vertical profile of the horizontal velocity is not resolved. This dispersive effect may be modelled as the product of a viscosity coefficient and a velocity gradient. The dispersive viscosity coefficient may be estimated by the Elder formulation. If the vertical profile of the horizontal velocity is not close to a logarithmic profile (e.g. due to stratification or due to forcing by wind) then a 3D-model for the transport of matter is recommended instead of 2D modelling with Elder approximation. The horizontal eddy viscosity is mostly associated with the contribution of horizontal turbulent motions and forcing that are not resolved by the horizontal grid (“sub-grid scale turbulence”) or by (a priori) the Reynolds-averaged shallow-water equations. For the former we introduce the sub-grid scale (SGS) horizontal eddy viscosity νSGS and for the latter the horizontal eddy viscosity νV . D-Flow FM simulates the larger scale horizontal turbulent motions through a Deltares 25 of 152 D-Flow Flexible Mesh, Technical Reference Manual sub-grid scale method (SGS), eg. Elder. The user may add a background horizontal viscosity, back νH , as a constant or spatially dependent. Consequently, in D-Flow FM the horizontal eddy viscosity coefficient is defined by back νH = νSGS + νV + νH . (5.1) The 3D part νV is referred to as the three-dimensional turbulence and in 3D simulations it is computed following a 3D-turbulence closure model. νV = νmol + max(νV , νVback ), T For turbulence closure models responding to shear production only, it may be convenient to specify a background or “ambient” vertical mixing coefficient in order to account for all other forms of unresolved mixing, νVback . Therefore, in addition to all turbulence closure models in D-Flow FM a constant (space and time) background mixing coefficient may be specified by the user, which is a background value for the vertical eddy viscosity in the momentum equations. Consequently, the vertical eddy viscosity coefficient is defined by: (5.2) 5.6 DR AF with νmol the kinematic viscosity of water. The 3D part ν3D is computed by a 3D-turbulence closure model, see section 7.7. Secondary flow This section presents developments regarding to the secondary flow by means of radius of flow curvature and the spiral intensity equation. Then the spiral flow intensity is used to calculate the deviation angle of shear stress, and the effect of secondary flow on depth averaged equations. The governing equations are first explained, then, the numerical techniques for reconstruction of velocity gradients are described. 5.6.1 Governing equations 5.6.1.1 Streamline curvature The curvature of flow streamlines, 1/Rs , can be defined by 1 =h Rs dx d2 y dt dt2 dx 2 dt − + dy d2 x dt dt2 i3/2 dy 2 dt (5.3) where x and y are the coordinate components of flow element and t is time. Substituting u = dx/dt and v = dy/dt gives u dv − v du 1 dt = dt 2 2 Rs (u + v )3/2 (5.4) Expanding the material derivatives du/dt and dv/dt gives, 1 = Rs u ∂v ∂t ∂v ∂v ∂u ∂u + u ∂x + v ∂y − v du + u + v dt ∂x ∂y (u2 + v 2 )3/2 (5.5) Under the assumption of a steady flow, Equation (5.5) changes to, ∂v ∂v + uv ∂y − uv ∂u − v 2 ∂u u2 ∂x 1 ∂x ∂y = 3/2 Rs (u2 + v 2 ) 26 of 152 (5.6) Deltares Conceptual description Equation (5.6) describes the curvature of flow streamlines by means of the velocity field. The sign of the streamline curvature indicates the direction in which the velocity vector rotates along the curve. If the velocity vector rotates clockwise, then 1/R > 0 and if it rotates counterclockwise, then 1/R < 0. Following this convention, the spiral flow intensity will be negative for bends with flows from left to right, and positive for bends with flows from right to the left. 5.6.1.2 Spiral flow intensity As the curvature is calculated, it can be contributed in the solution of spiral flow intensity. The spiral flow intensity, I , is calculated by where h is the water depth and I − Ie Ta Ie = Ibe − Ice h Ibe = |u| Rs h Ice = f √2 |u| = u2 + v 2 La Ta = |u| (1 − 2α) h La = 2κ2 α DR AF S=− ∂I ∂ ∂I DH +h DH + hS ∂x ∂x ∂y T ∂ ∂hI ∂uhI ∂vhI + + =h ∂t ∂x ∂y ∂x (5.7) (5.8) (5.9) (5.10) (5.11) (5.12) (5.13) (5.14) As the spiral motion intensity is found, it can be used in calculating the bedload transport direction and the dispersion stresses (and the effect on the momentum equations). 5.6.1.3 Bedload transport direction In the case of depth-averaged simulation (two-dimension shallow water), the spiral motion intensity is used to calculate the bedload transport direction φτ , which is given by tan φτ = u v − α I |u I | v u + αI | u I | (5.15) in which √ g 2 αI = 2 Es 1 − κ κC (5.16) Here g is the gravity, κ is the von Kármán constant and C is the Chézy coefficient. Es is a coefficient specified by the user to control the effect of the spiral motion on bedlead transport. Value 0 implies that the effect of the spiral motion is not included in the bedload transport direction. Deltares 27 of 152 D-Flow Flexible Mesh, Technical Reference Manual Dispersion stresses The momentum equations for shallow water are given as (without the Coriolis force) ∂zs ∂hTxx ∂hTyx ∂hSxx ∂hSyx ∂uh ∂uuh ∂vuh + + = −gh − Cf u |u| − − − − ∂t ∂x ∂y ∂x ∂x ∂y ∂x ∂y (5.17) ∂vh ∂vuh ∂vvh ∂zs ∂hTyx ∂hTyy ∂hSyx ∂hSyy + + = gh − Cf v |u| − − − − ∂t ∂x ∂y ∂y ∂x ∂y ∂x ∂y (5.18) The 3D velocity, can be decomposed into three components U = u + u∗ + u0 (5.19) Txx = hu∗ u∗ i , Txy = hu∗ v ∗ i Tyx = hv ∗ u∗ i , Tyy = hv ∗ v ∗ i T where u is the depth-averaged velocity component, u∗ is the depth-varying and u0 is the time varying component. The depth-averaged Reynolds stresses are represented as Sxx , Sxy , Syx and Syy following from an averaging operations in time and depth. The so-called dispersion terms are found on the right hand side DR AF 5.6.1.4 (5.20) The dispersion stresses need closure, similar to the Reynolds stresses. The used approach is to consider a fully developed flow in the streamwise direction (i.e. primary flow = logarithmic), and from a 1DV model it is possible to reconstruct the secondary flow profile. The time Figure 5.1: The flow streamline path and the direction of dispersion stresses. averaged velocity can be written as: H fn sin θ Rs (5.21) H fn cos θ + us (1 + fs ) sin θ Rs (5.22) u = u + u∗ = us (1 + fs ) cos θ − us v = v + v ∗ = us The depth varying component can subsequently be written as: H fn Rs (5.23) H fn + vfs Rs (5.24) u∗ = ufs − v v∗ = u 28 of 152 Deltares Conceptual description Which can subsequently be rewritten as: v Ifn |u| (5.25) u Ifn + vfs |u| (5.26) u∗ = ufs − v∗ = The dispersion terms can be evaluated as: uv v2 2 2 I hfs fn i + I fn |u| |u|2 u2 − v 2 uv 2 2 +2 I fn I hfs fn i − |u| |u|2 uv u2 2 2 + 2 I hfs fn i + I fn |u| |u|2 (5.27) hu∗ v ∗ i = uv fs2 (5.28) hv ∗ v ∗ i = v 2 fs2 T hu∗ u∗ i = u2 fs2 − 2 (5.29) Here, we applied Delft3D approach. In Delft3D approach, the following propositions are applied: DR AF hfs2 i is O (1) but hardly varies (Olesen, 1987, p. 9) I 2 hfn2 i is small for mildly curving, shallow water flow hfs fn i = 5α − 15.6α2 + 37.5α3 (cf. Delft3D-FLOW UM (2013, eq. 9.155)) Under these assumptions the dispersion stresses can be simplified to: uv I hfs fn i |u| u2 − v 2 = hu∗ v ∗ i = I hfs fn i |u| uv = hv ∗ v ∗ i = 2 I hfs fn i |u| Txx = hu∗ u∗ i = −2 Txy = Tyx Tyy 5.6.2 (5.30) (5.31) (5.32) Numerical schemes In this section, the numerical techniques, implemented for calculation of secondary flow, are described. It contains the calculation of the streamline curvature, spiral motion intensity, direction of bedload transport and the effect on the momentum equations. 5.6.2.1 Calculation of streamline curvature It is known that Perot reconstruction leads to inaccuracies in calculation of the streamlines curvature for the case with unstructured non-uniform grids. In general it is only first order accurate on unstructured meshes (Perot, 2000) and the velocity gradients derived from these reconstructed fields are inconsistent (Shashkov et al., 1998) and can result in erroneous estimates of the streamline curvature, leading to non-physical solutions. However, on uniform meshes, owing to fortunate cancellations on account of grid uniformity, this methodology leads to second order accurate velocities and consistent gradients (Shashkov et al., 1998; Natarajan and Sotiropoulos, 2011). In order to avoid the inaccuracy leading from Perot reconstruction on non-uniform grids, we reconstructed the velocity gradients by a higher order reconstruction method. There are two popular methods, namely Green-Gauss and least square reconstructions, which are widely used in the previous studies (Mavriplis, 2003) and they are also widely implemented in the Deltares 29 of 152 D-Flow Flexible Mesh, Technical Reference Manual existing commercial software (i.e. ANSYS Fluent). The least-squares constructions represent a linear function exactly for vertex and cell-centered discretizations on arbitrary mesh types, unrelated to mesh topology, while the Green-Gauss construction represents a linear function exactly only for a vertex-based discretization on simple elements, such as triangles or tetrahedra (Mavriplis, 2003). Hence, we used least square reconstruction for its ability in handling with all type of grid structures. The least-squares gradient construction is obtained by solving for the values of the gradients which minimize the sum of the squares of the differences between neighboring values and values extrapolated from the point i under consideration to the neighboring locations. The objective to be minimized is given as 2 2 Eik wik (5.33) k=1 T N X where w is a weighting function and E represents the error. Considering a linear reconstruction, and using Taylor series, we have ∂u ∂u (xk − xi ) + (yk − yi ) + E ∆x2 , ∆y 2 ∂x i ∂y i DR AF uk = ui + (5.34) Considering ∆xik = xk − xi , ∆yik = yk − yi and ∆uik = uk − ui , it yields 2 Eik 2 ∂u ∂u ∆xik + ∆yik = −∆uik + ∂x i ∂y i (5.35) A system of two equations for the two gradients ∂u/∂x and ∂u/∂y is obtained by solving the minimization problem PN 2 2 wik Eik =0 ∂ux P 2 2 ∂ N k=1 wik Eik =0 ∂uy ∂ k=1 (5.36) (5.37) Equations (5.36) and (5.37) lead to the following set of equations ∂u ∂u + bi = di ∂x ∂y ∂u ∂u + ci = ei bi ∂x ∂y ai 30 of 152 (5.38) (5.39) Deltares Conceptual description where ai = bi = N X k=1 N X 2 ∆x2ik wik (5.40) 2 ∆xik ∆yik wik (5.41) 2 2 wik ∆yik (5.42) 2 wik ∆uik ∆xik (5.43) ci = di = ei = k=1 N X k=1 N X 2 wik ∆uik ∆yik k=1 T k=1 N X (5.44) DR AF The above system of equations for the gradients is then easily solved using Cramer’s rule. This method is shown to have a second order accuracy (Mavriplis, 2003). For the unweighted case (wik = 1), the determinant corresponds to a difference in quantities of the order O (∆x4 ), which may lead to ill-conditioned systems. This may be the motivation for investigations into alternate solution techniques for the least-squares construction, such as the QR factorization method advocated in Haselbacher and Blazek (1999) and Anderson ), and Bonhaus (1994). Note that when inverse distance weighting is used (wik = √ 21 2 dxik +dyik the determinant scales as O (1), and the system is much better conditioned. 5.6.2.2 Calculation of spiral flow intensity As the spiral flow intensity is in the form of transport equation, it is calculated using the existing transport function in D-Flow FM. This is achieved by calculating the source term of Equation (5.7) and linking it to the existing code. 5.6.2.3 Calculation of bedload sediment direction The direction of bedload sediment is calculated by implementing Equation (5.15) in D-Flow FM. The calculated spiral intensity and velocity field is used to find the final angle of the acting shear stress. 5.6.2.4 Calculation of dispersion stresses The dispersion stresses Txx , Txy (= Tyx ) and Tyy are calculated parametrically by Equation (5.27) to Equation (5.29). In order to calculate the effect of these stresses on the momentum equations, calculation of derivatives, and hence a reconstruction technique, is necessary. This is achieved by implementing the same reconstruction technique used in section 5.6.2. 5.7 Wave-current interaction [yet empty] Deltares 31 of 152 D-Flow Flexible Mesh, Technical Reference Manual 5.8 Heat flux models [yet empty] 5.9 Tide generating forces [yet empty] 5.10 Hydraulic structures [yet empty] Flow resistance: bedforms and vegetation T [yet empty] DR AF 5.11 32 of 152 Deltares 6 Numerical approach D-Flow FM solves the two- and three-dimensional shallow-water equations. We will focus on two dimensions first. The shallow-water equations express conservation of mass and momentum DR AF with C being the Chézy coefficient. T ∂h + ∇ • (hu) = 0, (6.1) ∂t ∂hu τ + ∇ • (huu) = −gh∇ζ + ∇ • (νh(∇u + ∇uT )) + . (6.2) ∂t ρ T ∂ ∂ where ∇ = , (i.e. two dimensional), ζ is the water level, h the water depth, u ∂x ∂y the velocity vector, g the gravitational acceleration, ν the viscosity, ρ the water mass density and τ is the bottom friction: ρg (6.3) τ = − 2 kuku, C Rewrite the time derivative of the momentum equation (Equation (6.2)) as: ∂u ∂h ∂hu =h +u ∂t ∂t ∂t (6.4) The shallow water equations can then be written as: ∂h + ∇ • (hu) = 0, ∂t (6.5) ∂u 1 1 1τ + (∇ • (huu) − u∇ • (hu)) = −g∇ζ + ∇ • (νh(∇u + ∇uT )) + , ∂t h h hρ (6.6) The equations are complemented with appropriate initial conditions and water level and/or velocity boundary conditions. The boundary conditions are explained in section 6.4. The initial conditions will not be discussed further. 6.1 Topology of the mesh In this section the connectivity between cells, faces and nodes is defined (topology) and how the bed level is interpreted. 6.1.1 Connectivity We will firstly introduce some notation that expresses the connectivity of computational cells, faces and mesh nodes, see Figure 6.2b. We say that cell k contains vertical faces j that are in the set J (k), cell k contains mesh nodes i that are in the set I(k), face j contains mesh nodes l(j) and r(j), given some orientation of face j , face j contains neighbors cells L(j) and R(j), given some orientation of face j . Deltares 33 of 152 D-Flow Flexible Mesh, Technical Reference Manual ζ1 u2 ζ2 u3 hs1 u1 z3 u5 z2 hs2 bl1 u4 bl2 T z1 z4 DR AF Figure 6.1: Discretization of the water level ζk (at cell circumcenter), bed-levels zi (at nodes) and blk (at cell circumcenter), water depth hk (= ζk − blk ; at cell circumcenter) and face-normal velocities uj (at faces). 2 l(j) 2 3 5 1 4 2 1 L(j) 4 3 R(j) j 1 (a) Top-view on Figure 6.1. Numbering of cells, faces and nodes. The flow direction through the face is positive from the left to the right cell as defined by n. r(j) (b) Orientation of face j to the neighboring cells and nodes. Figure 6.2: Numbering of cells, faces and nodes, with their orientation to each other. cell k i ∈ I(k) j ∈ J (k) node k ∈ {L(j), R(j)} face i j i ∈ {l(j), r(j)} Figure 6.3: Connectivity of cells, faces and nodes 34 of 152 Deltares Numerical approach J (1) = {1, 2, 3}, J (2) = {4, 1, 5}, I(1) = {1, 2, 3}, I(2) = {2, 4, 1}, l(1) = 2 and r(1) = 1, l(2) = 2 and r(2) = 3, ..., l(5) = 2 and r(5) = 4, L(1) = 1 and R(1) = 2, L(2) = ∗ and R(2) = 1, ..., L(5) = 2 and R(5) = ∗ T Thus, in the example of Figure 6.2: DR AF The orientation of face j with respect to cell k ∈ {L(j), R(j)} is accounted for by sj,k in the following manner: sj,k = 1, −1, L(j) = k R(j) = k (nj is outward normal of cell k ), (nj is inward normal of cell k ), (6.7) where nj is the normal vector of face j , defined positive in the direction from cell L(j) to R(j). In the example of Figure 6.2a s1,1 = 1 and s1,2 = −1. The connectivity translates directly to administration in the D-Flow FM code as follows: J (k): nd(k)%ln, I(k): nd(k)%nod, l(j): lncn(2,j), r(j): lncn(1,j), L(j): ln(1,j), R(j): ln(2,j). 6.1.2 Bed geometry: bed level types The bed geometry is user defined by specifying the cell-centered values (bed level type = 1), by its face-based values (bed level type = 2), or by the values at the mesh nodes (other bed level types). In the first two cases, the bed is assumed piecewise constant. In the other cases, the bed is assumed piecewise linear or piecewise constant, depending on the "bed level type" and the term to be discretized at hand. The bed geometry appears in the discretization of the governing equations by means of its cell-centered value blk and its face-based values bl1j and bl2j . Given some orientation, bl1j represents the left-hand side bed level at face j and bl2j the right-hand side bed level, respectively. In such a manner a linear representation of the bed from bl1j to bl2j is obtained at face j . It is used, for example, in the computation of the flow area Auj as we will see in Section Face-based water depth huj . Note: that for the sake of clarity we will not discuss one-dimensional modelling at this occasion. In case of bed level type "1", the cell-centered levels are (user) defined in blk and the nodebased levels zi from the mesh are disregarded. Similarly, for bed level type "2" the face-based Deltares 35 of 152 D-Flow Flexible Mesh, Technical Reference Manual bed levels are defined in bluj . In the other cases the bed levels zi are defined at the mesh nodes. The cell-based bed levels blk are then derived from the nodal values as shown in Algorithm (1). Refer to section 6.1.1 for the definitions of sets of nodes I(k) and faces J (k), respectively. How the face-based bed levels bl1j and bl2j are determined is shown in Algorithm (1). Refer to section 6.1.1 for the definitions of L(j), R(j), r(j) and l(j) respectively. Algorithm 1 setbobs: compute face-based bed-levels bl1j and bl2j and cell-based bed-level blk bl1j bed level type = 1, bed level type = 2, T bed level type ∈ {3, 4, 5}, bed level type = 6 otherwise (this value is supplied to cells without specified bed level). DR AF user specified, min (bluj ), j∈J (k) min min(bl1j , bl2j ) , j∈J P(k) P blk = zi / 1, i∈I(k) i∈I(k) zk uni , max(blL(j) , blR(j) ), bl uj , zl(j) , 1 = (z + zr(j) ), 2 l(j) min(z l(j) , zr(j) ), max(zl(j) , zr(j) ), max(blL(j) , blR(j) ), bl2j = bed level type bed level type bed level type bed level type bed level type bed level type bed level type = 1, = 2, ∈ {3, 4, 5} =3 =4 =5 = 6. ∧ ∧ ∧ ∧ (6.8) conveyance type conveyance type conveyance type conveyance type zr(j) , bed level type ∈ {3, 4, 5} ∧ conveyance type ≥ 1, bl1j , otherwise. ≥ 1, < 1, < 1, < 1, (6.9) (6.10) The notation translates directly to administration in the D-Flow FM code as follows: bl1j : bob(1,j), bl2j : bob(2,j). 6.2 Spatial discretization The spatial discretization is performed in a staggered manner, i.e. velocity normal components uj are defined at the cell faces j , with face normal vector nj , and the water levels ζk at cell centers k . See Figure 6.2 for an example. Note that in this example k ∈ {1, 2} and j ∈ {1, 2, . . . , 5}. 36 of 152 Deltares Numerical approach Continuity equation The continuity eqaution read:: ∂h + ∇ • (hu) = 0, ∂t (6.11) and is is spatially discretized as, see (Equation (6.5)): dVk dt =− X Auj uj sj,k , (6.12) j∈J (k) T . Where J (k) is the set of vertical faces that bound cell k and sj,k accounts for the orientation of face j with respect to cell k , see section 6.1.1. Furthermore, Vk is the volume of the water column at cell k computed with Algorithm (20), not discussed here, Auj approximates the flow area of face j , computed with Algorithm (3), and huj is the water depth at face j , computed with Algorithm (2). Algorithms (3) and (2) will be discussed momentarily. DR AF 6.2.1 Face-based water depth huj In contrast to the bed, which may vary linearly for bed level types 3, 4 and 5 and conveyance types ≥ 1, the water level is assumed constant within a face. The water level at the faces are reconstructed from the cell-centered water levels with an upwind approximation. The facebased water depth huj is then defined as the maximum water depth in face j , see Figure 6.4. It is computed with Algorithm (2). Algorithm 2 sethu: approximate the face-based water depth huj with an upwind reconstruction of the water level at the faces huj = ζL(j) − min(bl1j , bl2j ), uj > 0 ∨ uj = 0 ζR(j) − min(bl1j , bl2j ), uj < 0 ∨ uj = 0 ∧ ∧ ζL(j) > ζR(j) , ζL(j) ≤ ζR(j) . (6.13) Example In the example of Figure 6.1, the water level at face j , assumed constant in the face as indicated in the figure, is approximated by: ζuj if u1 < 0 ζ2 = max(ζ1 , ζ2 ) if u1 = 0 ζ1 if u1 > 0 (6.14) Remark 6.2.1. We will see later in Equation (6.97) that the time-integration of the continuity equation is implicit/explicit. Nonetheless, the upwind direction of huj is based on the velocity at the beginning of the time-step only. Remark 6.2.2. The upwind reconstruction of huj from the cell-centered water levels is a first-order approximation (possibly based on the incorrect upwind direction, see previous remark). Higher-order reconstruction is not available at this moment, regardless of the option limtyphu. Deltares 37 of 152 D-Flow Flexible Mesh, Technical Reference Manual ζiup(j) huj min(bl1j , bl2j ) Au j max(bl1j , bl2j ) r(j) l(j) wu j Wet cross-sectional area Auj T Figure 6.4: Flow area Auj and face-based water depth huj By the flow area Auj the wet cross-sectional area of the face j is meant. Since the bed level in face j is linearly varying from bl1j to bl2j , and the water in the face is assumed at constant level min(bl1j , bl2j ) + huj , the wet area can be computed with Algorithm (3). Note that wuj DR AF Algorithm 3 setau: compute the flow area Auj ∆blj = max(bl1j , bl2j ) − min(bl1j , bl2j ), ( wuj huj , if ∆blj < δwuj , huj Auj = ∆blj 1 wuj huj min( ∆blj , 1) 1 − 2 min( hu , 1) , otherwise. (6.15) (6.16) j is the width of face j , see Figure 6.4, and ∆blj is the cross-sectional bed variation. Remark 6.2.3. The exception for the case ∆blj < δwuj with δ = 10−3 in Equation (6.16) should maybe be reconsidered. Remark 6.2.4. In case of bed level type 3 and conveyance types ≥ 1, the bed is assumed lineary varying within a face, see Algorithm (1). This is accounted for in the computation of the wet cross-sectional areas of the vertical faces, see Algorithm (3). A linearly varying bed, on the other hand, is not accounted for in the computation water column volumes Vk in Algorithm (20), without non-linear iterations (explained later). This seems inconsistent when we are employing a finite volume approximation as in e.g. Equation (6.12). Total area of a cell The definition of variables to determined the total area of a computational cell are depicted in Figure 6.5. 38 of 152 Deltares wu 2 Numerical approach α 1 ∆ x1 Ω1 1 2 1 wu ∆x 2 α2 3 T α3 ∆x3 wu3 Figure 6.5: Area computation for cell Ω1 DR AF The total area A of cell Ωk is determined as follows: A(Ωk ) = X j∈J (Ωk )|L(j)=k αj ∆xj wuj + X (1 − αj )∆xj wuj (6.17) j∈J (Ωk )|L(j)6=k An example for area Ω1 is: 1 1 1 A(Ω1 ) = α1 ∆x1 wu1 + α2 ∆x2 wu2 + (1 − α3 )∆x3 wu3 2 2 2 6.2.2 (6.18) Momentum equation The momentum equation read 1 1τ ∂u 1 , + (∇ • (huu) − u∇ • (hu)) = −g∇ζ + ∇ • (νh(∇u + ∇uT )) + h hρ ∂t h (6.19) and is discretized at the faces and in face-normal direction, see Figure 6.6. Deltares 39 of 152 D-Flow Flexible Mesh, Technical Reference Manual αj ∆xj L(j) nj wuj R(j) T ∆xj Figure 6.6: Computational cells L(j) and R(j) neighboring face j ; water levels are stored at the cell circumcenters, indicated with the +-sign DR AF In this figure ∆xj is the distance between the two neigboring cell centers, i.e. ∆xj = kxR(j) − xL(j) k, and wuj is, as explained before, the width of face j . Making use of the properties of an orthogonal mesh, the water level-gradient term projected in the face-normal direction is discretized as g∇ζ|j • nj ≈ g (ζR(j) − ζL(j) ). ∆xj (6.20) The bed friction term is discretized as 1τ hρ • nj ≈ − j gkuj k C 2 ĥj uj , (6.21) where ĥj acts as an hydraulic radius whose computation depends on the "conveyance type". Its precise discretization is discussed later (see Algorithm (12) and Algorithm (13)). The magq nitude of the velocity is computed by: kuj k = u2j + vj2 . Furthermore, advection and diffusion are discretized as 1 1 T (∇ • (huu) − u∇ • (hu)) − ∇ • (νh(∇u + ∇u )) • nj ≈ Ai j uj +Ae j . (6.22) h h j The terms Ai j (implicit part) and Ae j (explicit part) will be discussed in more detail hereafter. These terms play an important role in the D-Flow FM code and are called advi and adve, respectively. Summing up, the spatial discretization of Equation (6.6) reads duj dt 40 of 152 =− g gkuj k ζR(j) − ζL(j) − Ai j uj − Ae j − uj . ∆xj C 2 ĥj (6.23) Deltares Numerical approach Momentum advection It would be a clear advantage if the momentum equation was discretized conservatively, especially for flows with discontinuities such as hydraulic jumps. This is not easily achieved in case of staggered, unstructured meshes. Nonetheless, Perot (2000) shows how to achieve momentum conservation in similar circumstances for the incompressible Navier Stokes equations. This approach is applied to the shallow water equations in Kramer and Stelling (2008) and Kleptsova et al. (2010). However, subtleties exist in the formulations as pointed out in Borsboom (2013). The various advection schemes in D-Flow FM differ on these subtleties. T The difficulty with the staggered layout on unstructured meshes is that we only solve the momentum equation in face-normal direction. We could, in principle, formulate a control volume for each face-normal velocity, but are unable to define conservative fluxes, as we do not solve for the whole momentum vector, as we would do with a collocated arrangement of the unknowns. To this end, Perot (2000) pursues conservation of the full reconstructed cellcentered momentum vector. The advection operator is firstly discretized at cell centers, as if we were dealing with a collocated layout of our unknowns, and subsequently interpolated back to the faces and projected in face-normal direction. DR AF Remark 6.2.5. Perot (2000) shows that the reconstruction from face-normal quantities to cell-centered vectors and the interpolation from cell-centered vector to face-normal quantities need to satisfy certain demands. We are not free to choose a reconstruction to our liking and the accuracy may even be compromised on irregular meshes. The application of this approach to the shallow-water equations as in Kramer and Stelling (2008) and Kleptsova et al. (2010) is non-trivial. Complicating matters significantly is that we are not solving in conservative, but in primitive variables. As pointed out in Borsboom (2013), the discretization of advection is subject to many subtleties. In D-Flow FM various advection schemes exist that vary on these subtleties. Remark 6.2.6. It’s fair to say that, formally speaking, none of the momentum advection schemes in D-Flow FM is conservative in the sense of Perot (2000). The approach in Perot (2000) is as follows. Given some cell k , assume that cell-centered conservative advection is approximated by ∇ • (huu)|Ωk ≈ ak . (6.24) Face-normal advection at face j is then interpolated from its neighboring cells L(j) and R(j) as ∇ • (huu)|Γj • nj ≈ αj aL(j) + (1 − αj )aR(j) • nj , (6.25) where αj is the non-dimensional distance from the left cell center to the face, see Figure 6.6. Note that the terms −u∇ • (hu) and h1 in Equation (6.22) are due to our non-conservative formulation and do not appear in Equation (6.25). In the non-conservative formulation of Equation (6.22), their discretization contributes significantly to the subtle differences in the various schemes. See Borsboom (2013) for more details. The cell-centered advection is discretized as ak = X 1 uuj qj sj,k , A(Ωk ) (6.26) j∈J (k) where uuj is the reconstructed full velocity at the faces and A(Ωk ) the area of the control volume Ωk , i.e. the cell. It is reconstructed from the cell-centered velocities uc with an upwind Deltares 41 of 152 D-Flow Flexible Mesh, Technical Reference Manual scheme, e.g. uuj = uL(j) , uj ≥ 0, uR(j) , uj < 0. , (6.27) or with a higher-order limited version, discussed later. The cell-centered velocities in turn are reconstructed from the (primitive) face-normal velocities with Algorithm (6), also discussed later. Furthermore, flux qj is derived from the face-normal velocity as qj = Auj uj , (6.28) see also Algorithm (21), explained later when we will discuss the time discretization. DR AF T The term −u∇ • (hu) is the so-called "storage term" and is due to our non-conservative formulation of the momentum equation. It originates from the substitution of the continuity equation in the conservatively formulated momentum equation. Glancing ahead at our temporal discretization, we observe the following. If we want our discretization to be discretely conservative, we need to substitute the continuity equation after spatial and temporal discretization, see Equation (6.108) (explained later). This means that we require the fluxes in the storage term to be identical to the fluxes in the discrete continuity equation, Equation (6.97), i.e. qjn+1 , where n denotes the time level: −u∇ • (hu)|nk ≈ − X u qjn+1 sj,k , A(Ωk ) (6.29) j∈J (k) where we do not mention at which time level term u A(Ωk ) is to be evaluated. Equation (6.29) leads to an implicit contribution to the discrete advection for θ > 0. However, in D-Flow FM the storage term is always discretized explicitly in time. It is based on explicit fluxes qjn or on qa nj , depending on the advection scheme. Remark 6.2.7. Since the fluxes in the storage term are at the old time level, in contrast to the fluxes in the continuity equation, advection in D-Flow FM is non-conservative for nonstationary flows and θ > 0. Given the discretization of the conservatively formulated advection of Eqns. ((6.25)) and ((6.26)) and the storage term of Equation (6.29), the advection can now be composed in general form as Ae j = ALj ARj P ∗ (L(j)) l∈J P l∈J ∗ (R(j)) and Ai j = −ALj X ql∗ sl,L(j) uul • nj − ql∗∗ sl,L(j) (1 − θl,L(j) )u∗Lj + ql∗ sl,R(j) uul • nj − ql∗∗ sl,R(j) (1 − θl,R(j) )u∗Rj , ql∗∗ sl,L(j) θl,L(j) − ARj X ql∗∗ sl,R(j) θl,R(j) , (6.30) (6.31) l∈J ∗ (R(j)) l∈J ∗ (L(j)) where J ∗ , ql∗ , ql∗∗ , θl,{L,R}(j) , u∗{L,R} , ALj , ARj vary for the different advection schemes as j described in Algorithm (4) and J i is the set of faces with inward fluxes, i.e. J i (k) = {j ∈ J (k)|uj sj,k < 0} (6.32) huvj = max(αj hζL(j) + (1 − αj )hζR(j) , εhζ ), (6.33) and 42 of 152 Deltares Numerical approach where εhζ is a threshold. θl,L(j) and θl,R(j) are determined by their face-based Courant numbers σj,L(j) and σj,R(j) as follows θl,{L,R}(j) = 1 (6.34) 1 − σj,{L,R}(j) where σj,L(j) and σj,R(j) are computed as: σj,L(j) = 1.4∆t|qa j | , αj VL(j) +(1−αj )VR(j) ∆t|qa j | , αj VL(j) +(1−αj )VR(j) other, 1.4∆t|qa j | , αj VL(j) +(1−αj )VR(j) P ∆t|qa j | , αj VL(j) +(1−αj )VR(j) P 1 = 3, j∈J (L(j)) (6.35) and j∈J (R(j)) other, DR AF respectively. 1 = 3, T σj,R(j) = (6.36) Algorithm 4 advec: compute advection terms of the form 1 h (∇ • (huu) − u∇ • (hu)) j • nj ≈ Ai j uj + Ae j compute higher-order accurate reconstructions of face-based velocity vector uu from cellcentered velocity vectors uc with Algorithm (10) compute Ae and Ai : X ql∗ sl,L(j) uul • nj − ql∗∗ sl,L(j) (1 − θl,L(j) )u∗Lj + Ae j = ALj l∈J ∗ (L(j)) X ARj ql∗ sl,R(j) uul • nj − ql∗∗ sl,R(j) (1 − θl,R(j) )u∗Rj (6.37) l∈J ∗ (R(j)) X Ai j = − ALj ql∗∗ sl,L(j) θl,L(j) − X ARj l∈J ∗ (L(j)) ql∗∗ sl,R(j) θl,R(j) l∈J ∗ (R(j)) (6.38) See Table 6.1 for the definition of the variables used in this algorithm. Where Note that VAu L(j) and VAu R(j) are undefined. Cell center interpolation We saw in the previous section that the cell-centered reconstructed full velocity vector uc plays an important role in the discretization of the momentum advection. This section elaborates on its computation. Following Perot (2000), and taking a cell k as a control volume, the full cell-centered velocity vector can be reconstructed from the face-normal components uj by using the following approximation uck 1 ≈ A(Ωk ) Z Ωk 1 ∇ • (u(x − xck )) dΩ = A(Ωk ) Z (x − xck )u • n dΓ, (6.39) ∂Ωk where Ωk is the control volume, i.e. the cell k , ∂Ωk the boundary of the control volume, A(Ωk ) its area and n is an outward orthonormal vector. Deltares 43 of 152 J∗ ql∗ - qa l qa l qa l qa l qa l qa l qa l qa l qa l qa l qa l ql ql ql qa l - J J J Ji J Ji J Ji J J J J J J J 0 1 44 of 152 2 uck = 3, 33 4 5 X j∈{l∈J (k)|sl,k =1} 6 wcL j uj 7,9,11 + 8,10,12 30 31 34 X 36 wcR j uj 37 38 333 qa l ql ql ql qa l qa l qa l qa l qa l qa l qa l qa l qa l qa l ql - ql∗∗ max(1 − max(1 − uj 1 , 0) σl,{L,R}(j) 0 0 0 0 0 0 0 1 1 VL(j) +VR(j) 1−αj αj VL(j) +(1−αj )VR(j) 1−αj αj VL(j) +(1−αj )VR(j) 1−αj αj VL(j) +(1−αj )VR(j) 1−αj αj VL(j) +(1−αj )VR(j) 1−αj αj VL(j) +(1−αj )VR(j) 1−αj αj VL(j) +(1−αj )VR(j) 1 VL(j) +VR(j) 1−αj VR(j) 1−αj huv j bA R(j) 1−αj VR(j) 1−αj huv j bA R(j) 1−αj VAu R(j) 1−αj VAu R(j) 1 VL(j) +VR(j) αj αj VL(j) +(1−αj )VR(j) αj αj VL(j) +(1−αj )VR(j) αj αj VL(j) +(1−αj )VR(j) αj αj VL(j) +(1−αj )VR(j) αj αj VL(j) +(1−αj )VR(j) αj αj VL(j) +(1−αj )VR(j) 1 VL(j) +VR(j) αj VL(j) uj uc{L,R}(j) • nj uj uj uj αj huv j bA L(j) αj VL(j) αj huv j bA L(j) αj VAu L(j) αj VAu L(j) ARj 1 VL(j) +VR(j) 0 ALj 1 VL(j) +VR(j) T j uc{L,R}(j) • nj uj uj uj uj 1 , 0) σl,{L,R}(j) 1 uj uj uj uj 0 u∗{L,R} 0 0 0 0 - θl,{L,R}(j) DR AF iadv D-Flow Flexible Mesh, Technical Reference Manual Table 6.1: Definition of the variables used in Algorithm (4) Remark 6.2.8. We will not discuss whether uck represents a cell-averaged or nodal value. Nevertheless, Equation (6.39) is a second order approximation if the center point is sufficiently close to the mass center of the control volume. Note: that in our case the center point is the cell circumcenter, which can deviate considerably from the mass center for irregular meshes. The discretization of Equation (6.39) in cell k is j∈{l∈J (k)|sl,k =−1} (6.40) Deltares Numerical approach with weight vectors w cL j and w cR j are computed with Algorithm (5), where bAk is the bed area of cell k . Algorithm 5 setlinktocenterweights: compute weight vectors w cL j and w cR j in the cellcenter reconstruction of Equation (6.40) αj ∆xj nj wuj A(ΩL(j) ) (1 − αj )∆xj nj wuj = A(ΩR(j) ) wcL j = (6.41) wcR j (6.42) T Remark 6.2.9. Cells that are cut by a dry-wet interface do not get any special treatment, i.e. dry faces (with formally undefined velocities) still appear in the reconstruction, with assumed zero velocity. Hence, cell centered velocity vectors near the dry-wet interface may be inconsistent with the local flow. DR AF The cell centered velocities are computed with Algorithm (6), where hζ k is the cell centered water depth at cell k , defined as hζ k = ζk − blζ . Note that uq is a ‘discharge-averaged’ Algorithm 6 setucxucyucxuucyu: reconstruct cell centered velocity vectors uc and uq , and set first-order upwind fluxes uL u uq k = 1 hζ k X huj wcL j uj X + j∈J (k)|L(j)=k huj wcR j uj (6.43) j∈J (k)|R(j)=k if iPerot = 2 then uck = uq k (6.44) else uck = X wcL j uj j∈J (k)|L(j)=k X + wcR j uj (6.45) j∈J (k)|R(j)=k end if uuj uc L(j) , qa j > 0 uc R(j) , qa j < 0 = 0, qa j = 0 (6.46) reconstructed velocity vector. It is used for the tangential velocity vj component at the faces: vj = αj uq L(j) + (1 − αj )uq R(j) × nj (6.47) Remark 6.2.10. It is not hard to see that the interpolation of uq may be inconsistent, depending on the "bed level type", see Algorithms (1) and (2), and the bed geometry itself. Note that Algorithm (6) also sets a first-order upwind approximation of uu , necessary in momentum advection, see Equation (6.26). Higher order corrections are added in Algorithm (10), explained later. Deltares 45 of 152 D-Flow Flexible Mesh, Technical Reference Manual ∆xj l(j) wuj L(j) R(j) αnRj wuj T r(j) DR AF Figure 6.7: Nodal interpolation from cell-centered values; contribution from face j to node r(j); the shaded area indicates the control volume Ωn . Nodal interpolation In the discretization of horizontal momentum diffusion and in the bed friction for "conveyance type" ≥ 3, node-based velocity vectors un appear. This section elaborates on their computation. The nodal velocity vectors are interpolated from the cell-centered velocity vectors uc , which were, in turn, interpolated from the face-normal velocities u • n, see the previous section. Given some available cell-centered data, say Φc (e.g. one of the components of the velocity vector), we can define a control volume as indicated in Figure 6.7 and interpolate to the nodes, say Φn , as follows: Z 1 Φn ≈ 2A(Ωn ) 1 ∇ • (Φ(x − xn )) dΩ = 2A(Ωn ) Ωn where Ωn ∂Ωn dΓ A(Ωn ) n xn Z Φ(x − xn ) • n dΓ, (6.48) ∂Ωn is the node-based control volume, the boundary of the control volume, its boundary, the area of the control volume, the outward normal vector and are the node coordinates. Remark 6.2.11. Equation (6.48) is a second order approximation if the node is located sufficiently close to the mass center of the control volume. In the example of Figure 6.7 this is indeed the case, but not necessarily for general meshes. The discretization of Equation (6.48) at node i is Φi = X j∈{l|l(l)=i} 46 of 152 1 wLj (Φc L(j) + ΦR(j) ) + 2 X j∈{l|r(l)=i} 1 wRj (ΦL(j) + ΦR(j) ), 2 (6.49) Deltares Numerical approach with weights wiL j and wiR j computed as 1 α ∆xj wuj 2 iL j wiL j = 1 α ∆xl wul 2 iL j P l∈{m|l(m)=l(j)} P + l∈{l|r(m)=l(j)} (6.50) 1 α ∆xl wul 2 iR l 1 α ∆xj wuj 2 nR j wiR j = P l∈{m|l(m)=r(j)} 1 α ∆xl wul 2 iL l P + l∈{m|r(m)=r(j)} (6.51) 1 α ∆xl wul 2 iR l Note that αiL j ∆xj and αiR j ∆xj approximate the components of (x − xi ) • n in Equation (6.50) and Equation (6.51) for node i and face j , which in D-Flow FM are computed as k 21 (xζ L(j) + xζ R(j) ) − xi l(j) k + k 12 (xζ L(j) + xζ R(j) ) − xi r(j) k , (6.52) T αiL j = k 21 (xζ L(j) + xζ R(j) ) − xi l(j) k αiR j = 1 − αnL j , where are the coordinates of cell-center k and are the coordinates of mesh node i, respectively. Remark 6.2.12. A more straightforward approach, employing the properties of an orthogonal mesh and using wuj := kxi r(j) − xi l(j) k, would be: DR AF xζk xi (6.53) αiL j = 1 (xζ L(j) 2 + xζ R(j) ) − xi l(j) • (xi r(j) − xi l(j) ) . wu 2j (6.54) In D-Flow FM the interpolation of cell-centered velocity vectors to nodal velocity vectors is as in Equation (6.48). That is, when "jacomp" 6= 1 and we do not consider mesh boundaries. The quantity Φ is to be replaced by both components of the velocity vector, respectively, i.e. ui = X j∈{l|l(l)=i} 1 wiL j (uc L(j) + uc R(j) ) + 2 X j∈{l|r(l)=i} 1 wiR j (uc L(j) + uc R(j) ) 2 (6.55) When "jacomp" = 1, however, the two components of the velocity vector (ux , uy ), get different weights. If we say uc =: (ucx , ucy )T and un =: (unx , uny )T , then the interpolation becomes as performed by Algorithm (7). The weights wnx L , wnx R , wny L and wny R are computed with Algorithm (8), where ex and ey are the unit vectors in x- and y -direction respectively. The exceptions at mesh boundaries remain unmentioned. Remark 6.2.13. For nodes not on the mesh boundary, it is unclear why the weights in Algorithm (7) for vector interpolation should differ from Equation (6.50) and Equation (6.51) for scalar interpolation, which is the case if "jacomp" = 1 in Algorithm (8). The option "jacomp" = 1 may need to be reconsidered. The various variables used Flow FM code: xζ k • ex : xz(k), xni • ex : xk(i), unx i : ucnx(i), αnL j : acn(2,j), wnx Lj : wcnx4(j), wnx Rj : Deltares wcnx3(j), in the nodal interpolation have the following names in the D- xζ k • ey : xni • ey : uny i : αnR j : wny Lj : wny Rj : yz(k), yk(i), ucny(i), acn(1,j), wcny4(j), wcny3(j). 47 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 7 setcornervelocities: interpolate nodal velocity vectors un = (unx , uny )T from cell-centered velocity vectors uc = (ucx , ucy )T X unx i = j∈{l|l(l)=i} 1 wnx Lj (ucx L(j) + ucx R(j) ) + 2 X j∈{l|r(l)=i} X uny i = j∈{l|l(l)=i} 1 wnx Rj (ucx L(j) + ucx R(j) ) 2 (6.56) 1 wny Lj (ucy L(j) + ucy R(j) ) + 2 X T j∈{l|r(l)=i} 1 wny Rj (ucy L(j) + ucy R(j) ) 2 (6.57) Algorithm 8 setlinktocornerweights: compute weights wnx Lj , wnx Rj , wny Lj and wny Rj in the nodal interpolation of Algorithm (7), Equation (6.56) and Equation (6.57) 2 max(10−6 , |nj • ex |), jacomp = 1 1, otherwise (6.58) 2 max(10−6 , |nj • ey |), jacomp = 1 1, otherwise (6.59) DR AF χx j = χy j = if r(j) and l(j) are not boundary nodes then wnx Lj = 1 α ∆xj wuj χx j 2 nL j P l∈{m|l(m)=l(j)} wny Lj = P P j∈{l|r(m)=l(j)} 1 α ∆xl wul χx j 2 nR l 1 α ∆xl wul χy j 2 nL j + P l∈{m|r(m)=l(j)} 1 α ∆xl wul χy j 2 nR l 1 α ∆xj wuj χx j 2 nR j P l∈{m|l(m)=r(j)} wny Rj = + 1 α ∆xj wuj χy j 2 nL j l∈{m|l(m)=l(j)} wnx Rj = 1 α ∆xl wul χx j 2 nL j 1 α ∆xl wul χx j 2 nL l + P l∈{m|r(m)=r(j)} 1 α ∆xl wul χx j 2 nR l 1 α ∆xj wuj χy j 2 nR j P l∈{m|l(m)=r(j)} 1 α ∆xl wul χy j 2 nL l + P l∈{m|r(m)=r(j)} 1 α ∆xl wul χy j 2 nR l else unmentioned, at least one of the nodes is a boundary node end if Higher-order reconstruction: limtypmom A higher-order accurate discretization of advection may be achieved by higher-order accurate reconstruction of the face-based full velocity vectors uu in Equation (6.26). A first-order approximation is already available from Algorithm (6), Equation (6.46). This section elaborates on the higher-order corrections added to uu . The reconstruction at the faces is a one-dimensional reconstruction on a line through both neighboring cells L(j) and R(j). Besides the neighboring cell-centered values, a third value is sought on the line, which is interpolated from cells connected to the left-hand side neigh- 48 of 152 Deltares Numerical approach kL1j RL1j CLj L(j) nj R(j) kL2j T RL2j DR AF Figure 6.8: Higher-order reconstruction of face-based velocity uuj , from the left boring cell L(j) for reconstruction from the left, and cells connected to the right-hand side neighboring cell R(j) for reconstruction from the right, respectively. We will refer the these third locations on the line as CLj and CRj respectively. For the reconstruction along the line a one-dimensional limiter is used with the purpose to obtain a TVD scheme. In D-Flow FM various limiters are available by means of the option limtypmom. Remark 6.2.14. It is not immediately clear why a TVD limiter based on interpolated values would guarantee TVD properties of the primitive variables. We will firstly consider the stencil for the reconstruction. Assume that we want to reconstruct at face j from the left, then the cells in the stencil are {R(j), L(j), kL1 j , kL2 j }. An example is shown in Figure 6.8. If we let RL1 j measure the distance from the cell center kL1 j to the line through L(j) and R(j), and similarly for RL2 j , then the cells kL1 j and kL2 j are chosen according to the rules stated in Algorithm (9). These cells are the cells whose circumcenters are closest to the line through L(j) and R(j). The values in cells kL1 j and kL2 j are used to interpolate a value at CLj , which is located on the line trough the left and right cell centers L(j) and R(j). The higher-order reconstruction is then performed based on the values of cells CLj , L(j) and R(j) in a one-dimensional fashion. A value, say Φ, at CLj , i.e. ΦCLj (being one of the two cell-centered velocity vector components as we will see later), is interpolated as follows: ΦCLj = sL1 j ΦkL1 j + sL2 j ΦkL2 j . (6.60) The weights are computed with Algorithm (9). Note that the exception for RL1j < 0.1∆xj only adds one cell to the stencil for higher-order reconstruction, mimicking stencils on e.g. curvilinear meshes. Note also the exception for the (face-specified) advection types 6 and 8, not discussed further. The interpolation of Equation (6.60) is applied to the Cartesian components of the velocity vector. In such a manner values at uxCLj and uy C are obtained. The reconstruction is Lj Deltares 49 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 9 setupwslopes: determine the cells kL1 and kL2 , and compute weights sL1 and sL2 in Equation (6.60) for the higher-order reconstruction from the left at the faces, and similar for reconstruction from the right to obtain kR1 , kR2 , sR1 and sR2 if reconstruction from the left then determine the cells kL1 j and kL2 j according to the following rules cells kL1 j and kL2 j each share a face with cell L(j) the cell center is at the left-hand side from cell center L(j), i.e. (xζ k nj < 0 for k ∈ {kL1 j , kL2 j } cell center kL1 j is closer to the line through cell centers L(j) and R(j) than, or as • close as, any other cell that obeys the two rules above cell center kL2 j is closer to the line through cell centers L(j) and R(j) than, or as close as, any other cell that is not kL1 j and obeys the first two rules above and results in a intersection point CLj that is sufficiently far from cell center L(j), as expressed by (xCLj − xζR(j) ) • (xζ L(j) − xζ R(j) ) > 1.2 T if RL1j < 0.1∆xj and the "advection type" of face between kL1 j and L(j) ∈ / {6, 8} then ∆x sL1 j = 1, sL2 j = 0, γL j = kx −xj k ζk L1 j DR AF ζ L(j) else if cell kL2 j found and the "advection type" of faces between kL1 j and L(j), and between kL2 j and L(j)∈ / {6, 8} then kxCLj −xζ k k ∆xj L2 j , sL2 j = 1 − sL1 j , γL j = kx sL1 j = kxζ − x k −xCLj k ζ ζ kL1 kL2 L(j) j j else sL1 j = 0, sL2 j = 0, γL j = 0 (no higher-order reconstruction) end if else similar as reconstruction from the left by replacing L with R, vice versa, and taking the reversed orientation into account end if then performed with Algorithm (10). Note that in Algorithm (10), Equation (6.63) and Equation (6.64), γL j accounts for the non-uniform spacing along the line through cell centers L(j) and R(j). It is computed along with the stencil and weights in Algorithm (9) and similarly for γR j . In D-Flow FM various limiters (Ψ in Algorithm (10)) are available. They are set with the keyword limtypmom, see Table 6.2. Remark 6.2.15. In the D-Flow FM limiters 1 to 4 are formulated using the property Ψ(r) = rΨ( 1r ) for symmetric limiters. Since the Koren limiter is not symmetric, its implementation is incorrect. Limiters 11, 12 and 13 are also incorrect implementations. Remark 6.2.16. Since the limiter functions are non-linear in general, and the velocity field is represented by face-normal components, the component-wise reconstruction is orientation dependent. Hence, the discretization is not invariant for a rotation of the coordinate frame. This may be circumvented by reconstructing face-normal and tangential components instead. The translation of the various variables introduced here to the D-Flow FM code is as follows: 50 of 152 Deltares Numerical approach Algorithm 10 sethigherorderadvectionvelocities: higher-order accurate reconstructions of face-based velocity vector uu from cell-centered velocity vectors uc interpolate velocity vectors on a line through cell centers L(j) and R(j), from the left and from the right: uCLj = sL1 j uckL1 j + sL2 j uckL2 j (6.61) uCRj = sR1 j uckR1 j + sR2 j uckR2 j (6.62) if qa j > 0 then compute slope ratio in limiter, for each velocity component rx = ry = uc R(j) x − uc L(j) x 1 uc L(j) x − uCLj x γL j uc R(j) y − uc L(j) y 1 (6.63) (6.64) uc L(j) y − uCLj y γL j uuj ∆t|uj | = uc L(j) +αj max(1− , 0) ∆xj T apply limiter Ψ to each velocity component and reconstruct the velocity vector at the face Ψ(rx ) 0 0 Ψ(ry ) (uc R(j) −uc L(j) ) (6.65) DR AF else reconstruction from the right similar as reconstruction from the left by replacing L with R, vice versa, αj by 1 − αj and taking the reversed orientation into account end if Table 6.2: Various limiters available in D-Flow FM for the reconstruction of face-based velocities in momentum advection limtypmom 0 1, 5, 15 2 3 4, 14 11 12 13 20 21 kL1 j : kL2 j : sL1 j : sL2 j : γL j : Deltares limiter first-order upwind minmod Ψ(r) 0 max(min(r, 1), 0) Van Leer r+|r| 1+|r| incorrect Koren monotonized central incorrect minmod r max(min(min(2/r, 1+2/r ), 2), 0) 3 max(min(min(2r, 1+r ), 2), 0) 2 1 max(min(r, 1), 0) r incorrect Van Leer 1 r+|r| r 1+|r| another incorrect Koren Beam-Warming Lax-Wendroff max(min(min(2/r, 1+2/r ), 2), 0) 3 r 1 klnup(1,j), klnup(2,j), slnup(1,j), slnup(2,j), slnup(3,j), kR1 j : kR2 j : sR1 j : sR2 j : γR j : klnup(4,j), klnup(5,j), slnup(4,j), slnup(5,j), slnup(6,j). 51 of 152 D-Flow Flexible Mesh, Technical Reference Manual Momentum diffusion The momentum diffusion term in Equation (6.6) is 1 ∇ • (νh(∇u + ∇uT )). h In D-Flow FM, this term is modified as 1 ∇ • (νhp (∇u + ∇uT )), hp where p= 1, istresstype = 3, 1, istresstype = 5, 0, otherwise. (6.66) T ( DR AF Remark 6.2.17. It is unclear why, for istresstype = 6 3 ∧ istresstype 6= 5, a modified, incorrect form of momentum diffusion, i.e. p 6= 1, is employed in D-Flow FM. Obviously, the momentum diffusion term needs to be discretized at the faces and projected in face normal direction. The approach undertaken is similar to the discretization of momentum advection. First a cell-centered conservative discretization of ∇ • (νh(∇u + ∇uT )) is formulated which is subsequently interpolated to the faces, projected in the face normal direction and divided by a water level h to bring it in non-conservative form. If we call the cell-centered discretization dk , or more precisely ∇ • νhp (∇u + ∇uT ) ≈ dk , Ωk (6.67) then the face-normal momentum diffusion at face j is interpolated from its neighboring cells L(j) and R(j) as ∇ • (νhp (∇u + ∇uT )) Γj • nj ≈ αj dL(j) + (1 − αj )dR(j) • nj , (6.68) where again αj is the non-dimensional distance from the left cell center to the face, see Figure 6.6. The cell-averaged diffusion in cell k can be written in the usual manner as ∇ • p T νh (∇u + ∇u ) Ωk 1 = A(Ω) Z νhp ( ∂u + ∇u • n) dΓ, ∂n (6.69) ∂Ωk where A(Ωk ) = bAk is the bed area of cell k . This expression is discretized as ∇ • νhp (∇u + ∇uT ) Ω ≈ dk = k 1 P t w s , p = 0, uj uj j,k bAk j∈J (k) 1 P tuj wuj min(hζ L(j) , hζ R(j) )sj,k , p = 1, bAk j∈J (k) 1 P tuj Auj sj,k , p = 1, bAk istresstype = 3, (6.70) istresstype = 5. j∈J (k) 52 of 152 Deltares Numerical approach Note that tj is the viscous stress at face j . By using n = (nx , ny )T , setting s = n⊥ = (−ny , nx )T and noting that ∂u nx 2 nx ny ∂u −nx ny −ny 2 ∂u n ∂n + , ∂u = nx ny ny 2 nx 2 nx ny ∂n ∂s n• ∂s ∇u•n = nx −ny ny nx • the viscous stresses tuj for istresstype 6= 6 are computed as (6.71) T tuj = νj 1 + nx 2j nxj ny j uc R(j) − uc L(j) + nxj ny j 1 + ny 2j ∆xj un l(j) − un r(j) −nxj ny j −ny 2j . nx 2j nxj ny j wuj For istresstype = 6 the viscous stresses are completely expressed in normal and tangential components and essentially the same expression as Equation (6.71) is obtained. DR AF Note that uck (here with k ∈ {L(j), R(j)}) and uni (here with i ∈ {l(j), r(j)}) are cellcentered and node-based velocity vectors, respectively. Their reconstruction from the facenormal velocity components and interpolation has been discussed in the foregoing sections, see Algorithms (6) and (7) respectively. The contribution of the horizontal momentum diffusion term to the discrete momentum equation Equation (6.23) is finally obtained by bringing it in non-conservative form and interpolation at the faces Ae j = − αj dL(j) (1 − αj )dR(j) + HL pj HR pj • nj , (6.72) as performed by Algorithm (11). It shows that the choice for HLj and HRj depends on istresstype. Algorithm 11 setumod|momentum diffusion: compute momentum diffusion terms of the form nj • − h1p νhp (∇u + ∇uT ) compute viscous stresses 1 + nx 2l nxl ny l nxl ny l 1 + ny 2l tl = νl j ≈ Ae j ucR(l) − ucL(l) + ∆xl Ae j = − αj bA L(j) HLj X νl Al tl • nj sl,L(j) + l∈J (L(j)) −nxl ny l −ny 2l nx 2l nxl ny l 1 − αj bA R(j) HRj X un l(l) − un r(l) wul νl Al tl • nj sl,R(j) l∈J (R(j)) with Al , HLj , HRj defined by: istresstype 2, 4, 6 3 5 Al wul wul min(hζ L(l) , hζ R(l) ) Aul HLj 1 1 (h ζ L(j) + hζ R(j) ) 2 hζ L(j) HRj 1 1 (h ζ L(j) + hζ R(j) ) 2 hζ R(j) Remark 6.2.18. Momentum diffusion is discretized in a similar fashion as momentum advection, namely based on a cell-centered expression of the conservative formulation, interpolation to the faces and bringing it into a non-conservative form, i.e. dividing it by the water depth. Deltares 53 of 152 D-Flow Flexible Mesh, Technical Reference Manual Consequently, the discretizations of the terms 1 HLj and 1 , HRj due to the non-conservative for- mulation, are expected to equal their counterparts in momentum advection. However, they do not, as can be seen by comparing Algorithm (11) with Algorithm (4). Remark 6.2.19. In the discretization of the diffusive fluxes, the area of face j is approximated by wuj min(hζ L(j) , hζ R(j) ) for istresstype ’3’. It is unclear why the actual cross-sectional area Auj does not suffice. For the other istresstypes, see Remark 6.2.17. Turbulence modelling: Smagorinsky, Elder For istresstype 2 and 3, the viscosity coefficient νj can be computed with Elder’s formula or a Smagorinsky model. Note that the background viscosity is added, not mentioned here further for simplicity. In the first case, it is T √ q g κ νj = E huj u2j + vj2 , 6 C (6.73) where E is the user-specified Elder coefficient and C is the (time- and space varying) Chézy coefficient. And in case of the Smagorinsky model s ∂un 2 2 + ∂n ∂un ∂ut + ∂t ∂n 2 ∂ut 2 +2 , ∂t DR AF p 2 νj = CS ∆xj wuj (6.74) j where CS is a user-specified Smagorinsky coefficient and the velocity derivatives at face j are approximated with finite differences similarly to Equation (6.71). Limitation of viscosity coefficient The explicit time integration of momentum diffusion is subject to a time-step limitation for numerical stability. We however maintain our time step and limit the eddy viscosity coefficient instead. We assume that it is sufficient to consider the model equation ∂u = ∇ • (ν∇u) ∂t Z ⇒ Ω ∂u dv = ∂t I ν∇u dS (6.75) S We also assume that it is sufficient to only consider a cell-based discretization, for cell k it would be unR(j) − unL(j) 1 X uc n+1 − uc nk k = n sj,k . νj Au nj ∆t Vk ∆xj (6.76) j∈J (k) Remark 6.2.20. If we disregard the differences due the interpolation to the faces, and the missing terms ∇ • (hν∇uT ), the discretization of the model equation only conforms to the form of the momentum diffusion term if istresstype=5, and if Vk = bAk hζ k (no non-linear iterations, see Algorithm (20)), as can be seen by comparing with Algorithm (11). Equation (6.76) can be rewritten as uc n+1 k n X X νj Au nj νj Au j ∆t uc nk + ∆t = 1 − n un , Vk ∆xj Vkn ∆xj O(k,j) j∈J (k) (6.77) j∈J (k) where O(k, j) = is the cell that shares face j with cell k , i.e. O(k, j) = L(j) + R(j) − k. 54 of 152 (6.78) Deltares Numerical approach We require that n ∆t X νj Au j 0≤ n ≤ 1, Vk ∆xj (6.79) j∈J (k) which is satisfied if we limit the viscosity coefficient by νj ≤ 1 ∆xj min(VLn(j) , VRn(j) ), N Au nj ∆t (6.80) where N is the maximum number of faces in a cell. It is set to N = 5, although cells with more than five faces may occasionally be encountered. T Boundary stresses: irov The viscous stress in Equation (6.70) at the closed boundaries need special attention, where three conditions that may be applied: DR AF irov=0: full slip, irov=1: partial slip, irov=2: no slip. The boundary conditions are further explained in Section 6.4.7. Bed friction The bottom friction can be expressed on the flow links as follows, 1τ hρ • j nj ≈ − gkuj k C 2 ĥj uj , (6.81) where ĥj = Aj /Pj and Aj = hj dyj , as shown in Figure 6.9 The Chézy formula for determining the velocity is: q uj = C ĥj i q 2/3 Aj ĥj √ qj = Aj C ĥj i = i n P 2/3 X √ Aj ĥj √ Q= qj = i=K i n j P 2/3 1 Aj ĥj √ Q K√ n P U= = i= i A A Aj !2 P 2 g A Aj =g Cf u = =g P 2/3 1 K C 2 ĥj Aj ĥj n (6.82) (6.83) (6.84) (6.85) (6.86) where ĥj and K vary for different conveyance schemes. The differences in the various schemes are in the way of defining the hydraulic radius ĥj and K in Equation (6.86). In D-Flow FM we have as a default setting of Ibedlevtype=3. This is applied for estimation of the bedlevel at flow links. It assumes variation in cross flow direction of the local waterdepth, Deltares 55 of 152 D-Flow Flexible Mesh, Technical Reference Manual flow velocity and friction coefficient. This is called the analytic 2D conveyance method (type 3). This method shows good grid convergence. A more simple variant is 1D conveyance (type 2). Another method is only by taking the variation of the waterdepth into account across flow links, which leads to a hydraulic radius equal to the cross-sectional area divided by the wet perimeter (type 1). These methods are described in Algorithm (12). For derivation of formulations in Algorithm (12) we refer the reader to Appendix A. When assuming a constant bedlevel at a flow link, one can either average between bedlevels at waterlevel points (type 0), or between the levels of two cornerpoints (type -1). The former one leads to lower bed friction in general, because the bedlevel at a waterlevelpoint is taken as the lowest connect link level. Formulations for conveyance types -1 and 0 are shown in Algorithm (13). ĥj = Aj /Pj T Algorithm 12 getprof2D: compute conveyance types 1, 2 and 3. DR AF 1/4 γi = nαi 1 + αi2 1/4 0 γi0 = nαi 1 + αi2 + αi2 3 8/3 8/3 K2 = hi − hi+1 /γi 8 3 δ 11/3 δ 11/3 − hi+1 K2 + h K3 = βi − hi αi 11 αi γi0 i conveyance type = 1, g/C 2 ĥj , 2 Cf u = g (Aj /K2 ) , conveyance type = 2, g (Aj /K3 )2 , conveyance type = 3, (6.87) (6.88) (6.89) (6.90) (6.91) (6.92) Algorithm 13 setcfuhi: compute conveyance types 0 and -1. Cf u = g C 2 ĥj where max (εh , huj ), conveyance type = −1, ĥj = max (εh , huvj ), conveyance type = 0, (6.93) (6.94) Coriolis forces [yet empty] 6.3 Temporal discretization The spatial discretization is, as explained in section 6.2, performed in a staggered manner, i.e. velocity normal components uj are defined at the cell faces j , with face normal vector nj , and the water levels ζk at cell centers k . If advection and diffusion are spatially discretized as in Equation (6.22) 1 1 T (∇ • (huu) − u∇ • (hu)) − ∇ • (νh(∇u + ∇u )) • nj ≈ Ai j uj + Ae j , h h j 56 of 152 Deltares Numerical approach then the temporal discretization of Equation (6.6) is 1 gkûj k + Ai nj + ∆t C 2h un+1 = j 1 n gθj n+1 uj − ζR(j) − ζLn+1 (j) ∆t ∆xj g(1 − θj ) n − Ae nj − ζR(j) − ζLn(j) , ∆xj (6.95) where superscript n denotes the time level, ûj is obtained by substituting ûj = (ûj , un j • n+1 T n⊥ j ) , uj = ûj , θj = 0 in Equation (6.95) and solving for ûj , and ∆xj = kxR(j) −xL(j) k measures the distance between the two water level points of cells L(j) and R(j) of face j . Note that we have assumed that the face normal nj is in the direction from cell L(j) to R(j). n+1 n un+1 = −fu nj (ζRn+1 j (j) − ζL(j) ) + ru j , n T The velocity update of Equation (6.95) is summarized as (6.96) where fu j and ru n j are determined iteratively by Algorithm (14). n n DR AF n+1 n+1 n Algorithm 14 furu: compute fu j and ru n = −fu j (ζRn+1 j in uj (j) − ζL(j) ) + ru j (0) ûj = uj n p=0 (p−1) (p) | > ε ∨ i = 0 do while p < MAXITER ∧ |ûj − ûj p=p+1 q g (p−1) 2 fr j = 2 (ûj ) + (vj n )2 C h 1 Bu = + Ai j + fr j ∆t 1 gθj fu nj = Bu ∆xj 1 1 n g(1 − θj ) n n n ru j = u − Ae j − ζR(j) − ζL(j) Bu ∆t j ∆xj (p) ûj = −fu nj (ζRn(j) − ζLn(j) ) + ru nj end while Here MAXITER = 4, ε = 10−2 is a tolerance and vj is the tangential velocity component at face j whose computation is discussed on a different occasion. The continuity equation is discretized as X Vkn+1 − Vkn =− Auj n θj uj n+1 + (1 − θj )uj n sj,k , ∆t (6.97) j∈J (k) where J (k) is the set of faces that bound cell k and sj,k accounts for the orientation of face j with respect to cell k , i.e. sj,k = Deltares 1, −1, L(j) = k R(j) = k (nj is outward normal of cell k ), (nj is inward normal of cell k ). (6.98) 57 of 152 D-Flow Flexible Mesh, Technical Reference Manual Furthermore, Vkn+1 is the volume of the water column at cell k and Auj approximates the flow area of face j , i.e. Auj = huj wj , (6.99) with huj the water level at face j (details not discussed here) and wj the width of face j . Substitution of Equation (6.96) in Equation (6.97) yields the following system for the water column volume at the next time instant: j∈J (k) T X X Vkn+1 − Vkn n+1 = Au nj θj fu nj ζO(k,j) + Au nj θj fu nj ζkn+1 − ∆t j∈J (k) j∈J (k) X − Au nj (1 − θj )unj + θj ru nj sj,k , (6.100) where O(k, j) = is the cell that shares face j with cell k , i.e. DR AF O(k, j) = L(j) + R(j) − k. (6.101) Remark 6.3.1. The flow area of face j , Auj , always appears explicitly in the continuity equation, Equation (6.97). The water level equation, Equation (6.100), is summarized as X Vkn+1 − Vkn n+1 + Bkn ζkn+1 + Cjn ζO(k,j) = dnk , ∆t (6.102) j∈J (k) where the coefficients Bkn (diagonal entries), Cjn (off-diagonal entries) and dn k (right-hand side) are computed by Algorithm (15). Algorithm 15 s1ini: compute the matrix entries and right-hand side in the water level equation Vkn+1 −Vkn ∆t + Bkn ζkn+1 + P n+1 = dnk , Equation (6.102) Cjn ζO(k,j) j∈J (k) Cjn = − Au nj θj fu nj X Bkn = − Cjn j∈J (k) X dnk = − Au nj (1 − θj )unj + θj ru nj sj,k j∈J (k) The continuity equation is only applied at water level cells that are or may become (partially) wet at the next time level. These cells are marked with kf s (k) = 1 and is based on the water level of the surrounding faces, see Algorithm (16). Algorithm 16 setkfs: mark the water level cells that are or may become (partially) wet with kf s (k) = 1 kf s (k) = 58 of 152 0, 1, huj = 0 ∀j ∈ J (k), otherwise. Deltares Numerical approach Algorithm 17 pack_matrix: determine the set K of water level cells for which the continuity equation is solved mark wet/dry cells, Algorithm (16) K = {k : kf s (k) = 1} The resulting set of water level cells is called K, see Algorithm (17). The continuity equation is only applied at cells k for k ∈ K. In order to solve Equation (6.102), we need to express the Vkn+1 volume of the water column at cell k at time level n + 1 in terms of the water level ζ n+1 . Since this relation is non-linear in general, Equation (6.102) is solved iteratively by means of Newton iterations. We firstly linearize the expression for the volume of the water column and obtain for some iteration p. = n+1(p) Vk + n+1(p) Ak n+1(p+1) n+1(p) ζk − ζk , T n+1(p+1) Vk n+1(p) (6.103) DR AF where Ak is the wet bed area of cell k at (iterative) time level n + 1(p). Substitution in Equation (6.102) yields 1 n+1(p) Ak + Bkn ∆t n+1(p+1) ζk + X n+1(p+1) Cjn ζO(k,j) = j∈J (k) dnk − 1 n+1(p) n+1(p) n+1(p) Vk − Vkn − Ak ζk , ∆t (6.104) which is summarized as n+1(p) Br k n+1(p+1) ζk + X n+1(p+1) Cr nj ζO(k,j) n+1(p) = dr k , (6.105) j∈J (k) n n where the coefficients Br n k (diagonal entries), Cr j (off-diagonal entries) and dr k (right-hand side) are computed by Algorithm (18). Algorithm 18 s1nod: compute the matrix entries and right-hand side in the water level equan+1(p) tion Br k n+1(p+1) ζk + P n+1(p+1) Cr nj ζO(k,j) n+1(p) = dr k , Equation (6.105) j∈J (k) n+1(p) Br k =Bkn + 1 n+1(p) A ∆t k Cr nj =Cjn n+1(p) dr k =dnk − 1 n+1(p) n+1(p) n+1(p) Vk − Vkn − Ak ζk . ∆t Note that we did not describe the water level boundary conditions in Algorithm (18). The unknown water levels k ∈ K in Equation (6.105) are solved with a Krylov solver as will be explained in section 6.3.1. n+1(p+1) During the iterative process, the water level ζk may have dropped below the bed level blk resulting in a negative water level. In these cases the time step is repeated with either a reduced time step with factor f = 0.7 (type 1), or the water level cell k is eliminated from Deltares 59 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 19 poshcheck: check positivity of water level n+1(p+1) if ζk < blk then if type 1 then ∆t = f ∆t, repeat time-step else if type 2 (default) then hu nj = 0, j ∈ J (k). repeat time-step end if end if T the system by setting the water levels of its bounding faces to zero (type 2, default), see Algorithm (19). n+1(p+1) Having computed a new iterate of the water level, the water column volume Vk n+1(p+1) Ak and DR AF wet bed area of cell k are computed with Algorithm (20). Note that if no non-linear iterations are performed, the wet bed area is set equal to the cell bed area bAk . n+1(p+1) Algorithm 20 volsur: compute water-column volume Vk n+1(p+1) and wet bed area Ak if no non-linear iterations then n+1(p+1) n+1(p+1) Vk =bAk max(ζk n+1(p+1) Ak =bAk − blk , 0) else compute actual wet bed area and water column volume of cell k based on a constant water level in a cell and linearly varying bed levels at the faces not elaborated further end if The time-step is finalized by employing Equation (6.96), see Algorithm (21). Two discharges are computed at the next time level, namely n qjn+1 =Au nj θj un+1 + (1 − θ )u , j j j qa n+1 j =Au nj un+1 . j (6.106) (6.107) Discharge qjn+1 satisfies the continuity equation Equation (6.97) X Vkn+1 − Vkn =− qjn+1 sj,k , ∆t (6.108) j∈J (k) and appears for example in the discretization of advection in Equation (6.6). The use of qa n+1 j is not discussed here, but it is important to note that it does not satisfy the continuity equation. 60 of 152 Deltares Numerical approach Algorithm 21 u1q1: update velocity un+1 and discharges qjn+1 and qa n+1 j j n if hu j > 0 then n+1 n un+1 = − fu nj (ζRn+1 j (j) − ζL(j) ) + ru j n qjn+1 =Au nj θj un+1 + (1 − θ )u j j j qa n+1 j (6.109) (6.110) =Au nj un+1 (6.111) else un+1 =0 j qjn+1 qa n+1 j (6.112) =0 (6.113) =0 (6.114) The time-step is summed up in Algorithm (22). DR AF Algorithm 22 step_reduce: perform a time step T end if while first iteration or repeat time-step (type 1) do tn+1 = tn + ∆t n compute fu j and ru n j with Algorithm (14) while first iteration or repeat time-step (type 2) do compute the matrix entries Bkn , Cjn and right-hand side dn k in the water level equation with Algorithm (15) determine the set of water levels that need to be solved, Algorithm (17) p=0 n+1(0) n ζk = ζk while max k n+1(p) ζk − n+1(p−1) ζk > ε ∧ not repeat time-step p=p+1 ∨ p = 0 do n n compute the matrix entries Br n k , Cr j and right-hand side dr k in the water level equation with Algorithm (18) n+1(p+1) solve the unknown water levels and obtain ζk , Algorithm (23) check positivity of water level with Algorithm (19) and repeat time-step if necessary n with modified ∆t (type 1) or hu j (type 2, default) if not repeat time-step then n+1(p+1) compute water-column volume Vk gorithm (20) end if end while end while end while n+1(p+1) and wet bed area Ak with Al- n+1(p+1) ζkn+1 = ζk compute velocities un+1 and discharges qjn+1 and qa n+1 are defined at the next time level, j j Algorithm (21) Deltares 61 of 152 D-Flow Flexible Mesh, Technical Reference Manual 6.3.1 Solving the water level equation The unknown water levels k ∈ K in Equation (6.105) are solved with a Krylov solver, Algorithm (23). Algorithm 23 solve_matrix: solve the unknown water levels in Equation (6.105) perform Gauss elimination to reduce the number of unknowns in the system solve system with Algorithm (24) n+1(p+1) perform the Gauss substitution and obtain ζk set n+1(p+1) ζk = n+1(p) ζk , , k∈K k∈ /K T However, prior to solving the system, a Minimum Degree algorithm is applied to reduce the system size. The somewhat misleading terms Gauss elimination and substitution in Algorithm (23) are due to the minimum degree algorithm. The permutation order is only computed during the initialization of the computations. It will not be discussed further. DR AF The (reduced) water level equation to be solved has the form of As = d, (6.115) where according to Equation (6.105) Br1 ζ1 + P Crj ζO(1,j) j∈J (1) Br2 ζ2 + P Crj ζO(2,j) As = j∈J (2) (6.116) .. . and d = (dr1 , dr2 , . . . )T . Note that we have omitted the superscripts for the sake of brevity. Note also that for simplicity, we assumed all unknowns ζ1 , ζ2 , . . . appear in the solution vector, although due to the minimum degree algorithm and possible dry cells, they do not. The system is solved by a preconditioned Conjugate Gradient method as shown in Algorithm (24). The preconditioner P can either be diagonal scaling, or an incomplete Cholesky decomposition. Remark 6.3.2. The iterations in Algorithm (24) could be stopped after the computation of the absolute error. However, we want the possibility to base our stopping criterion on the (p) preconditioned residual kz r k∞ . For now, we will base our stopping criterion only on the residual r (p) . 6.4 Boundary Conditions We can identify three types of boundary conditions in D-Flow FM. These are: 1 Boundary conditions that complement the governing equations, Equation (6.5) and Equation (6.6). 2 Supplementary boundary conditions that impose additional constraints at the boundaries. 3 Boundary conditions for constituents, such as salinity. We will not discuss the last category. The following boundary conditions in the first category may be imposed: 0 default: full-slip, 62 of 152 Deltares Numerical approach dyj hj Pj DR AF T Figure 6.9: Cross sectional bed bathemetry perpendicular to the flow direction. Algorithm 24 conjugategradient: solve water level equation with a preconditioned Conjugate Gradient method compute preconditioner P compute initial residual r (0) = d − As(0) compute maximum error ε = kr (0) k∞ (0) apply preconditioner P z r = r (0) (0) set p(0) = z r compute inner product D r (0) (0) , zr E i=0 while ε > tol do compute Ap(p) compute p(p) , Ap(p) D E r (p) ,z (p) r α = p(p) ,Ap(p) h i s(p+1) = s(p) + α(p) p(p) r (p+1) = r (p) − α(p) Ap(p) compute maximum error ε = kr (p+1) k∞ (p+1) apply preconditioner P z r = r (p+1) if ε > tol then D E (p+1) (p+1) compute r , zr (p) D β (p+1) r (p+1) ,z (p+1) r = D (p) (p) E r ,z r (p+1) p(p+1) = z r p=p+1 E + β (p+1) p(p) end if end while Deltares 63 of 152 D-Flow Flexible Mesh, Technical Reference Manual 1 2 3 4 5 6 7 "waterlevel", "Neumann", "velocity", "discharge", "Riemann", "outflow" "Qh", where, except for the default full-slip condition, we have adopted the terminology and numbering of D-Flow FM. Additionally, the following boundary conditions in the second category may be imposed: T 8 "tangentialvelocity", 9 "ucxucyadvectionvelocity", 10 "normalvelocity", DR AF were again we have used D-Flow FM terminology, but extended the numbering for our convenience. We will use the numbering for the identification of the (parts of) the boundary, at which these conditions are implied. i.e. Γ1 is the part of the boundary with water level boundary conditions, et cetera. Since the boundary conditions 8 to 10 are supplemental, they may be combined with conditions 1 to 9. Disregarding the effects of atmospheric pressure and time relaxation (discussed later), the boundary conditions may be summarized as: u • n = 0, ζ = ζb , ∂ζ = sb , ∂n u • n = ub , x ∈ Γ0 , x ∈ Γ1 , default, (6.117) "waterlevel", (6.118) x ∈ Γ2 , "Neumann", (6.119) x ∈ Γ3 , "velocity", (6.120) hu • n dΓ = Qb , x ∈ Γ4 , "discharge", (6.121) x ∈ Γ5 , "Riemann", (6.122) x ∈ Γ6 , "outflow", (6.123) x ∈ Γ6 , "outflow", (6.124) x ∈ Γ7 , "Qh", (6.125) Z Γ4 s ζ+ ∂ζ p − gh ∂t h u • n = 2ζb − ζ 0 , g ∂ζ = 0, u • n > 0, ∂n ∂ζ + sb ∂n = 0, u • n ≤ 0, Z ζ = hb hu • n dΓ , Γ7 and u • t = vb , x ∈ Γ8 , "tangentialvelocity", u = ub , x ∈ Γ9 , "ucxucyadvectionvelocity", • u n = ub , x ∈ Γ10 , "normalvelocity", 64 of 152 (6.126) (6.127) (6.128) Deltares Numerical approach xL(j) bj dj T xR(j) DR AF Figure 6.10: Virtual boundary "cells" near the shaded boundary; xLj is the virtual "cell" center near boundary face j ; xR(j) is the inner-cell center; bj is the point on face j that is nearest to the inner-cell center where ζb , sb , ub , vb , ub , Qb and hb are user prescribed at the boundary where appropriate, n is the inward-positive normal vector, t is a unit tangential vector and ζ 0 is the initial water level. Remark 6.4.1. The condition u • n > 0 in Equation (6.123) is satisfied at inflow only. Remark 6.4.2. At the "Qh" boundary ζ is a function hb of Q and Q − ζ condition is imposed. 6.4.1 Virtual boundary "cells": izbndpos We firstly introduce some notation. B0 is the set of faces that are at the full-slip boundary, B1 is the set of faces at the "waterlevel" boundary Γ1 and so on. There is no administration in D-Flow FM for B0 . The default boundary conditions are satisfied by effectively setting the face-normal velocity component to zero, i.e. uj = 0, j ∈ B0 . (6.129) The non-default boundary conditions are imposed by using virtual boundary cells, see Figure 6.10. Note that the term "cell" is ambiguous as it is only defined by means of its circumcenter. For boundary conditions of the first category (1 to 7), we discriminate between boundaries where, roughly speaking, the water level is imposed (1, 2, 5 and 7) and where velocities are imposed (6 and 7), i.e. Γζ = Γ1 ∪ Γ2 ∪ Γ5 ∪ Γ6 ∪ Γ7 , Γu = Γ3 ∪ Γ4 , Γ = Γζ ∪ Γu (6.130) (6.131) (6.132) and similarly for the sets Bζ , Bu and B . The second category of boundaries are supplemental and are a subset of the first. Hence, for the definition of the virtual boundary "cell" centers we only need to consider water level and velocity boundaries, Γζ and Γu respectively. Let dj measure the shortest distance from the cell circumcenter to the boundary face, see Figure 6.10, and let bj be the corresponding nearest point on the boundary face. Then the virtual Deltares 65 of 152 D-Flow Flexible Mesh, Technical Reference Manual "cell" centers are computed with Algorithm (25). Note that xn are mesh node coordinates and remember that the face normal nj is inward positive. Algorithm 25 addexternalboundarypoints: compute centers of virtual boundary "cells" xL(j) p bj − max(dj , 12 bA R(j) )nj , j ∈ Bζ ∧ izbndpos = 0 1 (xn l(j) + xn r(j)p ), j ∈ Bζ ∧ izbndpos = 1, = 2 bj − max(dj , 12 bA R(j) )nj , j ∈ Bu . (6.133) Remark 6.4.3. Option izbndpos = 2 is not documented here. T Algorithm (25) showsp that the virtual cell centers are on the boundary for izbndpos=1 and 1 at a distance dj (or 2 bA R(j) ) from the boundary otherwise. Besides a center, the virtual boundary "cells" also have a bed area bA and bed level bl defined as 6.4.2 j ∈ B. DR AF bA L(j) = bA L(j) , blL(j) = blR(j) . (6.134) Discretization of the boundary conditions The boundary conditions are accounted for by modification of the discretization near the boundaries. Assume that we are at time-level n and advance to time-level n + 1, then the discretization of Eqns. ((6.117)) to ((6.125)) is: un+1 = 0, j j ∈ B0 , default, (6.135) ), j ∈ B1 , "waterlevel", (6.136) = sb (bj , t̂n+1 ), ∆xj un+1 = ub (bj , t̂n+1 ), j j ∈ B2 , "Neumann", (6.137) j ∈ B3 , "velocity", (6.138) j ∈ B4 "discharge", (6.139) ζRn+1 (j) − ζLn+1 (j) n+1 ζL(j) = ζb (bj , t̂ n+1 Qb (t̂n+1 )(hu nj )2/3 P un+1 = , j Au nl (hu nl )2/3 l∈B4 ζLn+1 (j) = 2ζb (bj , t̂n+1 ) − ζR0(j) + . . . s 1 (hζ nL(j) + hζ nR(j) ) n 2 uj , j ... − g n n ζLn+1 j (j) = ζR(j) , uj > 0 r n ζLn+1 1 (j) − ζL(j) = g (hζ nL(j) + hζ nR(j) ) . . . n ∆t 2 ζRn(j) − ζLn(j) ...( + sb (bj , t̂n+1 )), uj ≤ 0, j ∆xj X j ζLn+1 = h ( qln ), b (j) ∈ B5 , "Riemann", (6.140) ∈ B6 , "outflow", (6.141) ∈ B6 , "outflow", (6.142) ∈ B7 , "Qh", (6.143) l∈B7 where hζk is the cell-centered water depth, i.e. hζk = ζk − blk , 66 of 152 (6.144) Deltares Numerical approach ζb (x, t) is a user-prescribed time-varying water level at boundary Γ1 , similar for normal slope sb (x, t) and normal velocity ub (bj , t̂n+1 ), and Qb (t) is a user-prescribed time-varying discharge at boundary Γ4 . Furthermore, t̂n+1 is an estimate of the next time level tn+1 . Note that at "Qh" boundaries the discharge qjn is used, which is according to Algorithm (21) qjn = Au n−1 θj unj + (1 − θj )ujn−1 . j (6.145) The function hb (Q) is user-provided by means of a table. It will not be discussed further. n We do neither mention the threshold on hu j for the discharge boundaries under outflow conn n ditions Qb (t) < 0, nor a threshold on 21 (hζ L(j) + hζ R(j) ) at the Neumann boundaries. T The second category boundary conditions only affect the reconstruction of the cell-centered full velocity vectors uc near the boundary: uc nL(j) = unj nj + vb (bj , t̂n+1 )tj , j ∈ B8 , "tangentialvelocity", (6.146) uc nL(j) uc nL(j) (6.147) n+1 = ub (bj , t̂ j ∈ B9 , "ucxucyadvectionvelocity", ), DR AF n+1 = ub (bj , t̂ j ∈ B10 ,"normalvelocity", )nj , (6.148) where vb (x, t), ub (x, t) and ub (x, t) are user-prescribed and time-varying at the boundary. Remark 6.4.4. During the time-step from tn to tn+1 , the cell center reconstructed is based on un j (fully explicit). The boundary conditions are at the new time-level, on the other hand. This seems inconsistent. Note that the "ucxucyadvectionvelocity" and "normalvelocity" conditions allow a supercritical inflow at the boundary. All three boundary conditions types are only relevant for inflow conditions. Discharge boundaries: jbasqbnddownwindhs, qbndhutrs For simplicity we only consider one discharge boundary and mention that there may be more than one. The face-based water depth in the evaluation of the flow area can optionally be set to a downwind approximation (for an inflowing discharge boundary) with the option jbasqbnddownwindhs, i.e. huj = ζR(j) − blR(j) , j ∈ B4 ∧ jbasqbnddownwindhs = 1, "discharge". (6.149) Compare with Algorithm (2) where the face-based water depths huj are computed. They are overwritten in Algorithm (26) at the discharge boundary. Remark 6.4.5. Since for some cases the water depth at the discharge boundaries are modified after the volumes Vk and cross-sectional wetted areas Auj are computed, the water depth now seems inconsistent with the aforementioned quantities. Riemann boundaries At a Riemann boundary we do not allow any outgoing perturbation with respect to some reference boundary state to reflect back from the boundary. This is achieved by prescribing the incoming Riemann invariant. Note that we disregard directional effects. Using the DFlow FM convention of a positive inward normal at the boundary, this can be put as u•n+2 Deltares p p gh = ub + 2 ghb (6.150) 67 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 26 setau | discharge boundaries: adjustment to Algorithm (3) to overwrite water depths at the discharge boundaries if jbasqbnddownwindhs=0 then B ∗ = {l ∈ B4 |hP ul > 0} ∗ ζR(l) wul huj = max(0, l∈BP l∈B∗ wul ) − min(bl1j , bl2j ), j ∈ B∗ end if if jbasqbnddownwindhs=1 then huj = ζR(j) − blR(j) , j ∈ B4 compute Auj , j ∈ B5 as in Algorithm (3) end if Q (h )2/3 P b uj2/3 , (hul ) Aul zuj = T B̂ = {l ∈ B4 |hul ≥ qbndhutrs ∨ Qb ≥ 0} huj = 0, j ∈ B4 \ B̂ Auj = 0, j ∈ B4 \ B̂ j ∈ B4 DR AF l∈B̂ where we take boundary √ values (ζb , ub ) as the reference boundary state. By using hb = ghb can be linearized in ζ around ζ = ζb as h + ζb − ζ , the term p p p 1 ghb = g(h + ζb − ζ) ≈ gh + 2 r g (ζb − ζ). h (6.151) Substitution yields r g ζ + u • n = ub + h r g ζb . h (6.152) Instead of prescribing a combination of velocity and water level, we prefer to prescribe the water level at the boundary, i.e. ζb . For the necessary, but unknown velocity ub we use linear theory with respect to the initial state (ζ, u) = (ζ 0 , u0 ) = (ζ 0 , 0). Remark 6.4.6. We assume that the initial velocity field is zero in any case. Note: Assumed is that there is no residual flow in the model. By assuming small perturbations with respect to the initial conditions and considering conservation of mass at the boundary, we have: ub h = p gh(ζb − ζ 0 ), (6.153) or r ub = g (ζb − ζ 0 ). h (6.154) Substitution of this expression in Equation (6.152) yields r g ζ +u•n= h r g (2ζb − ζ 0 ). h (6.155) Note that a similar approach is taken in ? 68 of 152 Deltares Numerical approach The discretization in D-Flow FM is then as shown in Equation (6.140): s ζLn+1 (j) n+1 = 2ζb (bj , t̂ 0 ) − ζR(j) − 1 (hζ nL(j) 2 + hζ nR(j) ) g unj , j ∈ B5 , "Riemann". Qh boundaries: qhrelax Again, for simplicity we will only consider one Qh boundary. The applied water level ζbj is relaxed with a user-specified parameter αQh (qhrelax) that turns Equation (6.143) into ζjn+1 = αQh hb ( X qln ) + (1 − αQh ) ζjn , j ∈ B7 l∈B7 P qln ) we in fact always refer to this relaxed expression and will not mention the l∈B7 relaxation explicitly. Imposing the discrete boundary conditions: jacstbnd DR AF 6.4.3 T By hb ( During a time-step from tn to tn+1 , the discrete boundary conditions, i.e. Equation (6.136) to Equation (6.143) and Equation (6.146) to Equation (6.148), are imposed in the following manner: the reconstruction of the full velocity vectors uc nj is modified with Algorithm (27) to account for the boundary conditions at the new time level t̂n+1 , the water level boundary conditions at the new time level t̂n+1 are applied to the water level at the old time level tn with Algorithm (28), the velocity boundary conditions are imposed on un+1 , j ∈ Bu in Algorithm (30), j the system of equations, referred to as the "water level equations", to obtain ζ n+1 is adjusted in Algorithm (29) near the boundaries, having computed the water levels ζ n+1 from the "water level equation" with Algorithm (23), n+1 the water levels in the virtual boundary "cells" ζLj , j ∈ Bζ are computed with Algorithm (28), the velocities at the new time level un+1 are computed with Algorithm (21) which requires j no modifications since fu and ru were properly adjusted in Algorithm (30). Remark 6.4.7. The boundary conditions at the new time level t̂n+1 are applied to the celln center reconstruction of the full velocity vectors un c at the old time level t . Remark 6.4.8. It is unclear why boundary conditions need to be applied again to the water level at the old time level tn at the beginning of the time step. They where applied at the end of the previous time step. Furthermore, conditions from the new time level t̂n+1 are now applied to the water level at the previous time level tn . Remark 6.4.9. It is unclear why boundary conditions need to be applied to the water level at the new time level t̂n+1 right after solving the "water level equation" with Algorithm (28), since the virtual boundary "cells" are included in the solution vector s = (ζ1 , ζ2 , . . . )T and the discrete system of Equation (6.105) is augmented with the discrete boundary conditions of Equation (6.118) to Equation (6.125) in Algorithm (29). Remark 6.4.10. The discretization of the "outflowboundary" condition, Γ6 , in Algorithm (28) is different from the one in Algorithm (29) and seems incomplete. The condition for uj ≤ 0 is missing. Remark 6.4.11. The "Qh" boundary condition is ineffective in Algorithm (28), since it is missing from Equation (6.156) and Equation (6.157). Deltares 69 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 27 setucxucyucxuucyu | boundary conditions: adjustment to Algorithm (6) to satisfy the boundary conditions uc nL(j) n uc R(j) , n (uc R(j) • nj )nj , = unj nj + vb (bj , t̂n+1 )tj , u (b , t̂n+1 ) b j n+1 ub (bj , t̂ )nj , j j j j j ∈ B2 ∨ (j ∈ B ∧ jacstbnd = 1) ∈ B \ B2 ∧ jacstbnd = 0 ∈ B8 ∈ B9 ∈ B10 Algorithm 28 sets01zbnd: apply boundary conditions to water levels ζ n or ζ n+1 max( 1 (hζ n +hζ n L(j) R(j) 2 2ζb (bj , t̂n+1 ) − g P n ql ), (1 − αsmo )ζL0(j) + αsmo hb ( ),εhs ) n uj , l∈B7 −pav patm j ∈ B1 j ∈ B2 j ∈ B5 T zb = (1 − αsmo ) ζj0 + αsmo ζb (bj , t̂n+1 ), n+1 ζj , r j ∈ B7 DR AF L(j) zb = max(zb − ρmean , blL(j) + δ), j ∈ Bζ \ B6 g −3 δ = 10 if apply to ζ n then zb , j ∈ B1 ∪ B2 ∪ B5 n ζL(j) = max(ζ n n , bl ), u > 0, j ∈ B6 R(j) j R(j) n+1 else {apply to ζ } zb , j ∈ B1 ∪ B2 ∪ B5 n+1 ζL(j) = max(ζ n , bl ), un > 0, j ∈ B R(j) end if R(j) j 6 (6.156) (6.157) The water level boundary conditions are inserted into the system of equations as follows. Firstly, Equation (6.136) to Equation (6.143) show that for some zb the boundary conditions can be put as ζLn+1 (j) = zb , ζRn+1 (j) − ζLn+1 (j) ∆xj j ∈ Bζ \ B2 , = sb (b, t̂n+1 ), j ∈ B2 . (6.158) (6.159) The rows in the system that are affected by these boundary conditions are the rows that correspond to the virtual boundary "cell" L(j) and the neighboring internal cell R(j). The latter may come as a surprise, but is due to our constraint that the system should remain symmetric. The general form of the system for these rows is obtained by substituting k = L(j) and k = R(j), j ∈ Bζ in Equation (6.105) respectively, and using O(L(j), j) = R(j) and O(R(j), j) = L(j), i.e. n+1(p) n+1(p+1) Br L(j) ζL(j) n+1(p) n+1(p+1) Br R(j) ζR(j) + P n+1(p+1) Cr nl ζO(R(j),l) l∈J (R(l))\j n+1(p+1) n+1(p) +Cr nj ζR(j) = dr L(j) , n+1(p+1) n+1(p) +Cr nj ζL(j) = dr R(j) , j ∈ Bζ . Combining these expressions yields for the non-Neumann boundary conditions n+1(p+1) n+1(p) Br R(j) ζL(j) n+1(p+1) ζR(j) + P l∈J (R(l))\j 70 of 152 n+1(p+1) Cr nl ζO(R(j),l) = zb , n+1(p) n = dr R(j) − Cr j zb , j ∈ Bζ \B2 Deltares Numerical approach Algorithm 29 s1nod | boundary conditions: adjustments to Algorithm (18) to satisfy the boundary conditions in the water level equation n+1(p+1) ζk + P n+1(p+1) Cr nj ζO(k,j) j∈J (k) n+1(p) = 1, j ∈ Bζ (1 − αsmo ) ζj0 + αsmo ζb (bj , t̂n+1 ), n −sb (bj , t̂n+1 )∆xr j Cr j , , Equation (6.105) DR AF Br L(j) zb = n+1(p) = dr k T n+1(p) Br k max( 1 (hζ n +hζ n ),εhs ) j ∈ B1 j ∈ B2 L(j) R(j) 2 2ζb (bj , t̂n+1 ) − unj , g ζRn(j) , unj > 0, q ζLn(j) + ∆tn g 12 (hζ nL(j) + hζ nR(j) )(ζRn(j) − ζLn(j) + sb (bj , t̂n+1 )), uj ≤ 0, P n (1 − αsmo )ζL0(j) + αsmo hb ( ql ), j ∈ B5 j ∈ B6 j ∈ B6 j ∈ B7 l∈B7 patm L(j) −pav zb = max(zb − ρmean g , blL(j) + 10−3 ), j ∈ Bζ n+1(p) n+1(p) = dr R(j) − Cr nj zb , dr R(j) n+1(p) = 1, Br L(j) j ∈ Bζ \ B2 Cr nj = 0, n+1(p) = zb , dr L(j) ) n+1(p) Br L(j) = −Cr nj , j ∈ B2 n+1(p) = −Cr nj ∆xj sb (bj , t̂n+1 ), dr L(j) n+1(p) Cr nj = −Br R(j) , n+1(p) n Br L(j) = −Cr j , j ∈ Bu n+1(p) dr L(j) = 0, n+1(p) n+1(p) Br R(j) = Br R(j) − Cr nj , Deltares 71 of 152 D-Flow Flexible Mesh, Technical Reference Manual and for the Neumann boundary condition n+1(p+1) n+1(p+1) −Cr nj ζL(j) n+1(p) Br R(j) n+1(p+1) ζR(j) n+1(p+1) Cr nl ζO(R(j),l) P + = +Cr nj ζR(j) n n+1 −Cr j ∆xj sb (bj , t̂ ), n+1(p+1) +Cr nj ζL(j) =, l∈J (R(l))\j n+1(p) dr R(j) , j ∈ B2 . The consequences for the matrix elements are shown in Algorithm (29). The velocity boundary conditions appear in the system in the following manner. The condition for the face-normal velocity components can be expressed as j ∈ Bu = B3 ∪ B4 , (6.160) T un+1 = zuj , j where according to Equation (6.138) zuj = ub (bj , t̂n+1 ), j ∈ B3 (6.161) DR AF and zuj is computed with Algorithm (26) for the discharge boundaries j ∈ B4 . Since the velocity at the next time level with Equation (6.96) in Algorithm (14) n+1 n un+1 = −fu nj (ζRn+1 j (j) − ζL(j) ) + ru j , the adjustments to Algorithm (14) are obvious and presented in Algorithm (30). Note that the velocity boundary conditions are relaxed with a parameter αsmo from the initial conditions, assumed zero. This will be explained in the next section. Algorithm 30 furu | boundary conditions: adjustments to Algorithm (14) to satisfy the boundn+1 n ary conditions of the form un+1 = zuj , j ∈ Bu in un+1 = −fu nj (ζRn+1 j j (j) − ζL(j) ) + ru j fu nj = 0, ru nj = αsmo zuj , j ∈ Bu Returning to the system of water level equations, the consequence of the velocity boundary conditions for the matrix element Cr n j can be seen in Algorithm (15), i.e. Cr nj = 0, j ∈ Bu . (6.162) However, we want to apply a homogeneous Neumann condition to the water level at the velocity boundary: n+1 ζRn+1 (j) − ζL(j) = 0 ∈ Bu . (6.163) This can for arbitrary non-zero Cr n j be formulated as n+1(p+1) −Cr nj ζL(j) n+1(p) (Br R(j) n+1(p+1) − Cr nj ) ζR(j) n+1(p+1) = n+1(p+1) =, +Cr nj ζR(j) P + n+1(p+1) Cr nl ζO(R(j),l) +Cr nj ζL(j) 0, l∈J (R(l))\j n+1(p) dr R(j) , j ∈ Bu . To obtain a sensible order of magnitude, we set, as shown in Algorithm (29), n+1(p) Cr nj = −Br R(j) , 72 of 152 j ∈ Bu . (6.164) Deltares Numerical approach 6.4.4 Relaxation of the boundary conditions: Tlfsmo In Algorithms (28), (30) and (29) the boundary conditions are relaxed from the initial values with a parameter αsmo that turns the discrete boundary conditions into 0 n+1 ζLn+1 ), j ∈ B1 ,"waterlevel", (j) = (1 − αsmo )ζL(j) + αsmo ζb (bj , t̂ (6.165) un+1 = αsmo ub (bj , t̂n+1 ), j j ∈ B3 ,"velocity", (6.166) Qb (t̂n+1 )(hu nj )2/3 , un+1 = α smo P j Au nl (hu nl )2/3 j ∈ B4 "discharge", (6.167) l∈B4 0 ζLn+1 (j) = (1 − αsmo )ζL(j) + αsmo hb ( X qln ), j ∈ B7 ,"Qh" (6.168) l∈B7 DR AF αsmo = min t̂n+1 − t0 ,1 . Tsmo T and similar for the continuous formulation. The parameter αsmo is computed from the userprescribed parameter Tsmo (Tlfsmo) as (6.169) Remark 6.4.12. The second category velocity boundary conditions are not being relaxed in the same way as the first category, but maybe they should. Remark 6.4.13. A zero initial velocity field is assumed in the relaxation of the boundary conditions. 6.4.5 Atmospheric pressure: PavBnd, rhomean Local changes in atmospheric pressure at the boundaries, except for the outflow boundary, are accounted for by correcting the water level with − patm L(j) − pav ρmean g (6.170) as shown in Algorithms (28) and (29), where patm k , pav (called PavBnd in D-Flow FM) and ρmean (called rhomean in D-Flow FM) are the user-supplied atmospheric pressure in cell k , average pressure and average density, respectively. 6.4.6 Adjustments of numerical parameters at and near the boundary At and near the boundary, the advection scheme and time-integration method are adjusted with Algorithm (31). The time-integration parameter θj is set to 1 and the advection scheme is set to ’6’ at and near the water level boundary. See Algorithm (4) for an overview of the advection schemes. These settings are not only applied to the water level boundary faces, but also to all faces of internal cells that are adjacent to the water level boundary. For the velocity boundary conditions, the time integration parameter θj is set to 1 at and near the boundary. Advection is turned off by setting the advection scheme to −1, but only for the faces at the boundary that is. Deltares 73 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 31 flow_initexternalforcings: adjust numerical settings near the boundaries θl iadvl θl iadvj 6.4.7 1, l ∈ J (R(j)) j ∈ Bζ 6, l ∈ J (R(j)) 1, l ∈ J (R(j)) j ∈ Bu −1 = = = = Viscous fluxes: irov tuj irov=0, free slip, 0, ∗ ∗ −uj |uj |sj , irov=1, partial slip, = −ν Uj s , irov=2, no slip, j ∆yj j T Momentum diffusion is elaborated in Theorem 6.2.2 and in particular Algorithm (11). It will be clear that we can not evaluate the viscous stresses tuj at closed boundaries as in Equation (6.71). Instead, boundary conditions need to be imposed. These are: (6.171) DR AF where u∗j is the friction velocity, sj = n⊥ j a unit tangential boundary vector whose orientation we will not discuss and, if R(j) is the boundary cell (note that L(j) does not exist), ∆yj = 1 bA R(j) . 2 wuj (6.172) The friction velocity is computed as Uj κ , C + d/z0 (6.173) Uj = uc R(j) • sj , (6.174) u∗j = with z0 the user specified roughness height, κ the Von Karman contanst, d a distance from the cell centroid perpendicular to the boundary face and C either 1 or 9. The boundary cell-based momentum diffusion term then becomes 1 p T • νh (∇u + ∇u ) ∇ Ω hp P R(j) ≈ 1 HRp(j) dR(j) + tul wul sl,R(j) l∈{m∈B0 |R(m)=R(j)} bA R(j) , j ∈ J0 , (6.175) where dR(j) represents the contribution from the non-boundary faces of boundary cell R(j) as given by Equation (6.70) for k = R(j). Remark 6.4.14. Comparing the contribution of the viscous boundary stress with the expression for the contribution of the internal faces dk in Equation (6.70) reveals that the istresstype does not apply to the contribution of the boundary stresses. Apparently p = 0 is applied here. See Remark 6.2.17 in this respect. 6.5 Summing up: the whole computational time step With the discretization explained in the previous sections, we are now able to sum up the computational time step. It is shown in Algorithms (32), (33) and (34). The data being computed and updated are shown in Table 6.3. 74 of 152 Deltares Numerical approach Table 6.3: Data during a computational time step from tn to tn+1 with Algorithm (32); the translation to D-Flow FM nomenclature is shown in the last column input time instant water level face-normal velocity components fluxes water column volumes wet bed areas time step D-Flow FM t ζkn unj qjn , qa nj Vkn Ank ∆tn−1 time0 s0 u0 q1, qa vol1 A1 dts during the time step (a selection) estimate for next time instant the face based water level wetted cross-sectional areas the water column thickness the cell-centered full velocity vectors node-based full velocity vectors momentum equation terms t̂n+1 hu nj Au nj hs nk uc nk , uq nk un ni Ae j , Ai j time0+dts hu Au hs ucx, ucy, ucxq, ucyq ucnx, ucny adve, advi tn+1 ζkn+1 un+1 j qjn+1 , qa n+1 j Vkn+1 An+1 k ∆tn time1 s1 u1 q1, qa vol1 A1 dts DR AF T n output time instant water level face-normal velocity components fluxes water column volumes wet bed areas time step Algorithm 32 flow_single_timestep: perform a computational time step from tn to tn+1 and n obtain ζkn+1 , un+1 , qj 1 , qa n+1 and Vk n+1 , ∀k and ∀j j j n flow_initimestep: compute derived data huj , Au n j , et cetera and perform the predictor phase of the fractional time step to obtain Ai j and Ae j , ∀j with Algorithm (33) step_reduce: compose system of water-level equations, solve the system to obtain ζkn+1 , n , set hu j to zero (old time-level) for discompute volumes and wetted areas Vkn+1 , An+1 k abled faces during solve and perform the corrector phase to obtain un+1 , qjn+1 and qa n+1 j j with Algorithm (22) Deltares 75 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 33 flow_initimestep: compute derived data and perform the predictor phase of the fractional time step hζ nk = ζkn − blk , ∀k t̂n+1 = tn + ∆tn DR AF T flow_setexternalboundaries: update boundary values at time instant t̂n+1 n sethu: compute face-based water levels hu j with Algorithm (2) and Algorithm (41) explained later setau: compute the flow area Au n j with Algorithms (3) and (26) n setumod: compute cell-based full velocity vectors uc n k , uq k , first-order upwind velocity n uLu j and add Coriolis forces and viscous fluxes to Ae j with Algorithm (34) compute bed friction coefficients compute time step ∆tn+1 advec: add advection terms to Ai j and Ae j with Algorithms (4) and (42) setextforcechkadvec: add external forces to Ai j and Ae j and make adjustments for small water depths, Algorithm (37) explained later Algorithm 34 setumod: compute cell-based full velocity vectors uck , uq k , first-order upwind velocity uL u j and add Coriolis forces and viscous fluxes to Ae j setucxucyucxuucyu: reconstruct cell centered velocity vectors uck and uq k , and set firstorder upwind fluxes uL u j with Algorithms (6) and (27) compute tangential velocities vj from the cell-centered velocities uq k with Eqn. ((6.47)) compute Coriolis forces setcornervelocities: interpolate nodal velocity vectors un from cell-centered velocity vectors uc with Algorithm (7) compute viscous momentum fluxes, except at the default boundaries, i.e. j ∈ / J0 , and add to Ae j with Algorithm (11) compute viscous momentum fluxes near the default boundaries j ∈ J0 and add to Ae j 76 of 152 Deltares Numerical approach 6.6 Flooding and drying The governing equations, Equation (6.5) and Equation (6.6), can only be formulated for positive water levels, i.e. the "wet" part of the whole domain where h > 0. However, our domain may also contain areas that are dry. If we let Ω denote the whole domain, then we can define the wet part Ω̄(t) as Ω̄(t) = {x ∈ Ω|h(x, t) > 0}. (6.176) In other words, when we are faced with flooding and drying we are actually attempting to solve a moving boundary problem, where ∂ Ω̄(x, t) is the moving boundary. T In D-Flow FM the governing equations are discretized on a stationary mesh (in two dimensions). Looking at the governing equations, Equation (6.5) and Equation (6.6), we can immediately identify two difficulties in the numerical treatment of the wet/dry boundary: the spatial discretization near the moving wet/dry boundary, and the temporal discretization at cells that become wet or dry during a time-step. 6.6.1 DR AF One may think of two possible approaches to overcome the difficulties with the spatial operators near the moving boundary: the stencil could be adapted such that it does not extend to the dry part of the domain, or, alternatively, the spatial operators could be left unmodified and the flow variables in the dry part could be given values that comply with the (moving) boundary conditions. We leave it up to the reader to decide which approach is taken in D-Flow FM and restrict ourselves by describing the measures taken in D-Flow FM to account for the wet/dry boundary. Wet cells and faces: epshu We can distinguish between wet (or dry) cells and wet (or dry) faces, which are the discrete counterpart of Ω̄ (or Ω \ Ω̄). Dry faces are identified by setting their face-based water level to zero, i.e. huj = 0. In D-Flow FM this occurs at two occasions during a time-step: at the beginning of the time step, and based on the water level ζkn , faces for which hu ≤ εhu are disabled by setting them to zero with Algorithm (35). Note that εhu is a threshold which is called epshu in D-Flow FM and is user specified, n+1(p) during the time step, the water level ζk may have dropped below the bedlevel. Depending on poshcheck , the time-step is repeated with a smaller time step (type 1) or n all faces of the cell are deactivated by setting their hu j to zero, see Algorithm (19), and the water level equation is solved again. Algorithm 35 sethu | drying and wetting: adjustment to Algorithm (2) to account for drying and wetting n compute hu j with Algorithm (2) n n disable dry faces by setting hu j = 0 if hu j ≤ εhu 6.6.2 Spatial discretization near the wet/dry boundary In D-Flow FM, dry faces affect the discretization of: n the wet bed areas An k and water-column volumes Vk , momentum advection: set to zero in Algorithm (4) (not mentioned there), bed friction forces: set to zero, and n viscous fluxes: set to zero for hu j in Algorithm (34). Deltares 77 of 152 D-Flow Flexible Mesh, Technical Reference Manual The computation of the wet bed areas and water-columns was already presented in Algorithm (20). As can been seen in Algorithm (20), the bed is assumed constant in case of no non-linear iterations. That is, as far as the water-column volumes and wet bed areas are concerned. See Remark 6.2.4 in that respect. With a constant bed level, no modifications are necessary for the computation of the wet bed area. The bed is either completely wet, or it isn’t. In case of non-linear computations, however, the bed is assumed non-constant in a cell. The expressions for Vk and Ak are then Z Vk = h dΩ (6.177) dΩ (6.178) Ωk ∩Ω̄ and Ak = T Z Ωk ∩Ω̄ DR AF respectively, where we have used that Ωk ∩ Ω̄ indicates the wet part op the cell. These integrals are discretized as indicated in Algorithm (36). Remark 6.6.1. Applying Gauss’s theorem to Equation (6.178) yields Z Ak = 1 (x − xk ) • n dl + 2 ∂Ωk ∩Ω̄ Z 1 (x − xk ) • n dl, 2 (6.179) Ωk ∩∂ Ω̄ where we have assumed outward positive normal vectors n. It shows that we do not only need to integrate along (a part of) the edges of Ωk , but also along the wet/dry boundary in cell ∂ Ω̄ ∩ Ωk . Since this term is missing in the expression for Ak , the wet bed area of a partially wet cell is incorrectly computed. n+1(i+1) Algorithm 36 volsur | non-linear iterations: compute water-column volume Vk wet bed area and n+1(i+1) Ak if no non-linear iterations then use Algorithm (20) else compute ∆bj = max(bl1j , bl2j ) − min(bl1j , bl2j ) and wet cross-sectional area Auj as in Algorithm (3) Ak = P j∈{l∈J (k)|sk,l =1} P Vk = 1 ∆xj αj 2 h min( ∆bujj , 1)wuj + 1 ∆xj (1 2 h − αj ) min( ∆bujj , 1)wuj j∈{l∈J (k)|sk,l =−1} P 1 ∆xj αj Auj + 2 j∈{l∈J (k)|sk,l =1} P 1 ∆xj (1 − αj )Auj 2 j∈{l∈J (k)|sk,l =−1} end if 78 of 152 Deltares Numerical approach 6.6.3 Spatial discretization of the momentum equation for small water depths: chkadv, trshcorio Recall that Eqn. ((6.23)) summarizes the spatial discretization of the momentum equation: duj dt =− g g |uj | ζR(j) − ζL(j) − Ai j uj − Ae j − uj , ∆xj C 2h where Ae j and Ai j represent the contributions of momentum advection, diffusion, Coriolis forces and external forces not being bed friction. These contribution are computed with Algorithm (4) for advection and Algorithm (34) for diffusion and Coriolis forces, respectively. The contributions to Ae j by external forces not being the bed friction are added by Algorithm (37). It shows that for small water depths huj the term Ae j is limited to zero from a user-specified threshold hchkadv , called chkadv in D-Flow FM. T Algorithm 37 setextforcechkadvec: add external forces not being the bed friction forces to Ae j and Ai j , and limit for vanishing water depths, in the expression: duj g |u | g ζ − ζ − Ai j uj − Ae j − C 2 hj uj = − R (j) L (j) ∆xj dt DR AF add external forces to Ae j if huj > 0 then if hs L(j) < 12 hζ R(j) ∧ Ae j < 0 ∧ hζ R(j) < hchkadv then hζ L(j) , 1)Ae j Ae j = min( hchkadv 1 else if hζ R(j) < 2 hζ L(j) ∧ Ae j > 0 ∧ hζ L(j) < hchkadv then hζ R(j) Ae j = min( hchkadv , 1)Ae j end if end if Remark 6.6.2. It is unclear why the term Ae j needs to be limited to zero for vanishing water depths. Remark 6.6.3. It is unclear why only the term Ae j is limited, and not the other terms. In the first place Ai j , but also the remaining terms in Eqn. ((6.23)). Coriolis forces are computed and added to Ae j in Algorithm (34). Besides the limitation described above, an additional limitation is performed. If fc j is the Coriolis normal force at face j , then it is limited as indicated in Algorithm (38) with a threshold htrshcorio called |trshcorio | in D-Flow FM. Algorithm 38 setumod | limitation of Coriolis forces: adjustment to Algorithm (34) to account for vanishing water depths htrshcorio = 1 hminj = min(hζ L(j) , hζ R(j) ) limit Coriolis forces fc j to fc j min( hhmin , 1) trshcorio Remark 6.6.4. The Coriolis forces are limited by Algorithm (38) and by Algorithm (37). 6.6.4 Temporal discretization of the momentum equation near the wet/dry boundary If the face is dry at the beginning of the time step, then it is assumed that during a time-step from tn to tn+1 no water is fluxed through it. The face-normal velocity un j is set to zero in such circumstances. Deltares 79 of 152 D-Flow Flexible Mesh, Technical Reference Manual Remark 6.6.5. The assumption that during a time step no water is fluxed through a dry face that is dry at the old time instant imposes a time step limitation. Remark 6.6.6. Setting the face-normal velocities in the dry area to zero does not seem to obey a moving wet/dry boundary condition. Hence, the spatial operators and temporal discretization are not allowed to be applied without modification. However, they are. n Setting hu j = 0 during the time step does not affect the computation of momentum advection and diffusion et cetera, as the terms Ae and Ae remain untouched. It only affects the watercolumn volumes Vkn+1 and wet bed areas An+1 , face-normal velocities un+1 and fluxes qjn+1 j k and qa n+1 at the new time instant as can be seen from Algorithm (22), which do not appear j in the discretization of the momentum equation. n+1 n un+1 = −fu nj (ζRn+1 j (j) − ζL(j) ) + ru j , T Recall that the temporal discretization of the momentum equation is expressed by Eqn. ((6.96)) for huj > 0, or hu nj > 0. un+1 j DR AF Extended for the situation when the face becomes wet or dry, it becomes face is dry at beginning of the time step, 0, 0, face is wet and becomes dry during the time step, = −fu n (ζ n+1 − ζ n+1 ) + ru n , face remains wet. j R(j) j L(j) (6.180) If the face is still wet at the end of the time step from tn to tn+1 , but becomes dry at the beginning of the new time step from tn+1 to tn+2 due to Algorithm (35), then its normal velocity component is left unmodified, since the velocities are only set at the end of the time step by Algorithm (21). Remark 6.6.7. A face that was still wet at the end of the previous time-step, but becomes dry during the current time-step can have a non-zero normal-velocity at the old time level. It is being used in the evaluation of advection terms, diffusion terms et cetera at the beginning of the next time step, although the face is dry. In contrast, faces that were already dry from the end of the previous time step have zero normal-velocity. 6.7 Fixed Weirs This section elaborates on the numerical treatment of the fixed weirs. They are commonly used to model sudden changes in depth (roads, summer dikes) and groynes in numerical simulations of rivers. In D-Flow FM, a fixed weir is a fixed non-movable construction generating energy losses due to constriction of the flow. Weirs are discretely represented along mesh lines. In such a manner, faces can be identified that are located exactly on top of the weirs, and no computational cells are cut by a weir. A cell is either on one side of a fixed weir, or on the other side. Provided that the cross-sectional wet areas of the faces Auj have been properly modified to account for the fixed weir (if present), no modifications have to be made to the discretization of the continuity equation. The momentum equation, on the other hand, has to be modified such that we obtain our desired subgrid model. The flow over a fixed weir can not be modeled in D-Flow FM as is, but is based on an alternative approach which is called ’subgrid’ modelling, which means that a weir is not ’modelled on the grid’, but that a parametrization is applied. Two different subgrid approaches are available to simulate the energy losses by fixed weirs. First of all, a numerical approach has been implemented. Then, a special discretization of the advective terms before and after the fixed weir is applied. This option is switched on 80 of 152 Deltares Numerical approach via keyword fixedweirtype=6. This numerical approach is described in detail in section 6.7.1 to section 6.7.4. Next to the numerical approach, there is an empirical approach to determine the energy losses by weirs, for which two options are availabe in D-Flow FM, namely the so-called ’Tabellenboek’ and ’Villemonte’ approaches. The Tabellenboek option is switched on via keyword fixedweirtype=8, while the Villemonte approach coincides with keyword fixedweirtype=9. The two corresponding empirical formulas have been taken from the Simona software, see the website http://www.helpdeskwater.nl/ onderwerpen/applicaties-model/applicaties-per/watermanagement/watermanagemen simona. Based on many flume measurements formulas have been derived to fit the measurements as well as possible. This empirical approach is described in section 6.7.5. 6.7.1 Adjustments to the geometry: oblique weirs and FixedWeirContraction DR AF wuj = c kxr(j) − xl(j) k |nj • nwj |, T Recall that the bed geometry is represented by the face-based bed-levels bl1 and bl2 , see section 6.1.2 and Algorithm (1). The wet cross-sectional area Au is derived from it with Algorithm (3). In other words, the fixed weirs are properly represented by adjusting bl1 and bl2 . Also appearing in the expression for Au is the face width wu . Weirs that are not aligned with the mesh, called oblique weirs for shortness, are projected to the (non-aligned) weir, i.e. (6.181) where nwj is a unit vector normal to the part of the fixed weir that is associated with face j . The cross-sectional wetted area is decreased by the same amount as wu by means of Algorithm (3). Remark 6.7.1. Oblique weirs are not fully understood at this moment. We do not attempt to explain Equation (6.181) further. In Equation (6.181) c is a user-specified contraction coefficient that accounts for obstacles in the flow that accompanied with the weir, such as pillars. It is called FixedWeirContraction in D-Flow FM. The adjustments of bl1 , bl2 and wu are performed with Algorithm (39). Algorithm 39 setfixedweirs: change geometry bl1 , bl2 and wu and advection type for fixed weirs bl1j = max(zcj , bl1j ) bl2j = max(zcj , bl2j ) if left and right weir sill levels are prescribed and conveyance type > 0 then set bl1j and bl2j of adjacent faces, not described further end if adjust advection type of adjacent faces with Algorithm (40) wuj = c kxr(j) − xl(j) k |nj • nwj | 6.7.2 Adjustment to momentum advection near, but not on the weir Due to our subgrid modelling,the flow over a weir is discontinuous. In principle, this has is consequences for the discretization of all spatial operators near the weir and to this end the advection type near the weir is also adjusted by Algorithm (39). More precisely, all faces belonging to cells that are adjacent to weirs, except for the faces that are associated with a weir themselves, with Algorithm (40) have their advection type set to 4. As can be seen in Algorithm (4), only inflowing cell-centered velocities are used in the expression for momentum advection for scheme 4. Doing so, the advection at faces adjacent to and upstream of the weir are not affected by the cell-centered velocities near the weir. Deltares 81 of 152 D-Flow Flexible Mesh, Technical Reference Manual Remark 6.7.2. Since the flow over a weir is discontinuous due to our subgrid modelling, one may need to discretize the spatial operators near the weir more rigorously. Algorithm 40 setfixedweirscheme3onlink: set advection type to 4 of faces near the weir if face j is associated with a fixed weir then iadvj = 21 θj = 1 for l ∈ {m ∈ J (L(j)) ∪ J (R(j)) | iadvm 6= 21} do iadvl = 4 θl = 1 end for end if T Adjustments to the momentum advection on the weir: FixedWeirScheme We assume that a face j is located exactly on top of a fixed weir or not at all. Upstream of a fixed weir, a contraction zone exists. The cell-centered water level upstream of the face (L(j) if uj > 0) represents the far-field water level before the contraction zone. The water level at the cell-centered water level downstream of the face (R(j) if uj > 0) is used as a downwind approximation of the water level on top of the fixed weir. In other words, the discretization at a face j represents the flow upstream of the weir at face j . This is the contraction zone, which is governed by energy conservation. The expansion zone downstream of the weir, is governed by momentum conservation and is directly resolved in the mesh without, in principle, further adjustments. DR AF 6.7.3 Assume that at face j is on top of a weir and that the flow is from the left L(j) to the right neighboring cell R(j). We require that: 1 Energy is conserved from cell L(j) to R(j). 2 The downstream water level ζR(j) should have no effect on the fixed weir in supercritical conditions. In this case the water level on top of the weir reached its minimum value of 2 E , where Ej is the far-field energy head above crest. Its computation will be discussed 3 j later. Energy conservation is expressed by means of Bernoulli’s equation, i.e. 1 1 2 uin j + gζL(j) = u2j + g(zC j + huj ), 2 2 (6.182) where uinj is a far-field velocity component in face-normal direction nj and zC j is the crest level. For the water level at the weir huj a downwind approximation is used that obeys our second requirement: 2 huj = max(ζR(j) − zC j , Ej ), 3 (6.183) where Ej is the far-field energy head above the crest. It is computed as Ej = ζL(j) − zC j + 1 uin 2 . 2g j (6.184) Remark 6.7.3. Equation (6.184) is only valid along streamlines and consequently we may only consider flows that are perpendicular to the weir (1D flows) or are uniform along both sides of the weir. 82 of 152 Deltares Numerical approach Substitution of Equation (6.186) in Equation (6.182), some rearrangement of terms and division by ∆xj yields g 1 g 2 u2j − uin 2j = − ζR(j) − ζL(j) − max(0, Ej −(ζR(j) −zC j )) (6.185) 2∆xj ∆x ∆x 3 This equation if brought into the form that is solved in D-Flow FM by adding the acceleration term, which only serves to relax to our stationary subgrid expression of Equation (6.185) duj dt + g 1 g 2 u2j − uin 2j = − ζR(j) − ζL(j) − max(0, Ej −(ζR(j) −zC j )) 2∆xj ∆x ∆x 3 (6.186) T Remark 6.7.4. Although momentum diffusion over the wear is missing in Equation (6.186), it is actually included in D-Flow FM. Recall that the spatial discretization is summarized as shown in Equation (6.23): duj gkuj k g ζR(j) − ζL(j) − Ai j uj − Ae j − uj . ∆xj C 2h DR AF dt =− For the temporal discretization, see Equation (6.95). The terms for fixed weirs can then be put as, assuming uj > 0: 1 uj , 2∆xj g 1 2 = − uin 2j + max(0, Ej − (ζR(j) − zC j )). 2∆xj ∆x 3 Ai j = (6.187) Ae j (6.188) Remark 6.7.5. Although bed friction is not included in Equation (6.185), it is included in DFlow FM by means of Equation (6.23). Its actual computation will not be discussed at this occasion. The terms of Equation (6.183), and Equation (6.187) and Equation (6.188) are prescribed partly with Algorithm (41) and partly with Algorithm (42). Note that the latter also adjusts the cell-centered velocity vectors uc . In Algorithms (41) and (42) a far-field velocity uin is computed. For FixedWeirScheme 4, the far-field velocity is projected in weir-normal, instead of face-normal direction. For FixedWeirScheme 5 the kinetic energy is not used in the determination of the far-field energy head. Remark 6.7.6. Starting from Bernoulli’s equation to derive the weir subgrid model, it seems inconsistent to project the far-field velocity in weir-normal direction for scheme 4, while using the face-normal velocity as the weir crest velocity. Remark 6.7.7. Starting from Bernoulli’s equation to derive the weir subgrid model, it seems inconsistent not to include the far-field velocity for scheme 5. The far-field velocity is based on the cell-centered velocity vector in the adjacent, upstream cell. The cell-centered velocity vectors are reconstructed from the face-normal velocity components with Algorithm (6). However, the upstream cell-centered velocity is reconstructed from a set of face-normal velocity components that includes the weir itself. Since we are seeking for a far-field velocity, we have to exclude the increased crest velocity uj from the reconstruction. See Remark 6.7.2 in this respect. This is achieved by estimating an unperturbed Deltares 83 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 41 sethu | fixed weir: adjustment to Algorithm (2); set hu and part (one of two) to Ae 1 uin 2j Ej = ζL(j) − zcj + 2g if ζR(j) < ζL(j) then huj = max(ζR(j) − zcj , 32 Ej ) g Ae j = − ∆x min(0, ζR(j) − zcj − 23 Ej ) j T if uj > 0 then compute far-field velocity ûc L(j) with Algorithm (43) ( ûc L(j) • nwj , fixed weir scheme 4 fixed weir scheme 5 uinj = 0 • ûc L(j) nj , otherwise DR AF end if else as above by interchanging L(j) and R(j) and taking reversed orientation into account end if Algorithm 42 advec | fixed weir: adjustment to Algorithm (4) for fixed weir; set Ai and add part (two of two) to Ae ; overwrite cell-center velocity vectors uc of adjacent cells if fixed weir scheme ∈ {3, 4, 5} then compute and overwrite cell-centered weir-velocities uc L(j) and uc R(j) with Algorithm (44) end if if uj > 0 then compute far-field velocity ûc L(j) with Algorithm (43) uinj = Ai j = ûc L(j) • nwj , fixed weir scheme 4 ûc L(j) • nj , otherwise uj 2∆xj Ae j = Ae j − uin 2j 2∆xj else as above by interchanging L(j) and R(j) and taking reversed orientation into account end if 84 of 152 Deltares Numerical approach velocity ûj as if no weir was present and using that velocity in the reconstruction instead. The unperturbed velocity is estimated by using continuity, i.e. ûj = huj ĥj uj , (6.189) where ĥj is a typical water depth for the upstream cell (L(j) if uj > 0). The reconstruction of the upstream cell-centered velocity vector is then performed as shown in Algorithm (43). Note that the faces that are associated with a weir are identified with iadvj = 21, see Algorithm (40), so Jˆ(k) is the set of faces of cell k without the faces that are associated to a fixed weir. T Algorithm 43 getucxucynoweirs: reconstruct a cell-centered velocity vector near a fixed wear without the weir itself R̂(k) = {j ∈ R(k)|iadvj 6= 21} ( P wuj j∈R̂(k) wuj huj , R̂(k) 6= ∅ j∈R(k) DR AF ĥk = P1 0, uck = (6.190) (6.191) otherwise 1 bAk ( X αj ∆xj wuj nj uj + j∈{l∈R̂(k)|sl,k =1} X αj ∆xj wuj nj uj min(1, j∈{l∈R(k)\R̂(k)|sl,k =1} X huj ĥk )+ (1 − αj )∆xj wuj nj uj + j∈{l∈R̂(k)|sl,k =−1} X (1 − αj )∆xj wuj nj uj min(1, j∈{l∈R(k)\R̂(k)|sl,k =−1} huj ĥk ))(6.192) For the advection downstream of the wear the cell-centered velocity vectors get the opposite treatment with Algorithm (44). Deltares 85 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 44 getucxucyweironly: reconstruct a cell-centered velocity vector near a fixed wear with the weir itself J¯(k) = {j ∈ J (k)|iadvj = 21} P1 ( h̄k = P wuj j∈J¯(k) wuj huj , R̄(k) 6= ∅ j∈J¯(k) (6.194) 0, uck = (6.193) otherwise 1 bAk X ( αj ∆xj wuj nj uj + j∈{l∈J¯(k)|sl,k =1} X αj ∆xj wuj nj uj max(1, X T j∈{l∈J (k)\R̄(k)|sl,k =1} (1 − αj )∆xj wuj nj uj + j∈{l∈J¯(k)|sl,k =−1} (1 − αj )∆xj wuj nj uj max(1, DR AF X j∈{l∈J (k)\R̄(k)|sl,k =−1} 6.7.4 huj )+ h̄k huj ))(6.195) h̄k Supercritical discharge Supercritical conditions are defined by 2 ζR∗(j) ≤ zc + Ej , 3 (6.196) where we let superscript ∗ indicate supercritical and stationary conditions. The water level at the crest is then according to Equation (6.183) 2 hu ∗j = Ej . 3 (6.197) and the crest velocity according to Equation (6.185) r u∗j = 2 gEj . 3 (6.198) The face-based discharge under stationary and supercritical conditions is then by definition 2 qj∗ := Au ∗j u∗j = wuj hu ∗j u∗j = wuj Ej 3 r 2 gEj , 3 (6.199) where we have used Equation (6.28) and Algorithm (3). 6.7.5 Empirical formulas for subgrid modelling of weirs The energy loss due to a weir described by the loss of energy height ([m]). The energy loss in the direction perpendicular to the weir is denoted as ∆E . This energy loss is added as an opposing force in the momentum equation by adding a term −g∆E/∆x to the right hand side of the momentum equation, resulting in a jump in the water levels by ∆E at the location of the weir. 86 of 152 Deltares Numerical approach The computation of the energy loss depends on the flow condition. There is a distinction between a subcritical flow condition and a supercritical flow condition. Furthermore, there are two different empirical formulations for the energy loss in use in D-Flow FM: 1 Tabellenboek Then, the energy loss is computed according to the following principles, see Wijbenga (1990): In critical flow conditions DR AF T To match the theoretical critical flow condition on the crest (flow velocity and wave propagation speed are the same on the crest). In subcritical flow conditions Based on the so-called "Tabellenboek"’ approach, see Vermaas (1987) and the formula according to Carnot. The formulation was fitted to match laboratory measurements with hydraulically smooth weirs and with the ramp factors m1 = m2 both equal to 4.0: see (Equation (6.207)) for the definitions of m1 and m2 . Whether Carnot’s formula or the Tabellenboek is used depends on the flow velocity above the weir: if the flow velocity at the weir is less than 0.25 m/s, the energy loss is calculated according to the Carnot equation for the energy loss in a sudden expansion. If the flow velocity above the weir is more than 0.50 m/s, the energy loss is determined by interpolation of measured data which are collected in the Tabellenboek. When the flow velocity is between 0.25 and 0.50 m/s, a weighted average is taken between the energy loss following Carnot and the measurements. For velocities at the weir less than 0.25 m/s the energy loss is calculated according to Carnot’s law: 1 ∆E = 2g Qweir Uweir − ζ2 + d2 2 (6.200) with Uweir the flow velocity on the weir and ζ2 the downstream water level and U2 the downstream flow velocity. 2 Villemonte The second available formulation is the formulation proposed by Villemonte (1947). The formula has terms for different aspects of the weir’s geometry and for the vegetation on it, more than the Tabellenboek-formulation. This formulation involves a number of parameters, for which realistic values need to be found. The default values produce an energy loss which is very close to the energy loss found by the Tabellenboek formula. Alternative values for the tuning parameters were calculated by Sieben (2011). Depending on the flow condition, the empirical discharge is processed into the model in one of the following two ways: 2.1 In critical flow, a loss of energy height is prescribed which causes the discharge to converge to the empirical discharge over a small period of time. 2.2 In subcritical flow, a loss of energy height is prescribed which is the same as the loss of energy height in a one-dimensional, steady flow with the given discharge. Under the influence of (wind-)forces or two-dimensional effects, the discharge may not converge to the empirical value, even though the energy loss will be the same as in the one-dimensional, steady case. 3 In section 6.7.6 the Villemonte approach is described in detail. 6.7.6 Villemonte model for weirs The Villemonte model is based on the analysis of a large number of measurements, which were fitted for a formula which expresses the discharge across the weir as a function of the Deltares 87 of 152 D-Flow Flexible Mesh, Technical Reference Manual energy heights E1 upstream and E2 downstream of the weir: Q = Q(E1 , E2 ). (6.201) The energy heights E1 and E2 are given by: E1 = ζ1 + U12 , 2g E2 = ζ2 + U22 , 2g (6.202) where the following notations are introduced: upstream water level, measured from weir crest [m] downstream water level, measured from weir crest [m] gravitational acceleration [m/s2 ] upstream flow velocity component in direction towards the weir [m/s] downstream flow velocity component in direction from the weir [m/s] T ζ1 ζ2 g U1 U2 Apart from the energy heights, the discharge in the empirical formula ((6.201)) depends on the properties of the weir. The formula proposed by Villemonte is s p E2 1 − max 0, min 1, , E1 DR AF Q = Cd0 Qc (E1 ) (6.203) where the following notations are introduced: Q Cd0 Qc (E1 ) p discharge per unit width across the weir [m2 /s] resistance coefficient of the weir [−] theoretical value for discharge across the weir in case of critical flow [m2 /s] power coefficient in discharge formula [−] Determination of Cd0 , Qth and p The determination of Cd0 , Qth and p is as described in the following three sections. Theoretical critical discharge The theoretical value Qc for the discharge in case of critical flow is given by 2 Qc = E1 3 r 2g E1 . 3 (6.204) Note: that, even in critical flow conditions, the discharge has the form ((6.203)), and therefore differs from the theoretical critical discharge Qc . Resistence coefficient of the weir The resistance coefficient Cd0 depends on the weir’s vegetation in the following way: Cd0 = (1 + ξ1 /3)−3/2 Cd0,ref , (6.205) where Cd0,ref is the resistance coefficient the weir would have if it had no vegetation, and where ξ1 is the dimensionless vegetation coefficient, given by ξ1 = (1 − Ar min(hv , h1 )) Cdrag (6.206) where the following notations are introduced: 88 of 152 Deltares Numerical approach Cdrag Ar hv h1 user-specified drag coefficient [−] user-specified vegetation density per linear meter [1/m] user-specified vegetation height [m] upstream water level measured from the crest [m] The effects of the weir’s geometry, vegetation and flow conditions on the resistance coefficient Cd0,ref is modeled in the following way: Cd0,ref = 4 13 −m2 /10 1 −m1 /2 + (1 − w) , c1 w 1 − e + e 4 5 20 (6.207) where the following notations were introduced: user-specified calibration coefficient [−], default [.0 Note: the Tabellenboek measurements correspond to the default value c1 = 1.0. user-specified ramp of the upwind slope toward the weir (ratio of ramp length and height, [−], default 4.0 user-specified ramp of the downwind slope from the weir [−], default 4.0 interpolation weight [−] T c1 m1 DR AF m2 w The interpolation weight w is given by w = e−E1 /Lcrest , (6.208) where Lcrest is the length of the weir’s crest [m] in the direction across the weir. Power coefficient p The effect of the vegetation on the power-coefficient p is modeled in the following way: (1 + ξ1 /3)3 p= pref , 1 + 2 ξ1 (6.209) where pref is the power coefficient found in absence of vegetation: pref = 27 2 4 Cd0 1+ d1 1−e E1 −2 −m2 /c2 − 1+ d1 E1 −2 !−1 . (6.210) The user-specified calibration coefficient c2 has a default value c2 = 10. This is the correct value for hydraulically smooth weirs. For hydraulically rough weirs, the value should be 50. 6.7.7 Grid snapping of fixed weirs and thin dams All geographical features of a model that are described by x-, and y -coordinates, like fixed weirs, thin dams and cross-sections, have to be interpolated to the computational grid when running a model. The computational core of D-Flow FM automatically assigns these features to the corresponding net links of the grid. This is called grid snapping. In this section is explained how the grid snapping is implemented in the computational core of D-Flow FM. This can be checked with the graphical user interface via the grid snapping feature. In Figure 6.11 eight examples are shown how grid snapping of fixed weirs and thin dams has been implemented. The upper four examples are for thin dams (in red), while the lower four examples involve fixed weirs (in blue). In all eight examples one computational cell is Deltares 89 of 152 DR AF T D-Flow Flexible Mesh, Technical Reference Manual Figure 6.11: Examples of grid snapping for fixed weirs and thin dams. shown with the water level point at the centre and four flow links that are connected to this water level point. If a thin dam or fixed weir intersects with a flow link, then this object will be snapped to the corresponding net link. In the left top example there is no intersection and thus no grid snapping to a net link. In the second example, there is one intersection with one flow link, in the third example four intersections and in the fourth example two intersections. This corresponds to the number of net links to which grid snapping have been applied. In the lower four examples of Figure 6.11 grid snapping of fixed weirs is explained. The algorithm for determining whether or not a fixed weir is snapped on a net link is the same as for thin dams and is explained above. The extra aspects for fixed weirs are its width and its height. The width of a fixed weir is illustrated in Figure 6.11, while the computation fo the height is illustrated in Figure 6.12. The following algorithm is applied for the computation of the height of a fixed weir: the height is the weighted average of the heights at the ends of the polyline of a fixed weir, if multiple fixed weirs intersect a flow link, then the maximum of the interpolated values is taken, The width (wu) of a fixed weir is determined by the corner (α) between the fixed weir and the net link and is computed according to wu = cos (90 − α) × width, (6.211) with width the width of a net link. If multiple fixed weirs intersect a flow link, then the maximum of the interpolated values is taken for the width. 90 of 152 Deltares DR AF T Numerical approach Figure 6.12: Examples of computation of crest heights. Deltares 91 of 152 DR AF T D-Flow Flexible Mesh, Technical Reference Manual 92 of 152 Deltares 7 Numerical schemes for three-dimensional flows Governing equations In D-Flow FM transport is formulated as, d dt Z Z Z ϕ (u − v) • n dS = ϕ dV + V (t) ∂V (t) ˜ K ∇ϕ Z • n dS + ∂V (t) s dV (7.1) V (t) where V (t) is a three-dimensional control volume, ϕ is a transport variable, u the flow velocity field, v the velocity of the (vertically) moving control volume, K is a diagonal matrix ˜ is the gradient operator in 3D, with diffusion coefficients and s K = diag (νH , νH , νV ), ∇ a source term. In case of three-dimensional (layer-averaged) flow, with ∆z a layer thickness from z1 (x, y, t) to z2 (x, y, t), we obtain T ∂∆zϕ + ∇ • (∆zuϕ) + ωz2 [ϕ]z=z2 − ωz1 [ϕ]z=z1 = ∇ • (∆zνH ∇ϕ) ∂t ∂ϕ ∂ϕ + νV − νH ∇z2 • ∇ϕ − νV − νH ∇z1 • ∇ϕ + ∆zs ∂z ∂z z=z2 z=z1 DR AF 7.1 where u and ∇ still the horizontal components are meant, i.e. u = (u, v) ∂ , ∂ ∂x ∂y T T (7.2) and ∇ = and νV is the vertical diffusion coefficient. Furthermore, ωz1 and ωz2 are the velocity components normal, relative to the moving z = z1 and z = z2 layer interfaces, respectively. The continuity equation is derived by setting ϕ = 1 and s = 0, ∂∆z + ∇ • (∆zu) + ωz2 − ωz1 = 0 ∂t (7.3) Summing up all equations along the layers, and setting zero flux condition at the bed and the free surface, it yields: ∂h + ∇ • (hu) = hs ∂t (7.4) In a similar way, the horizontal momentum equation can be obtained by setting ϕ = u. Unlike the continuity equation, the momentum equation is not integrated over the depth. ∂∆zu + ∇ • (∆zuu) + ωz2 uz2 − ωz1 uz1 = ∇ • (∆zνH ∇u) ∂t ∂u ∂u • • + νV − νH ∇z2 ∇u − νV − νH ∇z1 ∇u + ∆zs ∂z ∂z z2 z1 (7.5) subtracting Equation (7.3) from Equation (7.5) yields, ∂u + ∂t + + 1 ∆z [∇ • (∆zuu) − ∇ • (∆zu) − ∇ • (∆zνH ∇u)] 1 ∆z 1 ∆z [ωz2 (uz2 − u) − ωz1 (uz1 − u)] = ∂u ∂u 1 νV ∂z − νH ∇z2 • ∇u z2 − ∆z νV ∂z − νH ∇z1 • ∇u z1 + s (7.6) The last term in the right-hand side of Equation (7.6) includes the source terms, namely pressure. It can be described by s = sp . The pressure term is imposed on all flow cells as sp = −g Deltares ∂ζ ∂x (7.7) 93 of 152 D-Flow Flexible Mesh, Technical Reference Manual The bed friction acts as surface force and it affects the flow in the first layer close to the bed. ∂u ∂z νV = z=0 τb ρ (7.8) The wind force also acts as a surface force on the free surface, and hence it affects the top layer of the flow. ∂u ∂z νV = Cd z=zmax ρa 2 W ρw (7.9) 7.2 T where W is the speed of the wind, ρa is the air density, ρw is the density of water and Cd is air-water friction coefficient. Three-dimensional layers DR AF In D-Flow FM two type of grid topologies in the vertical direction are applied, σ and z grids. σ layers are layers which divide the computational regions between the bed and the free surface. These layers are adaptive and the interfaces of the layers may change in time associates with the deformation of the bed and free surface, see Figure 7.1a. σ=1 z z x σ=0 (a) σ -layers x (b) z -layers Figure 7.1: A schematic view of σ - and z -layers. Unlike the σ -layers, z -layers are strictly horizontal and they don’t adapt the temporal variation of the bed and free surface, see Figure 7.1b. 7.2.1 σ -layers In σ -grid the vertical distribution of the grid form layers which can adapt the geometry of the bed and free surface. In D-Flow FM the thickness of sigma-layers can be uniform (equidistant in the vertical direction), user specified, or stretched around a user defined level γ with stretching factor of α (Algorithm (45)). For stretching around a user defined level, Equation (7.10) and Equation (7.11) are applied for both bottom and top parts. Algorithm 45 flow_allocflow: ∆zi,1 ∆zi,k 7.2.2 user specified, 1−αi × γ, = 1−αm 1 i , ( m user specified, ∆zi,k−1 × αi , = ∆zi,k−1 , stretching type = 1, i = 1 stretching type = 2, i = 1, 2 otherwise i=1 stretching type = 1, i = 1 stretching type = 2, i = 1, 2 otherwise, i=1 (7.10) (7.11) z-layers 94 of 152 Deltares Numerical schemes for three-dimensional flows 7.3 Connectivity In D-Flow FM the horizontal connectivity of the computational cells in three-dimensional are defined identical with that of 2D case. Vk,l l ∆zi,l y j i DR AF x T Ak z Figure 7.2: Layer distribution in 3D. Ak , projected area of cell k . Vk,l , volume in layer l of cell k . ∆zi,l thickness of layer l above node i. However, in order to take the vertical distribution into account, a structured type of bookkeeping is applied. The data is stored in an one-dimensional array, and for each base node (2D flow node on the bed), two pointers are defined associated to the bottom and top cells in the vertical direction, defined by Kb (k) and Kt (k), respectively. Similar type of connectivity is also applied for the flow links in the vertical direction. Each base link (2D flow link on the bed), similar to flow nodes, consists of two pointers associated to the links in the bottom and top levels in the vertical direction, defined by Lb (j) and Lt (j). The connectivity translates directly to administration in the D-Flow FM code as follows: Kb (k): Kt (k): Lb (j): Lt (j): kbot(k), ktop(k), Lbot(j), Ltop(j), where j is the link index for the base flow nodes k . Note: In D-Flow FM the layers are defined by one-dimensional array. For each cell column the layers change from Kb (k) to Kt (k) and for each flow-link column they change from Lb (j) to Lt (j). However for the reason of clarity, we define it by two-dimensional indices at which the first index specifies the base cell k (or flow link j ) and the second index specifies the layer number l. 7.4 Spatial discretization Deltares 95 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 46 sethu: compute the layer depths at flow-link location j zL(j),l , uj,l > 0 ∨ uj,l = 0 zR(j),l , uj,l < 0 ∨ uj,l = 0 zuj,l − zuj,0 σ= zuj,M(j) − zuj,0 zuj,l = ∧ ∧ ζL(j) > ζR(j) ζL(j) ≤ ζR(j) h̃uj,l = σhuj Auj,l = h̃uj,l − h̃uj,l−1 wuj 7.4.1 Continuity equation X M(j) X dVk =− Auj,l uj,l sj,k dt l=1 j∈J (k) T The continuity equation Equation (7.4) is spatially discretized on the water column as (7.12) DR AF where M(j) is the maximum layers number at the location of link j , Vk is the volume of water column for base cell k computed with Algorithm (20), Auj,l approximates the flow area of face j at layer l computed with Algorithm (3), uj,l is the normal velocity component associated to face (j, l) and sj,k accounts for the orientation of face j with respect to cell k . Face based layer depth The face-based layer depths reconstructed from the cell-centered layer depths with an upwind approximation. The face-based layer depth, h̃u , is then applied to calculate the crosssectional area, Auj,l at layer j (see Algorithm (46)). 7.4.2 Momentum equation Unlike the two-dimensional case, the discretization of the momentum equation in 3D occurs on all flow faces associated with the layers (Horizontally). However, the discretization of the advection and diffusion terms are identical with that of the two-dimensional case, except it is applied along the layers. Hence, the advection and diffusion terms can be expressed by 1 ∇ • (∆zuu) − u∇ • (∆zu) − ∇ • (ν∆z(∇u + ∇uT )) j,l • nj ∆z ≈ Ai j,l uj,l + Ae j,l (7.13) advec = where Ai j,l and Ae j,l are the implicit and explicit parts, respectively. Because of similarity with the two-dimensional case, the derivation of the equations is not discussed here. The advection term is discretized in Algorithm (4) and the diffusion term in Algorithm (11) for each layer. Similar to the two-dimensional case, the limiters, used for the advection, is described in Algorithm (9) and Algorithm (10) on each layer. The water level-gradient term projected in the face-normal direction is discretized along the water column as ∇ζ|j • nj ≈ g ζR(j) − ζL(j) ∆xj (7.14) The is discretized as The contribution of the bed friction term into the momentum equation occurs only on the flow faces associated with the first σ -layer. However, unlike the 2D case, 96 of 152 Deltares Numerical schemes for three-dimensional flows Algorithm 47 getustbcfuhi: compute the bed shear stress for the first σ -layer S S S S √ cf u∗j ∆zuj,1 /2 + µz0 = ln , m=0 z0 ∆zuj,1 + µz0 , m=1 = ln ez0 ∆zuj,1 /e + µz0 = ln , m=2 z0 ∆zuj,1 /2 + z0 = ln , m=3 z0 κ = S √ = un+1 cf j,1 T DR AF this term is not discretized in its original form. The discretization of this term is done by fitting a logarithmic-law for rough beds. The merely of this approach is in finding the shear velocity by means of integration of the log-law wall function. The log-law wall-function for rough beds reads 1 u ≈ ln ∗ u κ z + µz0 z0 (7.15) where κ is von Kármán constant and z0 id the roughness height and µ is a constant equals to 1 or 9. Integration of Equation (7.15) for the first layer at flow link j gives uj,1 u∗j = κ ∆zuj,1 + µz0 z0 z0 µ ln(µ) − 1 1+µ ln − ∆zuj,1 z0 ∆zuj,1 (7.16) Considering z0 /∆zuj,1 to be small, the bed shear velocity will be uj,1 u∗ ≈ ln κ ∆zuj,1 + µz0 ez0 (7.17) Then the shear velocity is derived as u∗j = κ ln ∆zuj,1 +µz0 ez0 √ uj,1 = uj,1 cf (7.18) The bed shear stress is defines as τ = ρu∗2 . However, different forms of log-law functions are used in D-Flow FM. The calculation of the bed shear stress is given in Algorithm (47). Remark 7.4.1. The log-law wall function is valid for fully developed flow. The bed shear stress under fully developed flow is lower than that of non-developed flow. Therefore, Equation (7.18) underestimates the bed friction for unstationary flows. 7.5 Temporal discretization Similar to the 2D part, the spatial discretization in 3D is also performed in a staggered manner. The velocity normal components uj,l are defined at the cell faces (j, l), with face normal vector nj,l , and the water levels ζk at cell centers k . If advection and diffusion are spatially Deltares 97 of 152 D-Flow Flexible Mesh, Technical Reference Manual discretized as in Equation (7.13) then the temporal discretization of Equation (7.5) is ∂u 1 +Advec + [ωz (uz2 − u) − ωz1 (uz1 − u)] ∂t ∆z 2 ∂ζ 1 ∂u 1 ∂u =−g + νV − νV ∂x ∆z ∂z z2 ∆z ∂z z1 (7.19) Remark 7.5.1. Note that in D-Flow FM the second term in the vertical diffusion term, namely νH δz • ∇u is neglected in. It is done for simplification of the discretization. However, this term becomes important in when the layer-level gradient is large, and neglecting this term may cause large error. After substitution of Advec from Equation (7.13) and discretize the other terms implicitly, it yields the following discretized form of equation DR AF T 1 n+1 n+1 0 n+1 0 n+1 0 0 u + Ai j,l un+1 j,l + Ae j,l + ω2 uz2 − ω1 uz1 − (ω2 − ω1 ) uj,l ∆t j,l g (1 − θ ) gθj n+1 1 n j uj,l − ζR(j) − ζLn+1 − ζRn(j) − ζLn(j) = (j) ∆t ∆xj ∆xj n+1 n+1 n+1 0 +ν2 uj,l+1 − uj,l − ν10 un+1 j,l − uj,l−1 (7.20) where uz1 and uz2 are the upwinded velocities, ω10 = ωz1 /∆zj,l , ω20 = ωz2 /∆zj,l , ν10 = ν1 /zj,l ∆z1 and ν20 = ν2 /zj,l ∆z2 , ∆z1 = (zj,l + zj,l−1 )/2 and ∆z2 = (zj,l + zj,l+1 )/2. ν1 and ν2 are the vertical eddy diffusivity at the top and the bottom of the velocity control volume, respectively. Applying a first order upwind scheme, Equation (7.20) can be reformed as follows gθj n+1 n+1 n+1 ζR(j) − ζLn+1 + al un+1 j,l−1 + bl uj,l + cl uj,l+1 = dl (j) ∆xj where al = − max (ω10 , 0) − ν10 1 + Ai j,l + max (ω20 , 0) − min (ω10 , 0) − (ω20 − ω10 ) + ν20 + ν10 bl = ∆t cl = min (ω20 , 0) − ν20 g (1 − θj ) n 1 n uj,l − ζR(j) − ζLn(j) dl = ∆t ∆xj (7.21) (7.22) (7.23) (7.24) (7.25) Remark 7.5.2. in D-Flow FM the discretization of vertical convection is also done by central scheme (javau = 4). It is found that the central scheme may lead to instabilities. Remark 7.5.3. In D-Flow FM the vertical advection can be switched off by using javau = 0. However, switching off the vertical advection may lead to non-physical results. We write Equation (7.20) in a general form as n n+1 n+1 un+1 = −f ζ − ζ + ru nj,l u j,l j,l R(j) L(j) (7.26) Substituting Equation (7.26) in Equation (7.21) leads to the following relation for fu and ru h i gθj n+1 n+1 n+1 ζR(j) − ζLn+1 +a r − f ζ − ζ l uj,l−1 u j,l−1 (j) R(j) L(j) ∆xj h i n+1 n+1 +bl ruj,l − fu j,l ζR(j) − ζL(j) h i n+1 +cl ruj,l+1 − fu j,l+1 ζRn+1 − ζ = dl (j) L(j) 98 of 152 (7.27) Deltares Numerical schemes for three-dimensional flows Equation (7.27) needs to be satisfied for any given initial water level (e.g. ζR(j) = ζL(j) ) . Hence, this equation can be splitted to two equations. by making a homogeneous field and dropping the pressure terms, by substituting the derived equation from the previous step, and derive a second equation. Dropping the pressure terms in Equation (7.27) gives al ruj,l−1 + bl ruj,l + cl ruj,l+1 = dl (7.28) Substituting Equation (7.28) in Equation (7.27), leads to the following equation for fu al fu j,l−1 + bl fu j,l + cl fu j,l+1 = d0l (7.29) d0l = − gθj n+1 ζR(j) − ζLn+1 (j) ∆xj DR AF This procedure is presented in Algorithm (48). T where (7.30) Equation (7.28) and Equation (7.29) are tri-diagonal matrices for ru and fu , respectively. They are solved by Thomas Algorithm for tri-diagonal matrices (See Algorithm (49)) n n n+1 n+1 n+1 Algorithm 48 vertical_profile_u0: compute fu j,l and ru n j,l in uj,l = −fu j,l (ζR(j,l) −ζL(j) )+ ru nj For each j : a = 0, b = 1/∆t, c = 0, d1 = unj,Lb (j) /∆t for l = 1 to M(j) − 1 do adv1 = max (ωl0 , 0) adv = − min (ωl0 , 0) T1 = (νt + adv1 )/∆zl+1 T2 = (νt + adv)/∆zl bl+1 = bl+1 + T1 al+1 = al+1 − T1 bl = bl + T2 cl = cl − T2 dl+1 = unj,l+1 /∆t end for for l = 1 to M(j) do bl = bl + Ai j,k dl = dl − Ae j,k − d0l = g (1 − θj ) n ζR(j) − ζLn(j) ∆xj gθj ∆xj end for Solve al ruj,l−1 + bl ruj,l + cl ruj,l+1 = dl by Algorithm (49) Solve al fu j,l−1 + bl fu j,l + cl fu j,l+1 = d0l by Algorithm (49) Deltares 99 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 49 tridag: compute tridiagonal matrix of ai ui−1 + bi ui + ci ui+1 = di β = b1 u1 = d1 /β for i = 2 to n step 1 do ci−1 β β = bi − ai ei di − ai ui−1 ui = β ei = ui = ui − ei+1 ui+1 , i = n − 1, n − 2, ..., 1 DR AF The continuity equation is discretized as T end for X M(j) X Vkn+1 − Vkn n =− Au nj,l θj un+1 + (1 − θ ) u j j,l sj,k j,l ∆t l=1 (7.31) j∈J (k) where Vkn+1 is the volume of the water column at base cell k and Auj,l approximates the flow area of face j, l Auj,l = ∆zj,l wj (7.32) with ∆zj,l is the distance between two layers l and l − 1 related to base link j , wj is the width of base link j . Subsitution of Equation (7.26) in Equation (7.31) yields the following equation. X M(j) X X M(j) X Vkn+1 − Vkn n n+1 n n+1 Au j,l θj fu j,l ζk − Au nj,l θj fu nj,l ζO(k,j) + ∆t l=1 l=1 j∈J (k) j∈J (k) X M(j) X =− Au nj,l (1 − θj ) unj,l + θj ru nj,l sj,k (7.33) j∈J (k) l=1 Equation (7.31) can be summarized as X M(j) X Vkn+1 − Vkn n+1 n n+1 + Bk ζk + Cjn ζO(k,j) = dnk ∆t l=1 (7.34) j∈J (k) where Bkn (diagonal entries), Cjn (off-diagonal entry) and dn k (right-hand side) are computed by Algorithm (50). In order to solve Equation (7.34), we need to express Vkn+1 in the terms of ζkn+1 . Since this relation is non-linear, Equation (7.34) is solved iteratively by means of Newton iterations. After linearizion of the volume, we have n+1(p+1) Vk 100 of 152 n+1(p) = Vk n+1(p) + Ak n+1(p+1) ζk n+1(p) − ζk (7.35) Deltares Numerical schemes for three-dimensional flows Algorithm 50 s1ini: compute the matrix entries and right-hand side in the water level equation Vkn+1 −Vkn ∆t + Bkn ζkn+1 + P n+1 Cjn ζO(k,j) = dnk , Equation (7.34) j∈J (k) M(j) Cjn =− X Au nj,l θj fu nj,l l=1 Bkn X =− Cjn j∈J (k) dnk X M(j) X =− Au nj (1 − θj )unj + θj ru nj sj,k n+1(p) T j∈J (k) l=1 where Ak is the wet bed area of cell k at (iterative) time level n + 1(p). Substituting Equation (7.35) into Equation (7.34), yields n+1(p) n+1(p+1) ζk Br k + X n+1(p+1) Crnj ζO(k,j) = drn+1(p) k DR AF j∈J (k) (7.36) the form of Equation (7.36) is identical with that of Equation (6.105) in 2D. Hence, the coefficients Brnk , Crnk and dn rk are computed at the same way of 2D, shown in Algorithm (18). Similar to 2D, the unknown water levels k ∈ K are solved with Krylov solver (see section 6.3.1). The time step is finalized by employing Equation (7.26) back for un+1 as it is shown in Algorithm (51). Moreover, the velocities and the discharge are integrated over depth. n+1 Algorithm 51 u1q1: update velocity un+1 and qa n+1 j j,k and discharges qj n if hu j > 0 then n n+1 n+1 n un+1 j,l = − fu j,l (ζR(j) − ζL(j) ) + ru j,l n+1 n qj,l =Au nj,l θj un+1 j,l + (1 − θj )uj,l n n+1 qa n+1 j,l =Au j,l u M(j) n+1 qj,0 = X n+1 qj,l l=1 M(j) qa n+1 j,0 = X qa n+1 j,l l=1 M(j) Au n+1 j,0 = X Au n+1 j,l l=1 n+1 n+1 un+1 j,0 =qj,0 /Au j,0 end if 7.6 Vertical fluxes In order to solve the vertical advection in Equation (7.19), the values of ωz1 and ωz2 needs to be calculated. In D-Flow FM the vertical fluxes are evaluated as the superposition of two effects. Deltares 101 of 152 D-Flow Flexible Mesh, Technical Reference Manual 1 Mass balance for each cell 2 The vertical motion of the water surface. If qH describes the sum of horizontal fluxes, then δqH k,l = − X qj,l sj,k + δqz k,l (7.37) j∈J (k) where δqH k,l = qH k,l − qH k,l−1 is the vertical flux passing through the interface (k, l), and δqz k,l is the vertical flux from cell (k, l) under effect of vertical motion of the free surface. T The difference in the horizontal fluxes has to be compensated via the vertical fluxes by δqH k,l = −δqV k,l (first under assumption δqz k,l = 0). As there is no vertical flux through the bed (zero flux), the calculation of the flux starts from the first layer, and is advanced to the upper layers. DR AF The change of the water level (and the vertical location of layers) induces extra vertical fluxes through layer interfaces. This flux is equal to the rate of volume which passes through the interface, because of its motion. This flux is equal to n+1 n zk,l − zk,l qσ = A(Ωk ) ∆t (7.38) where zk,l is the vertical position of the interface (k, l). Note that this flux does not effect the value of the vertical velocity of the flow. The calculation of the vertical fluxes and velocities is described in Algorithm (52). Algorithm 52 u1q1: calculate the vertical fluxes qH n if hu j > 0 then qH k,0 = 0 for l = 1 to N (k) do δqV k,l = − X qj,l sj,k j∈J (k) δqH k,l = − δqV k,l qH k,l =qH k,l−1 + δqH k,l ωk,l =ωk,l−1 + δqH k,l /A (Ωk ) qH k,l =qH k,l − A(Ωk ) end for end if n+1 n zk,l − zk,l ∆t Remark 7.6.1. In the calculation of the fluxes, by marching, along the water column from the bottom to the top, the fluxes on the water surface will not be equal to zero. The error in the vertical flux on the water surface is supposed to be small, and it is neglected. Hence, the procedure is not fully mass conservative. 7.7 Turbulence closure models In D-Flow FM four types of turbulence closure models are employed. 1 Constant coefficient model 102 of 152 Deltares Numerical schemes for three-dimensional flows 2 Algebraic eddy viscosity closure model 3 k -ε turbulence model 4 k -τ turbulence model At the first model, the eddy viscosity is a user defined constant. The three last models are based on the so-called eddy viscosity concept of Kolmogorov and Prandtl. The eddy viscosity is related to a characteristic length scale and velocity scale. The common target of this models is to find the eddy viscosity νV . 7.7.1 Constant coefficient model 7.7.2 Algebraic eddy viscosity closure model T This model is the simplest closure based on a constant value which has to be specified by the user. We remark that a constant eddy viscosity will lead to parabolic vertical velocity profile as laminar flow. DR AF The algebraic eddy viscosity model does not involve transport equations for the turbulent quantities. This so-called zero order closure scheme consists of algebraic formulation. This model uses analytical formulas to determine L and νV . zuj L = zuj 1 − huj νV = Lu∗b κ (7.39) (7.40) with κ the von Kármán constant. For homogeneous flow this leads to a logarithmic velocity profile. The computation of νV is given in Algorithm (53). Algorithm 53 update_verticalprofiles: compute the vertical turbulent viscosity νV L = h̃uj,l Compute √ cf from Algorithm (47) √ u∗j = cf un+1 j,l νV = κLu∗j 7.7.3 k -ε turbulence model In the k -ε turbulence model, transport equations have to be solved for both the turbulent kinetic energy k and for the energy dissipation ε. The mixing length L is then determined from ε and k according to: √ k k . L = cD ε (7.41) The transport equations for k and ε are non-linearly coupled by means of their eddy diffusivity Dk , Dε and dissipation terms. The transport equations for k and ε are given by: ∂k ∂k ∂k ∂k ∂ ∂k +u +v +ω = Dk + Pk + Bk − ε (7.42) ∂t ∂x ∂y ∂z ∂z ∂z ∂ε ∂ε ∂ε ∂ε ∂ ∂ε ε2 +u +v +ω = Dε + Pε + Bε − c2ε (7.43) ∂t ∂x ∂y ∂z ∂z ∂z k Deltares 103 of 152 D-Flow Flexible Mesh, Technical Reference Manual with νmol νV + σmol σk νV Dε = σε Dk = (7.44) (7.45) In the production term Pk of turbulent kinetic energy, the horizontal gradients of the horizontal velocity and all the gradients of the vertical velocities are neglected. The production term is given by: " Pk = νV ∂u ∂z 2 + ∂v ∂z 2 # (7.46) νV ∂ρ ρσρ ∂z DR AF Bk = g T In stratified flows, turbulent kinetic energy is converted into potential energy. This is represented by a buoyancy flux Bk defined by: (7.47) with the Prandtl-Schmidt number σρ = 0.7 for salinity and temperature and σρ = 1.0 for suspended sediments. The production term Pε and the buoyancy flux Bε are defined by: ε Pε = c1ε Pk k ε Bε = c1ε (1 − c3ε ) Bk k (7.48) (7.49) with the calibration constants given by (Rodi, 1984): c1ε = 1.44, c2ε = 1.92, 0.0 c3ε = 1.0 (7.50) (7.51) unstable stratification (7.52) stable stratification The vertical eddy viscosity νV is determined, with L prescribed by Equation (7.41), by: √ k2 νV = c0µ L k = cµ ε (7.53) with cµ = cD c0µ . The k -ε equations are discretized explicitly in the horizontal direction and implicitly in the vertical direction. The variables k and ε are located at the base flow-link and on the interface of the layers. Figure 7.3 shows an schematic view of the control volume for k and ε. 104 of 152 Deltares Numerical schemes for three-dimensional flows k1 ∆zj,l+1/2 ∆zj,l+1 k2 kj,l , εj,l j ∆zj,l (a) Top view (b) Side view T Figure 7.3: The top view (a) and the side view (b) of the location of the turbulence variables on the computational grid. Advection DR AF The horizontal advection term is discretized explicitly by means of first order upwind. The horizontal advection can be written in non-conservative form as u • (∇k) = ∇ • (uk) − k (∇ • u) (7.54) Integration of this term yields, Z Z Z ∇ (uk) dV − u (∇k) dV = • k (∇ • u) dV • V V Z Z A u (∇k) = • Z (uk) • ndA − u • (∇k) dV = V (7.55) V k (u • n) dA (7.56) A n+1 X kj,l 1 X n+1 n n+1 qj,l kj,l − qj,l V V (7.57) Diffusion The diffusion terms in equations Equation (7.42) and Equation (7.43) are discretized implicitly as, ∂ ∂z ∂τ Dk ∂z θDk1 θDk2 n+1 n+1 n+1 n+1 kj,l+1 − kj,l − kj,l − kj,l−1 ∆zj,l+1 ∆zj,l+1/2 ∆zj,l ∆zj,l+1/2 (1 − θ) Dk2 (1 − θ) Dk1 n n n n + kj,l+1 − kj,l − kj,l − kj,l−1 ∆zj,l+1 ∆zj,l+1/2 ∆zj,l ∆zj,l+1/2 ≈ (7.58) ∂ ∂z ∂ε Dε ∂z θDε2 θDε1 n+1 n+1 − εn+1 εn+1 j,l+1 − εj,l j,l − εj,l−1 ∆zj,l+1 ∆zj,l+1/2 ∆zj,l ∆zj,l+1/2 (1 − θ) Dε2 (1 − θ) Dε1 + εnj,l+1 − εnj,l − εnj,l − εnj,l−1 ∆zj,l+1 ∆zj,l+1/2 ∆zj,l ∆zj,l+1/2 ≈ (7.59) Deltares 105 of 152 D-Flow Flexible Mesh, Technical Reference Manual where indices 1 and 2 refer to the values on the bottom and the top of control volume, respectively. The production terms for k equation is then discretized as n+1 2 n+1 n+1 2 un+1 + vj,l+1 − vj,l j,l+1 − uj,l ∆zj,l+1/2 Pk ≈ νV (7.60) The dissipation term is a sink and the buoyancy term may act as a sink and can destabilize the system. In order to conserve a diagonal dominant matrix, a semi-implicit method (Patankar trick) is used to guarantee positivity of the numerical solutions. The discretized terms read εnj,l ≈ if B<0 if B≥0 (7.61) j,l Bk nj,l n+1 2εnj,l kj,ln − εnj,l k if k − ε j,l if k − τ DR AF n+1 kj,l n τj,l T Bk ≈ ( kn+1 2Bk nj,l kj,ln − Bk nj,l (7.62) The production in the ε equation is reformed by substituting Equation (7.53) in Equation (7.48). Pε = c1ε cµ n k Pk νV j,l (7.63) The discretization of the buoyancy term for the ε equation is similar to that of k equation: ensuring positivity by using Patankar trick as n Bε = c3ε cµ Bk kj,l (7.64) collecting all above-mentioned terms, in their discretized forms, leads to tridiagonal matrices for k and ε in the form of and n+1 n+1 n+1 al kj,l−1 + bl kj,l + cl kj,l+1 = dl (7.65) n+1 n+1 al εn+1 j,l−1 + bl εj,l + cl εj,l+1 = dl (7.66) which are solved by Thomas algorithm, with the following boundary conditions. The boundary conditions use the bed friction velocity, u∗b , and surface friction velocity, u∗t (caused by wind). u2∗ kj,0 = √ b , cµ ∂ε ∂z u2 kj,M(j) = √∗t cµ |u∗b |3 =− j,1/2 κ 1 ∆zj,1 2 + µz0 (7.67) 2 , ∂ε ∂z |u∗t |3 = j,M(j)−1/2 κ 2 1 ∆z j,M(j) 2 (7.68) where µ takes values of 1 (based on theoretical analysis) or 9 (based on measurements). Algorithm (54) and Algorithm (55) represent algorithms for k and ε equations, respectively. 106 of 152 Deltares Numerical schemes for three-dimensional flows Algorithm 54 update_verticalprofiles: compute the kinetic energy k for l = 1 to M(j) do ρz = 21 (ρz1 + ρz2 ) ν0 Bk = −g ρσVρ ρz 2 2 uj,l+1 −uj,l vj,l+1 −vj,l 0 0 Pk = νV ∆zj,l+1/2 + νV ∆zj,l+1/2 if k − ε then n Sk = εnj,l /kl,j β=2 else if k − τ then n Sk = 1/τj,l β=1 end if T D1 = Dkj,l−1/2 / ∆zj,l+1/2 ∆zj,l , D2 = Dkj,l+1/2 / ∆zj,l+1/2 ∆zj,l+1 νV0 = min (νv , νmin ) ρ (j),l+1 −ρR(j),l ρ (j),l+1 −ρL(j),l ρz1 = R∆z , ρz2 = L∆z R(j),l+1/2 L(j),l+1/2 DR AF al = −D1 θ − max (ω1 , 0)/∆zj,l+1/2 n bl = 1/∆t + (D1 + D2 )θ + 2 max(Bk , 0)/kj,l + βSk + max (ω2 , 0)/∆zj,l+1/2 − min (ω1 , 0)/∆zj,l+1/2 cl = −D2 θ + min (ω2 , 0)/∆zj,l+1/2 n n n n n dl = kj,l /∆t − D2 kj,l − kj,l+1 (1 − θ) + D1 kj,l−1 − kj,l (1 − θ) n + max(Bk , 0) − min(Bk , 0) + Pk + (β − 1)Sk kj,l − Akj,l end for Calculate u∗b by Algorithm (47) √ a0 = 0, b0 = 1, c0 = 0, d0 = u2∗b / cµ √ aM(j) = 0, bM(j) = 1, cM(j) = 0, dM(j) = u2∗t / cµ Solve al kl−1 + bl kl + cl kl+1 = dl by Algorithm (49) Algorithm 55 update_verticalprofiles: compute the energy dissipation ε for l = 1 to M(j) do D1 = Dεj,l−1/2 / ∆zj,l+1/2 ∆zj,l , D2 = Dεj,l+1/2 / ∆zj,l+1/2 ∆zj,l+1 νV0 = min (νv , νmin ) n Pε = c1ε cµ kj,l Pk /νV0 n+1 Bε = cµ c1ε kj,l min(Bk , 0) n+1 Sε = c2ε εnj,l /kj,l al = −D1 θ − max (ω1 , 0)/∆zj,l+1/2 bl = 1/∆t + (D1 + D2 )θ + 2Sε + max (ω2 , 0)/∆zj,l+1/2 − min (ω1 , 0)/∆zj,l+1/2 cl = −D2 θ + min (ω2 , 0)/∆zj,l+1/2 dl = εnj,l /∆t − D2 εnj,l − εnj,l+1 (1 − θ) + D1 εnj,l−1 − εnj,l (1 − θ) −Bε + Pε + Sε εnj,l − Aεj,l end for a0 = 0, b0 = 1, c0 = −1, d0 = ∆zj,1 max(u∗b , 0)3 /(κ∆( 21 zj,1 + µz0 )2 ) aM(j) = −1, bM(j) = 1, cM(j) = 0, dM(j) = 4 |u∗t |3 /(κ∆zj,M(j) ) Solve al εl−1 + bl εl + cl εl+1 = dl by Algorithm (49) Deltares 107 of 152 D-Flow Flexible Mesh, Technical Reference Manual k -τ turbulence model The time-scale of turbulence, τ , is defined by τ= k ε (7.69) The eddy viscosity then equals k2 = cµ kτ (7.70) ε where cµ = 0.09. The variable τ models a typical time-scale of turbulent eddies. The k − τ νV = cµ equations read where T ∂k ∂k ∂k ∂k ∂ ∂k k +u +v +ω = Dk + Pk + Bk − ∂t ∂x ∂y ∂z ∂z ∂z τ ∂τ ∂τ ∂τ ∂τ ∂ ∂τ +u +v +ω = Dτ + Pτ + Bτ − (1 − c2ε ) ∂t ∂x ∂y ∂z ∂z ∂z +Dkτ + Dτ τ + Dkk DR AF 7.7.4 νmol νV + σmol στ τ Pτ = (1 − c1ε ) Pk k τ Bτ = (1 − c3ε ) Bk k ∂τ ∂k 1 2 Dkτ = 2 Dτ h k ∂σ ∂σ 1 2 ∂τ ∂τ Dτ τ = − 2 Dτ h τ ∂σ ∂σ 1 τ ∂ 1 1 ∂k Dkk = − 2 − νV h k ∂σ σε σk ∂σ Dτ = (7.71) (7.72) (7.73) (7.74) (7.75) (7.76) (7.77) (7.78) The signs of the coefficients are so that the production term Pτ actually acts as sink of τ . This can be explained by realizing that production of dissipation ε results in a faster dissipation of turbulent eddies and therefore a smaller time-scale τ of turbulence. Even though Pτ acts as a sink, it will still be called a production term because of the parallels with the ε-equation. Likewise the dissipation term ετ is a source of τ . By substituting Equation (7.70) in Equation (7.74) for k , it changes to the following form Pτ = cµ c1τ Pk τ 2 νt (7.79) where c1τ = 1 − c1ε is a constant. This equation is linearized by Picard method as Pτ = cµ c1τ Pk τ n τ n+1 νt (7.80) Similar to the above expression, by substituting Equation (7.70) in Equation (7.75), the buoyancy term is changed to the following form Bτ = c3τ 108 of 152 cµ Bk τ 2 νt (7.81) Deltares Numerical schemes for three-dimensional flows where c3τ = 1 is for stable stratification and c = −0.44 is for unstable stratification. After linearization by Picard method, it yields Bτ = c3τ cµ n n+1 Bk τj,l τj,l νt (7.82) Bτ = c3τ cµ 2 n n+1 N τj,l τj,l στ (7.83) or and N2 = − g ∂ρ ρ0 ∂z (7.84) T The currently used values of c3τ for stable and unstable stratification guarantee that c3τ N 2 is positive under all conditions, hence c3τ < 0 if N 2 < 0 and c3τ > 0 if N 2 > 0. DR AF The diffusion terms Dτ τ and Dkτ are simplified by neglecting ν from the viscosity, as it is small compared with the eddy viscosity. By inserting Equation (7.70) into the equations for Dτ τ and Dkτ , it leads to the following form of equations Dτ τ = − Dkτ = 2cµ ∂τ k στ ∂z 2cµ ∂k τ στ ∂z ∂τ ∂z ∂τ ∂z (7.85) (7.86) By summing Equation (7.85) and Equation (7.85) we have, Dkτ + Dτ τ 2cµ = στ ∂τ ∂k −k τ ∂z ∂z ∂τ ∂τ =A ∂z ∂z (7.87) Equation (7.87) is an advection equation. This equation is discretized by means of first order upwind as follows. Dkτ + Dτ τ = max(A, 0) n+1 n+1 n+1 n+1 τj,l − τj,l−1 τj,l+1 − τj,l + min(A, 0) ∆zj,l ∆zj,l+1 (7.88) where A is discretized as, τj,l−1 + τj,l kj,l − kj,l−1 τj,l+1 + τj,l kj,l+1 − kj,l + 2 ∆zj,l 2 ∆zj,l+1 kj,l−1 + kj,l τj,l − τj,l−1 kj,l+1 + kj,l τj,l+1 − τj,l − − 2 ∆zj,l 2 ∆zj,l+1 cµ A≈ στ (7.89) In this analysis, the term of Dkk in Equation (7.73) is neglected. The vertical diffusion term (the first term in the right hand side of Equation (7.73)) is discretized implicitly by means of θ method. ∂ ∂z ∂τ Dτ ∂z θDτ 1 θDτ 2 n+1 n+1 n+1 n+1 − τj,l+1 − τj,l τj,l − τj,l−1 ∆zj,l+1 ∆zj,l+1/2 ∆zj,l ∆zj,l+1/2 (1 − θ) Dτ 2 (1 − θ) Dτ 1 n n n n + τj,l+1 − τj,l − τj,l − τj,l−1 ∆zj,l+1 ∆zj,l+1/2 ∆zj,l ∆zj,l+1/2 ≈ (7.90) Deltares 109 of 152 D-Flow Flexible Mesh, Technical Reference Manual Combining all equations together, it leads to the following equation for each computational cell n+1 n+1 n+1 al τj,l−1 + bl τj,l + cl τl+1 = dl (7.91) Marching in the vertical direction for each j location, it leads to a tridiagonal matrix (for each j ) which is solved by Thomas algorithm (see Algorithm (56)). The boundary conditions at the bed and water surface are applied as, a0 = 0, b1 = 1, aM(j) = 0, c0 = 0, bM(j) = 1, 9κz0 √ max(u∗b , 10−6 ) cµ = 0, dM(j) = 0 d0 = cM(j) T Remark 7.7.1. The Dkk term is neglected because it may cause numerical instabilities. If k goes to zero, then it follows from the positivity of k that ∂k/∂z also goes to zero. However, numerically ∂k/∂z is not necessarily small when k goes to zero, especially on coarse grids, and this term can grow to infinity. It is expected that this term is generally rather small because the factor 1/σε − 1/σk in front of the term is only 0.2 with the current parameter settings. Remark 7.7.2. The k -τ turbulence model is applied for the first time in Delft3D package and it still needs intensive verifications. DR AF Algorithm 56 update_verticalprofiles: compute the energy dissipation τ for l = 1 to M(j) do D1 = Dεj,l−1/2 / ∆zj,l+1/2 ∆zj,l , D2 = Dεj,l+1/2 / ∆zj,l+1/2 ∆zj,l+1 νV0 = min (νv , νmin ) n Pτ = (1 − c1ε ) cµ τj,l Pk /νV0 n Bτ = c3τ cµ Bk τj,l n n n n α1 = kj,l−1 + kj,l τj,l − τj,l−1 / (2∆zj,l ) n n n n α2 = kj,l+1 + kj,l τj,l+1 − τj,l / (2∆zj,l+1 ) Dτ τ = cµ (α1 + α2 ) /στ n n n n β1 = τj,l−1 + τj,l kj,l − kj,l−1 / (2∆zj,l ) n n n n β2 = τj,l+1 + τj,l kj,l+1 − kj,l / (2∆zj,l+1 ) Dkτ = cµ (β1 + β2 ) /στ D = (Dτ τ − Dkτ ) /∆zj,l+1/2 al = −D1 θ − max(D, 0) − max (ω1 , 0)/∆zj,l+1/2 bl = 1/∆t + (D1 + D2 )θ − Bτ − Pτ + max(D, 0) − min(D, 0) + max (ω2 , 0)/∆zj,l+1/2 − min (ω1 , 0)/∆zj,l+1/2 cl = −D2 θ + min(D, 0) + min(ω2 , 0)/∆zj,l+1/2 n n n n n dl = τj,l /∆t − D2 τj,l − τj,l+1 (1 − θ) + D1 τj,l−1 − τj,l (1 − θ) −(1 − c2ε ) − Aεj,l end for Calculate u∗ by Algorithm (47) √ a0 = 0, b1 = 1, c0 = 0, d0 = 9κz0 / max(u∗b , 10−6 ) cµ aM(j) = 0, bM(j) = 1, cM(j) = 0, dM(j) = 0 Solve al τl−1 + bl τl + cl τl+1 = dl by Algorithm (49) 7.8 Baroclinic pressure Under the shallow-water assumption, the vertical momentum equation is reduced to a hydrostatic pressure equation. Vertical accelerations due to buoyancy effects and due to sudden variations in the bottom topography are not taken into account. So: ∂P = −gρ ∂z 110 of 152 (7.92) Deltares Numerical schemes for three-dimensional flows After integration between two successive layers, in the vertical direction, the hydrostatic pressure is Z ∆zl ρ(z)dz P (z) = P2 + g (7.93) 0 where P2 is the pressure on the upper layer level. The local density is related to the values of temperature and salinity by the equation of state. The density is assumed to change linearly at each flow cell, along the layer in the vertical direction. The density can be described as ρ(z) = ρ2 + αz , with α = (ρ1 − ρ2 ) /∆zl , where ρ1 and ρ2 are the densities on the top and bottom of the flow cell, respectively. After substitution of this relation in Equation (7.93) and integration , it gives, 1 P (z) = P2 + g ρ2 ∆zl + α∆zl2 2 (7.94) T The force on the flow is derived by integration of the pressure in the vertical direction. Z ∆zl P (z)dz F (z) = DR AF 0 (7.95) Subsituting Equation (7.95) in Equation (7.94) gives, 1 1 F (z) = P2 ∆zl + gρ2 ∆zl2 + gα∆zl3 2 6 (7.96) Remark 7.8.1. For integration of Equation (7.94) and Equation (7.95), the vertical coordinate is locally set starting from the top of the cell (on the layer) toward downward. The merely of this method is to calculate F (z) at the cells between the layers, and integrate the force from the water surface to the cell levels. Once it is done, the forces around the control volume are integrate. This method is applied in Algorithm (57). Deltares 111 of 152 D-Flow Flexible Mesh, Technical Reference Manual Algorithm 57 addbaroc2: compute the baroclinic pressure along σ -layers First, extrapolate the density on the water surface ∆zL(j),M(j)−1 ∆zL(j),M(j) + ∆zL(j),M(j)−1 ∆zR(j),M(j)−1 βR = ∆zR(j),M(j) + ∆zR(j),M(j)−1 ρ̃L,M(j) = (1 + βL ) ρL(j),M(j) − βL ρL(j),M(j)−1 ρ̃R,M(j) = (1 + βR ) ρR(j),M(j) − βR ρR(j),M(j)−1 βL = for l = M(j) − 1 to 1 step −1 do ∆zL(j),l ∆zL(j),l + ∆zL(j),l+1 ∆zR(j),l βR = ∆zR(j),l + ∆zR(j),l+1 ρ̃L,l =βL ρL(j),l + (1 − βL ) ρL(j),l+1 ρ̃R,l =βR ρR(j),l + (1 − βR ) ρR(j),l+1 DR AF T βL = end for for l = M(j) to 1 step −1 do αL = ρ̃L,l−1 − ρ̃L,l ρ̃R,l−1 − ρ̃R,l , αR = ∆zL(j),l ∆zR(j),l M(j) PL =g X 1 1 ρ̃L,l0 ∆zL(j),l0 + αL ∆zL2(j),l0 2 6 l0 =l M(j) PR =g X 1 1 ρ̃R,l0 ∆zR(j),l0 + αR ∆zR2 (j),l0 2 6 l0 =l 1 1 GL =PL ∆zL(j),l + ρ̃L,l ∆zL2(j),l + αL ∆zL3(j),l 2 6 1 1 GR =PR ∆zR(j),l + ρ̃R,l ∆zR2 (j),l + αR ∆zR3 (j),l 2 6 1 ρ̃j,l = ρ̃L(j),l + ρ̃L(j),l−1 + ρ̃R(j),l + ρ̃R(j),l−1 4 M(j) X GB = zL(j),l−1 − zR(j),l−1 ρ̃j,l0 ∆zj,l0 l0 =l GT = zL(j),l − zR(j),l M(j) X ρ̃j,l0 ∆zj,l0 l0 =l+1 δPl =GL − GR + GB − GT 1 Vρ = ∆zL(j),l (ρ̃L,l + ρ̃L,l−1 ) + ∆zR(j),l (ρ̃R,l + ρ̃R,l−1 ) 4 ∆P =δPl /Vρ end for 112 of 152 Deltares Numerical schemes for three-dimensional flows 7.9 Artificial mixing due to σ -coordinates The fluxes of the transport equations consist of both advective and diffusive fluxes. In sigma co-ordinates the approximation of the advective fluxes does not introduce large truncation errors. Therefore in this section we consider only diffusive fluxes given by Fi = DH ∂c , ∂xi i = 1, 2; F 3 = DV ∂c ∂x3 (7.97) where DH , denotes the horizontal eddy diffusion coefficient and DV denotes the vertical eddy diffusion coefficient. 7.9.1 DR AF T It is difficult to find a numerical approximation that is stable and positive. Near steep bottom slopes or near tidal flats where the total depth becomes very small, truncations errors in the approximation of the horizontal diffusive fluxes in σ -coordinates are likely to become very large, similarly to the horizontal pressure gradient. Thus a complete transformation must be included. However, in that case numerical problems are encountered concerning accuracy, stability and monotonicity. In D-Flow FM a method is applied which gives a consistent, stable and monotonic approximation of the horizontal diffusion terms even when the hydrostatic consistency condition is violated. For details we refer the user to Stelling and Van Kester (1994) A finite volume method for a σ -grid Applying the Gauss theorem to the transport equation yields ∂ ∂t I Z F • n ds = 0 c dv + (7.98) s v Instead of transforming the transport equation to σ -co-ordinates, we generate a sigma grid by choosing a distribution of the vertical co-ordinate sigma. The vertical diffusive fluxes are straightforward to implement. The only difficulty is the approximation of the horizontal diffusive fluxes. To explain this method, it is sufficient to consider a simplified one-dimensional heat equation (i.e. a transport equation without advection in one dimension) ∂ ∂c (x, z, t) − ∂t ∂x ∂c (x, z, t) DH =0 ∂x (7.99) For this equation a finite volume method has to be constructed that meets the following requirements: 1 consistent approximation of the horizontal diffusive fluxes 2 fulfilment of the min-max principle 3 minimal artificial vertical diffusion A non-linear approach is chosen which consists of the following steps. Step 1 First, diffusive fluxes fi+ 1 ,l+ 1 , l = 0, . . . , 2K (K is the σ -layer number), are defined 2 2 according to fi+ 1 ,l+ 1 = 2 2 zi+ 1 ,l+1 −zi+ 1 ,l 2 2 D min (∆ c, ∆ c) , H m n xi+1 −xi DH max (∆m c, ∆n c) 0, zi+ 1 ,l+1 −zi+ 1 ,l 2 xi+1 −xi 2 , if ∆m c > 0 ∧ ∆n c > 0 if ∆m c ≤ 0 ∧ ∆n c ≤ 0 if ∆m c∆n c < 0 (7.100) Deltares 113 of 152 D-Flow Flexible Mesh, Technical Reference Manual The differences ∆m/n c = ∆m/n ci+ 1 ,l+ 1 are given by (l = 0, . . . , 2K ) 2 fi+ 1 ,l+ 1 2 2 ( ∆m ci+ 1 ,l+ 1 = ci+1 zi,m(l) − ci,m(l) 2 2 = ∆n ci+ 1 ,l+ 1 = ci+1,n(l) − ci zi+1,n(l) 2 2 (7.101) 2 where ci (z) is a simple linear interpolation formula given by ci,1 , if z ≤ zi,1 z−zi,k c zi,k+1 −zi,k i,k+1 ci (z) = + zi,k+1 −z c , zi,k+1 −zi,k i,k c , i,K if zi,k < z ≤ zi,k+1 (7.102) if z ≥ zi,K Step 2 X n+1 n+1 n n Vi,k ci,k = Vi,k ci,k − ∆t T In this step the diffusive fluxes are added to the appropriate control volumes according to n fi+ + ∆t 1 ,l+ 1 2 ∀l|m(l)=k 2 X n fi− 1 ,l+ 1 2 (7.103) 2 ∀l|n(l)=k 7.9.2 DR AF where n is the time index, t = n∆t and V n denotes the size of the control volume. The absence of advection implies V n = V n+1 Approximation of the pressure term The horizontal gradients of the pressure must be approximated for the horizontal momentum equations. The pressure gradient must be computed along the same verticals as the horizontal concentration gradients. The pressure p in Cartesian coordinates is given by ζ Z ρ (x, z 0 , t) gdz 0 p (x, z) = (7.104) z From the Leibniz rule it follows that ∂p/∂x is given by ∂ ∂p = ∂x ∂x ζ(x) Z 0 0 Z ζ(x) ρ (x, z ) gdz = g z z ∂ ∂ζ ρ (x, z 0 ) dz 0 + gρ (ζ) ∂x ∂x (7.105) The relation between the density ρ and the salinity s and temperature T is given by the equation of state, namely ρ = ρ (s(x, t), T (x, t)). The integral in Equation (7.105) is replaced by a summation over the intervals which are in the water column above the velocity point with vertical co-ordinate z . ∂p ∂x xi+ 1 ,z 2 2K+1 X f (s) ∂ρ f (T ) =g + D ∂T DH i+ 1 ,l+ 1 H l=K+1 2 2 zi+ 1 ,k+1 − z ∂ρ f (s) ∂ρ f (T ) 2 +g + zi+ 1 ,k+1 − zi+ 1 ,k ∂s DH ∂T DH i+ 1 ,k+ 1 ∂ρ ∂s 2 where k = max l|zi+ 1 ,l 2 114 of 152 ζi+1 − ζi + gρ ∆xε ∧ not repeat time-step ∨ i = 0 do i=i+1 n n compute the matrix entries Br n k , Cr j and right-hand side dr k in the water-level equation with Algorithm (18) n+1(i+1) parallel solve the unknown water-levels and obtain ζk n+1(i−1) update all ghost water-levels ζk , see section 8.1.5 , k ∈ Gsall check positivity of water level with Algorithm (19) and repeat time-step if necessary n with modified ∆t (type 1) or hu j (type 2, default) reduce ’repeat time-step’ if not repeat time-step then n+1(i+1) compute water-column volume Vk rithm (20) n+1(i) reduce max ζk k n+1(i+1) and wet bed area Ak with Algo- n+1(i−1) − ζk end if end while end while end while n+1(i+1) ζkn+1 = ζk compute velocities un+1 , j update ghost velocities un+1 , k ∈ Gu j and compute dis- charges qjn+1 and qa n+1 at the next time level, Algorithm (61) j 120 of 152 Deltares Parallelization Algorithm 61 parallel u1q1: update velocity un+1 , and com, update ghost velocities un+1 j j pute discharges qjn+1 and qa n+1 ; parallel-specific statements are outlined j n if hu j > 0 then n+1 n+1 − ζL(j) ) + ru nj ujn+1 = −fu nj (ζR(j) else un+1 =0 j end if update ghost velocities un+1 , j ∈ Gu j n if hu j > 0 then qjn+1 =Au nj θj un+1 + (1 − θj )unj j else qjn+1 =0 qa n+1 =0 j (8.8) (8.9) DR AF end if 8.1.5.1 (8.7) T qa n+1 =Au nj un+1 j (8.6) parallelized Krylov solver The (reduced) global system to be solved has the form of A[0,0] ··· A[0,N −1] s[0] .. . .. .. . .. . A [N −1,0] . ... A [N −1,N −1] s [N −1] = d[0] .. . , [N −1] (8.10) d where the superscript [id] indicates the domain number. A matrix-vector multiplication can be written as .. . A[id,id] s[id] + P A[id,jd] s[jd] , jd6=id .. . where the diagonal diagonal contribution is computed as in the sequential case, see Equation (6.116), however for the internal unknowns only .. . A [id,id] [id] s P [id] [id] [id] [id] Br k sk + C s r j O(k,j) = [id] [id] j∈J (k)\Gs (8.11) .. . [id] and the off-diagonal contributions are computed by means of the ghost values Gs .. . P [id] [id] Cr j sO(k,j) , A[id,jd] s[jd] = [id] [id] j∈J (k)∩Gs jd6=id X (8.12) .. . [id] provided that the ghost values Gs Deltares are up-to-date . 121 of 152 D-Flow Flexible Mesh, Technical Reference Manual Remark 8.1.4. Equation (8.10) shows that water-level unknowns in Ss are required for the global matrix-vector multiplication. For that reason, they are disregarded in the Maximum Degree algorithm and will never be eliminated from the solution vector s. The system is solved by a parallelized preconditioned Conjugate Gradient method of Algorithm (24), as shown in Algorithm (62), where we consider one subdomain id only and have dropped the superscript [id]. The parallel extensions are trivial, except for the preconditioner P that is. We apply a non-overlapping Additive Schwarz MILU factorization and precondition(i+1) = r (i+1) can then be expressed as X [id] P [id] z (i+1)[id] = r − A[id,jd] z (i)[id] , r r ing P z r (8.13) jd6=id 8.1.5.2 T where P [id] approximates A[id,id] . We use a MILU factorization available from SPARSKIT, Saad (1994). PETSc solver 8.2 DR AF As an alternative to the parallelized sequential Krylov solver, as explained in the foregoing, we can apply a solver from the Portable, Extensible Toolkit for Scientific Computation (PETSc), Balay et al. (2013). We use default settings. Test-cases In this section two test-cases are considered. To assess the scalability of the parallel implementation, the computing time is measured for decompositions with varying number of subdomains. We measure the wall-clock times spent in the time-steps. This does not include file output for post-processing. At prescribed modelling-time instances, computing times are measured and summed (in time) by each subdomain. The maximum computing times over all the subdomains are used to determine a time-step average during a measurement interval, i.e. max Ttime-step k = d nk P ∆Tid − max d i=1 nk − nk−1 nP k −1 i=1 ∆Tid , (8.14) where ∆Tid is the wall-clock computing time of time-step i and subdomain d, k is a measurement index and n is the number of time steps. We will refer to this time as the time-step averaged wall-clock time of a "time-step". The time-step wall-clock time is further divided into MPInon-sol : MPI-communication time not related to the Krylov solver. These are the update of the ghost-values Gsall and Gu , respectively and the reduction of the variables as indicated in Algorithm (60), solver: total Krylov solve time. This is the time spent by the Krylov solver, including MPIcommunication, MPIsol : MPI-communication time in the Krylov solver. Unfortunately, no such times are available for the PETSc solver, #Krylov iterations: the time-step averaged number of iterations needed for the Krylov solver to converge. We expect that the non-communication times will show nearly linear scalability and foresee that the communication times behave much worse. Furthermore, if the precondition becomes 122 of 152 Deltares Parallelization Algorithm 62 conjugategradient_MPI: solve water-level equation with a preconditioned Conjugate Gradient method; parallel specific statements are outlined compute preconditioner P update ghost values ζk , k ∈ Gs compute initial residual r (0) = d − As(0) compute maximum error ε = kr (0) k∞ update ghost residuals rk , k ∈ Gs (0) set p (0) (0) zr = compute inner product reduce inner product D D r (0) (0) , zr (0) r (0) , z r E E DR AF reduce maximum error ε = kr (0) k∞ T = r (0) apply preconditioner P z r i=0 while ε > tol do update ghost values pk , k ∈ Gs compute Ap(i) compute p(i) , Ap(i) reduce p(i) , Ap(i) D E r (i) ,z r(i) (i) α = p(i) ,Ap(i) i h (i+1) (i) s = s + α(i) p(i) (i+1) r = r (i) − α(i) Ap(i) compute maximum error ε = kr (i+1) k∞ ε = kr (0) k∞ reduce maximum error ε = kr (0) k∞ update ghost values r (i+1) , k ∈ Gs (i+1) apply preconditioner P z r = r (i+1) if ε > tol then D E (i+1) (i+1) compute r , zr reduce β (i+1) D r (i+1) , z r E D E (i+1) r (i+1) ,z r(i+1) = D (i) (i) E r ,z r (i+1) p(i+1) = z r i=i+1 + β (i+1) p(i) end if end while Deltares 123 of 152 D-Flow Flexible Mesh, Technical Reference Manual less effective when the number of subdomains increases, the number of iterations will increase. The speed-up factor f can now be defined as: fk (N ) = Ttime-step k Ttime-step k N N, (8.15) ref where N is the number of subdomains and ref refers to a reference domain decomposition, for which we take the decomposition with the smallest number of subdomains available. Note that we do not compare with the single-domain, sequential simulations. T The simulations were conducted on the Deltares h4 cluster and the Lisa cluster at SURFsara, see Lisa. For all our simulations, we took four cores per node. Remark 8.2.1. Wall-clock times on Lisa were limited to 2.5 hours, so, depending on the number of subdomains, some simulations advanced further in modelling time than others. 8.2.1 DR AF For our comparison, we will always compare time-step averaged computing times at the same modelling times. Schematic Waal model The first test-case under considerations is the schematic Waal model, see Yossef and Zagonjoli (2010). The model has a rectangular domain of length 30 km and width 1800 m. It has a deep center section of width 600 m and bottom levels varying from 0.795 (left) to −2.205 m (right). The shallow outer part has a bottom level varying from 6.988 (left) to 3.988 m (right). The mesh size in the deep, center part is 2 × 2 m2 and in the shallow outer part 2 × 4 m2 . The total number of cells is 9 000 000. The maximum time step is 0.45 sec. The domain is decomposed in 8, 16, 32, 64 and 128 subdomains, respectively. The partitioning is depicted in Figure 8.3. Timing results on the SURFsara Lisa cluster are presented in Table 8.2 and the corresponding speed-up factor in Figure 8.4. The results on the Deltares h4 cluster are shown in Table 8.3 and Figure 8.5 respectively. Recall that the wall-clock computing time on Lisa was limited to 2.5 h, see Remark 8.2.1. The results show that the speed-up factor with 128 subdomains is 108.66 on the Lisa cluster and 85.1 on the Deltares h4 cluster. This is a factor of 0.84, respectively 0.67 away from their theoretical maximum. The reduced scaling on the h4 may be attributed to the poorer scaling of the Krylov solver on the h4, due to communication overhead. It is interesting to see that the number of iterations of the Krylov solver does not increase significantly when the number of subdomain is increased. We do therefore not expect the preconditioner to have lost its effectiveness. On the other hand, a more advanced preconditioner should reduce the number of iterations in all cases and consequently the communication overhead, especially for large numbers of subdomains. 8.2.2 esk-model 124 of 152 Deltares Parallelization (a) 8 subdomains (b) 16 subdomains T (c) 32 subdomains DR AF (d) 64 subdomains (e) 128 subdomains Figure 8.3: Partitioning of the schematic Waal model with METIS Table 8.2: time-step averaged wall-clock times of the Schematic Waal model; Lisa; note: MPI communication times are not measured for the PETSc solver #dmns 8 16 32 64 128 Deltares t [h] 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 time step [s] 3.24200 MPInon-sol [s] 0.07037 solver [s] 1.29400 MPIsol [s] 0.00000 #Krylov-iters 15.06000 1.64950 1.62100 0.03644 0.02498 0.64200 0.62600 0.00000 0.00000 16.01500 15.00000 0.87400 0.87000 0.84851 0.03441 0.03687 0.03394 0.34975 0.34800 0.32426 0.00000 0.00000 0.00000 16.84500 16.00000 14.14356 0.44050 0.44950 0.42673 0.41782 0.01904 0.01983 0.01962 0.01906 0.18345 0.17100 0.16139 0.15347 0.00000 0.00000 0.00000 0.00000 17.22000 16.00000 14.25248 13.20792 0.23870 0.22450 0.21733 0.21436 0.21733 0.01792 0.01344 0.01334 0.01332 0.01352 0.09415 0.09075 0.08361 0.08069 0.08020 0.00000 0.00000 0.00000 0.00000 0.00000 17.03000 16.00000 14.17327 13.09901 13.00000 125 of 152 D-Flow Flexible Mesh, Technical Reference Manual 16 32 64 128 t [h] 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 time step [s] 3.74800 3.74000 3.62376 3.56436 3.56931 1.91550 1.88450 1.84158 1.81188 1.79703 1.01650 1.01300 0.96535 0.95050 0.95050 0.56200 0.54450 0.53465 0.50990 0.51485 0.35225 0.34550 0.32228 0.30941 0.31040 MPInon-sol [s] 0.05160 0.05333 0.05163 0.05029 0.05019 0.04459 0.04294 0.04365 0.04255 0.04414 0.05025 0.06046 0.04963 0.04990 0.04960 0.03892 0.03161 0.03145 0.03226 0.03446 0.03553 0.03375 0.03249 0.03199 0.03188 solver [s] 1.31350 1.31050 1.19802 1.13861 1.13861 0.69650 0.66700 0.61881 0.59406 0.57426 0.39900 0.38300 0.34703 0.33020 0.33416 0.23580 0.22550 0.21634 0.19158 0.19307 0.17490 0.17005 0.14703 0.13465 0.13812 MPIsol [s] 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 #Krylov-iters 15.06000 15.00000 13.00000 12.00990 12.06436 16.01500 15.00000 13.43564 12.63861 12.03960 16.84500 16.00000 14.10396 13.00990 13.00000 17.41000 16.61000 14.88614 13.14851 13.20297 17.03000 16.00000 14.18317 13.04950 13.0099 DR AF #dmns 8 T Table 8.3: time-step averaged wall-clock times of the Schematic Waal model; h4; note: MPI communication times are not measured for the PETSc solver 126 of 152 Deltares Parallelization t [h] 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 time step [s] 2.85100 2.85000 2.73762 2.68317 2.68812 1.49700 1.47000 1.41584 1.39604 1.38614 0.75100 0.73850 0.71535 0.69802 0.70297 0.38245 0.37900 0.35941 0.36386 0.34851 0.19340 0.18550 0.18119 0.17723 0.17673 MPInon-sol [s] 0.03012 0.03273 0.02946 0.03151 0.03118 0.01458 0.01882 0.01454 0.01439 0.01494 0.02350 0.02326 0.02308 0.02249 0.02239 0.01719 0.01764 0.01667 0.02118 0.01580 0.01688 0.01454 0.01455 0.01499 0.01435 solver [s] 1.15250 1.14950 1.04455 0.99505 0.99505 0.63950 0.61200 0.56238 0.54455 0.52970 0.32120 0.31000 0.28564 0.27129 0.27129 0.16115 0.15610 0.14059 0.13960 0.13020 0.07790 0.07245 0.06812 0.06436 0.06337 MPIsol [s] 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 DR AF #dmns 8 T Table 8.4: time-step averaged wall-clock times of the Schematic Waal model; SDSC’s Gordon; note: MPI communication times are not measured for the PETSc solver 16 32 64 128 Deltares #Krylov-iters 15.06000 15.00000 13.00000 12.00000 12.03960 16.00500 15.00000 13.20792 12.49505 12.04455 16.84500 16.00000 14.11386 13.00000 13.00000 17.41000 16.59500 14.90594 13.28218 13.22277 17.03000 16.00000 14.16832 13.05446 13.00000 127 of 152 D-Flow Flexible Mesh, Technical Reference Manual 16 32 64 128 t [h] 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 time step [s] 5.73000 5.64500 5.44554 MPInon-sol [s] 0.02977 0.03029 0.02777 solver [s] 4.04400 3.96000 3.76238 MPIsol [s] 0.06205 0.07000 0.03337 #Krylov-iters 22.86000 22.24500 20.89109 DR AF #dmns 8 T Table 8.5: time-step averaged wall-clock times of the Schematic Waal model; SDSC’s Gordon; CG+MILUD 128 of 152 3.13550 3.02000 2.89604 0.02596 0.02771 0.02547 2.27150 2.16000 2.03465 0.05955 0.06665 0.06297 24.54500 23.00000 21.40594 1.65000 1.61900 1.53960 0.02941 0.03393 0.02714 1.21550 1.18350 1.10396 0.08840 0.08590 0.07139 25.00000 24.00000 22.19802 0.88850 0.85700 0.82970 0.02410 0.02364 0.01814 0.66200 0.62950 0.60792 0.07745 0.06110 0.06282 26.20000 24.99000 23.75248 0.46550 0.44900 0.43465 0.42327 0.42079 0.01583 0.01584 0.01655 0.01655 0.01568 0.35070 0.33450 0.31980 0.30891 0.30446 0.06740 0.06505 0.05683 0.05990 0.05743 25.48500 24.01500 22.79703 21.89604 21.77228 Deltares Parallelization Table 8.6: time-step averaged wall-clock times of the ’esk-model’; Lisa; note: MPI communication times are not measured for the PETSc solver time step [s] 0.33152 MPInon-sol [s] 0.00314 solver [s] 0.09406 0.16979 0.17875 0.00355 0.00451 0.05513 0.05752 MPIsol [s] 0.00000 0.00000 0.00000 DR AF 8 t [h] 0.35 0.45 0.63 0.75 0.85 1.10 0.35 0.45 0.63 0.75 0.85 1.10 0.35 0.45 0.63 0.75 0.85 1.10 0.35 0.45 0.63 0.75 0.85 1.10 0.35 0.45 0.63 0.75 0.85 1.10 0.35 0.45 0.63 0.75 0.85 1.10 16 32 64 128 Deltares #Krylov-iters 3.11984 T #dmns 4 3.30041 4.06024 0.09284 0.10073 0.10140 0.00271 0.00637 0.00341 0.03237 0.03337 0.03565 0.00000 0.00000 0.00000 3.09976 3.86932 3.75257 0.04625 0.04792 0.04908 0.04865 0.00171 0.00200 0.00202 0.00209 0.01493 0.01844 0.01608 0.01487 0.00000 0.00000 0.00000 0.00000 3.36052 4.34007 3.97418 3.09526 0.02323 0.02508 0.02567 0.02543 0.02545 0.00122 0.00148 0.00111 0.00120 0.00182 0.00999 0.01139 0.00915 0.00894 0.00846 0.00000 0.00000 0.00000 0.00000 0.00000 3.22176 4.30026 3.74654 3.00078 2.99741 0.01341 0.01514 0.01489 0.01496 0.01415 0.01414 0.00087 0.00119 0.00125 0.00101 0.00090 0.00100 0.00681 0.00782 0.00803 0.00614 0.00566 0.00554 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 3.89344 3.00000 4.00273 3.06459 3.00109 3.00715 129 of 152 T D-Flow Flexible Mesh, Technical Reference Manual Schematic Waal model; lisa t=0.33 h DR AF 120 100 speed−up 80 60 40 20 0 0 20 40 60 #subdomains 80 100 120 Figure 8.4: Speed-up of the schematic Waal model; Lisa 130 of 152 Deltares T Parallelization Schematic Waal model; h4 t=0.33 h 0.65 1.25 2.57 3.00 DR AF 120 100 speed−up 80 60 40 20 0 0 20 40 60 #subdomains 80 100 120 Figure 8.5: Speed-up of the schematic Waal model; h4 Deltares 131 of 152 D-Flow Flexible Mesh, Technical Reference Manual Schematic Waal model; Gordon t=0.33 h 0.65 1.25 2.57 3.00 120 100 60 T speed−up 80 40 DR AF 20 0 0 20 40 60 80 #subdomains 100 120 Figure 8.6: Speed-up of the schematic Waal model; SDSC’s Gordon; PETSc Schematic Waal model; Gordon t=0.33 h 0.65 1.25 120 100 speed−up 80 60 40 20 0 0 20 40 60 80 #subdomains 100 120 Figure 8.7: Speed-up of the schematic Waal model; SDSC’s Gordon; CG+MILUD 132 of 152 Deltares DR AF T Parallelization (a) 4 subdomains (b) 8 subdomains (c) 16 subdomains (d) 32 subdomains (e) 64 subdomains (f) 128 subdomains Figure 8.8: Partitioning of the ’esk-model’ with METIS Deltares 133 of 152 esk_model; lisa t=0.35 h DR AF 120 T D-Flow Flexible Mesh, Technical Reference Manual 100 speed−up 80 60 40 20 0 0 20 40 60 #subdomains 80 100 120 Figure 8.9: Speed-up of the ’esk-model’; Lisa 134 of 152 Deltares Parallelization t [h] 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 0.33 0.65 1.25 2.57 3.00 time step [s] 2.85100 2.85000 MPInon-sol [s] 0.03012 0.03273 solver [s] 1.15250 1.14950 MPIsol [s] 0.00000 0.00000 DR AF #dmns 8 T Table 8.7: time-step averaged wall-clock times of the Schematic Waal model; Gordon; note: MPI communication times are not measured for the PETSc solver 16 32 64 128 Deltares #Krylov-iters 15.06000 15.00000 1.02900 1.01950 1.02277 1.01980 0.02056 0.01502 0.01663 0.01624 0.20595 0.20350 0.20297 0.20396 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.74950 0.73900 0.71634 0.02224 0.02293 0.02423 0.32080 0.31000 0.28614 0.00000 0.00000 0.00000 16.84500 16.00000 14.11386 0.37265 0.36750 0.35792 0.34802 0.34802 0.23665 0.23350 0.22624 0.22228 0.22129 0.01499 0.01483 0.01431 0.01390 0.01353 0.03332 0.03431 0.03432 0.03386 0.03327 0.15550 0.15075 0.14059 0.13119 0.13069 0.10325 0.09945 0.09287 0.08861 0.08812 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 17.41000 16.59500 14.90594 13.28218 13.22277 17.03000 16.00000 14.16832 13.05446 13.00000 135 of 152 T D-Flow Flexible Mesh, Technical Reference Manual Schematic Waal model; gordon t=0.33 h 0.65 DR AF 120 100 speed−up 80 60 40 20 0 0 20 40 60 #subdomains 80 100 120 Figure 8.10: Speed-up of the schematic Waal model; Gordon 136 of 152 Deltares Parallelization T San Fransisco Delta-Bay model DR AF 8.2.3 Deltares 137 of 152 T D-Flow Flexible Mesh, Technical Reference Manual DR AF San Fransisco Delta−Bay model t=12.00 h 24.00 36.00 48.00 60.00 72.00 84.00 96.00 108.00 120.00 60 50 speed−up 40 30 20 10 0 0 10 20 30 40 #subdomains 50 60 Figure 8.11: Speed-up of the San Fransisco Delta-Bay model; Gordon 138 of 152 Deltares Parallelization Table 8.8: time-step averaged wall-clock times of the San Fransisco Delta-Bay model; Gordon; note: MPI communication times are not measured for the PETSc solver time step [s] 0.14902 0.14889 0.14595 0.14759 0.14408 0.14509 0.14399 0.14880 0.14632 0.15038 0.08892 0.08726 0.08581 0.08607 0.08461 0.08183 0.08015 0.08123 0.08180 0.08547 0.05542 0.06021 0.09062 0.06466 0.06179 0.06537 0.06325 0.06352 0.06137 0.06140 0.03032 0.05749 0.06610 0.07463 0.07151 0.07442 0.06798 0.06844 0.06524 0.05862 MPInon-sol [s] 0.03099 0.02928 0.02592 0.02715 0.02398 0.02441 0.02353 0.02593 0.02445 0.02918 0.02771 0.02380 0.02293 0.02290 0.02147 0.01859 0.01716 0.01806 0.01852 0.02227 0.02316 0.02928 0.05868 0.03252 0.02975 0.03326 0.03124 0.03145 0.02929 0.02937 0.01249 0.03969 0.04823 0.05664 0.05354 0.05639 0.05006 0.05042 0.04724 0.04063 solver [s] 0.01477 0.01528 0.01490 0.01527 0.01498 0.01519 0.01504 0.01518 0.01512 0.01510 0.00958 0.00981 0.00973 0.00991 0.00993 0.01005 0.00999 0.00998 0.00989 0.00985 0.00776 0.00791 0.00775 0.00790 0.00779 0.00785 0.00780 0.00782 0.00787 0.00775 0.00593 0.00612 0.00595 0.00613 0.00605 0.00611 0.00607 0.00611 0.00609 0.00606 MPIsol [s] 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 DR AF 16 t [h] 12.00 24.00 36.00 48.00 60.00 72.00 84.00 96.00 108.00 120.00 12.00 24.00 36.00 48.00 60.00 72.00 84.00 96.00 108.00 120.00 12.00 24.00 36.00 48.00 60.00 72.00 84.00 96.00 108.00 120.00 12.00 24.00 36.00 48.00 60.00 72.00 84.00 96.00 108.00 120.00 32 64 Deltares #Krylov-iters 16.25754 17.40124 15.49879 16.83857 15.99481 16.30267 16.12262 16.15620 16.01746 15.54151 13.72882 15.03835 12.97420 14.47656 13.58980 14.13277 13.80952 13.95845 13.77271 13.07582 18.51036 20.00691 17.71882 19.38103 18.33746 18.83925 18.64772 18.54788 18.57109 17.73242 19.85593 22.02080 18.88561 21.21491 19.72320 20.56026 20.07916 20.40540 20.24993 19.43446 T #dmns 8 139 of 152 D-Flow Flexible Mesh, Technical Reference Manual 16 32 64 t [h] 12.00 24.00 36.00 48.00 60.00 72.00 84.00 96.00 108.00 120.00 12.00 24.00 36.00 48.00 60.00 72.00 84.00 96.00 108.00 120.00 12.00 24.00 36.00 48.00 60.00 72.00 84.00 96.00 108.00 120.00 12.00 24.00 36.00 48.00 60.00 72.00 84.00 96.00 108.00 120.00 MPIu [s] 0.00028 0.00029 0.00028 0.00028 0.00029 0.00027 0.00028 0.00027 0.00028 0.00028 0.00030 0.00030 0.00031 0.00030 0.00031 0.00030 0.00031 0.00031 0.00032 0.00030 0.00032 0.00033 0.00033 0.00032 0.00034 0.00031 0.00033 0.00033 0.00033 0.00032 0.00021 0.00022 0.00023 0.00023 0.00022 0.00024 0.00024 0.00023 0.00021 0.00020 MPIsall [s] 0.02238 0.01985 0.01609 0.01600 0.01268 0.01284 0.01227 0.01346 0.01249 0.01756 0.02184 0.01594 0.01250 0.01202 0.00982 0.00866 0.00795 0.00869 0.00807 0.01173 0.01859 0.01228 0.00884 0.00736 0.00595 0.00582 0.00574 0.00669 0.00588 0.00809 0.00902 0.00886 0.00696 0.00676 0.00437 0.00395 0.00375 0.00423 0.00374 0.00517 MPIreduce 0.00833 0.00914 0.00956 0.01086 0.01101 0.01130 0.01098 0.01220 0.01168 0.01133 0.00557 0.00756 0.01012 0.01058 0.01134 0.00963 0.00890 0.00907 0.01013 0.01024 0.00424 0.01667 0.04951 0.02484 0.02347 0.02713 0.02517 0.02442 0.02307 0.02096 0.00326 0.03060 0.04103 0.04966 0.04895 0.05220 0.04607 0.04597 0.04329 0.03526 DR AF #dmns 8 T Table 8.9: time-step averaged wall-clock times of the San Fransisco Delta-Bay model; Gordon; non-solver MPI communication times 140 of 152 Deltares Parallelization 8.3 Governing equations D-Flow FM solves the two- and three-dimensional shallow-water equations. We will focus on two dimensions first. The shallow-water equations express conservation of mass and momentum and can be put into the following form: Z d Z h dΩ + dt hu • n dΓ =0, (8.16) Ω d Z∂Ω Z Z 1 2 • (8.17) hu dΩ + huu n dΓ = − h n dΓ − h∇d dΩ 2 Ω ∂Ω ∂Ω Z Z T • + (νh(∇u + ∇u )) n dΓ + τ dΩ, Z dt Ω Ω T ∂Ω (8.18) where ζ is the water level, h the water level, d = ζ − h the bed level, u the velocity vector, g the gravitational acceleration, ν the viscosity and τ is the bottom friction: g kuku, C2 DR AF τ = (8.19) with C being the Chézy coefficient. 8.4 Spatial discretization The spatial discretization is performed in a staggered manner, i.e. velocity normal components uj are defined at the cell faces j , with face normal vector nj , and the water levels sk at cell centers k . We define volume Vk associated with cell Ωk as Z Vk = h dΩ (8.20) Ω and the discharge through face j as Z hu • n dΓ, qj = (8.21) Γj which is discretized as qj = hupwind(j) uj . (8.22) The upwind cell associated with face j is upwind(j) = L(j), uj ≥ 0, R(j), uj < 0. (8.23) We define the water-column volume Vk as Z Vk = h dΩ (8.24) Ωk Deltares 141 of 152 D-Flow Flexible Mesh, Technical Reference Manual and for simplicity assume that it can be expressed as Vk = bAk hk , (8.25) where Ωk is the (two-dimensional) grid cell and bAk is the area of its horizontal projection. Note that this relation does not hold in case of (partially) dry cells. Borsboom et al. show that Equation (8.16) and Equation (8.18) can be discretized conservatively as: d dt dt 1 X bAk qj 1j,k , (8.26) j∈J (k) (sR(j) − sL(j) ) − αLj AL(j) + αRj AR(j) • nj ∆xj + αLj D L(j) + αRj D R(j) • nj + τj , (h̃j uj ) = − g h̄j T d hk = (8.27) where ∆xj = kxR(j) − xL(j) k, h̃j is the weighted average face water level DR AF h̃j = αL(j) hL(j) + αR(j) hR(j) , (8.28) h̄j is the average face water level 1 1 h̄j = hL(j) + hR(j) , 2 2 (8.29) Ak is the cell-centered conservative advection of hu, discretized as 1 X Ak = uc upwind(l) ql 1l,k . bAk (8.30) l∈J (k) and D k is the cell-centered diffusion, not discussed further. The cell-center based velocity vectors are reconstructed from the face-normal velocity components with uck = Using d dt 1 X bAk (xuj − xck )uj ∆Γj 1j,k . (8.31) j∈J (k) (h̃j uj ) = h̃j duj dt + uj dh̃j dt = h̃j duj dt + αL dhL(j) dt + αR dhR(j) dt (8.32) and substituting Equation (8.26) we obtain duj dt h̄j (sR(j) − sL(j) ) ∆xj h̃j X 1 1 − αLj (uc upwind(l) • nj − uj )ql 1l,k + bAL(j) h̃j l∈J (L(j)) X 1 αRj (uc upwind(l) • nj − uj )ql 1l,k bAR(j) =−g l∈J (R(j)) + 142 of 152 1 τj αLj D L(j) + αRj D R(j) • nj + . h̃j h̃j (8.33) Deltares Parallelization 4 3 3 2 4 4 4 2 3 3 1 2 4 4 2 1 3 3 3 3 4 4 T 4 4 DR AF Figure 8.12: Stencil for momentum advection and diffusion; the numbers indicate the level of the neighboring cells The advection and pressure-gradient terms are conform Kramer and Stelling. In D-Flow FM, however, the following form is implemented: duj dt (sR(j) − sL(j) ) ∆xj X 1 − αLj (uc upwind(l) • nj − uj )ql 1l,k + Vuj l∈J (L(j)) X αRj (uc upwind(l) • nj − uj )ql 1l,k =−g l∈J (R(j)) + 1 τj αLj D L(j) + αRj D R(j) • nj + , hRj h̄j (8.34) where Vuj is a face-based volume Vuj = αLj VL(j) + αRj VR(j) (8.35) and hRj is the hydraulic radius of face j . The stencil used for computing momentum advection and diffusion is depicted in Fig. 8.12. Issues: orthogonal meshes hard to achieve, compromises mesh smoothness, non-conservative advection and different pressure gradient term implemented, but gives best results for shock problems, higher-order implementation gives satisfactory results for swirling flows, shear-dominated flow suffers from wide advection stencil, see Poiseuille test-case. Deltares 143 of 152 DR AF T D-Flow Flexible Mesh, Technical Reference Manual 144 of 152 Deltares A Analytical conveyance Conveyance type 2 In conveyance type 2, we consider the flow is one dimensional, and we calculate the bed friction based on intersection perpendicular to the flow direction(Figure A.1). Parameter K2 can be derived as follows. zi+1 − zi hi − hi+1 = yi+1 − yi yi+1 − yi (A.1) √ Z C RdA , or K2 = K2 = r Z A C dA dA dP A T αi = (A.2) Where R is hydraulic radius, C is Chézy coefficient, A is the cross sectional area and P is the wet area. DR AF A.1 dA = h(y)dy , h(y) = hi − αi (y − yi ) dP = q Z dy 2 yi+1 K2 = yi Z yi K2 = Deltares 1 yi+1 K2 = K2 = h(y) 6 dy , (C = h(y) ) 1 n (1 + αi2 ) 4 3 2 n(1 + αi2 ) yi 5 1 4 1 n(1 + αi2 ) h(y) 3 dy (A.5) (A.6) 5 1 4 (hi − αi (y − yi )) 3 dy −1 8 3 {hi − αi (y − yi )} 3 nαi (1 + αi2 ) 8 1 4 1 (A.4) 1 C yi+1 K2 = Z q + (αi dy) = 1 + αi2 dy 2 (A.3) 8 3 83 3 h − h 1 i i+1 nαi (1 + αi2 ) 4 8 (A.7) yi+1 (A.8) yi (A.9) 145 of 152 D-Flow Flexible Mesh, Technical Reference Manual yi yi+1 hi+1 hi z y Ai Pi Figure A.1: A schematic view of cross sectional bed bathemetry perpendicular to the flow direction. DR AF T yi yi+1 Figure A.2: A schematic view of flow nodes and the velocity components in twodimensional case. A.2 Conveyance type 3 Conveyance type 3 is similar to type 2, except it is extended to consider the second velocity component. Considering a two-dimensional case as illustrated in Figure A.2, we can derive K3 as follows, u uU = i, U = 2 2 C R β (A.10) 2 p √ βAj Rj3 uj = βC Rj i, K3 = n β = βi − δ (y − yi ) , δ = βi − βi+1 yi+1 − yi (A.11) (A.12) If αi and αi0 are the slopes in the streamwise and transverse directions respectively, we have, Z yi+1 K3 = yi K3 = 146 of 152 5 βi − δ (y − yi ) 3 1 (hi − αi (y − yi )) dy 0 n 1 + αi2 + αi2 4 T 0 n 1 + αi2 + αi2 14 (A.13) (A.14) Deltares Analytical conveyance Z yi+1 5 (βi − δ (y − yi )) (hi − αi (y − yi )) 3 dy T = (A.15) yi Z yi+1 5 (βi − δ (y − yi )) (hi − αi (y − yi )) 3 dy T = (A.16) yi δ T = αi Z δ T = αi Z yi+1 yi yi+1 yi yi+1 α 5 i βi − αi (y − yi ) (hi − αi (y − yi )) 3 dy δ (A.17) α 5 i βi − hi + (hi − αi (y − yi )) (hi − αi (y − yi )) 3 dy δ (A.18) T Z α 5 8 i βi − hi (hi − αi (y − yi )) 3 + (hi − αi (y − yi )) 3 dy (A.19) δ DR AF T = δ T = αi yi 3 8 −δ αi βi − hi (hi − αi (y − yi )) 3 αi αi δ 8 yi+1 yi + 11 −δ 3 (hi − αi (y − yi )) 3 αi αi 11 yi+1 yi (A.20) 3 8 8 11 δ 3 113 αi 3 3 3 T = βi − hi h − hi+1 + h − hi+1 αi αi δ 8 i 11 i (A.21) 8 11 δ 3 113 δ 3 83 3 3 βi − hi h − hi+1 + h − hi+1 αi 8 i αi 11 i (A.22) 1 T = α 11 δ 1 δ 3 113 3 K3 = = β − h K + h − h i i α 1 i i+1 1 02 4 2 2 α α α 11 2 i n(1 + αsi + αni ) 4 i i n 1 + αi + αi T Deltares (A.23) 147 of 152 DR AF T D-Flow Flexible Mesh, Technical Reference Manual 148 of 152 Deltares References Anderson, W. K. and D. L. Bonhaus, 1994. “An implicit upwind algorithm for computing turbulent flows on unstructured grids.” Computers Fluids 23 (1): 1–21. Balay, S., J. Brown, K. Buschelman, V. Eijkhout, W. D. Gropp, D. Kaushik, M. G. Knepley, L. C. McInnes, B. F. Smith and H. Zhang, 2013. PETSc Users Manual. Tech. Rep. ANL-95/11 Revision 3.4, Argonne National Laboratory. Borsboom, M., 2013. Construction and analysis of D-FLOW FM-type discretizations. Tech. rep., Deltares memorandum. Dam, A. van, 2009. Go with the Flow. Ph.D. thesis, University of Utrecht. Moving meshes and solution monitoring for compressible flow simulation. T Delft3D-FLOW UM, 2013. Delft3D-FLOW User Manual. Deltares, 3.14 ed. Haselbacher, A. and J. Blazek, 1999. “On the accurate and efficient discretization of the Navier-Stokes equations on mixed grids.” In Proceedings of the 14th AIAA CFD Conference, AIAA Paper 99-3363-CP, pages 946–956. Snowmass,CO. DR AF Huang, W., 2001. “Practical Aspects of Formulation and Solution of Moving Mesh Partial Differential Equations.” Journal of Computational Physics 171: 753–775. Huang, W., 2005. “Anisotropic Mesh Adaptation and Movement.” lecture notes for the workshop on Adaptive Method, Theory and Application. Karypis, G., 2013. METIS - A Software Package for Partitioning Unstructured Graph, Partitioning Meshes, and Computing Fill-Reducing Orderings of Sparse Matrices, Version 5.1.0. Tech. rep., Department of Computer Science and Engineering, University of Minnesota. Kleptsova, O., G. S. Stelling and J. D. Pietrzak, 2010. “An accurate momentum advection scheme for a z -level coordinate models.” Ocean Dyn. 60 (6): 1447–1461. DOI: 10.1007/s10236-010-0350-y. Kramer, S. C. and G. S. Stelling, 2008. “A conservative unstructured scheme for rapidly varied flows.” Int. J. Numer. Methods Fluids 58 (2): 183–212. DOI: 10.1002/fld.1722. Lisa. https://www.surfsara.nl/systems/lisa. Mavriplis, D. J., 2003. Revisiting the least-squares procedure for gradient reconstruction on unstructured meshes. Report NASA/CR-2003-212683, NASA. Natarajan, G. and F. Sotiropoulos, 2011. “IDeC(k): A new velocity reconstruction algorithm on arbitrarily polygonal staggered meshes.” Journal of Computational Physics 230: 6583– 6604. Olesen, K. W., 1987. Bed topography in shallow river bends. Tech. rep., Delft University of Technology. Communications on Hydraulic and Geotechnical Engineering. Perot, B., 2000. “Conservation properties of unstructured staggered mesh schemes.” J. Comput. Phys. 159 (1): 58–89. DOI: 10.1006/jcph.2000.6424. Rodi, W., 1984. “Turbulence models and their application in Hydraulics, State-of-the-art paper article sur l’etat de connaissance.” IAHR Paper presented by the IAHR-Section on Fundamentals of Division II: Experimental and Mathematical Fluid Dynamics, The Netherlands. Saad, Y., 1994. “SPARSKIT: a basic tool kit for sparse matrix computations - Version 2.” Deltares 149 of 152 D-Flow Flexible Mesh, Technical Reference Manual Shashkov, M., B. Swartz and W. B., 1998. “Local reconstruction of a vector field from its normal components on the faces of grid cells.” Journal of Computational Physics 139: 406–409. Sieben, J., 2011. Overzicht en synthese beschikbare data overlaatproeven, Update 2011. Tech. rep., Rijkswaterstaat. Stelling, G. S. and J. A. T. M. van Kester, 1994. “On the approximation of horizontal gradients in sigma co-ordinates for bathymetry with steep bottom slopes.” International Journal Numerical Methods In Fluids 18: 915–955. Uittenbogaard, R. E., J. A. T. M. van Kester and G. S. Stelling, 1992. Implementation of three turbulence models in 3D-TRISULA for rectangular grids. Tech. Rep. Z81, WL | Delft Hydraulics, Delft, The Netherlands. T Vermaas, H., 1987. Energylosses due to weirs. Tech. Rep. Q92, WL | Delft Hydraulics, Delft, The Netherlands. In Dutch (Energieverliezen door overlaten: Een gewijzigde berekeningsprocedure voor WAQUA-rivieren versie). DR AF Villemonte, J., 1947. “Submerged Weir Discharge Studies.” Engineering News Record pages 866–869. Wijbenga, J. H. A., 1990. Representation of extra energy losses in RIVCUR. Tech. Rep. Q910, WL | Delft Hydraulics, Delft, The Netherlands. In Dutch (Weergave van extra energieverlies in RIVCUR), research for Rijkswaterstaat, Dienst Binnenwateren/RIZA. Yossef, M. and M. Zagonjoli, 2010. Modelling the hydraulic effect of lowering the groynes on design flood level. Tech. Rep. 1002524-000, Deltares. 150 of 152 Deltares DR AF T T DR AF PO Box 177 2600 MH Delft Boussinesqweg 1 2629 VH Delft The Netehrlands +31 (0)88 335 81 88 sales@deltaressystems.nl www.deltaressystems.nl
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.5 Linearized : No Page Count : 166 Page Mode : UseOutlines Author : Deltares Title : D-Flow Flexible Mesh Technical Reference Manual Subject : Creator : LaTeX with hyperref package Producer : pdfTeX-1.40.18 Keywords : Deltares, Technical, Reference, Manual, D-Flow, Flexible, Mesh, Hydrodynamics Create Date : 2018:04:18 05:45:26+02:00 Modify Date : 2018:04:18 05:45:26+02:00 Trapped : False PTEX Fullbanner : This is MiKTeX-pdfTeX 2.9.6588 (1.40.18)EXIF Metadata provided by EXIF.tools