27
CE 498/698 and ERS 485 (Spring 2004) Lecture 7 1 Lecture 7: Computer Methods for Well-Mixed Reactors CE 498/698 and ERS 685 Principles of Water Quality Modeling

Lecture 7: Computer Methods for Well-Mixed Reactors

  • Upload
    amara

  • View
    24

  • Download
    0

Embed Size (px)

DESCRIPTION

Lecture 7: Computer Methods for Well-Mixed Reactors. CE 498/698 and ERS 685 Principles of Water Quality Modeling. Modeling Tradeoff. Simplifying Assumptions. Idealized loading curves Q , k , V are constant First-order reactions. What if these don’t apply????. - PowerPoint PPT Presentation

Citation preview

Page 1: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 1

Lecture 7: Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 685

Principles of Water Quality Modeling

Page 2: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 2

Modeling Tradeoff

more realism

mo

re c

om

ple

xity

Page 3: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 3

Simplifying Assumptions

• Idealized loading curves• Q, k, V are constant

• First-order reactions

What if these don’t apply????

Computers and numerical methods

Page 4: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 4

Completely Mixed Lake Model

VtW

cdtdc

c

VtW

dtdc

Hv

kVQ where

Page 5: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 5

Euler’s MethodCh. 25 in Chapra and Canale

c

t

h

forward difference:h

cc

tt

cc

tc

dt

dc ii

ii

iii

1

1

1

+

ti

ciconc. at present ti

+

ti+1

ci+1conc. at future ti+1

Page 6: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 6

Euler’s MethodCh. 19 in Chapra and Canale

fwd difference:h

cc

dt

dc iii 1

hc

V

tWcc i

iii

1or

i

iiii cV

tW

h

cc

dt

dc 1

hctfcc iiii ,1 or

where dtdc

cVtW

ctf ii

iii ,

Page 7: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 7

Example 7.1Given: Q = 10000 m3 yr-1 V = 106 m3

Z = 5 m k = 0.2 yr-1

v = 0.25 m yr-1 c0 = 15 mg L-1

At t = 0, step loading = 50106 g yr-1

Simulate concentration from t = 0 to 20 yr using timestep of 1 year

1-6

5

yr 35.0525.0

2.01010

Hv

kVQ

Page 8: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 8

Example 7.1At ti = 0, ci = 15 mg L-1 and W(ti) = 50106 g yr-1

1-6

6

1 L mg 75.590.11535.010

1050151

cci

ci for next computation

Page 9: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 9

Two equations:

22122

12111

,,

,,

kcctfdtdc

kcctfdtdc

Euler’s Method

Page 10: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 10

Heun’s methodCh. 25 in Chapra and Canale

c

t

+

ti

ci+

ti+1

ci+1

hctfccctfdt

dciiiiii

i ,, 01

slope 1 (predictor)

Page 11: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 11

Heun’s method

c

t

+

ti

ci+

ti+1

ci+1

011

1 , iii ctfdt

dc

slope 2

c0i+1

2

,,

22 slope 1 slope 0

11 iiii ctfctf

dtdc

Page 12: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 12

Heun’s method

c

t

+

ti

ci+

ti+1

ci+1c0i+1

2

,,

22 slope 1 slope 0

11 iiii ctfctf

dtdc

h

ctfctfcc iiiiii 2

,, 011

1

Page 13: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 13

Examplewithout iteration

1-yr 35.0From previous calcs:

75.441535.010

105015,0, 6

6

fctf ii

175.4415101 cci h

0875.2975.5935.010

105075.59,1, 6

60

11 fctf ii

91875.5112

0875.2975.44151 c

At ti = 0, ci = 15 mg L-1 and W(ti) = 50106 g yr-1

Page 14: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 14

4th-order Runge-Kutta

general form of RK methods: hcc ii 1

slope estimate

Euler: hkcc ii 11

Heun: hkkcc ii

211 21

4th-order RK: hkkkkcc ii

43211 2261

Page 15: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 15

4th-order Runge-Kutta

where

hkkkkcc ii

