cheproo user manual - upc - grupo de hidrología subterránea

104

Upload: others

Post on 19-May-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 2: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 3: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

CHEPROO

(CHEmical PRocesses Object-Oriented)

A User’s Guide

Department of Geotechnical Engineering and Geo-Sciences (ETCG)

Technical University of Catalonia, UPC

Earth Science Institute ’Jaume Almera’ (CSIC)

Spanish Research Council

Sergio Andres Bea Jofre

Jesus Carrera Ramırez

Carlos Ayora Ibanez

Francesc Batlle

Luit Jan Slooten

Maarten Saaltink

October, 2008

Page 4: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

CHEPROO was funded by CSIC-UPC and was developed in the framework of the FUNMIG

project, Fundamental Migration of Radionuclides, contract XXX1-XX-2000-00034.

Page 5: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Abstract

Accurate prediction of contaminant migration in surface and ground water bodies, including

interaction with aquifer and hyporheic zone materials requires reactive transport modeling. The

increasing complexity and the procedure-oriented type of programming often used in reactive transport

hinder codes reuse and transportability. We present a Fortran 90 module using object-oriented

concepts that simulates complex hydrobiogeochemical processes (CHEPROO, CHEmical PRocesses

Object-Oriented). CHEPROO consists of a general structure with two classes. The Nodal Chemistry

class accounts for the description of local chemistry and geochemical state variables. As such, it

provides many functions related to basic operations (evaporation, mixing, etc) and can easily grow on this

direction (extreme dry conditions, biochemical state variables, etc). The Chemical System class includes

kinetic and thermodynamic models that describe reactions between and within phases. As such, it can

grow in the the direction of increasingly complex chemical systems (solid solutions, microorganisms

as individual phases, etc), without loss in the handling of simple problems. These two classes are

overlaid by CHEPROO, a general structure designed for interaction with other codes. CHEPROO

can be used as a geochemical tool for the modeling of complex processes such as biodegradation or

evaporation at high salinities. However, many functions CHEPROO are devoted to coupling a broad

range of chemical processes to other phenomena (flow, transport, mechanical). We have shown that

reactive transport (based on either DSA or SIA approaches) could be easily implemented into existing

conservative transport code with a minimal number of changes.

i

Page 6: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 7: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Table of Contents

1 Introduction 1

2 Getting Started with CHEPROO 3

2.1 About CHEPROO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2 High-level structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3 Installing and running CHEPROO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3.1 Project description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3.2 Linking CHEPROO in an external program . . . . . . . . . . . . . . . . . . . . 9

2.3.3 Using, creating and initializing a CHEPROO object . . . . . . . . . . . . . . . . 10

3 CHEPROO class organization 15

3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.2 CHEPROO object-oriented inspired principles . . . . . . . . . . . . . . . . . . . . . . . 18

3.3 CHEPROO: Class organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.3.1 Chemical system class, the geochemical system . . . . . . . . . . . . . . . . . . 22

3.3.2 Species class, the basic entity . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.3.3 Phase class, the thermodynamic behavior . . . . . . . . . . . . . . . . . . . . . 23

3.3.4 Reaction class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

3.3.5 Nodal Chemistry class, compositional information and geochemical state variables 26

3.3.6 CHEPROO class, handling compositional information and management ofchemical processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4 The geochemical system 31

4.1 The geochemical system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

4.1.1 Species, reactions and stoichiometric coefficients . . . . . . . . . . . . . . . . . 31

4.1.2 Chemical equilibrium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.1.3 Aqueous complexation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

4.1.4 Surface complexation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

iii

Page 8: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

iv TABLE OF CONTENTS

4.1.5 Mineral dissolution and precipitation . . . . . . . . . . . . . . . . . . . . . . . 41

4.1.6 Reactions of biogeochemical degradations . . . . . . . . . . . . . . . . . . . . . 44

4.1.7 Components definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

5 Geochemical modeling using CHEPROO 47

5.1 Mass balance of components in CHEPROO . . . . . . . . . . . . . . . . . . . . . . . . 47

5.2 Tracing reaction paths in CHEPROO . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

5.2.1 Adding/removing species . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

5.2.2 Evaporation reaction paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

5.2.3 Polythermal reaction path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

5.2.4 Mixing waters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

5.2.5 Kinetic reaction path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

6 Reactive transport modeling using CHEPROO 53

6.1 Reactive transport modeling using CHEPROO . . . . . . . . . . . . . . . . . . . . . . . 53

6.1.1 Water mass balance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

6.1.2 Conservative mass balance of solutes . . . . . . . . . . . . . . . . . . . . . . . 54

6.1.3 Reactive transport equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

6.1.4 Sequential (Non)-Iteration Approach (SIA, SNIA) using CHEPROO . . . . . . . 56

6.1.5 Direct Substitution Approach (DSA) using CHEPROO . . . . . . . . . . . . . . 57

6.2 Coupling the geochemical processes with other processes using CHEPROO . . . . . . . 59

6.2.1 Changes in the porosity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

6.2.2 Changes in the flow properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

7 Initialization of CHEPROO 61

7.0.3 <cheproo> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

7.0.4 <chemicalsystem> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

7.0.5 <phase> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

7.0.6 <surface> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7.0.7 <reaction> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

7.0.8 <reactionratelaw> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

7.0.9 <water> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

7.0.10 <set> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

7.0.11 <output> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

7.1 Output options of CHEPROO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

7.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

Page 9: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

TABLE OF CONTENTS v

7.2.1 Example I: The WAD case. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

7.2.2 Example II. Biodegradation of the phenolics compounds in a deep aquifer. . . . 69

8 Linking CHEPROO to other codes 75

Bibliography 83

A The WAD case 85

A.1 Input file in xml format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

B Biodegradation of the phenolics compounds 89

B.1 Input file in xml format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Page 10: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 11: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Chapter 1

Introduction

CHEPROO is an Object-Oriented module designed to model complex geochemical processes. It

facilitates the coupling with other processes and phenomenas such as thermal, flow, mechanical, etc.

in the Earth science models.

CHEPROO presents the following features:

• Complete set of reaction path options (e.g. evaporation trend, kinetic reaction path,

adding/removing species, etc).

• Many calculations devoted to geochemical and reactive transport problems (e.g. calculation of

components and their derivatives).

• Simulation of one-step of reactive transport of chemical species in the liquid (either DSA or SIA).

• Simulation of the following chemical reactions: aqueous complexation (including redox and

acid-base reactions), sorption (including cation exchange) by means of electrostatic models,

precipitation and dissolution of minerals and gas-liquid interaction

• Pitzer model.

• Mineral precipitation/dissolution in equilibrium or kinetics.

• Kinetic microbiology-mediated reactions (e.g. Michaelis-Menten mechanism).

1

Page 12: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

2 Chapter 1. Introduction

• Effects of precipitation and dissolution on porosity and permeability.

• Effects of aqueous solutes concentrations on certain flow properties (e.g. liquid density, viscosity).

• Complete set of output information (e.g. concentrations, activities, pH, volumetric fractions, etc).

• Easy to couple with other codes.

This document consists of eight chapters. Chapter 2 is the getting started of CHEPROO. Chapters 4 to 6

contain the basic theory. Many of relevant concepts can be found in the papers Saaltink et al. (1998), Bea

et al. (2008b,a). In addition, this document was partially based on RETRASO user’s manual (Saaltink

et al., 2005). Chapter 7 describes the input files and initialization of a CHEPROO object. Chapter 8

describes how to link CHEPROO from an external program. Input files and results for these examples

are also presented in the appendices (Appendixes A and B).

Page 13: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Chapter 2

Getting Started with CHEPROO

This guide describes the prerequisites for and how to install CHEPROO (CHEmical PRocesses

Object-Oriented). It also shows how to use certain features of CHEPROO and summarizes the

initialization steps from an external program.

2.1 About CHEPROO

CHEPROO, as described in the corresponding chapter in this thesis, is an Object-Oriented module

designed for modeling complex geochemical processes. This section provides an introduction to the

module, and it give details about how to install and initialize from an external program (e.g. an hydraulic

simulator, speciation program).

CHEPROO provides a framework for the implementation of complex geochemical calculations in Earth

science problems. In fact, it was designed to be flexible enough to allow almost any geochemical

processes to be implemented in it. Researchers have a module at their disposal that offers a large set

of basic functionality (e.g. oriented to geochemical or reactive transport calculations). This can lead to

a significant reduction in coding effort and debug time. CHEPROO has been written in Object-Oriented

Programming (OOP) paradigm, as to allow an easy growth by inheritance. In this case, Fortran (F90) was

the language used. This language has enough language features to support OO features such as dynamic

binding, inheritance and polymorphism, while offering at the same time good performance.

3

Page 14: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

4 Apendix B

2.2 High-level structure

The classes of CHEPROO are chosen in such a way as to represent chemical and thermodynamic

concepts. At the highest level, we have one object of each of the following classes that interact with

each other

• CHEPROO: This class could represent all geochemical processes in an Earth science model.

Therefore, it contains two main classes:

– NODAL CHEMISTRY: This class contains the general state variables used in the

geochemical modeling (e.g. concentrations, activity coefficients, ionic strength, mass of

water, temperature, gas volume). It can be used to represent a chemistry of one node of

the finite element mesh, a parcel of aquifer, a batch experiment, etc.

– CHEMICAL SYSTEM: This class contains the reactivity of the system, components

definition and thermodynamic behavior of the geochemical system. Inheritance was applied

in this class. Notice that at this point, CHEPROO increases the growing capacity.

Geochemical processes are involved in many phenomenas in the Earth sciences problems (e.g. ). In

addition, these phenomenas are involving many processes (e.g. hydraulic, transport and chemical

processes) and they are object of study of the reactive transport modeling. In fact, they are coupling

between them. In this way, the CHEPROO class reveals the strength of the encapsulation strategy: an

entity that understand about geochemical processes. In addition, it offers interesting services that are

involving complex geochemical calculations. In this way, we may change implementation details in any

of these classes, and the changes do not propagate to the rest as long as the interfaces do not change. In

order to allow this, the interfaces must be well chosen.

The reactive transport modeling requires the solution of two set of equations. The first one are the partial

differential equations and represents the mass balance of chemical solutes per unit of medium. On the

other hand, the second one represents algebraic equations and they are used to simulate the complex

relationship between solute transport and the various chemical reactions, such as acid/base reactions,

oxidation, complexation, sorption, ion exchange, precipitation of minerals, and biological processes.

These set of equations are then manipulated until they are formulated in terms of a set of variables that

Page 15: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

2.3. Installing and running CHEPROO 5

completely describe the state of the system. An important strategy is to choose total concentration like

unknowns of the equation sets obtained.

2.3 Installing and running CHEPROO

Installing CHEPROO from an external program can be summarized in the following steps

1. Build a CHEPROO project.

2. Compile and create a CHEPROO library (building the CHEPROO.lib and corresponding .obj files).

Once installed, you can run CHEPROO with the following steps

1. Link CHEPROO to an external project.

2. Create and initialize a CHEPROO object from an external program.

System requirements

To run CHEPROO, you need the following

• A standard Fortran’90 compiler.

• Sufficient memory.

Compilation of the current version of CHEPROO requires Visual Studio 2005 (preferably with

service pack 1), or Compaq Visual Fortran.

2.3.1 Project description

CHEPROO can be compiled into Fortran project. A project consists of the source files for your

application, along with the specifications for the building the project. Projects are contained in a

Page 16: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

6 Apendix B

workspace. A workspace can contain multiple projects. You need to create a project for each binary

executable file to be created. For instance, two types of projects are recommendable for CHEPROO tool

1. A Fortran Static library (e.g. CHEPROO.lib), where the library routines to link into .EXE files

2. A Fortran Dynamic-Link Library (e.g. CHEPROO.dll) where the library routines to associateduring execution.

Now, from an external program (e.g. hydraulic simulator) and Fortran static library (e.g.

CHEPROO.lib) would each reside in the same workspace as separates projects. In the Visual Compaq

compiler, the project is created as

1. Click on File menu, select New.

2. A dialog box appears with the following tabs

• Files.

• Projects.

• Workspaces.

• Other documents.

3. The projects tab displays various project types. Specify the project name and location. Click thetype of Fortran project to be created.

4. Click Ok when you have entered the information.

On the other hand, in the Visual Studio 2005, the project is created as

1. Click on File menu, select New/Project.

2. A new dialog box appears. Select the Intel(R) Fortran Projects.

3. The Visual Studio Installed templates displays various project types. Click the type of Fortranproject to be created.

4. Click Ok when you have entered the information.

Page 17: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

2.3. Installing and running CHEPROO 7

In the Compaq Visual Fortran, the CHEPROO files are included by selecting Add to project from the

Project menu. In the case of the Visual Studio 2005, they are included by selecting Add Existing Item

from the Project menu. Now, the following files must be included

• m cheproo.f90

• m nodalchemistry.f90

• m chemicalsystem.f90

– m parentchemicalsystem.f90

– m chemicalsystemcheproo.f90

– m chemicalsystemclassic.f90

• m species.f90

• m reaction.f90

• m reactionratelaw.f90

– m parentreactionratelaw.f90

– m reactionratelawmonod.f90

– m reactionratelawlasaga.f90

• m phase.f90

– m parentphase.f90

– m aqueousphase.f90

∗ m parentaqueousphase.f90∗ m aqueousphasedavis.f90∗ m aqueousphasepitzer.f90∗ m aqueousphaseideal.f90∗ m aqueousphasebdot.f90

– m gasphase.f90

∗ m gasidealphase.f90

– m mineralphase.f90

∗ m mineralidealphase.f90∗ m bynarisolution.f90

• surface.f90

– m parentsurface.f90

– m surfaceconstcap.f90

– m surfacecexch.f90

Page 18: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

8 Apendix B

– m surfacedl.f90

– m surfacetl.f90

• m constants.f90

• m general tools.for

All classes implemented in CHEPROO can read their attributes from xml files. Thus, a xml parser in

Fortran90 must be included in the CHEPROO project. The present version includes a parser located

in http://lcdx00.wm.lc.ehu.es/ag/xml/download.html). Thus, the following files must be

included

• flib sax.f90

• m buffer.f90

• m charset.f90

• m converters.f90

• m debug.f90

• m dictionary.f90

• m elstack.f90

• m entities.f90

• m fsm.f90

• m handlers.f90

• m io.f90

• m xml error.f90

• m xml parser.f90

• m flib xpath.f90

• m path.f90

Additional files related to BLAS numerical libraries must be also included

• cbnag.for

Page 19: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

2.3. Installing and running CHEPROO 9

In addition, the following NAG numerical libraries must be included

• F01brf.f

• F01brq.f

• F01brr.f

• F01brs.f

• F01brt.f

• F01bru.f

• F01brv.f

• F01brw.f

• F01brx.f

• F01bry.f

• F01brz.f

• F04axf.f

• F04axz.f

• X04abf.f

Last, the following files must be included

• m general tools cheproo.for

• lubksb.for

• ludcmp.for

• svd.for

2.3.2 Linking CHEPROO in an external program

This section leads for how to link the CHEPROO library from an external program. CHEPROO

library file (CHEPROO.lib), and object files (.obj extension) generated for the Fortran compiler, must

Page 20: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

10 Apendix B

be included in the external project.

In the case of Compaq Visual Fortran compiler

• The CHEPROO.lib is included in

1. Click on Project Settings menu.

2. Click on Link tab.

3. Specify the name of the CHEPROO.lib in Object/library modules:.

4. Click on Tools/Options menu.

5. Click on Directories tab.

6. Specify the location of the CHEPROO.lib file in Show directories for:/Library files.

• The .obj files are included in

1. Click on Tools/Options menu.

2. Click on Directories tab.

3. Specify the location of the .obj files in Show directories for:/Include files.

In the case of Visual Studio 2005 compiler

• The CHEPROO.lib is included in

1. Click on Project/Properties on File menu.

2. Select the Input directory in Configuration properties/Linker. Specify the name of theCHEPROO.lib in Additional Dependencies.

3. Select the General directory in Configuration properties/Linker. Specify the location of theCHEPROO.lib file in Additional Library Directories.

• The .obj files are included in

1. Click on Project/Properties on File menu.

2. Select the Fortran directory in Configuration properties/Linker. Specify the location of the.obj files in Additional Include Directories.

2.3.3 Using, creating and initializing a CHEPROO object

This section leads for the initialization of the CHEPROO tool from an external program. First, use the

CHEPROO module must be declared in the headers of the program according to

Page 21: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

2.3. Installing and running CHEPROO 11

use m_cheproo

Thus, a CHEPROO variable (mychemistry) can be defined

type(t_cheproo) :: mychemistry

Notice that a number of ’mychemistry’ objects could be defined in a program. Create mychemistry object

entails to call the service

create_ (mychemistry)

Note that is very important always to call this last service. The initialization of the CHEPROO object

can be carried out in two ways

1. From xml files.

2. From input files of the Retraso code (Saaltink et al., 1998) (including che.inp, master25.dat,master.temp, kinetics.dat).

Regarding the xml option, it entails to call the service

read_xml_ (mychemistry,namefile,iserror)

where

• mychemistry (t cheproo, inout)CHEPROO variable.

• namefile (character, in)Name of the file (e.g. cheproo.xml). The directory path must be included in it.

• iserror (logical, out)If iserror=.true., then there was an error.

Page 22: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

12 Apendix B

Regarding the RETRASO option, it entails to call the following service

read_txt_ (mychemistry,namefile,namethdb,namekindb,filebase, &

itypesolver,ioptxhl,iserror)

where

• mychemistry (t cheproo, inout)CHEPROO variable.

• namefile (character, in)Name of the file (e.g. cheproo.inp).

• namethdb (character, in)Name of the thermodynamic database (e.g. master25.dat).

• namekindb (character, in)Name of the kinetic database (e.g. kinetics.dat).

• filebase (character, in)Directory path of the files.

• itypesolver (integer, in)Index of the reactive transport solver.itypesolver=1, SNIA solver.itypesolver=2, SIA solver.itypesolver=3, DSA solver.

• ioptxhl (integer, in)ioptxhl=2, the molecular weight of the chemical species must be read of the thermodynamicdatabase (for default ioptxhl=0).

• iserror (logical, out)If iserror=.true., then there was an error.

As exposed above, the operational unit in CHEPROO are nodal chemistry objects. Thus, to operate

with CHEPROO entails to create a number of them through the service

create_nodalchem_ (mychemistry,numnch,iserror)

Page 23: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

2.3. Installing and running CHEPROO 13

where

• mychemistry (t cheproo, inout)CHEPROO variable.

• numnch (integer, in)Number of nodal chemistry objects.

• iserror (logical, out)If iserror=.true., then there was an error.

Regarding the initialization of CHEPROO, each nodal chemistry object must be initialized

(init_nodalchem_) according to water types (idwaterset[numnch]), mineral (idminset[numnch])

and surface sets (idsurfset[numnch]) defined in the input files. The sintaxis of this service is the

following

init_nodalchem_ (mychemistry,iserror,idwaterset=idwaterset, &

idminset=idminset,idsurfset=idsurfset)

where

• mychemistry (t cheproo, inout)CHEPROO variable.

• idwaterset (integer[numnch], optional, in)Indices of water defined in the CHEPROO object.

