Martyn Clark Short course on “Model building, inference and hypothesis testing in hydrology” 21-25 May, 2012.

Slides:



Advertisements
Similar presentations
Time averages and ensemble averages
Advertisements

Formal Computational Skills
Gravity And Free Fall. When gravity is the only force acting on an object,it is said to be in free fall. 1.
Volume 4: Mechanics 1 Vertical Motion under Gravity.
Free fall with air resistance Forces which resist motion play an important part in everyday life: –Brakes in cars; friction in many forms, damped vibrations.
Copyright © by Holt, Rinehart and Winston. All rights reserved. ResourcesChapter menu Law of Universal Gravitation Sir Isaac Newton (1642–1727) gave us.
EARS1160 – Numerical Methods notes by G. Houseman
Distance The length an object actually travels. How far you go. Scalar Displacement The change in position of an object. Length between start and finish.
Error Measurement and Iterative Methods
1Notes. 2 Building implicit surfaces  Simplest examples: a plane, a sphere  Can do unions and intersections with min and max  This works great for.
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 2 : Dynamics & Numerical Methods Goal : To write a simple physics simulation Topics: Intro.
Nazgol Haghighat Supervisor: Prof. Dr. Ir. Daniel J. Rixen
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Ordinary Differential Equations Equations which are.
CVEN Computer Applications in Engineering and Construction Dr. Jun Zhang.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 2 Mathematical Modeling and Engineering Problem Solving.
CHE/ME 109 Heat Transfer in Electronics LECTURE 11 – ONE DIMENSIONAL NUMERICAL MODELS.
Numerical Solutions of Ordinary Differential Equations
Finite Difference Methods to Solve the Wave Equation To develop the governing equation, Sum the Forces The Wave Equation Equations of Motion.
Differential Equations and Boundary Value Problems
Numerical Methods for Partial Differential Equations CAAM 452 Spring 2005 Lecture 9 Instructor: Tim Warburton.
6&7-2 Dynamics, two examples of the use of ode45. Numeric Integration using trapz and quad/quadl functions. Readings: Matlab by Pratap Chapter 5.4,5.5.
1 Chapter 6 Numerical Methods for Ordinary Differential Equations.
In the previous two sections, we focused on finding solutions to differential equations. However, most differential equations cannot be solved explicitly.
Kinematics – The study of motion. Questions From Reading Activity?
Professor Walter W. Olson Department of Mechanical, Industrial and Manufacturing Engineering University of Toledo Solving ODE.
Motion in One Dimension
Chapter 2 Motion in One Dimension. Kinematics Describes motion while ignoring the agents that caused the motion For now, will consider motion in one dimension.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Concept Summary Batesville High School Physics. Motion of What?  To simplify things as much as possible, we will first consider one-dimensional motion.
Gravity, Air Resistance, Terminal Velocity, and Projectile Motion
Erin Catto Blizzard Entertainment Numerical Integration.
Martyn Clark Short course on “Model building, inference and hypothesis testing in hydrology” May, 2012.
ME451 Kinematics and Dynamics of Machine Systems
Hydrologic model benchmarks: Synthetic test cases, CZO data, and continental-scale diagnostics CUAHSI Community Modeling Working Group, San Francisco,
Chapter 1 Computing Tools Analytic and Algorithmic Solutions Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ME451 Kinematics and Dynamics of Machine Systems Numerical Solution of DAE IVP Newmark Method November 1, 2013 Radu Serban University of Wisconsin-Madison.
Dr. Hatim Dirar Department of Physics, College of Science Imam Mohamad Ibn Saud Islamic University.
C M C C Centro Euro-Mediterraneo per i Cambiamenti Climatici COSMO General Meeting - September 8th, 2009 COSMO WG 2 - CDC 1 An implicit solver based on.
Kinematics in One Dimension Chapter 2. Expectations After this chapter, students will:  distinguish between distance and displacement  distinguish between.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation
Part 1 Gravity and Free Fall Free Fall An object is in free fall if it is accelerating due to the force of gravity and no other forces are acting on.
Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine.
Rocket Propulsion Physics Montwood High School R. Casao.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 12.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Physics for Games Spring 2012.
Numerical Methods.
CH02-1 Constant Net Force.
Numerical Methods Solution of Equation.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 7 - Chapter 25.
ES 240: Scientific and Engineering Computation. Chapter 1 Chapter 1: Mathematical Modeling, Numerical Methods and Problem Solving Uchechukwu Ofoegbu Temple.
Part 1 Chapter 1 Mathematical Modeling, Numerical Methods, and Problem Solving PowerPoints organized by Dr. Michael R. Gustafson II, Duke University and.
Ch 8.2: Improvements on the Euler Method Consider the initial value problem y' = f (t, y), y(t 0 ) = y 0, with solution  (t). For many problems, Euler’s.
Ch 1.1: Basic Mathematical Models; Direction Fields Differential equations are equations containing derivatives. The following are examples of physical.
Part 1 Chapter 1 Mathematical Modeling, Numerical Methods, and Problem Solving PowerPoints organized by Dr. Michael R. Gustafson II, Duke University and.
Lecture 39 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 6 - Chapters 22 and 23.
Differential Equations Copyright © Cengage Learning. All rights reserved.
Acceleration due to Gravity
Physics: Principles with Applications, 6th edition
Part 7 - Chapter 25.
Acceleration due to Gravity
Class Notes 18: Numerical Methods (1/2)
Emma Taila & Nicolas Petruzzelli
Objective of This Course
Mathematical Modeling, Numerical Methods, and Problem Solving
Part 7 - Chapter 25.
MATH 175: Numerical Analysis II
Describing Motion: Kinematics in One Dimension
Modeling and Simulation: Exploring Dynamic System Behaviour
Presentation transcript:

