CE 498/698 and ERS 485 (Spring 2004) Lecture 71 Lecture 7: Computer Methods for Well-Mixed Reactors CE 498/698 and ERS 685 Principles of Water Quality Modeling
CE 498/698 and ERS 485 (Spring 2004) Lecture 72 Modeling Tradeoff
CE 498/698 and ERS 485 (Spring 2004) Lecture 73 Simplifying Assumptions Idealized loading curves Q, k, V are constant First-order reactions What if these don’t apply???? Computers and numerical methods
CE 498/698 and ERS 485 (Spring 2004) Lecture 74 Completely Mixed Lake Model where
CE 498/698 and ERS 485 (Spring 2004) Lecture 75 Euler’s Method Ch. 25 in Chapra and Canale c t h forward difference: + titi cici conc. at present t i + t i+1 c i+1 conc. at future t i+1
CE 498/698 and ERS 485 (Spring 2004) Lecture 76 Euler’s Method Ch. 19 in Chapra and Canale fwd difference: or where
CE 498/698 and ERS 485 (Spring 2004) Lecture 77 Example 7.1 Given: Q = m 3 yr -1 V = 10 6 m 3 Z = 5 m k = 0.2 yr -1 v = 0.25 m yr -1 c 0 = 15 mg L -1 At t = 0, step loading = 50 10 6 g yr -1 Simulate concentration from t = 0 to 20 yr using timestep of 1 year
CE 498/698 and ERS 485 (Spring 2004) Lecture 78 Example 7.1 At t i = 0, c i = 15 mg L -1 and W(t i ) = 50 10 6 g yr -1 c i for next computation
CE 498/698 and ERS 485 (Spring 2004) Lecture 79 Two equations: Euler’s Method
CE 498/698 and ERS 485 (Spring 2004) Lecture 710 Heun’s method Ch. 25 in Chapra and Canale c t + titi cici + t i+1 c i+1 slope 1 (predictor)
CE 498/698 and ERS 485 (Spring 2004) Lecture 711 Heun’s method c t + titi cici + t i+1 c i+1 slope 2 c 0 i+1
CE 498/698 and ERS 485 (Spring 2004) Lecture 712 Heun’s method c t + titi cici + t i+1 c i+1 c 0 i+1
CE 498/698 and ERS 485 (Spring 2004) Lecture 713 Example without iteration From previous calcs: h At t i = 0, c i = 15 mg L -1 and W(t i ) = 50 10 6 g yr -1
CE 498/698 and ERS 485 (Spring 2004) Lecture th -order Runge-Kutta general form of RK methods: slope estimate Euler: Heun: 4 th -order RK:
CE 498/698 and ERS 485 (Spring 2004) Lecture th -order Runge-Kutta where
CE 498/698 and ERS 485 (Spring 2004) Lecture 716 Spreadsheet Applications Example: Euler’s method for Example 7.1 Q =10000m 3 yr -3 V = m3m3 Z =5m v =0.25m yr -1 k =0.2yr -1 h =yr(timestep) =
CE 498/698 and ERS 485 (Spring 2004) Lecture 717 Spreadsheet Applications Example: Euler’s method for Example 7.1 Q =10000m 3 yr -3 V = m3m3 H =5m v =0.25m yr -1 k =0.2yr -1 h =yr(timestep) =
CE 498/698 and ERS 485 (Spring 2004) Lecture 718 Spreadsheet Applications Example: Euler’s method for Example 7.1 Q =10000m 3 yr -3 V = m3m3 Z =5m v =0.25m yr -1 k =0.2yr -1 h =yr(timestep) = titi W(t i )cici Slope (dc/dt)c i+1 0W(t 0 )Initial conc. 1W(t 1 )
CE 498/698 and ERS 485 (Spring 2004) Lecture 719 Spreadsheet Applications Example: Euler’s method for Example 7.1 Q =10000m 3 yr -3 V = m3m3 Z =5m v =0.25m yr -1 k =0.2yr -1 h =yr(timestep) = titi W(t i )cici Slope (dc/dt)c i+1 0W(t 0 )Initial conc.=c i +slope*h 1W(t 1 )
CE 498/698 and ERS 485 (Spring 2004) Lecture 720 Spreadsheet Applications Example: Euler’s method for Example 7.1 Q =10000m 3 yr -3 V = m3m3 Z =5m v =0.25m yr -1 k =0.2yr -1 h =yr(timestep) = titi W(t i )cici Slope (dc/dt)c i+1 0W(t 0 )Initial conc.=c i +slope*h 1W(t 1 )=c i+1
CE 498/698 and ERS 485 (Spring 2004) Lecture 721 Spreadsheet Applications Heun’s method titi W(t i )cici Slope 1 (s1) c 0 i+1 Slope 2 (s2) c i+1 0W(t 0 )Initial conc.=c i +s1*h=c i +0.5(s1+s2)*h 1W(t 1 )=c i+1
CE 498/698 and ERS 485 (Spring 2004) Lecture 722 Spreadsheet Applications Heun’s method titi W(t i )cici Slope 1 (s1) c 0 i+1 Slope 2 (s2) c i+1 0W(t 0 )Initial conc.=c i +s1*h=c i +0.5(s1+s2)*h 1W(t 1 )=c i+1
CE 498/698 and ERS 485 (Spring 2004) Lecture 723 Spreadsheet Applications Heun’s method titi W(t i )cici Slope 1 (s1) c 0 i+1 Slope 2 (s2) c i+1 0W(t 0 )Initial conc.=c i +s1*h=c i +0.5(s1+s2)*h 1W(t 1 )=c i+1
CE 498/698 and ERS 485 (Spring 2004) Lecture 724 Major Homework #1 Parameters from Example 5.3 Eigenvalues Calculations
CE 498/698 and ERS 485 (Spring 2004) Lecture 725 Major Homework #1 Parameters from Example Depth Area Volume Outflow Loading Settling Reaction rate Timestep, h One value for all 5 lakes
CE 498/698 and ERS 485 (Spring 2004) Lecture 726 Major Homework #1 Eigenvalues 11 yr yr -1
CE 498/698 and ERS 485 (Spring 2004) Lecture 727 Major Homework #1 YearTimec i,1 c i,2 c i,3 c i,4 c i,5 k 1,1 k 2,1 k 3,1 k 4,1 c i+1,1 k 1,2 k 2, =prev+h given