• idminset (integer[numnch], optional, in)Indices of mineral set defined in the CHEPROO object.

• idsurfset (integer[numnch], optional, in)Indices of surface set defined in the CHEPROO object.

• iserror (logical, out)If iserror=.true., then there was an error.

Page 24: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 25: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Chapter 3

CHEPROO class organization

3.1 Introduction

Reactive transport modeling is extensively used to understand migration of solutes and their interaction

with geological materials. This discipline has exerted an important influence on numerous Earth Science

fields including hydrogeology, geochemistry (Ayora et al., 1998; Chilakapati et al., 2000; Lichtner and

Felmy, 2003), biogeochemistry (Mayer et al., 2001; Meysman et al., 2003a,b; Curtis, 2003; Watson et al.,

2005), soil physics (Simunek and Suarez, 1994), and fluid dynamics (Bachler and Kohl, 2005).

Reactive transport codes have been traditionally developed in languages such as Fortran77, Pascal,

etc. These languages are based on Procedural-Oriented Programming (POP). The fundamental unit of

decomposition is the procedure that is coded as a subroutine or function. Codes beyond many 104 lines

based on POP are rigid and monolithic, not easy to modify or extend (even by the code author). Meysman

et al. (2003a) go as far as stating that a gap has developed between software engineering and reactive

transport modeling. This gap cannot be reduced by means of POP. Object-Oriented Programming (OOP)

may be a suitable alternative.

The main feature of OOP is its reliance on objects, which are data structures characterized by shared

data types and functions applied to these data. Chemical processes entail a well defined identity (e.g.

stoichiometric coefficients, equilibrium constants, concentrations, thermodynamic activity coefficients)

that are used to perform well defined functions (speciation, mixing, equilibrium with mineral phases, etc).

15

Page 26: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

16 Chapter 3. CHEPROO class organization

Thus, chemical processes seem ideally suited to OOP, which facilitates modularity and transportability

in the implementation of chemical processes in other Earth Science applications. Modularity means that

the tool could offer functions involving complex chemical calculations. External users (e.g. other codes)

could carry out chemical calculations using this tool. Transportability means that the same tool can be

implemented in different codes (e.g. in a conservative transport simulator, in a chemical speciation code).

In recent years, at least three areas of interest are currently being developed in reactive transport modeling

1) selection of geochemical processes to be incorporated in the model, 2) mathematical formulation of the

problem as a set of partial differential equations, and 3) numerical approach to solve these equations. Any

future object-oriented tool would have to meet these demands. As regards the first area of interest, the

accurate modeling of the chemical processes sometimes entails complex geochemical models, e.g. Pitzer

model, solid solutions, electrostatic-surface-complexation models. The second and third areas of interest

are related. Reactive transport entails to solve a set of coupled equations: PDE (Partial Differential

Equations, i.e. transport of species) and AE (Algebraic Equations, i.e. mass-action laws). The resulting

Differential Algebraic Equations (DAE) may be highly nonlinear. Nonlinearity coupled to the large

number of unknowns may entail a formidable computing effort. Thus, the second area of interest refers

to various strategies that have been proposed to decouple the system of equations. Some of them have

been proposed to reduce the number of unknowns (Saaltink et al., 1998; Molins et al., 2004; Krautle and

Knabner, 2005, 2007). Other strategies have been designed to improve the numerical convergence while

decoupling the reactive transport equations (Robinson et al., 2000; Molins et al., 2004; De Simoni et al.,

2005, 2007; Krautle and Knabner, 2005, 2007). As for the third area of interest, two kinds of approaches

exist to simulate kinetic-equilibrium reactive transport: the Direct Substitution Approach (DSA), based

on the Newton-Raphson method, and the Sequential Iteration Approach (SIA) based on Picard method.

SIA consists in solving the chemical and transport equations separately. DSA substitutes the chemical

equations into transport equations and solves them simultaneously by applying the Newton-Raphson

method (e.g. see Meysman et al., 2003b; Hofmann et al., 2008). Comparisons of both approaches and

examples of codes that use them are presented by Saaltink et al. (2001).

A number of works illustrate the advantages of OOP in both managing chemical information and solving

equilibrium problems (Blauch, 2002; Meeussen, 2003). These works separate the chemistry problem

in two entities. One of them (see ChemSys, Blauch, 2002) comprises the compositional (e.g. phase,

species) and reactivity classes (e.g. reactions or half-reactions). The other one entails the computational

Page 27: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

3.1. Introduction 17

classes to solve the chemical equilibrium problems. This explicit separation provides a great deal of

flexibility. Meeussen (2003) introduces a variant in the design where the solver equation is completely

generic and can be ’programmed’ in an input file. Thus, in a similar way to standard computer languages,

mathematical expressions can be defined in terms of variables, operators, and a set standard mathematical

functions including conditional expressions. However, this procedure could be too impractical and

inefficient to implement in the case of large reactive transport problem.

These tools are not specifically designed to handle reactive transport problems. A tool oriented to reactive

transport must meet a number of requirements. The tool must acknowledge that chemistry is spatially

variable (i.e., it should have a class to describe the chemistry at one point and objects of this class

could be created at many points). Second, it has to allow for different ways of coupling chemistry

and transport. Finally, it should allow for growth on the geochemical model (i.e., Pitzer model, solid

solutions, etc.). Significant contributions to the development of such a tool have been made by Meysman

et al. (2003a,b). These authors describe a flexible modular structure in Fortran 90 (F90) focused on early

diagenetic problems. Following this structure, geochemical models can be represented by entities such as

’element’, ’species’, ’reaction process’, ’transport process’, ’parameter’ and ’equation’. Many reaction

process entities are defined (e.g. mineralization reactions, acid-base dissociation reactions, sorption

reactions). These reflect the equilibrium and kinetic formulations frequently encountered in early

diagenetic problems. However, reactive transport applications may require the geochemical model to be

formulated in a more general way. For instance, reactions could be treated as one entity independently of

their types (e.g. acid-base dissociation, dissolution-precipitation reactions). Secondly, some geochemical

aspects were not incorporated in their work, e.g. activity coefficients models, surface-complexation

models. Finally, Meysman et al. (2003b) opted for a specific coupling method, the Direct Substitution

Approach (DSA). While DSA is often the most powerful coupling method (Saaltink et al., 2000), other

methods may be more appropriate in some circumstances.

The objective of this work is to present a specialized chemical process tool programmed in F90 and based

on OOP termed CHEPROO (CHEmical PRocesses Object-Oriented). It provides the basic functionalities

required for coupling to any transport simulator. By adopting the OOP methodology, this tool exhibits

features such as extensibility and flexibility for users and programmers.

Page 28: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

18 Chapter 3. CHEPROO class organization

3.2 CHEPROO object-oriented inspired principles

This section describes the main principles of object-oriented programming that are relevant for

CHEPROO. It is included for the sake of completeness, but can be omitted by readers that are familiar

with the topic. Details on OOP are given in Decyk et al. (1998), Akin (1999), Carr (1999), Meysman

et al. (2003a) and Gorelik (2004).

OOP consists of grouping entities that share both the type of data that describe them and the type of

functions they can perform. The resulting data structure (set of attributes) and functions (method) is

termed a ’class’. Specific entities from a class are called ’objects’ resulting from assigning values to

the attributes. For example, all chemical reactions have a name, a number of species, stoichiometric

coefficients, an equilibrium constant, and if the reaction is kinetic, a rate law. Chemical reactions can

perform maintenance operations (i.e. create, read, destroy) and be used for computing the concentration

of secondary species (equilibrium reactions) or reaction rates (kinetic reactions). Therefore, ’reaction’

defines the class and specific reactions (e.g. ’calcite dissolution/precipitation’) would be objects of this

class. Figure 3.1 displays several examples of classes and objects.

OOP is based on three features that facilitate the design, maintenance and growth of programs: 1)

encapsulation, 2) inheritance and 3) polymorphism. Encapsulation of objects makes it possible to hide

the details of internal implementation, while providing an explicit interface for them. This feature

facilitates the use of program units because an object can perform its services without bothering the ’user’

with details. Moreover, these internal details of the service may be changed without affecting the use of

the object, thus facilitating extension. Inheritance is formally defined as the ability to reuse and share the

data and methods of existing classes to construct hierarchical classes. Indeed, inheritance is most useful

when a class can be specialized (i.e., when an object can respond to the question ’is of type...’). For

example, an object of the class ’phase’ can be of type mineral, aqueous, gas (Figure 3.1). This feature

greatly facilitates extensibility. In the above example, simply adding the specialization ’solid mixture’

would allow the code to work with this new type of phase without any other modification. Inheritance

allows us to reuse previously created classes while reducing the size of the program. Polymorphism

allows us to use the same name on methods implemented in different classes. Figures 3.1C and 3.1D

illustrate example of polymorphism for reaction and phase classes. The method ’compute ’ is used in

Page 29: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

3.2. CHEPROO object-oriented inspired principles 19

Phase

Aqueous Species

contains1

Mineral

is type of phase

Gas

Species -Name

-Attribute values [:]-Number of attributes

-Create_

-Destroy_

-Set_

Reaction

-Stq [nsp], (stoich. coeff) -Log K

Species

-Create_

-Compute_xj_

-Destroy_

+Create_

+Compute_

+Destroy_

Contains1

+-+ -+Û HHCOCasCaCO 32

3 )(1 84 7. 8

)(3 sCaCO

2+Ca

-3HCO

+H

cont

is

an

)(3 sCaCO

2+Ca

-3HCO

+H

2+Ca

-3HCO

+H

Water

Quartz

Air

)(2 sSiO

n a n

cot i s

)(2 gNcontains

)(2 gO

)(2 gCO

tacon ins

)(2 gCO

Specific data

Name of the class

External User

Polymorphism

Abstraction (class)

-Attributes (data structure)

-Method (operation)

Inheritance

)(2 gN

)(2 gO )(2 sSiO

Nsp

A)

B)

C)

D)

Nsp

Instance (object)

+Create_

+Destroy_

+Set_

Interface +Method_

Calcite dissolution/precipitation

Name of the object

-Set_+Set_

-Name

-Create_

-Compute_act coeff__

-Destroy_

+Create_

+Compute_

+Destroy_

-Set_+Set_

-Name

-Attribute values [:]-Number of attributes

Figure 3.1: Example of class (abstracted data structure) and object (instance of this class) for severalentities in a geochemical system: species, reaction and phase

both classes. This operation returns the concentration of secondary species in equilibrium when applied

to a reaction object, or alternatively, the thermodynamic activity coefficients when applied to a phase

object.

F90 supports object-oriented programming. After we define a class, we create its container as a module.

The module separates the class from the main code and allows us to store it in an external file. The

data structure that defines a class is encapsulated in an user-defined data type. Therefore, each module

Page 30: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

20 Chapter 3. CHEPROO class organization

corresponds to one user-defined data type. The main operations upon this derived data type are also

defined within the module as typical subroutines (or functions). Polymorphism is implemented using

interfaces and the compiler will execute the correct implementation depending on the type of arguments

in the subroutine or function (examples about encapsulation and polymosrphism in F90 can be found

in Meysman et al., 2003a,b). Inheritance is not directly supported on F90 unlike truly object-oriented

languages such as C++ or Java. However, it can be emulated according to Decyk et al. (1998).

3.3 CHEPROO: Class organization

All the chemical processes are represented by a class termed CHEPROO. This class encapsulates two

different classes termed Nodal Chemistry and Chemical System (see Figure 3.2A). The Nodal Chemistry

class contains state data (e.g. concentrations, temperature, mass of water, cation exchange capacity) of

a portion of the physical system and is designed to define many objects (e.g. nodes of a finite element

mesh). The Chemical System class contains the entire description of a geochemical system (species,

phases, reactions and kinetic laws, Figure 3.2B). It is designed to describe few objects (e.g. zones

of an aquifer with different active minerals). Both classes are associated with each other. The methods

implemented in the Chemical System class are mainly used by the Nodal Chemistry class. Lists of Nodal

Chemistry and Chemical System objects can be created within a CHEPROO object. The present version

of CHEPROO contains three lists of Nodal Chemistry objects. One of them is fixed and predefined in

an input file (it is typically used to define initial conditions, boundary waters, or the like). The other

two Nodal Chemistry objects lists may change in dimension and content during running time. They may

represent the compositional information (e.g. concentrations) in different calculation events (e.g. one list

for a previous time step, the other for the present one). A list of Chemical System objects can be created.

The CHEPROO object handles them, assigning its corresponding Chemical System object to each Nodal

Chemistry object.

All input data is read from files in xml (eXtensible Markup Language) format. This format was

preferred because the information is organized in data structures, and is therefore consistent with the

object-oriented philosophy.

The Chemical System and Nodal Chemistry classes are described in detail in the following subsections,

Page 31: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

3.3. CHEPROO: Class organization 21

Inheritance symbol (is of type ...)

Extensibility of the class organization

A)Composition symbol (contains...)

CHEPROO

Contains

1

NodalChemistry

1

1..*associated with

1..*ChemicalSystem

Species

1

1..*

Phase

1

1..*

contains

11..*Reaction

1

0..*

11..*

ChemicalSystem (child)

is of type chemical system

ReactionRatelaw

0..*

10..*

1

B)

C)

List of symbols

1..* Multiplicity of objects

Phase

Pure Ideal Solution

Davis Pitzer

Aqueous

Speciescontains1 1..*

Bdot Ideal

is of type aqueous

Mineral

Gas

Gas Ideal

is of type mineral

is of type phase

Gas Non Ideal

is of type gas

Non Ideal Solution

Surface

Cation Exch Triple Layer ConstCap

is of type surface

Figure 3.2: Class organization: A) Internal organization of CHEPROO Class, B) Organization ofChemical System Class; C) Organization of Phase Class (Inheritance object-oriented concept was appliedin Chemical System and Phase Classes)

after which the methods are implemented in the CHEPROO class.

Page 32: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

22 Chapter 3. CHEPROO class organization

3.3.1 Chemical system class, the geochemical system

The entire description of the geochemical system (except composition data that are stored in the

Nodal Chemistry class) is contained in the Chemical System class (e.g. species, stoichiometric matrix,

thermodynamic models, kinetic rate laws, etc.). Within the Chemical System class, the information is

encapsulated in child classes: species, phase, reaction and reaction rate law (see Figure 3.2B). In addition,

the set of primary species (minimal set of species that can be used to compute the remaining species by

means of mass-action laws) and the components can be defined according to different formulations (e.g.,

see Saaltink et al., 1998; Molins et al., 2004; De Simoni et al., 2005). The Species class constitutes the

basic entity and is shared by the remaining classes, i.e., the same species object can be shared by a phase

object, reaction object and reaction rate law object (see Figure 3.2B).

The Chemical System class offers many functions such as providing information on the set of primary

species, and computing total concentrations or chemical speciation. The input for these computations

is the compositional information (e.g. concentrations, activity coefficients, temperature) stored in Nodal

Chemistry. Therefore, Chemical System functions are primarily designed to be used by Nodal Chemistry.

Four speciation algorithms were implemented in the Chemical System class: 1) equilibration of the

aqueous solution with mineral and gas phases, 2) speciation from solution characteristics (i.e. imposed

pH, in equilibrium with some mineral or gas phase), 3) speciation from total concentrations in all phases,

and 4) speciation from the concentration of primary species. These calculations depend on the different

child classes within the Chemical System class (e.g. the phase class computes activity coefficients, the

reaction class computes a secondary concentration through the mass-action law). The Newton Raphson

was implemented to solve the system of equations.

A Chemical System object supports one or more component formulations. Components of a chemical

system are those linear combinations of species that, together with the equilibrium constraints, enable us

to fully determine the chemical system (Molins et al., 2004). Components are not affected by equilibrium

reactions but may be affected by kinetic reactions. Therefore, it is possible to obtain a full-ranked kernel

matrix U (see Saaltink et al., 1998) so that

USte = 0 (3.1)

Page 33: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

3.3. CHEPROO: Class organization 23

where Se is the equilibrium stoichiometric matrix [number of equilibrium reactions times number of

species]. Note that U is not unique. The matrix U is termed the component matrix because components

are defined by:

u = Uc (3.2)

where c is the vector of concentrations. Matrix U and the dimension of u (i.e. number of components)

depend on the geochemical characteristics of the system. Thus, in a reactive transport problem, the

matrix U may vary in space and time in response to changes in the geochemical system (e.g. exhaustion

of the mineral or precipitation of a new phase). Various ways to define U have been reported (Steefel

and MacQuarrie, 1996; Saaltink et al., 1998; Molins et al., 2004; De Simoni et al., 2005). Chemical

System specializations can be created to accommodate different definitions of the components matrix

U (using inheritance). Two of them are currently implemented the component definition of Steefel and

MacQuarrie (1996) (here called ’Classic Chemical System class’), and the component definition of

Saaltink et al. (1998) (here called ’Retraso Chemical System class’).

3.3.2 Species class, the basic entity

The species class describes the properties of a geochemical species. Aqueous species are described by

their electrical charge, ion size or molecular weight. Mineral species are described by the molar volume.

The only operations on the Species class are related to the access of these attributes.

3.3.3 Phase class, the thermodynamic behavior

The phase class describes a phase and its thermodynamic behavior. It is used for represents the

’non-ideality’ of the chemical system. Phases are traditionally defined as homogeneous parts of the

chemical system with boundaries with adjacent phases that are mechanically separable. This holds for

all types of CHEPROO phases, except for surface phases, which are used for sorption and exchange

processes. The phase class contains the species class and its attributes that depend on the nature of the

phase (e.g. the dielectric constant for the aqueous phase). The main function of the Phase class is to

compute the thermodynamic activity coefficients of the species involved. Thermodynamic models also

depend on the nature of the phase. For example, both diluted water (Davis class) and brine (Pitzer class)

Page 34: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

24 Chapter 3. CHEPROO class organization

are specializations of ’Aqueous Phase’ but their thermodynamic behavior is different (Figure 3.2C).

Thus, the thermodynamic behavior of dilute water can be defined as ideal or calculated according to

Debye-Huckel-based formulas (Debye and Huckel, 1923, , Davis and Bdot Classes). Brines behave

according to the ionic interaction model (Pitzer Class). Note that compositional data are not stored in

this class. In fact, the molality vector is provided by nodal chemistry objects to chemical system objects

through the methods implemented in it.

A similar analysis is followed for mineral and gas phases. The thermodynamic behavior of solid and

gas phases can be defined as a pure phase or as an ideal or non-ideal solution (Figure 3.2C). Different

approaches to treat non-ideal solid solutions (i.e. regular, subregular) and a different equations of state

for non-ideal pure gases and gas mixtures are incorporated as specialized classes.

A specific phase class is the surface class (Figure 3.2C) that can be used to hold surface and cation

exchange species. Although a surface is not a mechanically separable part of the chemical system, it can

be assigned a specific thermodynamic behavior. Cation exchange and electrostatic complexation models

(e.g. triple layer, constant capacitance and double layer) are supported in CHEPROO.

3.3.4 Reaction class

The Reaction class establishes the relationship between species in the same phase (homogeneous

reaction), or species in different phases (heterogeneous reaction). The Reaction class is associated with

’Species’ and ’Reaction Rate Law’ classes (see Figure 3.2B). In addition, it encapsulates other data

