us army corps of engineers ® engineer research and development center reactive transport (3): solve...

34
US Army Corps of Engineers® Engineer Research and Development Center Reactive Transport (3): Solve Biogeochemistry with The Primitive Approach Pearce Cheng (x3699) Last Update: October 8, 2008

Upload: harvey-parsons

Post on 03-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

US Army Corpsof Engineers®

Engineer Research and Development Center

Reactive Transport (3):Solve Biogeochemistry with The

Primitive Approach

Reactive Transport (3):Solve Biogeochemistry with The

Primitive Approach

Pearce Cheng (x3699)

Last Update: October 8, 2008

US Army Corpsof Engineers®

Engineer Research and Development Center

OutlineOutline

• A Generic Biogeochemical System• Primitive Approach• Advantages and Disadvantages with The Primitive Approach• Solve Biogeochemistry with The Primitive Approach

US Army Corpsof Engineers®

Engineer Research and Development Center

A Generic Biogeochemical SystemA Generic Biogeochemical System

• No. of species = M• No. of reactions = Nr

– Fast reversible (equilibrium) reactions– Slow reversible/irreversible (kinetic) reactions– Fast irreversible (one way instantaneous) reactions

11RνG

U dt

d

where

U

G

1ν ik ik

1R

= the (MxM) identity matrix; = the vector representing the M species concentrations [M/L3];

= the (MxNr) reaction stoichiometry matrix with & as components;

= the vector representing the Nr reaction rates [M/(tL3)].

US Army Corpsof Engineers®

Engineer Research and Development Center

Example for DemonstrationExample for Demonstration 6

7

rN

M

HNTANTAH 1R

NTACoCoNTA 2R

HNTACoHCoNTA

BHHNTA

HNTACoNTANTACoH 2 5R

(R1) a fast reversible (equilibrium) reaction

(R2)

(R3) a slow reversible (kinetic) reaction

(R4) a slow irreversible (kinetic) reaction

(R5)

NTA: sodium nitrilotriacetate; C6H9NO6; a chelating agent used in detergents to improve their cleaning ability

a fast reversible (equilibrium) reaction

a fast reversible (equilibrium) reaction

PHB (R6) a fast irreversible (one way instantaneous) reaction

6R

US Army Corpsof Engineers®

Engineer Research and Development Center

5

6

rN

M

