Master thesis Francesco Serafin

  • View

  • Download

Embed Size (px)

Text of Master thesis Francesco Serafin

  • UNIVERSITY OF TRENTODepartment of Civil, Environmental and MechanicalEngineering

    Master Thesis inEnvironmental and Land Engineering

    Patterns for the application of modern informatics to theintegration of PDEs: the case of the Boussinesq Equation

    Advisor Author

    PhD Prof Riccardo Rigon Francesco Serafin


    PhD Emanuele Cordano

    PhD Giuseppe Formetta

    Academic Year 2013 - 2014

  • C O N T E N T S

    Introduction 11 setting up a modern environment for scientific com-

    puting 31.1 Before starting 3

    1.1.1 Software engineering & UML 41.1.2 Version Control System 71.1.3 Integrated development environment 10

    1.2 The advantages of Object-Oriented Programming 111.2.1 Object and Class 131.2.2 OOP features 13

    1.3 Java as programming language for scientific computing 151.3.1 Java performance 17

    1.4 The Object Modeling System 181.5 Lessons to take home 19

    2 the boussinesqs groundwater equation 212.1 The physical problem 21

    2.1.1 Some definitions 212.1.2 The moisture distribution in a vertical profile 222.1.3 Phreatic aquifer and its properties 22

    2.2 The Boussinesq equation 232.3 Mass conservative scheme for wetting and drying 24

    2.3.1 Unstructured orthogonal grid 252.3.2 Spatial discretization 272.3.3 Time discretization 28

    2.4 Boundary conditions 302.4.1 Flux-Based boundary conditions (Neumann) 302.4.2 Head-Based boundary conditions (Dirichlet) 31

    2.5 Lesson to take home 323 software implementation 33

    3.1 Object-oriented unstructured mesh 363.1.1 First design step: find different ways of implementa-

    tion 363.1.2 Second design step: class hierarchy 373.1.3 Third step: the implementation 38

    3.2 Object-oriented differential equations 413.2.1 First design step: find different implementation ways 413.2.2 Second design step: class hierarchy 423.2.3 Third step: the implementation of the Boussinesqs

    equation (BEq) 513.3 Input/output management 553.4 Conclusions 55

    4 test case 574.1 Analytical Non-linear Solution with planar topography 57

    4.1.1 Analytical non-linear one-dimensional Boussinesq Equa-tion 57

    4.1.2 Comparison between analytical and numerical solu-tion 59

    4.1.3 Nondimensionalization & maximum norm computa-tion 63


  • Contents

    4.2 Conclusions 655 summary 67a the structure of the numerical solver utilized 69b how to store sparse matrices 71

    b.1 Triplet form 71b.2 Compressed-row form 72b.3 Matrix-vector multiplication 72

    c about open source java matrices libraries - focusingon parallel colt 75

    d other comparisons between analytical and numeri-cal simulations 77d.1 Simulations at 5 days 78d.2 Simulations at 15 days 82d.3 Simulations at 20 days 86

    bibliography 91


  • L I S T O F S Y M B O L S

    Other Symbols

    Symbol Description Dimension Unit

    w Volumetric soil watercontent

    [] []

    ~Tj Transport coefficientalong the j-th edge

    [L3 T1] [m3/s]

    ~nj Outcoming versor or-thogonal to the j-th edge

    [] []

    H Thickness of the aquifer [L] [m]

    hw Total water volumestored in a soil columnper planimetric unit area

    [L] [m]

    hw Water volume per unitarea between the bedrockand the free surface level

    [L3/L2] [m3/m2]

    KS Saturated hydraulic con-ductivity

    [L T1] [m/s]

    pi Planimetric area of thecell

    [L2] [m2]

    Q Source term per plani-metric unit area

    [L T1] [m/s]

    Qni Water-table recharge (ora sink)

    [L2 T1] [m2/s]

    qL Outgoing water flux (wa-ter discharge per unitvertical area) normal tothe boundary

    [L T1] [m/s]

    s Drainable porosity [] []

    t Time [T ] [ s]

    x, y Planimetric cartesian co-ordinates

    [L] [m]

    zb Bedrock elevation [L] [m]

    zs Elevation of the terrainsurface

    [L] [m]

    Greek Symbols

    Symbol Description Dimension Unit

    j Distance between thecenters of the i-th andrho(i, j)-th polygons

    [L] [m]


  • List of Symbols

    Piezometric head [L] [m]

    j Length of the j-th edge [L] [m]

    Divergence operator [L1] [ /m]

    ~ Gradient operator [L1] [ /m]


  • A C R O N Y M S

    BC Boundary conditions

    BEq Boussinesqs equation

    CG Conjugate Gradient

    DC Dirichlet cells

    DVCS Distributed Version Control System

    EJML Efficient Java Matrix Library

    EMF Environmental Modeling Framework

    FDM Finite Difference Methods

    FEM Finite Element Method

    FVM Finite Volume Methods

    GC Garbage Collector

    GPL General Public License

    ICC Incomplete Cholesky Decomposition

    IDE Integrated Development Environment

    ILU Incomplete LU factorization

    ILUT Incomplete LU Transpose factorization

    ISO International Organization for Standardization

    JIT Just-in-time

    JVM Java Virtual Machine

    MMS Modular Modeling System

    ODE Ordinary Differential Equation

    OMS Object Modeling System

    OOP Object Oriented Programming

    PDE Partial Differential Equations

    SWEq Shallow Water Equation

    UJM Universal Java Matrix Package

    UML Unified Modeling Language

    VCS Version Control System


  • I N T R O D U C T I O N

    Mathematical models play a fundamental role in many scientific and en-gineering fields in todays world. They are used for example in geotechnicsto evalute the hillslope stability, in weather science to predict weather trendsand produce weather reports, in structural design to study the resistance tostress, and in fluid dynamics to compute fluid flows and air flows.

    Consequently mathematical models are evolving all the time: more andmore new numerical methods are being invented to solve the Partial Dif-ferential Equations (PDE)s that describe physical problems with increasingprecision, and more and more complex and efficient processor units arebeing created to reduce the computational time.

    Therefore, the code into which the mathematical models are translatedhas to be dynamic in order to be easily updated on the basis of the con-tinuous developments (Formetta et al. (2014) [16]).

    On the other hand, completely different physical problems are often de-scribed using similar PDEs. For this reason, the numerical methods whichprovide solutions to different problems can be the same. This suggest theimplementation of an IT infrastructure that hosts a standard structure forsolving PDEs and that can serve various disciplines with the minimum ofhassles.

    This work is focused on the application of what is envisioned above, withthe main purpose of the creation of an abstract code for implementing everytype of mathematical model described by PDEs.

    We work on hydrological topics but we hope to design a structure ofgeneral interest. Obviously the final goal of any work of this type is to finda proper numerical solver, and therefore, part of the thesis is devoted to theanalysis of the problem under scrutiny, and the description of the solutionfound.

    The thesis is organized as follows.In the first chapter an introduction to the software engineering and the

    tools that improve the team work for programming development is done.These aspects are usually neglected in environmental engineers practice.However the acquisition and the application of these notions is deemed nec-essary to a collaborative and incremental work, where many people can addtheir brick of specific knowledge and exploit their work. Positive and neg-ative aspects of object oriented languages are shown, because OO program-ming is an important element that helps to obtain short, readable, robust,manageable and portable codes.

    In the second chapter, the physical problem under analysis, the flow ofa phreatic table, is introduced: the model implemented is the Boussinesqsgroundwater equation. This equation is central to describing problems likerunoff formation, soil moisture distribution, and the prevention from hill-slopes instability. There are many models that solve this equation, such asHarman and Sivapalan (2009) [22], Harbaugh et al. (2000) [21], Painter et al.(2008) [28]. The implemented model merges the achievements of Brugnanoand Casulli (2008) [3] and Casulli (2009) [5] and is further developed by Cor-dano and Rigon (2013) [10] to include any type of boundary conditions.


  • It not only solves the BEq but also rigorously treats the wetting-and-drying problem with a clean, new numerical method. In fact it allowsfor a water table to dry up and form patchy spots of saturation without cre-ating any numerical problems, a characteristic considered very important inhillslope hydrology [24, 25].

    The third chapter is the original contribution of this thesis. It contains theentire software engineering work that implements the general structure thatsolves PDEs, and in particular non linear parabolic ones, discretized throughan unstructured grid. In the same chapter it is discussed the application ofthe abstract structure to the solution of the BEq.

    The fourth chapter shows a comparison between the numerical solutionand an analytical one, to verify the goodness of the model. This concludes acycle of software engineering in which first of all the software requirementswere delineated, then the system was subsequently designed, coded, andfinally tested. As developed, the cycle shows the peculiarities and the speci-ficities of the scientific problem under analysis, i.e. solving PDEs, and openstowards the final challenging phases of software engineering, the code main-tenance and debugging.

    The thesis has four appendices.In Appendix A, the structure of the numerical solver utilized is analyzed

    in depth.In Appendix B, the compressed format used to store matrices involved in

    the computation is described