Solving Ordinary Differential Equations Application of Unsteady Flow form an Orifice
Ordinary Differential Equations General Form: for sake of simplicity only consider linear case:
Finite Difference Methods Basic Concepts First - Discretize Time Second - Represent x(t) using values at ti Approx. sol’n Exact Third - Approximate using the discrete
Finite Difference Methods Forward Euler Approximation (Explicit method)
Finite Difference Methods Forward Euler Algorithm
Example: FDM Forward Euler Phenomenon: Flow through Orifice at Variable Head 1 2 3 γH2O Z = 0 A2 h
Math. Model: 1. Conservation of Mass
Math. Model: 2. Energy Equation
Mathematical Model
Numerical Model (FDM Forward Euler)
Choice of Time Step The choice of time step is based on the idea that the values do not change too much during the time step. Change of 5% in the initial value of the head h during the first time step is acceptable from engineering point of view. This is your judgment as a modeller.
Numerical Example Initial head h(t=0)= 5 m, cd=0.95, do=0.1 m, D=5 m. Calculate the falling of the water level in time until the tank is empty. Draw h(t) over t. Check your results with analytical solution.
Estimation of time step 5% of h(0)= 0.05*5=0.25 m H(n+1)=5-0.25=4.75 m
Table of Computation T (sec) H(n) 5 4.77 60 4.54 120 4.32 180 ---
Check by Analytical solution
Comparison
Modified Euler (Predictor-Corrector) Method Also “explicit” next h is an explicit function of previous But evaluate h at a some times to get a better estimate of next h E.g. midpoint method:
Finite Difference Methods Backward Euler Approximation (Implicit method)
Finite Difference Methods Backward Euler Algorithm Solve with Gaussian Elimination
Example (Tank Problem) Backward Difference
Example (Tank Problem) Backward Difference cont.
Finite Difference Methods Trapezoidal Rule Approximation
Finite Difference Methods Trapezoidal Rule Algorithm Solve with Gaussian Elimination
Example (Tank Problem) Trapezoidal Rule
Example (Tank Problem) Trapezoidal Rule
Finite Difference Methods Numerical Integration View Trap BE FE
Finite Difference Methods Summary of Basic Concepts Trap Rule, Forward-Euler, Backward-Euler Are all one-step methods Forward-Euler is simplest No equation solution explicit method. Boxcar approximation to integral Backward-Euler is more expensive Equation solution each step implicit method Trapezoidal Rule might be more accurate Trapezoidal approximation to integral