| Next || Previous || Top |

Types and Sequence of Calculations

After reading a database file of thermodynamic data, PHREEQC reads an input file until it reaches an END keyword or the end of the file. At that point, PHREEQC begins a simulation by processing any new thermodynamic data that have been read, creating updated lists of elements, phases, and aqueous, exchange, and surface species. After processing these new data, up to 12 types of calculations or data management operations may be performed in the following order: (1) initial solution or speciation calculations, (2) initial exchange calculations, (3) initial surface calculations, (4) initial gas-phase calculations, (5) batch-reaction calculations, (6) inverse-modeling calculations, (7) advective-transport calculations, (8) advective- dispersive transport calculations, (9) cell batch-reaction calculations, (10) copy operations, (11) dump operations, and (12) delete operations. After all of these calculations and operations are completed, PHREEQC reads the input file to the next END keyword and starts another simulation. All the simulations together are termed a “run”.

Initial Solution or Speciation Calculations

Generally, a chemical analysis provides total concentrations of elements in solution. A speciation calculation distributes these totals among aqueous species by using an aqueous model; the results of the speciation calculation are the activities of all of the aqueous species. The activities can be used for calculating saturation indices for minerals, relative to the water. Speciation modeling requires only a SOLUTION data block for each water analysis for which saturation indices are to be calculated. Alternatively, the SOLUTION_SPREAD data block can be used to define multiple solutions in the same data block--one row for each solution--and speciation calculations are performed for each analysis. Example 1 demonstrates speciation calculations.

Initial Exchange Calculations

One type of reactant used by PHREEQC is an assemblage of one or more ion exchangers. The elemental composition of the exchange assemblage can be defined explicitly or implicitly with the EXCHANGE data block. If the composition is defined explicitly, that is by specifying the number of moles of each element on exchange sites, then there is no need for an initial exchange calculation. If the composition of the exchange assemblage is defined implicitly, a calculation is performed to determine the composition of the exchanger that is in equilibrium with a specified solution composition. In this calculation, the composition of the solution does not change, but the composition of the exchanger is adjusted until it is in equilibrium with the solution. Examples 13, 14, 19, and 21 demonstrate this calculation in Examples.

Initial Surface Calculations

One type of reactant used by PHREEQC is an assemblage of one or more surfaces, each with one or more types of complexation sites. Similar to ion exchange, the elemental composition of the surface assemblage can be defined explicitly or implicitly with the SURFACE data block. If the composition is defined explicitly, that is by specifying the number of moles of each element on surface sites, then there is no need for an initial surface calculation. If the composition of the surface assemblage is defined implicitly, a calculation is performed to determine the composition of the surface that is in equilibrium with a specified solution composition. In this calculation, the composition of the solution does not change, but the compositions of the surfaces are adjusted until they are in equilibrium with the solution. Examples 14, 19, and 21 demonstrate this calculation in Examples.

Initial Gas-Phase Calculations

A gas phase is defined by the number of moles of gas components that are present. The gas phase may have either constant pressure or constant volume. The number of moles of each component in a constant-pressure gas phase can be defined by specifying the partial pressures of all the gas components, in which case no initial gas-phase calculation is done. An initial gas-phase calculation is done when the identifier -equilibrate is included in a fixed-volume gas-phase definition. In this case, the partial pressure of each gas component in the solution is taken as the partial pressure in the gas phase. From the partial pressures and the volume of the gas phase, the moles of each component will be calculated by the ideal gas law or (approximately) with the Peng-Robinson equation of state. The composition of the solution is not changed during an initial gas-phase calculation. Example 7 demonstrates this calculation in Examples.

Batch-Reaction Calculations