like the stoichiometric coefficients, the equilibrium constant and the power function coefficients for the

temperature dependence of the equilibrium constant. The relationship between species (S ) of jth reaction

can be formalized as

S j Ns∑i=1

ν j,i S i K j(T ) (3.3)

where Ns is the number of species, νi j the stoichiometric coefficient of the ith reacting species in the jth

reaction, and K j(T ) the equilibrium constant of the jth reaction, which is a function of temperature (T ).

At equilibrium, the relation (3.3) can be expressed by the mass action equation

x j = K−1j (T ) γ−1

j

Ns∏i=1

(γici)ν j,i (3.4)

Page 35: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

3.3. CHEPROO: Class organization 25

where γ are activity coefficients, and c and x are concentrations of the participating species. It is always

possible to write the reactions in terms of a subset of c called primary species (dimension [Ns-Nr], where

Nr is the number of equilibrium reactions) so that the secondary species can be obtained explicitly from

equation (3.4). The main method implemented in the Reaction class solves equation (3.4) (see Figure

3.1C, ’compute xj ’) and calculates its derivatives with respect to the participating species. Note that the

meaning of x j in equation (3.4) depends on the type of reaction. Thus, this could be the concentration of

an aqueous or a surface complex, a ratio between the ionic activity product and the equilibrium constant,

or a partial pressure of a gas species. If a reaction object is defined as kinetic, the class can additionally

calculate the reaction rate (and its derivatives with respect to all species). Internally the reaction rate

calculation is carried out by the associated reaction rate law object.

Reaction rate law class, the kinetic behavior of the reaction

This class contains mathematical expressions of kinetic laws for chemical reactions (see Figure 3.2B).

One expression generally used in dissolution/precipitation rate for mineral species (Steefel and Yabusaki,

1996; Steefel, 2001) is

Ri = σie−Ea,iRT

Nk∑k=1

kik

Ns∏j=1

apik jj

(Ωθik − 1

)ηik (3.5)

where Ri is the reaction rate (moles per minerals per unit of mass of water and unit time), kik is the

experimental rate constant (moles of minerals per unit of mineral surface and unit time), σi is the surface

area of mineral (unit of mineral surface per unit of mass of water), e−Ea,iRT is the Arrhenius term with Ea,i

being the apparent activation energy of the overall reaction, Ω is the saturation (ratio between the ion

activity product and the equilibrium constant), Nk is the number of experimental terms, Ns number of

catalytic species, and a j their activities. Parameters p, θ and η must be determined from experiments and

they are often taken as equal to 1. The last term in equation (3.5) is also called the far-from-equilibrium

term, decreasing the reaction rate in a non-linear way, as the solution approaches to equilibrium. The

Reaction Rate Law class can also represent other reaction mechanisms derived from the Monod type,

widely applied in biogeochemical problems

Ri = e−Ea,mRT ki

N si∏

j=1

[ua

k( j)

]νi, j N si∏

j=1

uak( j)

K si j + ua

k( j)

Nii∏

j=1

Kii j

Kii j + ua

k( j)

(3.6)

Page 36: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

26 Chapter 3. CHEPROO class organization

where ki is the maximum rate, N si is the number of Monod terms in the rate expression, K s

i j are the

half-saturation constants for the limitation by lack of substrate or electron acceptors, and Nii is the number

of inhibition terms in the reaction expression in which Kii j define the inhibition constants as a result of

toxicity or the preferential use of electron acceptors. The pointer k( j) relates the electron acceptor,

substrate, or inhibitor concentrations to the appropriate entry in the concentration vector of the total

aqueous component concentration ua.

A reaction rate law object can contain zero, one or more species objects. These species participate in

the kinetic law as catalysts and inhibitors, but do not necessarily participate in the stoichiometry of the

reaction. Therefore this class is associated with the Species class. Moreover, parameters defining a

law (e.g. rate constants, half saturation constants, inhibition constants, activation energy of the overall

reaction, etc.) are required as attributes of the reaction rate law class.

3.3.5 Nodal Chemistry class, compositional information and geochemical state variables

The Nodal Chemistry class forms the basic operational entity of the geochemical problem and contains

the compositional information. Nodal Chemistry objects are used to simulate the chemistry of parcels

of water. These parcels may represent samples, batch experiments, portions of a contaminated soil or

aquifer, etc. Therefore, this class contains all direct and derived state variables generally used in standard

geochemical calculations (e.g. concentrations, activity coefficients, ionic strength, temperature, mass of

water, kinetic reaction rates, surface area of minerals, derivatives of state variables, sorption sites). In

addition, each Nodal Chemistry object is associated with one Chemical System object, and can perform

any chemical operation (see Figure 3.2A). Methods offered by Nodal Chemistry class can be classified

into four groups of methods: A) internal maintenance (e.g. create, destroy, set, read/write), B) access

to compositional information encapsulated it (e.g. access to concentrations or total concentrations),

C) reaction path, D) setting compositional information. Six reaction path methods (daughter method

of group C) can be applied on a Nodal Chemistry object: 1) mixing waters, 2) kinetic trace (e.g.

dissolution/precipitation of minerals, oxidation and reduction (redox) reactions), 3) titration, 4) addition

of mineral species, 5) evaporation in closed and open systems (i.e. the precipitated mineral phases are

removed and not allowed to redissolve), 6) heating/cooling solutions. The compositional information in

a nodal chemistry object (group of methods D) can be defined from 1) concentrations of primary species,

Page 37: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

3.3. CHEPROO: Class organization 27

2) total concentrations in all present phases, 3) general characteristics of the solution (i.e. given a pH,

equilibrium with some mineral or gas phase, total concentrations, etc.).

3.3.6 CHEPROO class, handling compositional information and management of

chemical processes

The attributes of the CHEPROO class were described at the beginning of this section. Services include

initialization, management and calculation of chemical processes. Thus, a CHEPROO object may be

used to implement chemical processes in other Earth Science models. The most significant methods

are summarized in Table 3.1, and they are organized into six groups: A) internal maintenance, B)

reading/writing, C) management of the reaction path operations, D) reactive transport calculations, E)

access to general chemical information (e.g. concentrations or its derivatives with respect to primary

species), F) access to chemical information for coupling with other processes (e.g. changes in porosity,

fraction of water or salt in liquid). A CHEPROO object can manage reaction path operations (group

Table 3.1: Some methods implemented in the CHEPROO class.

Type Method Decription create_ Create object. destroy_ Destroy object. create_nodalchem_ Create lists of nodal chemistry objects.

save_nodalchem_ Save list of nodal chemistry objects in k to k+1 (or the opposite operation).

A Internal

maintenance

init_nodalchem_ Initialice nodal chemistry objects inside cheproo object.

reaction_path_ Reaction path operations upon and between nodal chemistry obejcts.

equilibrate_ Equilibrate specified nodal chemistry objects with mineral phases.

update_and_check_ Update reaction term for SIA for all nodal chemistry objects and check convergence.

B Reaction path management

mix_ Mix nodal chemistry objects. solve_react_trp_step_ Solve one reactive transport time step (for SIA or DSA)

update_and_check_ Update reaction term for SIA for all nodal chemistry objects and check the convergence. C

Reactive transport calculations

build_jacob_resid_dsa_ Build the jacobian and residual for DSA.

get_umob_ Return mobile components of all nodal chemisttry objects. get_uads_ Return adosorbed components of all nodal chemistry objects.

get_dumob_ Return derivatives of mobile components for all nodal chemistry objects.

D Acces to general

chemical information

compute_total_mol_ Compute total mol of components in a cheproo object. read_xml_ Read cheproo object file in xml format.

E Reading/Writing write_ Write general information on cheproo object.

get_chem_info_ Return general chemical information (e.g. mass of fixed water, fraction of salt in liquid, fraction of water in liquid)

F

Access to chemical

information for coupling with

other processes update_ Update porosity.

of methods C) on and between nodal chemistry objects. For example, on a group of nodal chemistry

Page 38: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

28 Chapter 3. CHEPROO class organization

objects, we may evaporate the ith Nodal Chemistry object, add calcite in the jth, mix the ith and jth,

and store the result in the kth Nodal Chemistry object. On the other hand, many methods in this class

are oriented to reactive transport calculations (group of methods D). CHEPROO objects have been

designed to enable flexibility on how to implement the reactive transport in other codes. Methods for

solving reactive transport problems result from combining conservative transport methods and chemical

problem formulations.

We outline the methodologies one could use when the conservative transport problem is solved

using a matrix based method (typical of 2nd order finite element or finite differences discretizations).

In such a case, the reactive transport problem can be described by solving together the mass action law

equation (3.4) and the transport of components (see, e.g. Saaltink et al., 1998)

[F∆t+ A

]uk+1 =

F∆t

uk + f (3.7)

where A is transport matrix (including advection and dispersion mechanisms), F is the storage matrix,

the superindex k stands for time step (i.e. equation (3.7) is solved sequentially in time), u is the vector

of components (equation (3.2)), and f includes both external sink/source and kinetic reaction terms (for

the sake of simplicity, we will assume that it also includes the immobile portion of u). The solution to

the system of equations given by (3.7) and (3.5) may be easy in special cases. For example when all

reactions are assumed in equilibrium and immobile species are pure minerals (i.e. they have a constant

activity), f does not depend on the chemical reactions and equations (3.7) and (3.5) become decoupled so

that one can first solve (3.7) and then use speciation functions to obtain c (De Simoni et al., 2005). These

simplifications are also feasible for biochemical reactions wherever reaction rates are limited by the

availability of electron acceptors or donors (Cirpka and Valocchi, 2007). In general, however, equations

(3.7) and (3.5) must be solved together. Two general approaches are available: Sequential Iteration

Approach (SIA) and Direct Substitution Approach (DSA). SIA consists in dividing the problem into two

steps. The first step is called the transport step and it entails solving (3.7) where the unknowns are uk+1.

The second step is known as the chemical step and involves updating the reaction contribution in (3.7)

(it is added to f) from uk+1. The process is repeated until convergence. The method ’update and check ’

calculates the reaction contribution and check the convergence. DSA, on the other hand, solves

Page 39: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

3.3. CHEPROO: Class organization 29

(3.7) and chemical equations simultaneously. The Newton-Raphson method is widely used in this

case. Jacobian and residual is computed by calling to the method ’build jacob resid dsa ’. Another

method implemented in this class solves one time step of the reactive transport in both approaches

(’solve react trp step ’). In all cases, matrices A and F, and ∆t in (3.7) depend on the method used

for solving transport and must be provided by the user.

Page 40: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 41: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Chapter 4

The geochemical system

4.1 The geochemical system

4.1.1 Species, reactions and stoichiometric coefficients

A chemical system consists of a set of atomic constituents or elements. A chemical species is defined

as any chemical entity distinguishable from the rest due to (1) its elemental composition, and (2) by

the phase at which it is present. For instance, CO2(g) is a different species than dissolved CO2(aq).

Components of a system are chemical entities independent from each other that allow a complete

description of the system. The selection of components is arbitrary, and depends on the system studied.

Although the NE atomic constituents or chemical elements could be as a set of components, they are

never used as such because the atomic constituents themselves are rarely present in aqueous phases. For

this reason, it is more convenient to select as components a set of NC aqueous species or combinations

of them. From a mathematical point of view, defining a set of components amounts to finding a base in

a vector space of chemical species. The set of NE atomic constituents is the most intuitive base of the

system. However, it would not be a base because equilibrium reactions cause species not be independent.

A subset of NC primary species represents a practical set of unknowns. In a system constituted of NS

chemical species, any of the NR reactions taking place can be represented as a linear combination such

31

Page 42: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

32 Chapter 4. The geochemical system

asNs∑j=1

νi jQ j = 0 (4.1)

where Q j is the chemical formula of the jth species, and νi j is its stoichiometric coefficient in the ith

reaction. The matrix of stoichiometric coefficients , S, is a NR×NS rectangular matrix with a range equal

to NR. If the reactions are independent, S contains a non-singular square NR×NR submatrix. This means

that it is possible (by forming appropriate linear combinations) to write matrix S in such a way that

S = [S1 |S2 ] (4.2)

where S2 is a square matrix of size NR and S1 is a rectangular [NR×(NS -NR)] submatrix. This equation

reflects that the chemical reactions in (4.1) can be rewritten so that a subset of secondary NR species

(those corresponding to the columns of matrix S2) can be expressed as linear combinations of the

remaining [NS -NR] primary species. The entries of matrix S are

S =

ν11 ν12 .. ν1NC −1 0 ... 0

ν21 ν22 .. ν2NC 0 −1 ... 0

. . .. . . . ... .

νNR1 νNR2 .. νNRNC 0 0 ... −1

(4.3)

The entries νi j of matrix S in CHEPROO are read from one of the possible databases or from an input file

in xml format (see section ??). Each database has a set of aqueous species considered as primary. The rest

of chemical species, termed secondary species (aqueous complexes, minerals, gases, surface complexes)

are expressed as lineal combination of primary species. By convention the stoichiometric coefficients are

positive for species on the right hand side of the reaction, and negative for those on the left hand side. The

reactions are written as dissociation reactions of one mole of secondary species. Therefore, the resulting

matrix S2 is −I, minus the identity matrix. Once this initial matrix S is built from the database, a switch

to any other set of primary species selected by the user is done automatically, as described below. The

choice of primary species is arbitrary. Secondary species correspond to the -1 columns of matrix S in

(4.3). Should other species be selected as primary, the corresponding stoichiometric coefficients should

be different. To illustrate the procedure for defining a new set of primary species, let us consider the case

Page 43: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

4.1. The geochemical system 33

where the second and fourth primary species are exchanged with the first and second primary species

in matrix S of (4.3). Then, by imposing that columns of secondary species are unit columns, we can

algebraically obtain a new stoichiometric coefficients for matrix S′

S′ =

ν′11 −1 ν′13 0 .. ν′1NCν′1NC+1 ν′1NC+2 ... 0

ν′21 0 ν′23 −1 .. ν′2NCν′2NC+1 ν′2NC+2 ... 0

. . . . .. . . . ... .

ν′NR1 0 ν′NR3 0 .. ν′NRNCν′NRNC+1 ν′NRNC+2 ... −1

(4.4)

Whose entries are different from those of S, but can be obtained in a similar manner. The two matrices S

and S′ are related through a linear matrix operator P [NR×NR]

S′ = PS (4.5)

The entries of P can be obtained taking into account that P is able to give the identity submatrix −I of

size NR×NR of matrix S′ (formed by the second, fourth and last columns in the previous example) from

the equivalent submatrix S2 (formed by the same columns) of S

− I = PS2 (4.6)

and therefore

P = −S−12 (4.7)

Where, as defined above, S2 is a square matrix of size [NR×NR] containing the NR columns of S

corresponding to the new set of secondary species.

4.1.2 Chemical equilibrium

When local equilibrium is assumed between chemical species of the system, at a given pressure and

temperature, the Gibbs free energy of the system reaches a minimum. Under these circumstances,

the system cannot spontaneously carry out any chemical work. The derivation from this principle of

Page 44: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

34 Chapter 4. The geochemical system

equilibrium Denbigh (1987) leads to the well known mass action law expression:

a−1j

NC∏i=1

aν jii = K j(P,T ) (4.8)

where K j is the equilibrium constant which depends on the pressure (P) and temperature (T ) of the

system. ai and a j are the thermodynamic activities of ith and jth species, respectively; NC is the total

number of primary species and ν ji is the stoichiometric coefficient of the ith primary species in the

dissociation reaction of the jth species. CHEPROO allows the equilibrium constants to depend on the

temperature (T ) according several mathematical expressions. For instance

ln K j = f1 ln T + f2 + f3T +f4T+

f5T 2 (4.9)

where f1 to f5 are coefficients obtained by fitting to experimental data. Changing primary species,

through operator P, implies rewriting the reactions (effectively, recombining the mass action laws of

the reactions). Therefore, K j must change. From (4.8) it follows that

ln K j = −ln a j +

NC∑i=1

ν ji ln ai (4.10)

The above equations can be expressed in matrix notation as

ln k = −S ln a (4.11)

where k is the column vector of K j values, S is the matrix of stoichiometric coefficients (see equation

(4.3)), and the vector a are species activities. For a different set of primary species having a S′ coefficient

matrix, the corresponding k′ values will be given by

ln k′ = −S′ ln a (4.12)

Notice that vector a remains the same as long as pressure and temperature remain constant. From

equations (4.5), (4.11), and (4.12) one has

ln k′ = −S′ ln a = −PS ln a = P ln k (4.13)

Page 45: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

4.1. The geochemical system 35

which means that ln k′ is computed from ln k through the P linear operator.

4.1.3 Aqueous complexation

Aqueous complexation reactions take place in the aqueous phase including acid-base and redox reactions.

The continuous motion of dissolved ions together with their large number per unit volume causes

numerous collisions between them. This leads to a potential formation of ion pairs and/or dissolved

complexes, which usually have an ephimerous live (order of 10−10 s). Since these reactions are almost

instantaneous, they can be effectively considered as equilibrium reactions. The equilibrium constant

relates the average number of ions pairs or complexes which are being formed. Applying the mass-action

law to the dissociation of secondary species, one has

ln ka = −ln a2 + Sa ln a1 (4.14)

where a1 and a2 are vectors containing the thermodynamic activities of the primary and secondary

aqueous species, respectively, and Sa is the matrix with stoichiometric coefficients. This equation allows

to express the concentration of secondary species or aqueous complexes c2 in terms of primary species

concentrations c1 (both in mol kgw−1)

ln c2 = −ln ka − lnγ2 + Sa (ln c1 + lnγ1) (4.15)

where the vectors γ1 and γ2 are the activity coefficients of primary and secondary aqueous species,

respectively. CHEPROO supports many models to describe the thermodynamic behavior of an aqueous

phase (e.g. Extended Debye-Huckel, Truesdell-Jones, Pitzer). Regarding the diluted solutions (less

than 1 mol kgw−1), the value of the activity coefficient of the ith aqueous species (γi) can be calculated

according to the extended Debye-Huckel formula

log γi = −Az2

i

√I

1 + Bri√

I+ bI (4.16)

where I is the ionic strength of the solution; zi and ri are the electric charge and the ionic radius in

solution of the ith aqueous species, respectively; A and B are constants which depend on temperature and

Page 46: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

36 Chapter 4. The geochemical system

dielectric constant of water, and b is a constant determined from fitting experimental data. The values

of A, B and b at different temperatures are tabulated in Helgeson and Kirkham (1974). The value of the

ionic strength is calculated as

I =12

Na∑i=1

z2i ci (4.17)

where ci is the concentration of the ith aqueous species, and Na is the number of aqueous species. Another

way to calculate the activity coefficient is using the formula of Truesdell-Jones. This formula is the same

as equation (4.16) except that b does not depend on the temperature but on species. That is, every species

has its own value for b. Water activity (aw) can be calculated according to the approximation of Garrels

and Christ (1965)

aw = 1 − 0.018Na∑i=1

ci (4.18)

On the other hand, to describe the interaction of individual ions in concentrated solutions, more complex

thermodynamic models must be used. These complex models are based on virial expansions that account

for the ionic interactions. One of the most popular is Pitzer model (based on Pitzer, 1973, equations).

This virial expansion entails summation over all possible binary and ternary short-range interaction