Martyn Clark Short course on “Model building, inference and hypothesis testing in hydrology” May, 2012

Approach Stick to very simple (yet robust) numerical methods –Simpler than those presented in “Numerical Recipes” –Yet very easy for people to code from scratch, and retrofit existing hydrologic models Learn by doing –“I never really understand something until I code it up myself” –Exercises to implement the methods that are introduced Encourage discussion

Perceptual Model –Understanding of the Earth System –Not constrained by mathematics –Different for different people (based on training, experience) Conceptual Model –Synthesis (simplification) of the perceptual model –Requires specifying System boundaries Relevant inputs, state variables and outputs Physical laws to be obeyed and simplifying assumptions –Different conceptual models = different hypotheses of system behavior Numerical Model –Temporal integration of the governing model equations 3 The typical hydrologic modeling recipe

Outline Numerical methods for bucket-style hydrologic models –The explicit Euler method –The implicit Euler method –Adaptive sub-stepping –Ad-hoc numerical implementations in hydrologic models Exploring impacts of unreliable numerical implementation –Macro-scale and micro-scale discontinuities in model response surfaces and associated difficulties in model calibration and sensitivity analyses –Computational cost –Fragility of unreliable numerical implementations in predictive mode Summary and outlook

5 State equations

The exact solution of the ODE system (and the need for approximations) The ODE system from Clark et al. (2008) can be written as The exact solution of the average flux over the interval t n (start of the time step) to t n+1 (end of the time step) is Given an estimate of the average flux, the model state variables can be temporally integrated as The exact solution is computationally expensive, so approximations to the exact solution are used The approximation controls the stability, accuracy, smoothness, and efficiency of the solution

The bread and butter of hydrology: The explicit Euler method The most straightforward approximation to the exact solution is the explicit Euler method where the flux at the start of the time step is used to approximate the average flux over the time step The explicit Euler method linearly extrapolates from the initial condition along the initial slope of g(S)