65431

][RRRRR

dt

Hd 521 2

][RRR

dt

NTAd

5431

][RRRR

dt

HNTAd 532

][RRR

dt

Cod

532

][RRR

dt

CoNTAd 64

][RR

dt

Bd

6

][R

dt

Pd

6

7

rN

M

Primitive ApproachPrimitive Approach

US Army Corpsof Engineers®

Engineer Research and Development Center

Advantages with The Primitive Approach

Advantages with The Primitive Approach

• Straightforward in terms of formulation and solution strategy

• Easy to be incorporated into reactive transport equations

US Army Corpsof Engineers®

Engineer Research and Development Center

Disadvantages with The Primitive Approach (1/2)

Disadvantages with The Primitive Approach (1/2)

• The time step size must be sufficiently (or infinitely) small to resolve fast/equilibrium reactions DAE approach

• The integration of the primitive rate equations, due to numerical errors, does not guarantee the conservation of the total mass of component chemical/species, which is necessary. DAE approach

• There is no way to define the subtraction or addition of infinity if more than one equilibrium reactions are involved DAE approach

65431

][RRRRR

dt

Hd

US Army Corpsof Engineers®

Engineer Research and Development Center

Disadvantages with The Primitive Approach (2/2)

Disadvantages with The Primitive Approach (2/2)

• Even if all reactions are slow/kinetic reactions, their rates are coupled via the concentration-versus-time curves of all species. They cannot be formulated and parameterized one reaction by one reaction independently of each other (most difficult issue) Identify the kinetic variables associated with the given experimental concentration-versus-time curves

Conc.

T im e

[Co]532

][RRR

dt

Cod

[P]6

][R

dt

Pd

US Army Corpsof Engineers®

Engineer Research and Development Center

The Primitive Approach Can Be Used When …

The Primitive Approach Can Be Used When …

• Fast reversible (equilibrium) reactions do not exist.– Linear equilibrium assumption may be used for

limited cases (e.g., RT3D strategy)• Reaction networks are adequately constructed.• Time steps used are sufficiently small to resolve all slow

reactions.• Special treatments to account for fast irreversible

reactions are incorporated when necessary.

US Army Corpsof Engineers®

Engineer Research and Development Center

Solve Biogeochemistry with The Primitive Approach

Solve Biogeochemistry with The Primitive Approach

• Solve Reaction Network with the Newton Method – Compute numerical Jacobian (generic approach) – Compute analytical Jacobian (when all reactions can be

represented in analytical form)• Compute adaptive time steps to avoid negative

concentrations• Employ special treatments to handle fast irreversible

reactions

US Army Corpsof Engineers®

Engineer Research and Development Center

Compute Adaptive Time StepsCompute Adaptive Time Steps

• For each chemical species, check the contribution from all slow reactions: – Scenario 1:

– Scenario 2:

• Examine and exclude unnecessary reactions:– If ( is a small positive number, e.g., 10-6), then

(a) Remove the reaction that yields the greatest value of (b) Re-calculate by excluding the reaction just removed(c) If still exists, repeat (a) and (b) until

0 1

nrx

iiijij R tt j

0 1

nrx

iiijij R

nrx

iiijij

oldj

j

R

CtMinimumt

1

,

jttt j

iijij R jt

tt j tt j

• Set ncsreaction tttMinimumt ,...,, 21

NoteNote: A simplified approach is actually : A simplified approach is actually adopted. adopted.

US Army Corpsof Engineers®

Engineer Research and Development Center

Special Treatments to Handle Fast Irreversible Reactions

Special Treatments to Handle Fast Irreversible Reactions

• Fast irreversible reactions are achieved immediately when compared to the slow reactions determine available reactants for fast irreversible reactions to occur

• The resultant chemical distribution after accounting for fast irreversible reactions is used to compute biogeochemistry where only slow reactions are taken into account within each nonlinear iteration.

US Army Corpsof Engineers®

Engineer Research and Development Center

Computation Flow Chart

Computation Flow Chart

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Account for Fast

Irreversible Reactions

Compute Adaptive Time

Steps

US Army Corpsof Engineers®

Engineer Research and Development Center

Demonstration Example: (10 species & 4 reactions)

Demonstration Example: (10 species & 4 reactions)

CkBAkR bf1

211

EDkR f22

FCkR f33

NkMHkR bf444

5R 355 PHkR f

(R1) a slow reversible reaction

(R2) a slow irreversible reaction

(R3) a fast irreversible reaction

(R4) a slow reversible reaction

(R5)

CBA 2

FED 2

HGFC 3R

NMH

QPH 3 a fast irreversible reaction

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Set Working Concentration

before Adjustment

Set Working Concentration

before Adjustment

pAA 00

pBB 00

pCC 00

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Adjust Species Concentrations Associated with Fast Irreversible

Reactions

Adjust Species Concentrations Associated with Fast Irreversible

Reactions

US Army Corpsof Engineers®

Engineer Research and Development Center

Adjust Species Concentrations Associated with Fast Irreversible Reactions

Adjust Species Concentrations Associated with Fast Irreversible Reactions

00

00

00

10 , FCMinimumCC

00

00

00

10 , FCMinimumFF

0

000

00

10 , FCMinimumGG

00

00

00

10 , FCMinimumHH

3

001

010

20

P, HMinimumHH

3 3

001

00

010

P, HMinimumPP

3

001

000

10

P, HMinimumQQ

(R3) a fast irreversible reactionHGFC 3R

5R(R5) QPH 3 a fast irreversible reaction

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Set New Initial Concentration

before Nonlinear Iterations

Set New Initial Concentration

before Nonlinear Iterations

10 CC p 10 FFp 10 GGp

20 HH p

10 PPp

10 QQp

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Set Working Concentrations

for Nonlinear Iterations

Set Working Concentrations

for Nonlinear Iterations

pnew AA

pold AA

pwork AA

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Compute Reaction Rates

for Slow Reactions

Compute Reaction Rates

for Slow Reactions

US Army Corpsof Engineers®

Engineer Research and Development Center

Compute Reaction Rates for Slow ReactionsCompute Reaction Rates for Slow Reactions

CkBAkR bf1

211

EDkR f22

NkMHkR bf444

(R1) a slow reversible reaction

(R2) a slow irreversible reaction

(R4) a slow reversible reaction

CBA 2

FED 2

NMH

NoteNote: The reaction rates are computed based on the working : The reaction rates are computed based on the working concentration: concentration:

NoteNote: The reaction rates can also be computed with the given : The reaction rates can also be computed with the given formulae when necessary.formulae when necessary.

,...,, workworkwork CBA

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Time Step AdaptionTime Step Adaption

US Army Corpsof Engineers®

Engineer Research and Development Center

• Check the overall reaction rate for each species, e.g., for the i-th species

• Adjustment is necessary only when the overall reaction rate is found negative:

Time Step Adaption (A Simplified Approach)Time Step Adaption (A Simplified Approach)

overalliR

overalli

iprxmip

R

CtMinimumtCC ,

, , If

Otherwise, temporarily de-activate the reactions that Otherwise, temporarily de-activate the reactions that would consume the i-th species for the time being.would consume the i-th species for the time being.

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Special Treatment for

Fast Irreversible Reactions

Special Treatment for

Fast Irreversible Reactions

US Army Corpsof Engineers®

Engineer Research and Development Center

Governing EquationsGoverning Equations(R1)(R2)(R3)(R4)(R5)

slow reversible slow irreversible

fast irreversible slow reversible

CBA 2FED 2

HGFC NMH QPH 3 fast irreversible

rxApnew tSourceRAA 1

rxBpnew tSourceRBB 12

31 RrxCpnew nConsumptiotSourceRCC

rxDpnew tSourceRDD 2

rxEpnew tSourceREE 2

322 RrxFpnew nConsumptiotSourceRFF

rxGRpnew tSourcenConsumptioGG 3

rxHRRpnew tSourceRnConsumptionConsumptioHH 453

rxMpnew tSourceRMM 4

rxNpnew tSourceRNN 4

rxPRpnew tSourcenConsumptioPP 53

rxQRpnew tSourcenConsumptioQQ 5

US Army Corpsof Engineers®

Engineer Research and Development Center

Special Treatment to Account for Fast Irreversible Reactions

Special Treatment to Account for Fast Irreversible Reactions

(R3) a fast irreversible reactionHGFC 3R

5R(R5) QPH 3 a fast irreversible reaction

(When (When RR11 > 0) > 0)

rxCrxp tSourcetRCCAvailable 1

rxCp tSourceC (When (When RR11 0) 0)

rxFrxp tSourcetRFFAvailable 22

FAvailableCAvaiableMinimumnConsumptio R 3 ,

rxHrxRp tSourcetRnConsumptioHHAvailable 43

rxHRp tSourcenConsumptioH 3

(When (When RR44 < < 0)0)(When (When RR44 0) 0)

rxPp tSourcePPAvailable

3

5

PAvailableHAvaiableMinimumnConsumptio R ,

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Compute ResidualsCompute Residuals

US Army Corpsof Engineers®

Engineer Research and Development Center

Compute ResidualsCompute Residuals(R1)(R2)(R3)(R4)(R5)

slow reversible slow irreversible

fast irreversible slow reversible

CBA 2FED 2

HGFC NMH QPH 3 fast irreversible

rxArxpold tSourcetRAA 1AResidual

rxBrxpold tSourcetRBB 1B 2Residual

rxCRrxpold tSourcenConsumptiotRCC 31CResidual

rxDrxpold tSourcetRDD 2DResidual

rxErxpold tSourcetREE 2EResidual

rxFRrxpold tSourcenConsumptiotRFF 32F 2Residual

rxGRpold tSourcenConsumptioGG 3GResidual

rxHRrxRpold tSourcenConsumptiotRnConsumptioHH 543HResidual

rxMrxpold tSourcetRMM 4MResidual

rxNrxpold tSourcetRNN 4NResidual

rxPRpold tSourcenConsumptioPP 5P 3Residual

rxQRpold tSourcenConsumptioQQ 5QResidual

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Compute JacobiansCompute Jacobians

US Army Corpsof Engineers®

Engineer Research and Development Center

Compute JacobiansCompute Jacobians

j

jjj

j C

CCCCCCC

C

,....,,,....,, 21i21ii

Residual ResidualResidual

• Compute Numerical Jacobians

jj CC (When (When CCjj > > CCmm))

mC (When (When CCjj CCmm))

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Full-Pivoting Direct SolverFull-Pivoting Direct Solver

ReferenceReference::Numerical Recipes, Numerical Recipes, 22ndnd Edition, Edition,bybyW.H. Press, W.H. Press, S.A. Teukolsky,S.A. Teukolsky,

W.T. Vetterling,W.T. Vetterling,B.P. FlanneryB.P. Flannery

US Army Corpsof Engineers®

Engineer Research and Development Center

Input Data

Adjust the concentration of species associatedwith fast irreversib le reactions as necessary

Com pute reaction rates for s low reactions

Adjust tim e step s ize based on the com puted s low reaction rates

Account for fast irreversib le reactions w ith specia l treatm ent

Com pute residuals

Com pute jacobians

Solve reaction equations w / fu ll-p ivoting d irect solver

Convergence?

Next tim e step?

Yes

NoYes

No End of tim e loop

Start of tim e loop

Start of nonlinear iteration loop

Check Convergence

Check Convergence

relativerelativej

jEMaximum

Convergence Convergence reached ifreached if

oldj

oldj

newjrelative

jC

CCE

(When (When CCjjoldold > >

CCmm))

wherewhere

0relativejE

(When (When CCjjoldold

CCmm))

US Army Corpsof Engineers®

Engineer Research and Development Center

Test ExampleTest Example

US Army Corpsof Engineers®

Engineer Research and Development Center

SummarySummary

• Major Difficulties in Solving Biogeochemistry• A Preprocessor with Reaction-Based Approach to Overcome

Major Difficulties