terms, as well as mixing terms. The implementation of Pitzer model in CHEPROO has been exhaustive

detailed in the corresponding section in this thesis (see Chapter ?? and Appendix ??).

4.1.4 Surface complexation

Soil and aquifers contain materials like clay minerals, organic matter and metal oxy-hydroxides which

can sorb chemical species. The term ’adsorption’ refers to the adherence of a chemical to the surface

of the solid, ’absorption’ suggests that the chemical is taken up into the solid, and ’exchange’ involves

replacement of one chemical for another at the solid surface.

It is sometime difficult to separate sorption and other types of reactions involving solids such as

precipitation and dissolution. A major difference is that sorption depends on the presence a preexisting

solid surface, in contrast to, for instance, precipitation. Sorption and ion exchange have became important

topics for hydrogeologists since these processes regulate the transport of pollutant chemicals in aquifers

and soils.

Page 47: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

4.1. The geochemical system 37

Cation exchange

Under steady-state chemical conditions, the composition of a cation-exchanger will be in equilibrium

with the resident groundwater. When the water composition changes as a result of pollution or

acidification, or due to a moving salt/fresh water interface, the cation exchanger readjusts its composition

to the new groundwater concentrations.

While in principle all solid surfaces in soils and aquifers can act as absorbers, solid phases with a large

specific surface area will adsorb most cations, and the adsorption capacity therefore depends on the grain

size. The adsorption capacity is therefore linked to the clay content (fraction < 2µm), clay minerals,

organic matter (%C), and oxide or hydroxide content. The current convention is to express the Cation

Exchange Capacity (CEC) of a soil in meq kg−1. Table 4.1 gives the CEC of common soil constituents.

Clay minerals show a wide range in CEC depending upon mineral structure, structural substitution and

the specific surface of the mineral accessible to water.

Table 4.1: Cation exchange capacities of common soil and sediment materials (taken from Appelo andPostma (1993), Table 6.3).

CEC, meq kg-1 Kaolinite 30-150 Halloysite 50-100 Montmorillonite 800-1200 Vermiculite 1000-2000 Glauconite 50-400 Illite 200-500 Chlorite 100-400 Allophane up to 1000 Gothite and hematite up to 1000 (pH>8.3)

1500-4000 (at pH=8) Organic matter (C) or accounting for pH-dependence 510 x pH-590=CEC per kg organic carbon1 1 Scheffer and Schachtschabel (2002)

For ion exchange we can write the general reaction

1i

Ii+ +1j

J − X j 1i

I − Xi +1j

J j+ (4.19)

Page 48: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

38 Chapter 4. The geochemical system

and the distribution of species is given by the mass-action law

βJ =β

j/iI K j

J/I aJ j+

a j/iIi+

(4.20)

where βi and β j are the equivalent fractions of ith and jth exchange complexes, respectively, K jJ/I is the

selectivity coefficient For ion Ii+ the equivalent fraction βI is calculated as

βI =[I − Xi]CEC

=[I − Xi]∑

I,J,K...

[I − X j

] (4.21)

where I, J, K... are the indices of exchangeable cations, with charges i, j, k, and [I−X] is the concentration

of the exchange complex (eq kgw−1).

Many surfaces objects with the cation-exchange model can be created in a CHEPROO object. A number

of sites can be also defined in each of them. In addition, each site is determined by a CEC.

The composition of the exchanger in a site can be calculated by combining the mass-action expression

with the mass balance for the sum of the exchangeable fractions. The mass-action law is expressed in

this case, as

ln βJ = S1 (ln c1 + ln γ1) − Sd ln βI − ln KI/J (4.22)

where βJ is the vector of equivalent fractions of the exchange complexes, βI is the vector of equivalent

fractions of primary exchange species, S1 and Sd contain the stoichiometric coefficients of the exchange

reactions, and KI/J is the vector of selectivity coefficients.

The sum of overall equivalent fractions in the site must satisfy the condition

Nex∑k=1

βk = 1 (4.23)

where Nex is the number of exchange species in a site.

Once c1 and γ1 are known, equations (4.22) and (4.23) can be solved using the Newton-Raphson method.

Page 49: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

4.1. The geochemical system 39

Electrostatic model: Triple Layer

The triple layer model was developed by Davies and Leckie (1978) to be applied to adsorption of metals

on oxide surfaces. All sorbed ions are ascribed to one of two surface layers, 0 and β, whereas a diffuse

layer, d, is formed with counter ions in solution. Some surface reactions, such as protonation and

de-protonation, take place at the immediate surface of the mineral or 0 layer. This layer has a total

surface charge σ0 and a potential ψ0. Other ions in solution are bounded to protonated/de-protonated

groups of opposite sign and create a layer β with a charge σβ and a potential ψβ. The surface charge of

layers 0 and β is calculate from the total surface species adsorbed on the layer

σ0 =FA

N0∑k=1

zkyk (4.24)

σβ =FA

Nβ∑k=1

zkyk (4.25)

where F is the Faraday constant (C mol−1), A is the specific surface area (m2 kgw−1), zk and yk are the

charge and the concentration of the kth adsorbed species (mol kgw−1), respectively; and N0 and Nβ are

the number of species adsorbed in layers 0 and β, respectively (N0 + Nβ = Ny). The value of A is currently

found in literature as the product S A, where S is the solid concentration (g kgw−1), and A is the surface

area of the solid per unit of mass (m2 g−1).

A number of solvated ions in solution do not neutralize the surface charge by forming surface complexes,

but by means of a zone of major density of delocalized ions of sign opposite to that of the surface. The

surface charge and the potential of this diffuse layer of counterions are related by Guy-Chapman or

double-layer theory

σd =√

8RT εε0Isinh(Fψd

RT

)(4.26)

where ε is the dielectric constant of water, ε0 the permitivity of free space (8.854·10−12 C V−1 m−1), and

I the ionic strength of the solution (mol kgw−1).

The 0 and β layers are separated by a region of capacitance C1, and the layers β and d are separated

by a region of capacitance C2. The surface charge of the three layers is also related to potentials by

Page 50: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

40 Chapter 4. The geochemical system

electrostatic capacitances, and also verify that the total surface charge is zero (σ0+σβ+σd = 0)

σ0 = C1(ψ0 − ψβ

)(4.27)

σβ = C1(ψβ − ψ0

)+C2

(ψβ − ψd

)(4.28)

σd = C2(ψd − ψβ

)(4.29)

The values of C1 and C2 (F m−2) are normally obtained by fitting experimental data.

Electrostatic model: Double (Diffuse) Layer

The diffuse layer model has been fully described by Dzombak and Morel (1990) and applied to adsorption

of metals on iron oxide surfaces. In the diffuse layer model the solid-water interface is composed by two

layers: a layer of surface-bounded complexes and a diffuse layer of counter ions in solution. All the

sorbed ions are assigned to the unique surface layer, whose surface charge is calculated according to an

equation similar to equation (4.24) or equation (4.25). Similar to the triple-layer model the relationship

between the surface charge and the potential can be calculated from the Guy-Chapman theory equation

(4.26). One normally uses a linearized expression for low values of the potential:

σd = εε0κψ (4.30)

where 1/κ (m) is the double-layer thickness:

1κ=

√εε0RT20F2I

(4.31)

where ε is the dielectric constant of water, ε0 the permitivity of free space (8.854·10−12 C V−1 m−1), F

the Faraday constant, and I the ionic strength of the solution (mol kgw−1). Therefore, in the diffuse-layer

model the value of the capacitance C relating the surface charge and the potential can be calculated based

on theoretical considerations, equation (4.30), instead of being an experimental fitting parameter.

Page 51: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

4.1. The geochemical system 41

Electrostatic model: Constant Capacitance

The constant capacity model has been introduced among others by Schindler et al. (1976). As in the

diffused-layer the constant capacitance model is based on the assumption that all the species are sorbed

in the same layer and a diffuse layer of counterions constitutes the transition to homogeneous solution.

However, differently from the diffuse-layer model the relationship between the surface charge and the

potential is assumed here to be linear and constant:

σ = Cψ (4.32)

where C is a constant value to be obtained from fitting experimental data.

4.1.5 Mineral dissolution and precipitation

Under equilibrium conditions, dissolution-precipitation reactions can be described by the mass-action

law

χmλmKm =

NC∏i=1

pmi

i γν

pmi

i (4.33)

where χm is the molar fraction of the mth solid phase, λm is its thermodynamic activity coefficient (χm

and λm are equal to 1 for pure phases), ci and γi are the concentration and activity coefficient of the ith

species, νpmi its stoichiometric coefficient in the dissolution reaction of the mth solid phase, and Km is

the corresponding equilibrium constant. The saturation ratio is the ratio (Ωm) between the ion activity

product and the solubility product

Ωm = K−1m

NC∏i=1

pmi

i (4.34)

The logΩm value is known as the saturation index S Im. The system reaches the minimum free energy at

equilibrium whenΩm=1 or S Im=0. Saturation ratiosΩm greater than 1 (S Im > 0) indicate that the system

will evolve so that the mth mineral precipitates. On the contrary, when Ωm < 1 (S Im < 0) the mineral

will tend to dissolve. This means that the mineral phases that can participate are those already present

initially and other potential minerals with Ωm values greater than 1. However, the phase rule states that

at given pressure and temperature the number of phases cannot exceed the number of components NC .

Page 52: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

42 Chapter 4. The geochemical system

In such cases, only the minerals with the largest Ωm values are retained as phases. Similarly, when a

mineral being dissolved is exhausted it must be excluded from the list of mineral phases.

On the other hand, the thermodynamic chemical equilibrium condition only states the minimum energy

state of the system, but says nothing about the progress of the system. Kinetics offers a way to analyze the

chemical evolution of a reaction, incorporating explicitly the time variable. Some geochemical processes

(such as dissolution and precipitation of many minerals) are known to progress so slowly that they may

never reach equilibrium. In these cases a kinetic law is required. However, quantitative information on

the kinetic law of most natural processes is scarce, although during the last years significant progress

has been made on dissolution rates. In CHEPROO, the rates for mineral precipitation are assumed to

follow the same law as dissolution. There are several experimental expressions for dissolution rate in

the literature. It is common to express the rate as the addition of several terms, each one expressing the

dependence of the rate upon a particular species in solution (see for example Chou and Wollast, 1985).

rm = σm

Ni∑i=1

kmici (4.35)

where Ni is the number of terms of the experimental expression, ci the concentration of the ith species

in solution, kmi an experimental constant and σm the reactive surface (m2 m−3). For mineral dissolution,

Lasaga (1984) have proposed the following general expression

rm = σmkm

Ns∏i=1

apii

(Ωθm − 1

)η(4.36)

where rm is the mineral dissolution rate (mol m−3 s−1), km is the experimental rate constant (mol m−2 s−1),

Ωm is the ratio between the ion activity product and the equilibrium constant as defined in (4.34). The

parameters θ and η must be determined from experiments. Usually but not always they are assumed to be

1. The term inside the parenthesis, called the far-from-equilibrium function, decreases the reaction rate in

a non-linear way, as the solution approaches to equilibrium. The term apii accounts for the catalytic effect

of some species (particularly of H+), where the value of pi is determined experimentally. Rate constants

are usually obtained from laboratory experiments carried out at conditions far from equilibrium. They

Page 53: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

4.1. The geochemical system 43

depend on temperature according to the Arrhenius equation

km = k0 e−EamRT (4.37)

where k0 is a constant and Eam is the apparent activation energy of the overall reaction process, which

for most minerals range from 30 to 80 (kJ mol−1) (Lasaga, 1984). Both k0 and Eam are determined from

experiments performed at different temperatures. Accordingly, CHEPROO uses (through the Reaction

Rate Law class) a general formulation which includes several types of experimental functions

rm = σmξme−EamRT

N j∑k=1

km j

Ns∏i=1

apk ji

(Ωθmi − 1

)ηm j (4.38)

Factor ξm is equal to +1 or -1 depending on whether Ωm is larger or smaller than 1 (precipitation or

dissolution), respectively. At equilibrium Ωm = 1, and therefore rm=0.

The reactive surface (σm) changes when the mineral precipitates or dissolves and, hence, can be written

as a function of the concentration of the mineral (cm). Because CHEPROO assumes that the mineral

grains have spherical geometry, the reactive surface is given by

σm = 4πr2gng (4.39)

where rg is the radius of a grain and ng is the number of grains per volume of rock. The concentration of

the mineral can be written as

cm =43

πr3gng

Vm(4.40)

where Vm is the molar volume of a mineral. By solving rg from (4.40) and substituting it into (4.39), we

obtain

σm =(36πng

)1/3(Vmcm)2/3 = kgc2/3

m (4.41)

where kg is a geometrical constant. Therefore, the reactive surface at a time t can be calculated from the

initial reactive surface (σ0m) and initial mineral concentration (c0

m)

σm =

(cm

c0m

)2/3

σ0m (4.42)

Page 54: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

44 Chapter 4. The geochemical system

When the mineral concentration (c0m) is zero, equation (4.42) cannot be applied. In that case, CHEPROO

assumes an initial radius (r0g) of 10−8 m and calculates the reactive surface by first calculating the number

of grains per volume (ng) from the initial reactive surface (σ0m) and the initial radius (r0

g) and then

substituting ng into equation (4.41). This leads to

σm =

(9σ0

m

)1/3(r0

g

)2/3(Vmcm)2/3 (4.43)

Notice that the initial reactive surface (σ0m) is not zero, contrary to the mineral concentration (c0

m).

4.1.6 Reactions of biogeochemical degradations

Reaction Rate Law class also can represent reaction mechanisms of Monod type, widely applied in

biogeochemical problems

ri = e−Ea,iRT ki

N si∏

j=1

[ua

k( j)

]νi, j︸ ︷︷ ︸

nonmonod

N si∏

j=1

uak( j)

K si j + ua

k( j)

︸ ︷︷ ︸monod

Nii∏

j=1

Kii j

Kii j + ua

k( j)

︸ ︷︷ ︸inhibitor

(Ωi − 1)ηi (4.44)

where ki is the maximum effective utilization rate, N si is the number of Monod terms in the rate

expression, K si j are the half-saturation constants for the limitation due to the lack of substrate or electron

acceptors, and Nii is the number of inhibition terms in the reaction expression. Ki

i j defines the inhibition

constants as a result of toxicity or the preferential use of electron acceptors. The pointer k( j) relates

the electron acceptor, substrate, or inhibitor concentrations to the appropriate entry in the concentration

vector of the total aqueous component concentration ua.

4.1.7 Components definition

Components can be defined as a combination of the chemical species that, together with the equilibrium

constraints, suffice to fully determine the chemical system. Thus, the components matrix (U) is defined

as

USet = 0 (4.45)

Page 55: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

4.1. The geochemical system 45

where Set is the transpose of the stoichiometric matrix of equilibrium reactions [Ns × Ne]. In a system

with Ns chemical species and Ne equilibrium equations, any set of [Ns-Ne] linearly independent vectors

orthogonal to the equilibrium reactions is a valid set of components. As discussed in the previous section,

the columns of the component matrix U, are defined from those vectors. If we multiply the component

matrix U[(Ns-Ne) × Ns] by the vector of concentrations c [Ns], we obtain the vector of components (u)

[Ns-Ne]

u = Uc (4.46)

Writing the transport equations in terms of u is very attractive, because they become linear in the case of

a system without kinetic reactions. Equation (4.45) can be satisfied in many ways. In CHEPROO, these

components definition are supported in different specializations of Chemical System class. One of them,

’Classic Chemical System’ class is based on the components definition proposed, for instance, by Steefel

and MacQuarrie (1996). In this case, the matrix U in equation (4.45) is computed from Gauss-Jordan

elimination as

Se = [S1 |S2 ] (4.47)

U =[I∣∣∣−St

2S1]

(4.48)

where S1 and S2 are the stoichiometric matrices corresponding to primary and secondary species and I

is the identity matrix. Notice that this matrix U is not spatially variable.

Among a number of components definition, CHEPROO includes the formulation proposed by Saaltink

et al. (1998). This satisfies also the equation (4.45) and, is implemented in the specialization ’Retraso

Chemical System’ class. In this case, we can also eliminate the concentrations of species with constant

activity. To do this, the matrix U in equation (4.45) can be split up into a part referring to the constant

activity species (with the subscript c) and a part that refers to the other species (with the subscript o)

c =

co

cc

(4.49)

U = [Uo |Uc ] (4.50)

Page 56: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

46 Chapter 4. The geochemical system

In the same way as for the equilibrium reactions, we can eliminate Uc by multiplying (4.50) by a matrix

E defined in such a way that

EUc = 0 (4.51)

Thus, we can obtain a new components matrix (Unew) multiplying the matrix U by E

Unew = EU (4.52)

Notice that the matrix Unew in (4.52) also satisfies

UnewSet = 0 (4.53)

Moreover, Unew is spatially variable (i.e. depends on the mineral species in equilibrium). The number of

components in Unew was reduced from [Ns-Nr] in (4.45) to [Ns-Nr-Nc] in (4.53).

Page 57: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Chapter 5

Geochemical modeling using CHEPROO

A geochemical tool can be created linking CHEPROO from an external program. Thus, the chemical

composition of nodal chemistry objects, previously created in CHEPROO, can be changed by adding (or

removing) reactants, changing the temperature, etc. This process is termed as reaction path.

Several reaction path services have been implemented in CHEPROO (e.g. evaporation trends, equilibrate

with heterogeneous phases, adding/removing the mass of some species, etc). Each of these services

entails two steps. First, the chemical composition is perturbed (e.g. subtracting mass of water). Second,

the mass balance of components (in moles) is calculated.

5.1 Mass balance of components in CHEPROO

The mass balance of components is calculated at two different levels inside CHEPROO: 1) in the

CHEPROO class (in order to solve one-step of reactive transport), and 2) in the Chemical System class.

We describe the mass balance calculations carried out in the latter.

The mass balance per unit volume of nodal chemistry object is calculated (in moles) as

ωitU

c1

it

c2it(c1

it)

cmit

= ωu (5.1)

47

Page 58: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

48 Chapter 5. Geochemical modeling using CHEPROO

where ω is the mass of water per volume of nodal chemistry (kgw m−3), u is the vector of aqueous

components given externally by the user (mol kgw−1), U is the components matrix calculated according

to (4.48), the vectors c1, c2 and cm are concentrations of primary, secondary and equilibrium mineral

species, respectively (mol kgw−1). The superscript it refers to iteration number.

Concentration of secondary species (c2) are computed from c1 through the mass-action law

ln c2 = S1 (ln c1 + ln γ1) − ln γ2 − ln K2 (5.2)

where S1 contains the stoichiometric coefficients of aqueous complexation, sorption and

dissolution/exsolution reactions, the vectors γ1 and γ2 are the activity coefficients computed according

to some thermodynamic model (e.g. Extended Debye-Huckel or Pitzer model), and the vector K2 are of

equilibrium constants.

Notice that the vector of gas species (cg) are also contained in c2. Their presence in a nodal chemistry

object depends on its gas volume. Partial gas pressures (Pg, MPa) are computed through the Henry’s law

as

ln Pg = Sg (ln c1 + ln γ1) − ln Γg − ln Kg (5.3)

where Sg contains the stoichiometric coefficients for dissolution/exsolution reactions, the vector Γg are