Batch-reaction calculations simulate reactions occurring in a beaker and can involve equilibrium and irreversible reactions. Equilibrium reactions are defined by specifying a solution or mixture of solutions to be put in the beaker along with a pure-phase assemblage, an exchange assemblage, a multicomponent gas phase, a solid-solution assemblage, and (or) a surface assemblage. The solution or mixture is brought to equilibrium with the reactants. Furthermore, irreversible reactions can be specified, including addition or removal of specified reactants, pressure changes, temperature changes, and (or) kinetic reactions, where the reaction rate can depend on solution composition or other, user-definable parameters. Conceptually, the irreversible reactions are added and equilibrium is calculated for the system (see examples 2, 3, 4, 5, 6, 7, 8, 10, 19, 20, 21, and 22 in the Examples). Kinetic reactions are integrated for a specified time step by calculating equilibrium following each of a series of irreversible reactions that depend on the evolving composition of the solution (see examples 6, 9, and 15 in Examples).

Initial conditions for batch reactions are defined with SOLUTION, SOLUTION_SPREAD, EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, SOLID_SOLUTIONS, and SURFACE data blocks. Irreversible reactions are defined with the following data blocks: MIX, for mixing of solutions; REACTION, for adding or removing fixed amounts of specified reactants; KINETICS and RATES, for defining kinetic reactions; REACTION_PRESSURE, for changing the pressure at which the batch reaction occurs; and REACTION_TEMPERATURE, for changing the temperature at which the batch reaction occurs.

Different sets of keyword data blocks can be defined within one simulation, each set being identified by the number or range of numbers which follow the keyword. In the subsequent batch reaction, a set may be included either implicitly or explicitly. For an implicit calculation, a solution or mixture (SOLUTION or MIX keywords) must be defined within the simulation, and the first of each keyword set (defined before the END) will be included in the calculation. That is, the first solution (or mixture) will be used along with the first of each of the data blocks EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, SOLID_SOLUTIONS, SURFACE, KINETICS, REACTION, REACTION_PRESSURE, and REACTION_TEMPERATURE. For an explicit calculation, “USE keyword number ” defines a set that is to be used regardless of position within the input lines (see examples 3, 6, 7, 8, and 9 in Examples). “USE keyword none ” eliminates a reactant that was implicitly defined (see example 8 in Examples). If the composition of the solution, pure-phase assemblage, exchange assemblage, gas phase, solid-solution assemblage, or surface assemblage has changed after the batch-reaction calculation, it can be saved with the SAVE keyword. RUN_CELLS invokes all the defined keyword data blocks automatically for specified cell numbers, as explained in Cell Batch-Reaction Calculations.

Inverse-Modeling Calculations

Inverse modeling is used to deduce the geochemical reactions that account for the change in chemical composition of water along a flow path. At least two chemical analyses of water at different points along the flow path are needed, as well as a set of phases that are potentially reactive along the flow path. From the analyses and phases, mole-balance models are calculated. A mole-balance model is a set of mole transfers of phases and reactants that accounts for the change in composition along the flow path. Normally, only SOLUTION or SOLUTION_SPREAD data blocks and an INVERSE_MODELING keyword data block are needed for inverse modeling calculations. However, additional reactant phases may need to be defined with PHASES or EXCHANGE_SPECIES data blocks (see examples 16, 17, and 18 in Examples).

Advective-Transport Calculations

Advective-transport calculations are used to simulate advection and chemical reactions as water moves through a 1D column (ADVECTION data block). The column is divided into a number of cells, n , which is defined by the user. The cells are numbered 1 through n , and these cells initially contain solutions with identifying numbers 1 through n . A solution composition for each of these integers must have been defined by SOLUTION (or SOLUTION_SPREAD) data blocks or the SAVE keyword. The cells also may contain other reversible or irreversible reactants. For a given cell number, i , if a phase assemblage, exchange assemblage, solid-solution assemblage, surface assemblage, gas phase, mixture, reaction, reaction-pressure, or reaction-temperature data block with identifying number i has been defined, then it is present in cell i during the advective-transport calculation. Thus, the initial conditions and the set of reactants can be defined individually for each cell, which provides flexibility to simulate a variety of chemical conditions throughout the column (see examples 11 and 14 in Examples).