Try this… A famous hydrologist (weight = 90 kg) has decided to go skydiving, and has asked you to determine how fast they will fall. The hydrologist in question thinks that it is acceptable for you to use Newton’s second law of motion considering only the gravitational force (F grav ) and the force due to air resistance (F res ). That is, where m = mass (kg) and v is the fall velocity (m s -1 ). Further, the hydrologist pursues the paradigm of parsimony, and is quite happy for you to use an empirical representation of the resistance force. After some discussion, you agree that the terms on the right-hand-side can be written as where k is a proportionality constant (for freefall, assume k = 15 kg s -1 ), and g is the gravitational acceleration 9.81 m s -2 ). Your mission, should you choose to accept it: Based on an initial velocity of zero (the hydrologist is hopping out of a hovering helicopter), temporally integrate the ODE for a 3 minute period using the explicit Euler method with 10 second time steps.

The parachute problem (freefall) ODE: Constants: –m = mass of the hydrologist (90 kg) –g = gravitational acceleration (9.81 m s -2 ) –k = proportionality constant for freefall (15 kg s -1 ) Hence Numerical approximation: explicit Euler Length of time step: Δt = 10 seconds Initial velocity = zero m s -1 –the hydrologist is hopping out of a hovering helicopter

…and, the end result…

Any observations?

Let’s see if we can do better… SOLVE THE PROBLEM AGAIN, EXCEPT THIS TIME USE THE EXPLICIT EULER METHOD WITH A TIME STEP OF 0.1 SECONDS

Ta-Da!

The parachute problem (landing) Velocity ODE: Position ODE: Initial conditions: –v = initial velocity (terminal velocity from the freefall example = 58 m s -1 ) –z = height to open the parachute (500 m) Use the same constants as in the freefall example, except for k: –m = mass of the hydrologist (90 kg) –g = gravitational acceleration (9.81 m s -2 ) –k = proportionality constant for the open chute (250 kg s -1 ) Numerical approximation: explicit Euler with Δt = 10 seconds

Poor numerical implementation can be downright dangerous!

Once again, short steps save the day… Terminal velocity = 3.53 m/s = km/hr = 7.89 mi/hr

Can we do better than the explicit Euler method? Can we both increase accuracy and decrease computing costs?

The implicit Euler method Approximates the exact solution of the average flux by estimating the flux at the end of the time step The implicit Euler method requires that the computed flux at the end of the time step is consistent with the estimated solution: In general, this requires iteration and can be computationally expensive.

Newton-Raphson iteration The Newton-Raphson method finds the root of a function by evaluating the function f (x) and the function derivatives f ́ (x) at arbitrary points of x. The function: In the implicit Euler method f (x) is the residual between a trial state variable (x) and the solution at the end of the time step estimated using the trial value x: The derivative: The derivative f ́ (x) can be computed using finite differences, as The new value of x can then be computed as and iterate until either the function or the derivative are below a user- specified error tolerance

Let’s give it a go: Can the implicit Euler method save our famous hydrologist? Step 1: –Provide an initial guess of v (v m ) –Compute the function evaluation (the residual) at v m and v m + ɛ requires the derivatives g(v m ) and g(v m + ɛ ) Notation: m=iteration index, and n=time step index; n denotes the start of the time step, and v 0 is the initial guess of v –Compute the derivative of the function evaluation Step 2: compute a new estimate of v and go back to step one, replacing the initial guess of v with the new estimate of v Keep going until you are happy!

… and, the result…

Summary and outlook In many cases model analysis complexities are consequences of numerical artifacts in the model implementation Numerical errors of uncontrolled time stepping schemes routinely dwarf the structural errors of the model conceptualization The robust numerics paradigm is yet to be accepted as the required standard in conceptual hydrology Reliable hydrologic modeling is a major challenge without adding confounding numerical artifacts—let’s avoid preventable numerical troubles before tackling more genuine challenges!