the fugacities, and Kg is the vector of equilibrium constant (also termed Henry’s constants). For low

pressures (in the range of atmospheric pressure), the gaseous phase behaves like an ideal mixture (Γg =

1).

The molalities of the gas species (cg) is computed as

cg =VgPg

ωRT(5.4)

where Vg is the gas volume content (m3 m−3), ω is the mass of water (kgw m−3), R is the universal gas

constant and T is the temperature in Kelvins.

The equilibrium with other mineral or gas phases can be imposed during the mol balance calculation.

The equilibrium with mineral phases is imposed through the mass-action law (ln Ωm=0) according to

0 = Sm (ln c1 + ln γ1) − ln Km (5.5)

Page 59: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

5.2. Tracing reaction paths in CHEPROO 49

where Sm contains the stoichiometric coefficients of dissolution/precipitation reactions and Km is the

vector of mineral equilibrium constants.

Regarding the equilibrium with gas phase, many gas phase objects can be created in a chemical system

object. However, only a single gas phase is considered during the mol balance calculation, including all

gas species. A total gas pressure (PTg , MPa) can be imposed on a nodal chemistry object. Equilibrium

between a fixed-pressure multicomponent gas phase and the aqueous phase requires another equation,

the Dalton’s law

PTg = 1tPg (5.6)

where 1t is the transpose of the unity vector. In this case the molalities of the gas species (cg) is computed

as

cg =Ng

ω

Pg

PTg

(5.7)

where Ng is total mol of gas.

Equations (5.1) to (5.6) are solved using the Newton-Raphson method where c1, cm, ω, and Ng are

unknowns.

5.2 Tracing reaction paths in CHEPROO

Several reaction path options are implemented in CHEPROO such as 1) adding/removing species, 2)

evaporation trends, 3) polythermal reaction paths, 4) mixing waters, and 5) kinetic reaction paths.

In CHEPROO, these reaction path options are applied on a nodal chemistry object, and they can be

carried out progressively according to the number of steps defined by the user. Several of these reaction

path options can be consecutively applied on a same nodal chemistry object.

5.2.1 Adding/removing species

This is the basic reaction path option. The procedure is simple. First, the mass of ith species (defined in

the chemical system) is added/subtracted from the ith position in the concentration vector. Second, the

mol balance of components can be (optionally) calculated according to the method described in section

5.1.

Page 60: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

50 Chapter 5. Geochemical modeling using CHEPROO

On the other hand, a specific number of sites for sorption or exchange (CEC, eq m−3) can be also added on

a nodal chemistry object. As exposed above, the mol balance can be (optionally) calculated considering

the formation of surface complexes in equilibrium with the solution.

5.2.2 Evaporation reaction paths

Evaporation is accomplished by removing water from the nodal chemistry object. This section details

the mathematical formulation of the stepwise method evaporation. The method is carried out in two step:

1) evaporation step, and 2) the mol balance step. The present formulation allows the stepwise method to

bypass the constrained water activity invariant points (references about invariant points can be found in

(references about invariant points can be found in Risacher and Clement, 2001).

The evaporation process is carried out according to a number of steps. In each of them, the released mass

of water per volume of nodal chemistry (∆ω) is computed. Thus, for the kth evaporation step

∆ωk = ωk − ω0 (5.8)

where ω0 is the initial mass of water (kgw m−3), and ωk is the mass of water in the kth evaporation step.

The ratio between the initial and released mass of water is defined as the evaporation factor ( f kev)

f kev =

ω0

ωk (5.9)

Therefore, the vector of components in the kth step, uk (mol kgw−1) is given by

uk = f kev u0 (5.10)

During the evaporation process, the mol of components per volume of nodal chemistry is conserved,

except for the water component

ωkukw = ω

0u0w +∆ωk

W(5.11)

Page 61: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

5.2. Tracing reaction paths in CHEPROO 51

where W is the molecular weight of water, and uw is the water component (mol kgw−1). Thus, for the

kth step, the mol of water component is calculated as

ukw = f k

evu0w +

(1 − f kev)

W(5.12)

After evaporation step, the mol balance of uk is calculated according to the method described in section

5.1.

5.2.3 Polythermal reaction path

CHEPROO traces polythermal reactions varying the temperature linearly from an initial to a final value

over a reaction path. Such a calculation is termed a sliding temperature path. To set a sliding temperature

model, the user has to specify the initial and final temperatures in the range of the thermo data, typically

0C–300C.

Each polythermal calculation on a nodal chemistry object involves two steps: 1) the thermodynamic

variables (e.g. equilibrium constants) are updated in the chemical system object associated with the nodal

chemistry object, 2) the mol balance of components is calculated according to these new thermodynamic

properties, based on equations described in section 5.1.

5.2.4 Mixing waters

Two or more waters (in CHEPROO, a water is considered a nodal chemistry object) can be mixed. This

mixing process can be traced according to different mixing fractions (p). Mixing two nodal chemistry

objects entails the following steps: 1) multiply each nodal chemistry object (including its attributes) by

a mixing fraction (p), 2) a new nodal chemistry object is created by summing over all fractional nodal

chemistry objects, and 3) the mol balance of components is calculated.

Regarding the first step, the extensive attributes of each nodal chemistry object are multiplied by the

corresponding mixing fraction (p)

ωk = pi ωi + p j ω j (5.13)

Vk = pi Vi + p j V j (5.14)

Page 62: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

52 Chapter 5. Geochemical modeling using CHEPROO

Vgk = pi Vgi + p j Vg j (5.15)

Txk = pi Txi + p j Tx j (5.16)

where the indices i, j and k refer to the corresponding nodal chemistry object, ω is the mass of water

(kgw m−3), V and Vg are the total and gas volume of the nodal chemistry object, respectively (m3 m−3),

and TX is the total number of sites for sorption/exchange (eq m−3).

Regarding the second step, the new vector of components (uk) is calculated as

uk =pi ωi ui + p j ω j u j

ωk(5.17)

where ui and uj are the vector of components for the ith and jth nodal chemistry objects.

In the latter step, the mol balance on uk is calculated according to the steps described in section 5.1.

5.2.5 Kinetic reaction path

In the reaction models, reactants are added to/from a system at arbitrary rates. CHEPROO can also trace

reactions where kinetic rate laws control the time rates at which reactions proceed.

CHEPROO can trace the progress through time of several types of kinetic reactions, including: 1) the

dissolution and precipitation of minerals, 2) oxidation and reduction (redox) reactions, in solutions held

in redox disequilibrium.

The user can construct a model considering a single kinetic reaction, or combining several reactions or

types of reaction. In addition, the user must specify the reaction laws in the input file. Mathematical

expressions for these rate laws are detailed in sections 4.1.5 and 4.1.6.

CHEPROO solves the following discretized equation for each time step

ωk+1uk+1 − ωkuk

∆t= θωk+1fkin

k+1 + (1 − θ)ωkfkink (5.18)

where ω is the mass of water (kgw m−3), θ is the temporal weight, ∆t is the time increment (s), u is

the vector of components (mol kgw−1), and the vector fkin represents the supply of components due to

kinetics reactions (mol kgw−1 s−1).

Page 63: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Chapter 6

Reactive transport modeling using

CHEPROO

6.1 Reactive transport modeling using CHEPROO

CHEPROO provides several services devoted to reactive transport calculations. These services facilitate

the coupling between processes (i.e. flow, transport, geochemical, etc). In some of these services,

CHEPROO assumes that water flow and transport were previously calculated by the user code. However,

for a complete description of reactive transport calculations, water flow and conservative transport

equations were included for the sake of completeness.

6.1.1 Water mass balance

The flow equation express mass conservation of each phase. It require expressing how the mass of the

liquid phase changes in response to external inputs and outputs and to fluxes within the domain (mass

redistribution). Liquid phase storage is controlled basically by liquid saturation (S l). It is related to

pressure by means of the retention or characteristic curve.

53

Page 64: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

54 Chapter 6. Reactive transport modeling using CHEPROO

The total mass balance of water is then expressed as

δ

δt

(φρlS lω

wl

)= −∇ · qlρlω

wl + ∇ ·

(Dρl∇ω

wl

)+ f w

ext + f ws (6.1)

where ρl is the liquid density (kg m−3), S l is the liquid saturation (m3 m−3), φ is the porosity (m3 m−3),

ωwl is the water mass fraction in liquid (kgw kg−1), ql is the volumetric flow of liquid (m3 m−3 s−1), D is

the dispersion tensor (m2 s−1), and f wext is an external supply of water (kgw m−3 s−1), and f w

s is the supply

due to phase changes (kgw m−3 s−1). Note that the first term in equation (6.1) represents the change of

mass of water in the liquid phase and the second and third terms represent the transport of water in the

liquid phase.

Phase fluxes are governed by Darcy’s law

ql = −kkrl

µl(∇Pl + ρlg) (6.2)

where k is the tensor of hydraulic conductivity, krl is relative permeability which expresses the

dependence with the phase saturation, µl is the liquid viscosity, Pl is the liquid pressure, and g is the

gravity vector.

Diffusive fluxes are evaluated through Fick’s law.

The liquid flow equation also take into account sink/source terms. These include phase change terms

(water evaporation/condensation and air dissolution/degassing). Geochemical processes may represent

source or sink terms in the liquid flow equation (e.g. gas consumption in chemical reactions, changes in

water activity). The liquid flow equation must be updated by these sink source terms as computed by the

reactive transport equations.

6.1.2 Conservative mass balance of solutes

The mass balance of the ith species per volume of medium is defined as

δωci

δt= ci

δω

δt+ ω

δci

δt= −∇ · ψqlci + ∇ · (ψD · ∇ci) + f w

ext c∗i (6.3)

ω = φS lρlωwl (6.4)

Page 65: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

6.1. Reactive transport modeling using CHEPROO 55

ψ = ρlωwl (6.5)

where φ is the porosity (m3 m−3), S l is the liquid saturation (m3 m−3), ρl is the liquid density (kg m−3),

ωwl is the mass fraction of water in liquid (kgw kg−1), ci is the concentration of the ith species (mol

kgw−1), c∗i is the external concentration of the ith species (mol kgw−1), ql is the volumetric flow of liquid

(m3 m−3 s−1), D the dispersion tensor ,and f wext is an external supply of water (kgw m−3 s−1).

The first term in equation (6.3) accounts for the change of mass of solute in the liquid phase whereas the

third and fourth terms represent the transport of the solute in liquid. On the other hand, the fifth term

accounts for the external supply of the solute.

A new mass balance equation can be obtained multiplying equation (6.1) by ci and subtracting it in

equation (6.3)

ωδci

δt= −ψql · ∇ci + ∇ · (ψD · ∇ci) − ci∇ · (ρlD · ∇ωw

l ) + f wext(c

∗i − ci) − f w

s ci (6.6)

Notice that equation (6.6) does not depend on changes in mass of water.

The lineal operator for the advection, dispersion/diffusion and non-chemical sink-source terms for the

liquid phase (L (·)) is defined as

L (·) = −qlψ · ∇ (·) + ∇ · (ψD · ∇ (·)) − (·)∇ · (ρlD · ∇ωwl ) − f w

ext (·) − f ws (·) (6.7)

Equation (6.6) is rewritten as

ωδci

δt= L (ci) + f w

extc∗i (6.8)

6.1.3 Reactive transport equations

In reactive transport, the mol balance per unit volume of medium can be written from equation (6.8) as

ωδuδt= L (ua) + ωfkin + fext (6.9)

ω = φS lρlωwl (6.10)

Page 66: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

56 Chapter 6. Reactive transport modeling using CHEPROO

where L (·) is the lineal transport operator (equation (6.7)), the vectors u and ua are the components in

all and aqueous phases respectively (mol kgw−1), φ is the porosity (m3 m−3), ρl is the liquid density (kg

m−3), S l is the liquid saturation (m3 m−3), ωwl is the water mass fraction in liquid (kgw kg−1), fext is the

external supply of components (mol m−3 s−1), and fkin is the kinetic supply of components (mol kgw−1

s−1).

Equation (6.9) is discretized in the time according to

ωuk+1 − uk

∆t= θL

(ua

k+1)+ (1 − θ) L

(ua

k)+ θωfkin

k+1 + (1 − θ)ωfkink + fext (6.11)

where ∆t is the time increment (s), and θ is a temporal weight (0≤θ≤1).

6.1.4 Sequential (Non)-Iteration Approach (SIA, SNIA) using CHEPROO

The solution of equation (6.11) by the SIA method is carried out in two steps. The first one entails

of solving the transport equations with the total concentrations of every chemical component (ua) as

unknowns. Terms involving concentrations of sorbed species, minerals and kinetic reactions are treated

as source/sink term (Rsia, mol kgw−1 s−1).

ωua

k+1,it+1 − uak

∆t− θL

(ua

k+1,it+1)= (1 − θ)L

(ua

k)+ fext + ωRsia

k+1,it (6.12)

where superscript it refers to the iteration number, ω is the mass of water per unit volume of medium

(kgw m−3), L (·) is the lineal transport operator (equation (6.7)), ∆t is the time increment (s), θ is a

temporal wight (0≤θ≤1), and fext accounts for the external source/sink of components.

Regarding the second step, it is the updating of the source/sink term (Rsia) by nodal chemistry object. As

there is not explicit an expression for Rsia as a function of ua, one has to calculate the total concentrations

of components (u) according to the information available from the previous iteration

uk+1,it+1 = uk+1,it − uak+1,it + ua

k+1,it+1 (6.13)

The mol balance of components is calculated on uk+1,it+1 following the procedure described in section

5.1. This can be done separately for every nodal chemistry object.

Page 67: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

6.1. Reactive transport modeling using CHEPROO 57

The new reaction term (Rsiak+1,it+1) is defined as

Rsiak+1,it+1 = −

(uk+1,it+1 − uak+1,it+1)

∆t+

(uk − uak)

∆t+ θfkin

k+1,it+1 + (1 − θ)fkink (6.14)

where the vectors u and ua are the components in all and aqueous phase respectively, and fkin is the

supply of components due kinetic reactions (mol kgw−1 s−1).

In the SIA method, these two steps are repeated until convergence. CHEPROO uses the following

maximum relative convergence criteria

max

∣∣∣∣∣∣uak+1,it+1 − ua

k+1,it

uak+1,it

∣∣∣∣∣∣ ≤∈ (6.15)

where ∈ is a tolerance defined by the user.

6.1.5 Direct Substitution Approach (DSA) using CHEPROO

This approach consists of substituting the chemical into the transport equations, which leads to a fully

coupled system of equations. The present version of CHEPROO implements the formulation proposed

by Saaltink et al. (1998). This formulation assumes mineral equilibrium in order to reduce the number of

transport equations by using the components definition described in equations (4.50) to (4.53). Transport

equations (6.11) is written as

ft = ωuk+1(c1

k+1)∆t

− θL(ua

k+1(c1k+1)

)− θωfkin

k+1(c1k+1) − bt

k = 0 (6.16)

ω = φS lρlωwl (6.17)

ln c2 = S1 (ln c1 + ln γ1) − ln γ2 − ln K2 (6.18)

0 = Sm (ln c1 + ln γ1) − ln Km (6.19)

ca =

c1

c2(c1)

(6.20)

ua = Uaca (6.21)

Page 68: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

58 Chapter 6. Reactive transport modeling using CHEPROO

u = Uc (6.22)

where φ is the porosity (m3 m−3), S l is the liquid saturation (m3 m−3), ρl is the liquid density (kg m−3),

ωwl is the mass fraction of water in liquid (kgw kg−1), bt

k contains the previous time and boundary

information, ∆t is the time increment (s), ua is the total concentrations of aqueous components (mol

kgw−1), fkin is the source/sink of components due kinetic reactions (mol kgw−1 s−1), S1 contains the

stoichiometric coefficients of aqueous complexation, sorption and dissolution/exsolution reactions, Sm

contains the stoichiometric coefficients of equilibrium minerals, the vectors γ1 and γ2 are the activity

coefficients computed according to some thermodynamic model (e.g. Extended Debye-Huckel or Pitzer

model), the vectors K2 and Km are of equilibrium constants. c and ca are vectors for all and dissolved

species respectively. Similarly, U and Ua are the component matrices for all and dissolved species

respectively.

The term btk is defined as

btk = ω

uk(c1k)

∆t+ (1 − θ) L

(ua

k(c1k))+ (1 − θ)ωfkin

k(c1k) − fext (6.23)

where fext is an external supply of components (mol m−3 s−1).

The Newton-Raphson method is implemented in order to solve the system of equations (6.16), and (??)

to (6.22)

Jk+1,it(c1

k+1,it+1 − c1k+1,it

)= −ft

k+1,it (6.24)

where J is the Jacobian matrix, and c1 is the vector of unknowns. The iterative processes is stopped when

convergence is arrived both in unknowns and residuals according to the following criterias

∣∣∣∣∣∣∆c1it+1

c1it

∣∣∣∣∣∣ ≤∈unk (6.25)

max |ft| ≤∈res (6.26)

where ∈unk and ∈res are tolerances defined by the user.

Page 69: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

6.2. Coupling the geochemical processes with other processes using CHEPROO 59

6.2 Coupling the geochemical processes with other processes using

CHEPROO

CHEPROO offers several services that are devoted for the enhancement of coupling between processes

(i.e. flow, transport, etc).

6.2.1 Changes in the porosity

The dissolution/precipitation of mineral phases lead to changes in the porosity of the soil and aquifer

which also affects its intrinsic permeability. As a consequence, flow properties are also affected.

CHEPROO accounts for the changes in porosity from the change in the concentrations of the minerals

according to

φk+1 = φk + ωk+1Nm∑

m=1

Vm ck+1m (6.27)

where φ is the porosity (m3 m−3), ω is the mass of water (kgw m−3), Nm is the number of the mineral

species, Vm is the molar volume (m3 mol−1), and cm is molality of the mth mineral species (mol kgw−1).

6.2.2 Changes in the flow properties

CHEPROO offers some services that permit to account for the influence of chemical on flow processes.

Some flow properties such as the liquid density or viscosity could be affected by the mass fraction of

solutes (ωsl , kg kg−1) in the liquid phase

ωsl =

∑Nai=1 ciPMi

1 +∑Na

i=1 ciPMi(6.28)

where PMi is the molecular weight (kg mol−1), ci is the molality (mol kgw−1) of the ith aqueous species,

and Na is the number of species in the aqueous phase. Thus, the mass fraction of water in liquid (ωwl ,

kgw kg−1) is computed from equation (6.28) as

ωwl = 1 − ωs

l (6.29)

Page 70: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 71: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Chapter 7

Initialization of CHEPROO

The initialization of CHEPROO can be carried out in two ways. One of them is based on the input files

of RETRASO code (including the chemical system description and thermo-kinetics databases, Saaltink

et al., 2005).

The other one is based on two input files in xml format:

• cheproo.xml: In this input file the user defines the composition of water types, set of minerals,

surfaces and gases.

• chemsys.xml: Contains the full description of the chemical system.

These files are described in the following sections.

7.0.3 <cheproo>

Contains attributes devoted to reactive transport calculations (Table 7.1).

7.0.4 <chemicalsystem>

This tag is described in chemsys.xml file. Contains the full description of the chemical system (Table 7.2).

Phase (<phase>), surface (<surface>), species (<species>), reaction (<reaction>) and reaction rate