The infilling solution for the column is always solution number 0. Advection is modeled by “shifting” solution 0 to cell 1, the solution in cell 1 to cell 2, and so on. At each shift, kinetic reactions are integrated in each cell, while maintaining equilibrium with any gas phase or solid-phase assemblages that are present in the cell. To facilitate definition of the initial conditions, the keywords EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, KINETICS, MIX, REACTION, REACTION_PRESSURE, REACTION_TEMPERATURE, SOLID_SOLUTIONS, SOLUTION, and SURFACE allow simultaneous definition for a range of cell numbers. The SAVE keyword also permits a solution, gas-phase, or assemblage numbers to be saved to a range of numbers simultaneously.

Advective-Dispersive Transport Calculations

Analogous to purely advective transport, advective-dispersive 1D and diffusive 2- or 3D transport can be modeled with the TRANSPORT data block. Dispersivities can be specified for cells, and either a single diffusion coefficient is used for all chemical species or each species can be given its own temperature-dependent diffusion coefficient. Like purely advective transport calculations, a column of n cells is defined, but also dispersion/diffusion parameters, boundary conditions, direction of flow, cell lengths, and advective time step can be provided. It also is possible to model double porosity by including the relevant information (example 13). The infilling solution depends on the direction of flow and may be solution number 0 or n+1 . For each shift (advection or diffusion time step) a number of dispersion/diffusion mixing steps are performed, the number depending on numerical stability criteria. For each shift and dispersion step, kinetic reactions are integrated for each cell while maintaining equilibrium with any gas phase or assemblages that are present in the cell (see examples 11, 12, 13, 15, 19, and 21, in Examples).

Cell Batch-Reaction Calculations

Cell batch-reaction calculations are a special case of batch-reaction calculations. Whereas any reactant with any identification number can be reacted in a batch-reaction calculation, only reactants with the same identification number are used in a cell batch-reaction calculation. For a cell batch-reaction calculation, the identification number (cell number) is specified, and any reactants with that identification number are brought together and reacted. The reactants may include any defined by the EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, KINETICS, MIX, REACTION, REACTION_PRESSURE, REACTION_TEMPERATURE, SOLID_SOLUTIONS, SOLUTION, and SURFACE data blocks. If both a MIX and SOLUTION are defined with the specified cell number, then the MIX reactant is used. The USE data block has no effect on cell batch-reaction calculations. The compositions of the EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, KINETICS, SOLUTION, and SURFACE reactants are automatically saved after a cell batch-reaction calculation and the SAVE data block has no effect.

COPY Operations

The COPY operation allows any numbered reactant to be replicated, including reactants defined with EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, KINETICS, MIX, REACTION, REACTION_PRESSURE, REACTION_TEMPERATURE, SOLID_SOLUTIONS, SOLUTION, and SURFACE data blocks. A reactant can be copied to a single new instance with a specified identification number or to multiple new instances with a contiguous range of identification numbers. If a reactant is copied to an identification number, and a reactant of that type already exists with that number, the existing reactant is overwritten.

DUMP Operations

The DUMP operation allows any numbered reactant to be written to a file in a form that is readable by PHREEQC (_RAW data blocks), including reactants defined with EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, KINETICS, MIX, REACTION, REACTION_PRESSURE, REACTION_TEMPERATURE, SOLID_SOLUTIONS, SOLUTION, and SURFACE data blocks. The file can be used to reestablish the state of a PHREEQC calculation in a subsequent PHREEQC run. IPhreeqc modules can retrieve DUMP information as a string, which can be used to copy the reactant definitions to other IPhreeqc modules.

DELETE Operations

The DELETE operation allows any numbered reactant to be deleted from the current PHREEQC run, including reactants defined with EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, KINETICS, MIX, REACTION, REACTION_PRESSURE, REACTION_TEMPERATURE, SOLID_SOLUTIONS, SOLUTION, and SURFACE data blocks. The reactants to be deleted can be identified by individual or ranges of identification numbers. In some circumstances, such as cell batch-reaction calculations, it may be useful to delete a reactant that is no longer wanted. For most batch-reaction calculations, memory is sufficiently available in modern computers so that it is not necessary to delete reactants that are no longer used. However, if IPhreeqc modules are used for simulations with hundreds of thousands of cells, then DELETE operations may be needed for efficient management of computer memory.


| Next || Previous || Top |