43211 2261

34

23

12

1

,

21

,21

21

,21

,

hkchtfk

hkchtfk

hkchtfk

ctfk

ii

ii

ii

ii

Page 16: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 16

Spreadsheet ApplicationsExample: Euler’s method for Example 7.1

Q = 10000 m3 yr-3

V = 1000000 m3

Z = 5 m

v = 0.25 m yr-1

k = 0.2 yr-1

h = yr (timestep)

=

Page 17: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 17

Spreadsheet ApplicationsExample: Euler’s method for Example 7.1

Q = 10000 m3 yr-3

V = 1000000 m3

H = 5 m

v = 0.25 m yr-1

k = 0.2 yr-1

h = yr (timestep)

= kH

v

V

Q

kH

v

V

Q

Page 18: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 18

Spreadsheet ApplicationsExample: Euler’s method for Example 7.1

Q = 10000 m3 yr-3

V = 1000000 m3

Z = 5 m

v = 0.25 m yr-1

k = 0.2 yr-1

h = yr (timestep)

=

ti W(ti) ci Slope (dc/dt) ci+1

0 W(t0) Initial conc.

1 W(t1)

kH

v

V

Q

i

i cV

tW

i

i cV

tW

Page 19: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 19

Spreadsheet ApplicationsExample: Euler’s method for Example 7.1

Q = 10000 m3 yr-3

V = 1000000 m3

Z = 5 m

v = 0.25 m yr-1

k = 0.2 yr-1

h = yr (timestep)

=

ti W(ti) ci Slope (dc/dt) ci+1

0 W(t0) Initial conc. =ci+slope*h

1 W(t1)

kH

v

V

Q

i

i cV

tW

Page 20: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 20

Spreadsheet ApplicationsExample: Euler’s method for Example 7.1

Q = 10000 m3 yr-3

V = 1000000 m3

Z = 5 m

v = 0.25 m yr-1

k = 0.2 yr-1

h = yr (timestep)

=

ti W(ti) ci Slope (dc/dt) ci+1

0 W(t0) Initial conc. =ci+slope*h

1 W(t1) =ci+1

kH

v

V

Q

i

i cV

tW

Page 21: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 21

Spreadsheet ApplicationsHeun’s method

ti W(ti) ci Slope 1 (s1)

c0i+1 Slope 2

(s2)ci+1

0 W(t0) Initial conc. =ci+s1*h =ci+0.5(s1+s2)*h

1 W(t1) =ci+1

i

i cV

tW

1

1i

i cV

tW

Page 22: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 22

Spreadsheet ApplicationsHeun’s method

ti W(ti) ci Slope 1 (s1)

c0i+1 Slope 2

(s2)ci+1

0 W(t0) Initial conc. =ci+s1*h =ci+0.5(s1+s2)*h

1 W(t1) =ci+1

i

i cV

tW

01

1i

i cV

tW

Page 23: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 23

Spreadsheet ApplicationsHeun’s method

ti W(ti) ci Slope 1 (s1)

c0i+1 Slope 2

(s2)ci+1

0 W(t0) Initial conc. =ci+s1*h =ci+0.5(s1+s2)*h

1 W(t1) =ci+1

i

i cV

tW

1

1i

i cV

tW

Page 24: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 24

Major Homework #1

Parameters from Example 5.3

Eigenvalues

Calculations

Page 25: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 25

Major Homework #1

Parameters from Example 5.3

1 2 3 4 5

Depth

Area

Volume

Outflow

Loading

Settling

Reaction rate

Timestep, h

One value for all 5 lakes

Page 26: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 26

Major Homework #1

Eigenvalues

11 yr-1

22 yr-1

Page 27: Lecture 7:  Computer Methods for Well-Mixed Reactors

CE 498/698 and ERS 485 (Spring 2004)

Lecture 7 27

Major Homework #1

Year Time ci,1 ci,2 ci,3 ci,4 ci,5 k1,1 k2,1 k3,1 k4,1 ci+1,1 k1,2 k2,2

1963 0

=prev+h

given