61

Page 72: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

62 Chapter 7. Initialization of CHEPROO

Table 7.1: Attributes description of <cheproo> tag.

Tag Level Attributes Description <cheproo> 1 name Name of the CHEPROO object. derivatestored =’yes’: Derivatives of concentrations with

respect to primary species are stored (default). =’not’: Derivatives of concentrations with respect to primary species are not stored.

writeinfo =’yes’: Information about Newton-Raphson method is written in an output file. =’not’: Information about Newton-Raphson method is not written in an output file.

typesolver =’snia’: Sequential Non-Iteration Approach. =’sia’: Sequential Iteration Approach. =’dsa’: Direct Substitution Approach.

zero Zero for concentrations (e.g. ‘1.0e-100’).

law (<reactionratelaw>) objects must be defined within this file.

Table 7.2: Attributes description of <chemicalsystem> tag.

Tag Level Attributes Description <chemicalsystem> 1 name Name of the chemical system object.

type Specialization of the chemical system class =’classic’: Chemical system with classical components definition (see e.g. Steefel and MacQuarrie (1996). =’retraso’: Chemical system with components definition based on Saaltink et al. (1998).

temp Temperature for thermodynamic calculations (in celcius)

writeinfo =’yes’: Information about the Newton-Raphson method according to the method described in section C.3.1 is written in an output unit (default writeinfo=’not’).

components =’gj’: Component matrix according to equation (C.45) is computed through Gauss-Jordan elimination (default). =’sv’: Component matrix according to equation (C.45) is computed through singular values decomposition.

7.0.5 <phase>

Within this tag, a phase and its attributes (i.e. species, thermodynamic model) are described (Table 7.3).

Examples

In order to illustrate the characterization of phases in xml format, two examples are shown. For anaqueous phase could be

Page 73: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

63

Table 7.3: Attributes description of <phase> tag.

Tag Level Attributes Description <phase> 1 name Name of the phase object.

type Specialization of the phase class =’aqueous’: Aqueous phase. =’mineral’: Mineral phase. =’gas’: Gas phase.

model Name of the thermodynamic model =’ideal’: Ideal (e.g. the activity coefficients are considered equal to unity). =’dhext’: Extended Debye-Hückel model (when type=’aqueous’). =’pitzer’: Pitzer model (when type=’aqueous’). =’bdot’: Trüesdel-Jones model (when type=’aqueous’).

convention Convention adopted to scale activity coefficients =’macinnes’: Activity coefficients are scaled according to MacInnes Convention (when model=’Pitzer’).

<species> 2 name Name of the species object. <property> 3 name Name of the property

=’ionsize’: Ionic radius. =’charge’: Electric charge. =’molvol’: Molar volume (cm3 mol-1).

value Value of the property.

<phase name="aqueous phase" type="aqueous" model="pitzer" convention="macinnes">

<species name="ca+2">

<property name="ionsize" value="6.0"/>

<property name="charge" value="2.0"/>

</species>

<species name="h+">

<property name="ionsize" value="9.0"/>

<property name="charge" value="1.0"/>

</species>

<species name="hco3-">

<property name="ionsize" value="4.0"/>

<property name="charge" value="-1.0"/>

</species>

</phase>

For a mineral phase could be

<phase name="caco3(s)" type="mineral" model="ideal">

<species name="caco3">

<property name="molvol" value="36.934"/>

</species>

</phase>

7.0.6 <surface>

Within this tag, a surface and its attributes (i.e. species, thermodynamic model) are described (Table 7.4).

Page 74: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

64 Chapter 7. Initialization of CHEPROO

Table 7.4: Attributes description of <surface> tag.

Tag Level Attributes Description <surface> 1 name Name of the surface object.

model Model of the surface object =’cexch’: Cation-exchange model. =’tl’: Triple layer model. =’dl’: Double layer model. =’cc’: Constant capacitance model.

<property> 2 name Name of the surface property =’incap’: Capacitance (in F m-2) of the internal layer (when model=’dl’, model=’tl’ or model=’cc’). =’outcap’: Capacitance (in F m-2) of the external layer (when model=’tl’).

value Value of the surface property. <site> 2 <species> 3 name Name of the surface complex. type =’primary’: The surface complex is a

primary species. <property> 4 name Name of the species property

=’chargecexch’: Charge of the exchangeable cation (if model=’cexch’). =’charge’: Electric charge of surface complex (if type=’dl’, type=’tl’, or type=’cc’).

value Value of the species property.

Examples

In order to illustrate the characterization of surface in xml format. For a surface with cation-exchangemodel and two sites could be

<surface name="surface" model="cexch">

<site>

<species name="cax2">

<property name="chargecexch" value="2.0d0"/>

</species>

<species name="nax" type="primary">

<property name="chargecexch" value="1.0d0"/>

</species>

<species name="mgx2">

<property name="chargecexch" value="2.0d0"/>

</species>

</site>

<site>

<species name="cay2" type="primary">

<property name="chargecexch" value="2.0d0"/>

</species>

<species name="nay" >

<property name="chargecexch" value="1.0d0"/>

</species>

<species name="mgy2">

<property name="chargecexch" value="2.0d0"/>

</species>

</site>

</surface>

7.0.7 <reaction>

Describes a chemical reaction (Table 7.5).

Page 75: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

65

Table 7.5: Reaction tag.

Tag Level Attributes Description <reaction> 1 name Name of the reaction object (name of the

secondary species related to the reaction). type Type of reaction

=’equilibrium’: Reaction modelled in equilibrium. =’kinetic’: Reaction modeled in kinetics (a reaction rate law tag must be defined).

<logk> 2 temp Temperature (oC) corresponding to the equilibrium constant.

value Logarithm10 of the equilibrium constant. <stoichiometry> 2 Describes the stoichiometry of participant

species in a reaction. <species> 3 name Name of the participant species.

coeff Stoichiometric coefficient.

Example

CaCO3(s) + H+ HCO−3 +Ca+2 log K = 1.849 (7.1)

<reaction name="caco3(s)" type="equilibrium">

<logk temp="25.0" value="1.849d0" />

<stoichiometry>

<species name="h+" coeff="-1.0" />

<species name="hco3-" coeff="1.0" />

<species name="ca+2" coeff="1.0" />

</stoichiometry>

</reaction>

7.0.8 <reactionratelaw>

Describes a reaction rate law object (Table 7.6).

Example

A monod expression for the sulphide reduction could be

R = 10−12[H+]2.5(

[S O4]1.6 · 10−4 + [S O4]

) (3.1 · 10−5

3.1 · 10−5 + [O2]

) 1.6 · 10−5

1.6 · 10−5 + [NO−3 ]

(Ω − 1)

<reactionratelaw name="sulphide reduction" type="monod" ea="0.0" attr1="1.0e-12" attr2="0" attr3="1">

<term type="nonmonod">

<species name="h+" attr1="2.5d0" />

</term>

<term type="monod">

Page 76: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

66 Chapter 7. Initialization of CHEPROO

Table 7.6: Attributes description of <reactionratelaw> tag.

Tag Level Attributes Description <reactionratelaw> 1 name Name of the reaction rate law object. type Type of expression of the reaction rate law

=’lasaga’: Uses the expression of equation (C.38). =’monod’: Uses the expression of equation (C.44).

ea Activation energy of the reaction rate law (kj mol-1).

attr1 First attribute of the reaction rate law. Threshold for Wm (when the reaction rate is type=’lasaga’). ki in equation (C.44) (when the reaction rate is type=’monod’).

attr2 Second attribute of the reaction rate law. Minimum rate (when the reaction rate is type=’monod’ (default attr2=’0’).

attr3 Third attribute of the reaction rate law. hi in equation (C.44) (when the reaction rate law is type=’monod’ (default attr3=’0’).

<term> 2 type Type of term of the reaction rate law =’monod’: Monod term (equation (C.44)). =’nonmonod’: Non-monod term (equation (C.44)). =’inhibitor’: Inhibitor term (equation (C.44)). =’catalyst’: Catalyst term (equation (C.38)).

attr1 kmk in equation (C.38) (when the reaction rate is type=’lasaga’).

attr2 qmk in equation (C.38) (when the reaction rate is type=’lasaga’).

attr3 hmk in equation (C.38) (when the reaction rate is type=’lasaga’).

<species> 3 name Name of the species object. attr1 pmki in equation (C.38) (when the reaction

rate is type=’lasaga’. Kij

s or Kiji in equation (C.44) (when the

reaction is type=’monod’).

<species name="so4-2" attr1="1.6e-4" />

</term>

<term type="inhibitor">

<species name="o2" attr1="3.1e-5" />

<species name="no3-" attr1="1.6e-5" />

</term>

</reactionratelaw>

7.0.9 <water>

Contains the description of a water type (Table 7.7).

7.0.10 <set>

Contains the description of a mineral or adsorption set (Table 7.8).

Page 77: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

67

Table 7.7: Attributes description of <water> tag.

Tag Level Attributes Description <water> 1 name Name of the water type temp Temperature (oC) of the solution. <species> 2 name Name of the component. icon Indicates the type of constrain controlling the solute

content. =’tot’: Component concentration is constrained by the total concentration defined in ctot="...". =’conc’: Concentration of primary species is assumed initially equal to ctot="...". =’act’: The activity of primary species associated to component is assumed initially equal to ctot=’...’. =‘eqmin’: Component concentration is calculated in equilibrium with a mineral defined in constraint=’...’. =’eqgas’: Component concentration is calculated in equilibrium with a gas defined in constraint=’...’ according to gas pressure defined in ctot=’...’. =’chgbal’: The component concentration is calculated through charge balance.

cguess Initial guess for the concentration (mol kgw-1) of the species.

ctot Total solute concentration (mol kgw-1). In case of icon=’eqgas’, ctot is the partial pressure of the gas used to constrain the concentration of the species.

constraint Name of the mineral (icon=’eqmin’) or gas (icon=’eqgas’) used to constrain the concentration of the species. The name of the constraint should coincide with one of those previously listed as minerals or gases in the definition of the system.

Table 7.8: Attributes description of <set> tag.

Tag Level Attributes Description <set> 1 name Name of the water type type Type of set

=’mineral’: Set of mineral species. =’surface’: Set of surfaces.

<species> 2 If type=’mineral’. name Name of the species object. conc Concentration of the mineral.

unitconc Selected unit for concentration.

<surface> 2 If type=’surface’. name Name of the surface object. <site> 3 txoh Site concentration (eq m-3).

7.0.11 <output>

Describes the components and species for the output (Table 7.9).

Table 7.9: Attributes description of <output> tag.

Tag Level Attributes Description <output> 1 <totals> 2 <species> 3 name Name of component. <concentrations> 2 Species <species> 3 name Name of the species. unit Unit for concentration.

Page 78: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

68 Chapter 7. Initialization of CHEPROO

7.1 Output options of CHEPROO

CHEPROO provides many output options for geochemical information. Output calculations can be

provided for all nodal chemistry objects or a number of them. The type of geochemical information can

be summarized as:

• Concentrations.

• Activities.

• Mol of species.

• Ionic strength.

• Reactive surface of minerals.

• Reaction rates.

• Saturation indices.

• Volumetric fraction of minerals.

7.2 Examples

This section is devoted for the description of two examples and their input files in xml format. The

first example entails the flushing of saline water by fresh water described by Appelo and Postma (1993).

The second example accounts the biodegradation of phenolics compounds in a deep aquifer in West

Midlands, UK (Mayer et al., 2001). The simulations were carried out with the codes CODE-BRIGHT

(Olivella et al., 1994) and CHEPROO. The first solves the flow processes while the second solves the

geochemical processes. Both codes are coupled by direct substitution of the chemical equations into the

transport equations (DSA, see e.g. Saaltink et al., 1998).

Page 79: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

7.2. Examples 69

7.2.1 Example I: The WAD case.

This example simulates the flushing of saline water by fresh water in the Waddenzee (the Netherlands)

in a one-dimensional domain described by Appelo and Postma (1993, example 5.8) (Figure 7.1B).

They include dissociation of water, aqueous carbonate complexation, cation exchange and dissolution

of calcite (Figure 7.1A). Calcite was assumed to dissolve in equilibrium. Figure 7.1C displays the

breakthrough curves of Na, Mg, Ca, Cl and C. Four stages can be distinguished: a saline stage, a Na

stage, a Mg stage and a Ca stage. The initial saline water comes out in the first stage. In the next

stage Na is exchanged by Ca and Mg, which leads to high Na concentrations in comparison to Mg

and Ca concentrations. Subsequently, adsorbed Mg is exchanged by Ca, leading to an increase in Mg

concentration in the effluent. Finally, Ca has replaced the rest of the exchanged cations and water comes

out with the same composition as the recharging fresh water.

7.2.2 Example II. Biodegradation of the phenolics compounds in a deep aquifer.

Reactive transport modeling is widely used in an effort to understand complex environmental problems

such as biodegradation processes in soil and groundwater. Mayer et al. (2001) have used reactive

transport modeling to describe the natural attenuation of a plume of phenolic contaminants in the West

Midlands, UK. The phenolic compounds (phenol, cresol and xilenol) underwent a set of biodegradation

reactions using multiple electron acceptors and fermentation. We use this example to show the

application of CHEPROO.

The CHEPROO model is based on the aforementioned study of Mayer et al. (2001), adopting their

1D flow domain, boundary conditions and stoichiometric reactions (see Figure ??A). For the sake of

simplicity, only one phenolic compound (C6H6O) was considered in our calculations. As a consequence,

the effective reaction rates were slightly modified in order to reproduce the results presented by Mayer

et al. (2001).

The following reactions and rate-limiting processes were considered:

1. aerobic respiration, limited by the substrate (phenol) and the electron acceptor (oxygen)

availability:

Page 80: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

70 Chapter 7. Initialization of CHEPROO

Figure 7.1: Example I: The Wad case.

17

C6H6O + O2 +37

H2O⇒67

HCO−3 +67

H+ (7.2)

2. denitrification: substrate and electron acceptor limitation, inhibited in the presence of oxygen:

Page 81: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

7.2. Examples 71

5

6

7

8

0 250 500 750x [m]

pH

0.0000

0.0001

0.0002

0.0003

0.0004

0 250 500 750x [m]

concentr

ació

n[m

olL-1

]

Fe(II)

Mn(II)

0.000

0.001

0.002

0.003

0 250 500 750x [m]

concentr

ació

n[m

olL-1

]

SO4O2NO3-CH4(aq)

0.00

0.01

0.02

0.03

0.04

0.05

0.06

0.07

0.08

0 250 500 750x [m]

concentr

ació

n[m

olL-1

] TIC

phenolics

1.E-05

1.E-04

1.E-03

1.E-02

0 250 500 750x [m]

concentr

ació

n[m

olL-1

]

calcitesideritemackinawiterhodocrosite

0.000

0.002

0.004

0.006

0.008

0.010

0.012

0.014

0 250 500 750x [m]

concentr

ació

n[m

olL-1

]

ClNaCaMg

0.00

0.02

0.04

0.06

0.08

0.10

0.12

0 250 500 750x [m]

concentr

ació

n[m

olL-1

]

Na-X

Ca-X2

Mg-X2

7 50 m.

year

m9.8p r i t =1Dis e s vi y m

o ty=0. 5Por si 12CCE =1.6 meq/100g A)

B) C)

D) E)

F) G)

H)

Figure 7.2: Reactive transport application: Biodegradation of the phenolics compounds in a deep aquifer(Mayer et al., 2001). A) Physical and chemical parameters of the solid medium. B) to H) Spatialdistribution of ions and minerals after 47 years.

528

C6H6O + NO−3 +128

H2O⇒1514

HCO−3 +12

N2 +114

H+ (7.3)

3. reductive dissolution of pyrolusite (MnO2), substrate and electron acceptor limitation, inhibited in

Page 82: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

72 Chapter 7. Initialization of CHEPROO

the presence of oxygen and nitrate:

114

C6H6O + MnO2 +117

H+ ⇒37

HCO−3 + Mn2+ +1114

H2O (7.4)

4. reductive dissolution of goethite (FeOOH), substrate and electron acceptor limitation, inhibited in

the presence of oxygen and nitrate:

128

C6H6O + FeOOH +2514

H+ ⇒314

HCO−3 + Fe2+ +3928

H2O (7.5)

5. sulfate-reduction: substrate and electron acceptor limitation, inhibited in the presence of oxygen

and nitrate, inhibited in presence of high phenol concentrations due to toxic effects to the

sulfate-reducing bacteria:

27

C6H6O + S O−24 +

67

H2O +27

H+ ⇒127

HCO−3 + H2S (7.6)

6. methane fermentation, inhibited in the presence of oxygen and nitrate:

27

C6H6O +137

H2O⇒57

HCO−3 +CH4(aq) +57

H+ (7.7)

Firstly, a conservative solute such as Cl indicates that the advection front is located some 400 m from

the origin (Figure 7.2B). There is also a decrease in the input Cl concentration at about 200 m. Although

affected by degradation reactions, the phenol distribution is similar to that of Cl, due to its high relative

concentration (Figure 7.2C).

According to reactions (7.2) and (7.3), oxygen and then nitrate are consumed as the phenol front advances

(Figure 7.2D). The reduction of pyrolusite and goethite (reactions (7.4) and (7.5)) is evidenced by the

precipitation of Fe(II) and Mn(II)-carbonates, siderite and rhodochrosite (Figure 7.2F), thanks to the

TIC high concentration from all the degradation reactions. The distribution of sulfate is slightly more

complex. As oxygen and nitrate, its concentration is reduced at the phenol front, according to reaction

(7.6). The high TIC concentration produced is probably the cause of the local precipitation of calcite

(Figure 7.2F). However, its concentration increases again behind the front due to the inhibitory effect of

phenol on the reaction (7.6) kinetics (Table 7.10).

Page 83: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

7.2. Examples 73

Table 7.10: Reactive transport application: Reaction parameters used for simulations of phenoliccompound degradation (Mayer et al., 2001).

Electron acceptor Units O2 NO3 FeOOH MnO2 SO4 Fermentation

(TIC) Maximum effective reaction rate (ki) mol l-1 s-1 3.98·10-10 3.98·10-11 1.28·10-11 8.7·10-13 7.07·10-12 5.01·10-13

Half-saturation constants ( sijK ) O2 mol l-1 3.1·10-6 -- -- -- --

NO3 mol l-1 -- 8.1·10-6 -- -- -- -- SO4 mol l-1 -- 2.4·10-4 -- 1.6·10-4 -- C6H5OH mol l-1 1.1·10-4 1.1·10-4 1.1·10-4 1.1·10-4 1.1·10-4 1.1·10-3

Inhibition constants ( iijK ) O2 mol l-1 -- 6.2·10-6 3.1·10-5 3.1·10-5 3.1·10-5 3.1·10-5

NO3 mol l-1 -- -- 1.6·10-5 1.6·10-5 1.6·10-5 1.6·10-5 Phenol mol l-1 -- -- 6.4·10-3 -- 6.4·10-3 --

ÕÕ== ú

úû

ù

êêë

é

+úúû

ù

êêë

é

+-=

ii

si N

1j k(j)iij

iij

N

1j k(j)sij

k(j)

iicK

K

cK

ckR

The generation of reduced S(II) and Fe(II) in the described reactions causes the precipitation of the

insoluble sulfide mackinawite (Figure 7.2F). Finally, fermentation and production of methane (reaction

(7.7)) takes place once the rest of electron acceptors are consumed or inhibited (Figure 7.2D).

Among the major solutes, the input water has high Na concentrations. However, the Na front is delayed

more than 200 m with respect to Cl (Figure 7.2B). This is interpreted as the replacement of Ca and Mg

from the cation exchange positions in clays by Na. As a consequence, the Ca and Mg concentration in

solution increased from 200 to 400 m from the origin (Figure 7.2B). The Ca removed at the exchange

front is probably the cause of a second local precipitation of calcite around 100 m from the origin (Figure

7.2F). Figure 7.2G shows the distribution of the exchange complex, where Ca-X2 is predominant. The pH

(Figure 7.2H) and total inorganic carbon, TIC (Figure 7.2B) patterns are the result of their concentration

in the input water, the consumption or increase in the degradation reactions, and finally the precipitation

of carbonates.

Page 84: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 85: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Chapter 8

Linking CHEPROO to other codes

We outline here the use of CHEPROO for solving reactive transport problems based on either SIA or

DSA. We assume that a user has got a conservative transport simulator and wishes to modify it to include

reactive transport. As illustrated in Figure 8.1, only a small number of modifications are needed.

One starts by declaring the use of CHEPROO module

use m_cheproo

In a F90 object-oriented implementation, a module supports one user-defined data type, and the

CHEPROO objects are variables declared as

type(t_cheproo) :: mychemistry

Initialization requires creating (memory space allocation) and reading ’mychemistry’ object from xml

file (’mychemistry.xml’)

create_ (mychemistry)

read_xml_ (mychemistry,’mychemistry.xml’)

In this process, the chemical system and the chemical composition of some ’waters’ are read. After

reading, initial waters are speciated and stored in nodal chemistry objects.

75

Page 86: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

76 Chapter 8. Linking CHEPROO to other codes

On the other hand, to work on ’mychemistry’ involves creating and initializing a list of nodal chemistry

objects. Initial information in these nodal chemistry objects can stored in three ways. As regards the first

option, it entails to define in the input file the number of nodal chemistry objects and their corresponding

indices with the ’waters’ defined in same file. As regards the second option, the number of nodal

chemistry objects and their corresponding indices are provided by the user code through the methods

’create_nodalchem_’ and ’init_nodalchem_’ respectively. The third option is known as ’restart’

procedure. Concentrations obtained in other calculation event (e.g. a simulation of reactive transport)

can be written in a xml file. In this case, a new list of nodal chemistry objects could be created and

initialized from this file.

The solution procedure using SIA is shown in Figure 8.1A. The external code solves the transport step for

each component, and then CHEPROO updates the reaction contribution. In the second implementation

(Figure 8.1B), a CHEPROO object solves the reactive transport equations (optionally in SIA or DSA).

In either case ’mychemistry’ object can yield information for updating flow and transport (e.g. to update

hydraulic conductivity from porosity variations).

It is clear that CHEPROO makes it very easy to build a reactive transport code from a standard

conservative transport code. This ease and flexibility could not be obtained when reactive transport

is implemented using procedural-programming in a similar way. Notice, moreover, enhancements on

either conservative transport (i.e. changing the simulation method) or reactive algorithms (i.e. using a

new speciation method) can be implemented without modifying the basic structure.

Page 87: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

77

Figure 8.1: Outline of possible reactive transport implementations in conservative transport simulators.Notice that a conventional conservative transport code (shaded boxes) can be easily transformed into aDSA-based (right) or a SIA-based (left) with a very limited number of modifications in the original code.

Page 88: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 89: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Bibliography

Akin, J. E. (1999), Object oriented programming via fortran 90, Engineering Computations, 16(1),

26–48.

Appelo, C., and D. Postma (1993), Geochemistry, Groundwater and Pollution., Balkema, A.A. Ed.

Ayora, C., C. Taberner, M. W. Saaltink, and J. Carrera (1998), The genesis of dedolomites: a discusion

based on reactive transport modeling, Journal of Hydrology, 209(1-4), 346–365.

Bachler, D., and T. Kohl (2005), Coupled thermal-hydraulic-chemical modelling of enhanced geothermal

systems, Geophysical Journal International, 161(2), 533–548.

Bea, S., J. Carrera, and C. Ayora (2008a), Pitzer algortithm: Efficient implementation of the pitzer

equations in geochemical and reactive transport models, Computers & Geosciences, (submitted).

Bea, S., J. Carrera, F. Batlle, C. Ayora, and M. Saaltink (2008b), Cheproo: A fortran 90 object-oriented

module to solve chemical processes in earth science models, Computers & Geosciences, (in press).

Blauch, D. N. (2002), Java classes for managing chemical information and solving generalized

equilibrium problems, Journal of Chemical Information and Computer Sciences, 42(2), 143–146.

Carr, M. (1999), Using fortran 90 and object-oriented programming to accelerate code development,

IEEE Antennas and Propagation Magazine, 41(6), 85–90.

Chilakapati, A., S. Yabusaki, J. Szecsody, and W. MacEvoy (2000), Groundwater flow, multicomponent

transport and biogeochemistry: development and application of a coupled process model, Journal of

Contaminant Hydrology, 43(3-4), 303–325.

79

Page 90: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

80 BIBLIOGRAPHY

Chou, L., and R. Wollast (1985), Steady-state kinetics and dissolution mechanisms of albite, American

Journal of Science, 285(10), 963–993.

Cirpka, O. A., and A. J. Valocchi (2007), Two-dimensional concentration distribution for

mixing-controlled bioreactive transport in steady state, Advances in Water Resources, 30(6-7),

1668–1679.

Curtis, G. P. (2003), Comparison of approaches for simulating reactive solute transport involving organic

degradation reactions by multiple terminal electron acceptors, Computers & Geosciences, 29(3),

319–329.

Davies, J. A., and J. O. Leckie (1978), Surface ionization and complexation at oxide/water interface, ii.

surface properties of amorphous iron oxyhydroxide and adsorption of metal ions, J. Colloid Interface

Sci., 67, 90–107.

De Simoni, M., J. Carrera, X. Sanchez-Vila, and A. Guadagnini (2005), A procedure for the solution of

multicomponent reactive transport problems, Water Resources Research, 41(11), W11,410.

De Simoni, M., X. Sanchez-Vila, J. Carrera, and M. W. Saaltink (2007), A mixing ratios-based

formulation for multicomponent reactive transport., Water Resources Research, 43(7), W07419.

Debye, P., and E. Huckel (1923), Zur theorie der elektrolyte, Phys. Z., 24, 185–208 305–325.

Decyk, V. K., C. D. Norton, and B. K. Szymanski (1998), How to support inheritance and run-time

polymorphism in fortran 90, Computer Physics Communications, 115(1), 9–17.

Denbigh, K. (1987), The Nature of Irreversibility - Hollinger,Hb, Zenzen,Mj, vol. 38(3), 404–406, Oxford

Univ Press United Kingdom, Walton St Journals Dept, Oxford, England Ox2 6dp.

Dzombak, D. A., and F. M. M. Morel (1990), Surface Complexation Modelling, 393 pp., Wiley

Interscience.

Garrels, R., and C. Christ (1965), Solutions, Minerals, and Equilibria, 450p pp., Harper & Row Publi.,

450p.

Gorelik, A. M. (2004), Object-oriented programming in modern fortran, Programming and Computer

Software, 30(3), 173–179.

Page 91: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

BIBLIOGRAPHY 81

Helgeson, H. C., and D. H. Kirkham (1974), Theoretical prediction of thermodynamic behavior of

aqueous electrolytes at high pressures and temperatures .1. summary of thermodynamic-electrostatic

properties of solvent, American Journal of Science, 274(10), 1089–&.

Hofmann, A. F., F. J. R. Meysman, K. Soetaert, and J. J. Middelburg (2008), A step-by-step procedure

for ph model construction in aquatic systems., Biogeosciences, 5, 227–251.

Krautle, S., and P. Knabner (2005), A new numerical reduction scheme for fully coupled multicomponent

transport-reaction problems in porous media, Water Resources Research, 41(9), W09,414.

Krautle, S., and P. Knabner (2007), A reduction scheme for coupled multicomponent transport-reaction

problems in porous media: Generalization to problems with heterogeneous equilibrium reactions,

Water Resources Research, 43(3), W03,429.

Lasaga, A. C. (1984), Chemical-kinetics of water-rock interactions, Journal of Geophysical Research,

89(NB6), 4009–4025.

Lichtner, P. C., and A. R. Felmy (2003), Estimation of hanford sx tank waste compositions from

historically derived inventories, Computers & Geosciences, 29(3), 371–383.

Mayer, K. U., S. G. Benner, E. O. Frind, S. F. Thornton, and D. N. Lerner (2001), Reactive transport

modeling of processes controlling the distribution and natural attenuation of phenolic compounds in a

deep sandstone aquifer, Journal of Contaminant Hydrology, 53(3-4), 341–368.

Meeussen, J. C. L. (2003), Orchestra: An object-oriented framework for implementing chemical

equilibrium models, Environmental Science & Technology, 37(6), 1175–1182.

Meysman, F. J. R., J. J. Middelburg, P. M. J. Herman, and C. H. R. Heip (2003a), Reactive transport

in surface sediments. i. model complexity and software quality, Computers & Geosciences, 29(3),

291–300.

Meysman, F. J. R., J. J. Middelburg, P. M. J. Herman, and C. H. R. Heip (2003b), Reactive transport

in surface sediments. ii. media: an object-oriented problem-solving environment for early diagenesis,

Computers & Geosciences, 29(3), 301–318.

Molins, S., J. Carrera, C. Ayora, and M. W. Saaltink (2004), A formulation for decoupling components

in reactive transport problems, Water Resources Research, 40(10), W10,301.

Page 92: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

82 BIBLIOGRAPHY

Olivella, S., J. Carrera, A. Gens, and E. E. Alonso (1994), Nonisothermal multiphase flow of brine and

gas through saline media, Transport in Porous Media, 15(3), 271–293.

Pitzer, S. (1973), Thermodynamics of electrolytes. i. theoretical basis and general equations, Journal of

Physical Chemistry, 77(2), 268–277.

Risacher, F., and A. Clement (2001), A computer program for the simulation of evaporation of natural

waters to high concentration, Computers & Geosciences, 27(2), 191–201.

Robinson, B. A., H. S. Viswanathan, and A. J. Valocchi (2000), Efficient numerical techniques for

modeling multicomponent ground-water transport based upon simultaneous solution of strongly

coupled subsets of chemical components, Advances in Water Resources, 23(4), 307–324.

Saaltink, M. W., C. Ayora, and J. Carrera (1998), A mathematical formulation for reactive transport that

eliminates mineral concentrations, Water Resources Research, 34(7), 1649–1656.

Saaltink, M. W., J. Carrera, and C. Ayora (2000), A comparison of two approaches for reactive transport

modelling, Journal of Geochemical Exploration, 69, 97–101.

Saaltink, M. W., J. Carrera, and C. Ayora (2001), On the behavior of approaches to simulate reactive

transport, Journal of Contaminant Hydrology, 48(3-4), 213–235.

Saaltink, M. W., C. Ayora, and S. Olivella (2005), User’s guide for RetrasoCodeBright (RCB),

Department of Geotechnical Engineering and Geo-Sciences, Technical University of Catalonia (UPC),

Barcelona, Spain Institute of Earth Sciences Jaume Almera, Spanish Research Council (CSIC),

Barcelona, Spain.

Scheffer, F., and P. Schachtschebel (2002), Lehrbuch der bodenkunde, 15 th Aufl. Elsevier, Amsterdam,

p. 607.

Simunek, J., and D. L. Suarez (1994), 2-dimensional transport model for variably saturated porous-media

with major ion chemistry, Water Resources Research, 30(4), 1115–1133.

Steefel, C., and S. Yabusaki (1996), OS3D/GIMRT, Software for Multicomponent Multidimensional

Reactive Transport, User Manual and Programmers Guide. PNL-11166. Technical Report, Pacific

Northwest National Laboratory.

Page 93: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

BIBLIOGRAPHY 83

Steefel, C., 2001 Steefel (2001), GIMRT, Version 1.2: Software for Modeling Multicomponent,

Multidimensional Reactive Transport. Users Guide.Technical Report UCRL-MA-143182., Lawr. Liv.

Nat. Lab., Livermore, CA.

Steefel, C. I., and K. T. B. MacQuarrie (1996), Approaches to modeling of reactive transport in porous

media, Reactive Transport in Porous Media, 34, 83–129.

Watson, I. A., S. E. Oswald, S. A. Banwart, R. S. Crouch, and S. F. Thornton (2005), Modeling the

dynamics of fermentation and respiratory processes in a groundwater plume of phenolic contaminants

interpreted from laboratory- to field-scale, Environmental Science & Technology, 39(22), 8829–8839.

Page 94: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 95: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Appendix A

The WAD case.

A.1 Input file in xml format

The chemsys.xml file is the following

<chemicalsystem name=’WAD case’ type="retraso" temp="25.0" >

<phases>

<phase name="aqueous phase" type="aqueous" model="dhext" >

<species name="ca+2">

<property name="ionsize" value="6.0"/>

<property name="charge" value="2.0"/>

</species>

<species name="mg+2">

<property name="ionsize" value="8.0"/>

<property name="charge" value="2.0"/>

</species>

<species name="h+">

<property name="ionsize" value="9.0"/>

<property name="charge" value="+1.0"/>

</species>

<species name="hco3-">

<property name="ionsize" value="4.0"/>

<property name="charge" value="-1.0"/>

</species>

<species name="co3-2">

<property name="ionsize" value="5.0"/>

<property name="charge" value="-2.0"/>

</species>

<species name="co2(aq)">

<property name="ionsize" value="3.0"/>

<property name="charge" value="0.0"/>

</species>

<species name="h2o">

<property name="ionsize" value="9.0"/>

<property name="charge" value="0.0"/>

</species>

<species name="oh-">

<property name="ionsize" value="4.0"/>

<property name="charge" value="-1.0"/>

</species>

<species name="cl-">

<property name="ionsize" value="3.0"/>

<property name="charge" value="-1.0"/>

</species>

<species name="na+">

<property name="ionsize" value="4.0"/>

<property name="charge" value="1.0"/>

</species>

</phase>

<phase name="caco3" type="mineral" model="ideal">

85

Page 96: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

86 Chapter A. The WAD case

<species name="caco3">

<property name="molvol" value="36.934"/>

</species>

</phase>

<phase name="co2(g)" type="gas" model="ideal">

<species name="co2(g)">

<property name="molvol" value="24465.0d0"/>

</species>

</phase>

</phases>

<surfaces>

<surface name="surface" model="cexch">

<site>

<species name="x2-ca" type="primary" >

<property name="chargecexch" value="2.0d0"/>

</species>

<species name="x-na" >

<property name="chargecexch" value="1.0d0"/>

</species>

<species name="x2-mg">

<property name="chargecexch" value="2.0d0"/>

</species>

</site>

</surface>

</surfaces>

<reactions>

<reaction name="caco3" type="equlibrium">

<logk temp="25.0" value="1.849d0"/>

<stoichiometry>

<species name="h+" coeff="-1.0"/>

<species name="hco3-" coeff="1.0"/>

<species name="ca+2" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="oh-" type="equlibrium">

<logk temp="25.0" value="13.998d0"/>

<stoichiometry>

<species name="h+" coeff="-1.0"/>

<species name="h2o" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="co3-2" type="equlibrium">

<logk temp="25.0" value="10.329d0"/>

<stoichiometry>

<species name="h+" coeff="-1.0"/>

<species name="hco3-" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="x-na" type=’equilibrium’>

<logk temp="25.0d0" value="0.39794d0"/>

<stoichiometry>

<species name="x2-ca" coeff="0.5"/>

<species name="ca+2" coeff="-0.5"/>

<species name="na+" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="x2-mg" type=’equilibrium’>

<logk temp="25.0d0" value="0.19382d0"/>

<stoichiometry>

<species name="x2-ca" coeff="1.0"/>

<species name="ca+2" coeff="-1.0"/>

<species name="mg+2" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="co2(g)" type=’equilibrium’>

<logk temp="25.0d0" value="-7.8136d0"/>

<stoichiometry>

<species name="h2o" coeff="-1.0"/>

<species name="h+" coeff="1.0"/>

<species name="hco3-" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="co2(aq)" type=’equilibrium’>

<logk temp="25.0d0" value="-6.3447"/>

<stoichiometry>

<species name="h2o" coeff="-1.0"/>

<species name="h+" coeff="1.0"/>

<species name="hco3-" coeff="1.0"/>

</stoichiometry>

</reaction>

</reactions>

</chemicalsystem>

The cheproo.xml file is the following

<cheproo name="WAD case" derivatestored="yes" typesolver="dsa">

<chemicalsystem>

Page 97: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

A.1. Input file in xml format 87

<file name="chemsys.xml"/>

</chemicalsystem>

<waters>

<water id="1" name="boundary water" temp="25.0d0">

<species name="h+" icon="eqmin" cguess="3.16228d-7" ctot="5.24807d-8" constraint="caco3"/>

<species name="ca+2" icon="tot" cguess="9.51d-3" ctot="1.7d-3" constraint=""/>

<species name="mg+2" icon="tot" cguess="4.75d-2" ctot="1.0d-7" constraint=""/>

<species name="na+" icon="tot" cguess="4.79d-7" ctot="1.0d-7" constraint=""/>

<species name="hco3-" icon="eqgas" cguess="3.7d-4" ctot="0.01" constraint="co2(g)"/>

<species name="cl-" icon="tot" cguess="5.66d-1" ctot="2.0d-7" constraint=""/>

</water>

<water id="2" name="initial water" temp="25.0d0">

<species name="h+" icon="act" cguess="3.16228d-7" ctot="8.07d-9" constraint=""/>

<species name="ca+2" icon="tot" cguess="1.7d-3" ctot="9.51d-3" constraint=""/>

<species name="mg+2" icon="tot" cguess="1.0d-7" ctot="4.75d-2" constraint=""/>

<species name="na+" icon="tot" cguess="1.0d-7" ctot="4.79d-1" constraint=""/>

<species name="hco3-" icon="eqmin" cguess="3.49d-3" ctot="3.49d-3" constraint="caco3"/>

<species name="cl-" icon="tot" cguess="2.0d-7" ctot="5.66d-1" constraint=""/>

</water>

</waters>

<sets>

<set id="1" name="zone mineral central" type="mineral" >

<species name="caco3" conc="0.5d0" unitconc="m3"/>

</set>

<set id="1" type="surface" name="surface in central nodes">

<surface name="surface">

<site txoh="30.3d0"/>

</surface>

</set>

</sets>

<output>

<totals>

<species name="hco3-"/>

</totals>

<concentrations>

<species name="h+"/>

<species name="hco3-"/>

<species name="caco3"/>

<species name="na+"/>

<species name="cl-"/>

<species name="mg+2"/>

<species name="ca+2"/>

<species name="x2-ca"/>

<species name="x2-mg"/>

<species name="x-na"/>

</concentrations>

</output>

</cheproo>

Page 98: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea
Page 99: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

Appendix B

Biodegradation of the phenolics

compounds in a deep aquifer.

B.1 Input file in xml format

The chemsys.xml file is the following

<chemicalsystem name=’Biodegradation of phenolics compounds’ type="retraso" isoterm="yes" temp="25.0" writeinfo=’not’ components="gj">

<phases>

<phase name="aqueous phase" type="aqueous" model="dhext" >

<species name="c6h6o">

<property name="ionsize" value="3.0"/>

<property name="charge" value="0.0"/>

</species>

<species name="ca+2">

<property name="ionsize" value="6.0"/>

<property name="charge" value="2.0"/>

</species>

<species name="mg+2">

<property name="ionsize" value="8.0"/>

<property name="charge" value="2.0"/>

</species>

<species name="so4-2">

<property name="ionsize" value="4.0"/>

<property name="charge" value="-2.0"/>

</species>

<species name="h2s">

<property name="ionsize" value="3.0"/>

<property name="charge" value="0.0"/>

</species>

<species name="hs-">

<property name="ionsize" value="3.0"/>

<property name="charge" value="-1.0"/>

</species>

<species name="s-2">

<property name="ionsize" value="4.0"/>

<property name="charge" value="-2.0"/>

</species>

<species name="h+">

<property name="ionsize" value="9.0"/>

<property name="charge" value="+1.0"/>

</species>

<species name="hco3-">

<property name="ionsize" value="4.0"/>

<property name="charge" value="-1.0"/>

89

Page 100: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

90 Chapter B. Biodegradation of the phenolics compounds

</species>

<species name="co3-2">

<property name="ionsize" value="5.0"/>

<property name="charge" value="-2.0"/>

</species>

<species name="h2co3">

<property name="ionsize" value="5.0"/>

<property name="charge" value="0.0"/>

</species>

<species name="h2o">

<property name="ionsize" value="9.0"/>

<property name="charge" value="0.0"/>

</species>

<species name="oh-">

<property name="ionsize" value="4.0"/>

<property name="charge" value="-1.0"/>

</species>

<species name="no3-">

<property name="ionsize" value="4.0"/>

<property name="charge" value="-1.0"/>

</species>

<species name="n2">

<property name="ionsize" value="0.0"/>

<property name="charge" value="0.0"/>

</species>

<species name="o2">

<property name="ionsize" value="3.0"/>

<property name="charge" value="0.0"/>

</species>

<species name="ch4">

<property name="ionsize" value="0.0"/>

<property name="charge" value="0.0"/>

</species>

<species name="fe+2">

<property name="ionsize" value="6.0"/>

<property name="charge" value="2.0"/>

</species>

<species name="mn+2">

<property name="ionsize" value="6.0"/>

<property name="charge" value="2.0"/>

</species>

<species name="cl-">

<property name="ionsize" value="3.0"/>

<property name="charge" value="-1.0"/>

</species>

<species name="na+">

<property name="ionsize" value="4.0"/>

<property name="charge" value="1.0"/>

</species>

</phase>

<phase name="caco3" type="mineral" model="ideal">

<species name="caco3">

<property name="molvol" value="36.934"/>

</species>

</phase>

<phase name="feco3" type="mineral" model="ideal">

<species name="feco3">

<property name="molvol" value="29.378"/>

</species>

</phase>

<phase name="fenol_no3" type="mineral" model="ideal">

<species name="fenol_no3">

<property name="molvol" value="1.0d-10"/>

</species>

</phase>

<phase name="feooh" type="mineral" model="ideal">

<species name="feooh">

<property name="molvol" value="20.820"/>

</species>

</phase>

<phase name="mno2" type="mineral" model="ideal">

<species name="mno2">

<property name="molvol" value="16.610"/>

</species>

</phase>

<phase name="fes" type="mineral" model="ideal">

<species name="fes">

<property name="molvol" value="20.48"/>

</species>

</phase>

<phase name="mnco3" type="mineral" model="ideal">

<species name="mnco3">

<property name="molvol" value="31.075"/>

</species>

</phase>

<phase name="fenol_ch4" type="mineral" model="ideal">

<species name="fenol_ch4">

<property name="molvol" value="1.0d-10"/>

</species>

</phase>

<phase name="fenol_s" type="mineral" model="ideal">

<species name="fenol_s">

Page 101: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

B.1. Input file in xml format 91

<property name="molvol" value="1.0d-10"/>

</species>

</phase>

<phase name="fenol_o2" type="mineral" model="ideal">

<species name="fenol_o2">

<property name="molvol" value="1.0d-10"/>

</species>

</phase>

</phases>

<surfaces>

<surface name="surface" model="cexch">

<site>

<species name="x2-ca" type="primary">

<property name="chargecexch" value="2.0d0"/>

</species>

<species name="x-na" >

<property name="chargecexch" value="1.0d0"/>

</species>

<species name="x2-mg">

<property name="chargecexch" value="2.0d0"/>

</species>

</site>

</surface>

</surfaces>

<reactions>

<reaction name="caco3" type="equlibrium">

<logk temp="25.0" value="1.849d0"/>

<stoichiometry>

<species name="h+" coeff="-1.0"/>

<species name="hco3-" coeff="1.0"/>

<species name="ca+2" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="mnco3" type="equlibrium">

<logk temp="25.0" value="-0.061d0"/>

<stoichiometry>

<species name="h+" coeff="-1.0"/>

<species name="hco3-" coeff="1.0"/>

<species name="mn+2" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="feco3" type="equlibrium">

<logk temp="25.0" value="-0.121d0"/>

<stoichiometry>

<species name="h+" coeff="-1.0"/>

<species name="hco3-" coeff="1.0"/>

<species name="fe+2" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="mno2" type="kinetic">

<logk temp="25.0" value="1.8487d0"/>

<stoichiometry>

<species name="c6h6o" coeff="-0.0714"/>

<species name="h2o" coeff="0.7857"/>

<species name="h+" coeff="-1.5714"/>

<species name="mn+2" coeff="1.0"/>

<species name="hco3-" coeff="0.4285"/>

</stoichiometry>

<reactionratelaw name="pyrolusite reduction" type="monod" ea="0.0" attr1="8.709e-13" >

<term type="monod">

<species name="c6h6o" attr1="1.1d-4" />

</term>

<term type="inhibitor" >

<species name="o2" attr1="3.1d-5" />

<species name="no3-" attr1="1.6d-5" />

</term>

</reactionratelaw>

</reaction>

<reaction name="feooh" type="kinetic">

<logk temp="25.0" value="1.8487d0"/>

<stoichiometry>

<species name="c6h6o" coeff="-0.0357"/>

<species name="h2o" coeff="1.3928"/>

<species name="hco3-" coeff="0.21428"/>

<species name="h+" coeff="-1.7857"/>

<species name="fe+2" coeff="1.0"/>

</stoichiometry>

<reactionratelaw name="goethite reduction" type="monod" ea="0.0" attr1="1.2882e-11" >

<term type="monod">

<species name="so4-2" attr1="2.4d-4" />

<species name="c6h6o" attr1="1.1d-4" />

</term>

<term type="inhibitor" >

<species name="o2" attr1="3.1d-5" />

<species name="no3-" attr1="1.6d-5" />

<species name="c6h6o" attr1="6.4e-3" />

</term>

</reactionratelaw>

</reaction>

<reaction name="oh-" type="equlibrium">

<logk temp="25.0" value="13.998d0"/>

<stoichiometry>

Page 102: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

92 Chapter B. Biodegradation of the phenolics compounds

<species name="h+" coeff="-1.0"/>

<species name="h2o" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="co3-2" type="equlibrium">

<logk temp="25.0" value="10.329d0"/>

<stoichiometry>

<species name="h+" coeff="-1.0"/>

<species name="hco3-" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="h2co3" type="equlibrium">

<logk temp="25.0" value="-6.351d0"/>

<stoichiometry>

<species name="h+" coeff="1.0"/>

<species name="hco3-" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="h2s" type="equlibrium">

<logk temp="25.0" value="-6.994d0"/>

<stoichiometry>

<species name="h+" coeff="1.0"/>

<species name="hs-" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="s-2" type="equlibrium">

<logk temp="25.0" value="12.918d0"/>

<stoichiometry>

<species name="h+" coeff="-1.0"/>

<species name="hs-" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="fes" type="equlibrium">

<logk temp="25.0" value="-4.648"/>

<stoichiometry>

<species name="hs-" coeff="1.0"/>

<species name="h+" coeff="-1.0"/>

<species name="fe+2" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="fenol_ch4" type="kinetic">

<logk temp="25.0" value="1.8487d0"/>

<stoichiometry>

<species name="c6h6o" coeff="-0.2857"/>

<species name="h2o" coeff="-1.8571"/>

<species name="hco3-" coeff="0.7142"/>

<species name="h+" coeff="0.7142"/>

<species name="ch4" coeff="1.0"/>

</stoichiometry>

<reactionratelaw name="fermentation" type="monod" ea="0.0" attr1="5.01187d-13" >

<term type="monod">

<species name="c6h6o" attr1="1.1d-3" />

</term>

<term type="inhibitor" >

<species name="o2" attr1="3.1d-5" />

<species name="no3-" attr1="1.6d-5" />

</term>

</reactionratelaw>

</reaction>

<reaction name="fenol_no3" type="kinetic">

<logk temp="25.0" value="1.8487d0"/>

<stoichiometry>

<species name="c6h6o" coeff="-0.17857"/>

<species name="no3-" coeff="-1.0"/>

<species name="h2o" coeff="-0.0357"/>

<species name="hco3-" coeff="1.0714"/>

<species name="h+" coeff="0.0714"/>

<species name="n2" coeff="0.5"/>

</stoichiometry>

<reactionratelaw name="denitrification" type="monod" ea="0.0" attr1="3.98107d-11" >

<term type="monod">

<species name="no3-" attr1="8.1d-6" />

<species name="c6h6o" attr1="1.1d-4" />

</term>

<term type="inhibitor" >

<species name="o2" attr1="6.2d-6" />

</term>

</reactionratelaw>

</reaction>

<reaction name="fenol_o2" type="kinetic">

<logk temp="25.0" value="1.8487d0"/>

<stoichiometry>

<species name="c6h6o" coeff="-0.142857"/>

<species name="o2" coeff="-1.0"/>

<species name="h2o" coeff="-0.42857"/>

<species name="hco3-" coeff="0.8571"/>

<species name="h+" coeff="0.8571"/>

</stoichiometry>

<reactionratelaw name="aerobic degradation" type="monod" ea="0.0" attr1="3.98107d-10" >

<term type="monod">

<species name="o2" attr1="3.1d-6" />

<species name="c6h6o" attr1="1.1d-4" />

Page 103: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

B.1. Input file in xml format 93

</term>

</reactionratelaw>

</reaction>

<reaction name="fenol_s" type="kinetic">

<logk temp="25.0" value="1.8487d0"/>

<stoichiometry>

<species name="c6h6o" coeff="-0.2857"/>

<species name="so4-2" coeff="-1.0"/>

<species name="h+" coeff="0.7142"/>

<species name="h2o" coeff="-0.8571"/>

<species name="hs-" coeff="1.0"/>

<species name="hco3-" coeff="1.7142"/>

</stoichiometry>

<reactionratelaw name="sulphide reduction" type="monod" ea="0.0" attr1="7.0795e-12" >

<term type="monod">

<species name="so4-2" attr1="1.6d-4" />

<species name="c6h6o" attr1="1.1d-4" />

</term>

<term type="inhibitor" >

<species name="o2" attr1="3.1d-5" />

<species name="no3-" attr1="1.6d-5" />

<species name="c6h6o" attr1="6.4e-3" />

</term>

</reactionratelaw>

</reaction>

<reaction name="x-na" type=’equilibrium’>

<logk temp="25.0d0" value="0.39794d0"/>

<stoichiometry>

<species name="x2-ca" coeff="0.5"/>

<species name="ca+2" coeff="-0.5"/>

<species name="na+" coeff="1.0"/>

</stoichiometry>

</reaction>

<reaction name="x2-mg" type=’equilibrium’>

<logk temp="25.0d0" value="0.19382d0"/>

<stoichiometry>

<species name="x2-ca" coeff="1.0"/>

<species name="ca+2" coeff="-1.0"/>

<species name="mg+2" coeff="1.0"/>

</stoichiometry>

</reaction>

</reactions>

</chemicalsystem>

The cheproo.xml file is the following

<cheproo name="Biodegradation of phenolics compounds" derivatestored="yes" writeinfo="yes" typesolver="sia" zero="1.0d-100">

<chemicalsystem>

<file name="chemsys.xml"/>

</chemicalsystem>

<waters>

<water id="1" name="time 0-25 years (flow line II)" temp="25.0d0">

<species name="h+" icon="act" cguess="7.943d-6" ctot="7.94328E-6" constraint="" />

<species name="ca+2" icon="tot" cguess="2.4d-3" ctot="2.4d-3" constraint="" />

<species name="so4-2" icon="tot" cguess="6.7d-3" ctot="6.7d-3" constraint="" />

<species name="mg+2" icon="tot" cguess="2.8d-4" ctot="2.8d-4" constraint="" />

<species name="na+" icon="tot" cguess="1.9d-2" ctot="1.9d-2" constraint="" />

<species name="hco3-" icon="tot" cguess="2.0d-2" ctot="2.0d-2" constraint=" " />

<species name="cl-" icon="tot" cguess="3.5d-3" ctot="3.5d-3" constraint="" />

<species name="fe+2" icon="tot" cguess="8.9d-7" ctot="8.9d-7" constraint="" />

<species name="o2" icon="tot" cguess="2.9d-4" ctot="2.9d-4" constraint="" />

<species name="no3-" icon="tot" cguess="1.7d-3" ctot="1.7d-3" constraint="" />

<species name="mn+2" icon="tot" cguess="1.2d-7" ctot="1.2d-7" constraint="" />

<species name="hs-" icon="tot" cguess="3.0d-10" ctot="3.0d-10" constraint="" />

<species name="n2" icon="tot" cguess="3.6d-10" ctot="3.6d-10" constraint="" />

<species name="ch4" icon="tot" cguess="6.2d-10" ctot="6.2d-10" constraint="" />

<species name="c6h6o" icon="tot" cguess="2.8d-2" ctot="2.8d-2" constraint="" />

</water>

<water id="2" name="time 25-47 years (flow line II)" temp="25.0d0">

<species name="h+" icon="act" cguess="5.01187d-7" ctot="5.01187d-7" constraint="" />

<species name="ca+2" icon="tot" cguess="2.4d-3" ctot="2.4d-3" constraint="" />

<species name="so4-2" icon="tot" cguess="8.0d-4" ctot="8.0d-4" constraint="" />

<species name="mg+2" icon="tot" cguess="2.8d-4" ctot="2.8d-4" constraint="" />

<species name="na+" icon="tot" cguess="1.9d-2" ctot="1.9d-2" constraint="" />

<species name="hco3-" icon="tot" cguess="2.9d-2" ctot="2.9d-2" constraint=" " />

<species name="cl-" icon="tot" cguess="6.0d-3" ctot="6.0d-3" constraint="" />

<species name="fe+2" icon="tot" cguess="8.9d-7" ctot="8.9d-7" constraint="" />

<species name="o2" icon="tot" cguess="2.9d-4" ctot="2.9d-4" constraint="" />

<species name="no3-" icon="tot" cguess="1.7d-3" ctot="1.7d-3" constraint="" />

<species name="mn+2" icon="tot" cguess="1.2d-7" ctot="1.2d-7" constraint="" />

<species name="hs-" icon="tot" cguess="3.0d-10" ctot="3.0d-10" constraint="" />

<species name="n2" icon="tot" cguess="3.6d-10" ctot="3.6d-10" constraint="" />

<species name="ch4" icon="tot" cguess="6.2d-10" ctot="6.2d-10" constraint="" />

<species name="c6h6o" icon="tot" cguess="9.3d-3" ctot="9.3d-3" constraint="" />

</water>

<water id="3" name="water BH59" temp="25.0d0">

<species name="h+" icon="act" cguess="1.2589254d-7" ctot="1.2589254d-7" constraint="" />

Page 104: Cheproo User Manual - UPC - Grupo de Hidrología Subterránea

94 Chapter B. Biodegradation of the phenolics compounds

<species name="ca+2" icon="tot" cguess="2.4d-3" ctot="2.4d-3" constraint="" />

<species name="so4-2" icon="tot" cguess="6.7d-4" ctot="6.7d-4" constraint="" />

<species name="mg+2" icon="tot" cguess="2.8d-4" ctot="2.8d-4" constraint="" />

<species name="na+" icon="tot" cguess="7.8d-4" ctot="7.8d-4" constraint="" />

<species name="hco3-" icon="tot" cguess="2.9d-3" ctot="2.9d-3" constraint=" " />

<species name="cl-" icon="tot" cguess="1.8d-3" ctot="1.8d-3" constraint="" />

<species name="fe+2" icon="tot" cguess="8.9d-7" ctot="8.9d-7" constraint="" />

<species name="o2" icon="tot" cguess="2.9d-4" ctot="2.9d-4" constraint="" />

<species name="no3-" icon="tot" cguess="1.7d-3" ctot="1.7d-3" constraint="" />

<species name="mn+2" icon="tot" cguess="1.2d-7" ctot="1.2d-7" constraint="" />

<species name="hs-" icon="tot" cguess="3.0d-10" ctot="3.0d-10" constraint="" />

<species name="n2" icon="tot" cguess="3.6d-10" ctot="3.6d-10" constraint="" />

<species name="ch4" icon="tot" cguess="6.2d-10" ctot="6.2d-10" constraint="" />

<species name="c6h6o" icon="tot" cguess="3.4d-10" ctot="3.4d-10" constraint="" />

</water>

</waters>

<sets>

<set id="1" name="zone mineral central" type="mineral" >

<species name="feooh" conc="3.56d-3" unitconc="m3"/>

<species name="mno2" conc="3.36d-5" unitconc="m3"/>

<species name="fenol_s" conc="3.36d-5" unitconc="m3"/>

<species name="fenol_o2" conc="3.36d-5" unitconc="m3"/>

<species name="fenol_no3" conc="3.36d-5" unitconc="m3"/>

<species name="fenol_ch4" conc="3.36d-5" unitconc="m3"/>

</set>

<set id="1" type="surface" name="surface in central nodes">

<surface name="surface">

<site txoh="27.02d0"/>

</surface>

</set>

</sets>

<output>

<totals>

<species name="hco3-"/>

<species name="hs-"/>

<species name="so4-2"/>

</totals>

<concentrations>

<species name="h+"/>

<species name="mn+2"/>

<species name="h2o"/>

<species name="mno2"/>

<species name="fe+2"/>

<species name="feooh"/>

<species name="hs-"/>

<species name="so4-2"/>

<species name="o2"/>

<species name="ch4"/>

<species name="fes"/>

<species name="c6h6o"/>

<species name="caco3"/>

<species name="mnco3"/>

<species name="feco3"/>

<species name="no3-"/>

<species name="n2"/>

<species name="na+"/>

<species name="cl-"/>

<species name="mg+2"/>

<species name="ca+2"/>

<species name="hco3-"/>

<species name="x2-ca"/>

<species name="x2-mg"/>

<species name="x-na"/>

</concentrations>

</output>

</cheproo>