Skip to main content
Log in

Accelerating Reactive Transport Modeling: On-Demand Machine Learning Algorithm for Chemical Equilibrium Calculations

  • Published:
Transport in Porous Media Aims and scope Submit manuscript

A Correction to this article was published on 05 June 2020

This article has been updated

Abstract

During reactive transport modeling, the computing cost associated with chemical equilibrium calculations can be 10 to 10,000 times higher than that of fluid flow, heat transfer, and species transport computations. These calculations are performed at least once per mesh cell and once per time step, amounting to billions of them throughout the simulation employing high-resolution meshes. To radically reduce the computing cost of chemical equilibrium calculations (each requiring an iterative solution of a system of nonlinear equations), we consider an on-demand machine learning algorithm that enables quick and accurate prediction of new chemical equilibrium states using the results of previously solved chemical equilibrium problems within the same reactive transport simulation. The training operations occur on-demand, rather than before the start of the simulation when it is not clear how many training points are needed to accurately and reliably predict all possible chemical conditions that may occur during the simulation. Each on-demand training operation consists of fully solving the equilibrium problem and storing some key information about the just computed chemical equilibrium state (which is used subsequently to rapidly predict similar states whenever possible). We study the performance of the on-demand learning algorithm, which is mass conservative by construction, by applying it to a reactive transport modeling example and achieve a speed-up of one or two orders of magnitude (depending on the activity model used). The implementation and numerical tests are carried out in Reaktoro (reaktoro.org), a unified open-source framework for modeling chemically reactive systems.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11

Similar content being viewed by others

Change history

  • 05 June 2020

    In the original publication of the article, Table 2 was published incorrectly.

Notes

  1. The reason for this choice of notation is that we aim to formulate chemical systems in a more general form, instead of one that presumes the existence of certain types of species (e.g., molalities for aqueous solutes, mole fractions for gases, moles for minerals, etc.). We acknowledge that notations used by Lichtner (1985), Steefel and Cappellen (1990), Bethke (2007) are more common in the geochemical community. However, we believe that our choice for dependent and independent variables (molar amounts for all species, no matter their type, and considering elements as the building blocks of species, instead of primary/basic species) should not be difficult to understand.

  2. When A is full rank, the number of primary species and elements (i.e., chemical elements and electric charge) are equal.

References

Download references

Acknowledgements

This research project is funded by the Swiss National Science Foundation (Ambizione Grant PZ00P2-179967) and Shell Global Solutions International BV (Netherlands). We thank the Werner Siemens Foundation (Werner Siemens-Stiftung) for its support of the Geothermal Energy and Geofluids group at ETH Zurich, Switzerland. We also thank the associate editor and four anonymous reviewers whose critical comments and suggestions contributed immensely to the final version of this manuscript.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Allan M. M. Leal.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

The original version of this article was revised: Table 2 and some sentences in the texts have been published incorrectly. The sentence “they are reliable and our benchmark” in the section “1.1.1 Advantages of the Smart Chemical Equilibrium Algorithm” under the heading “Reliability.” should read as “they are reliable and serve as a benchmark”. Also, the sentence “’N secondary species” below the equation 24 should read as “N-E secondary species”. The corrected version of table 2 and the sentences are updated in the article.

Appendices

Appendix 1: Chemical Equilibrium Equations

The solution of the Gibbs energy minimization problem in (9) needs to satisfy the following first-order optimality conditions, also known as Karush–Kuhn–Tucker (KKT) conditions, for a local minimum of the Gibbs energy function G (Nocedal and Wright 1999; Fletcher 2000):

$$\begin{aligned} \mu -A^{T}y-z&=0, \end{aligned}$$
(34)
$$\begin{aligned} An-b&=0, \end{aligned}$$
(35)
$$\begin{aligned} n_{i}z_{i}&=0&\quad&(i=1,\ldots ,\text{N}), \end{aligned}$$
(36)
$$\begin{aligned} n_{i}&\ge 0&(i=1,\ldots ,\text{N}), \end{aligned}$$
(37)
$$\begin{aligned} z_{i}&\ge 0&(i=1,\ldots ,\text{N}), \end{aligned}$$
(38)

where \(y\in{\mathbb{R}}^{\text{E}}\) and \(z\in{\mathbb{R}}^{\text{N}}\) are introduced Lagrange multipliers and slack variables, respectively, that need to be solved along with the vector of species amounts \({n\in{\mathbb{R}}^{\text{N}}}\). For more details about these Lagrange multipliers and slack variables, their interpretation, as well as instructions on how to efficiently solve these equations, see Leal et al. (2016a), Leal et al. (2017).

The previous chemical equilibrium equations can be written in an extended law of mass action (xLMA) formulation as:

$$\begin{aligned} \nu \ln a+\nu \ln w-\ln K&=0, \end{aligned}$$
(39)
$$\begin{aligned} An-b&=0,\end{aligned}$$
(40)
$$\begin{aligned} n_{i}\ln w_{i}&=0&\quad&(i=1,\ldots ,\text{N}),\end{aligned}$$
(41)
$$\begin{aligned} n_{i}&\ge 0&(i=1,\ldots ,\text{N}),\end{aligned}$$
(42)
$$\begin{aligned} 0<w_{i}&\le 1&(i=1,\ldots ,\text{N}), \end{aligned}$$
(43)

following the use of the extended law of mass action equations

$$\begin{aligned} K_{m}=\prod _{i=1}^{\text{N}}(a_{i}w_{i})^{\nu _{mi}}. \end{aligned}$$
(44)

This is associated with the M linearly independent chemical reactions among the N chemical species in equilibrium:

$$\begin{aligned} 0\rightleftharpoons \sum _{i=1}^{\text{N}}\nu _{mi}\alpha _{i}\quad (m=1,\ldots ,\text{M}), \end{aligned}$$
(45)

where \({K\in{\mathbb{R}}^{\text{M}}}\) is the vector of equilibrium constants of the reactions, with \({K_{m}=K_{m}(T,P)}\) denoting the equilibrium constant of the mth reaction, and \(\nu \in{\mathbb{R}}^{\text{M}\times \text{N}}\) the stoichiometric matrix of these chemical reactions, with \(\nu _{mi}\) corresponding to the stoichiometric coefficient of the ith species in the mth reaction. Conventionally, \(\nu _{mi}\) is positive if the ith species is a product in the mth reaction (on its right-hand side), and negative if it is a reactant (on the left-hand side). Moreover, \({w\in{\mathbb{R}}^{\text{N}}}\) is the vector of species stability factors that need to be solved along with the species amounts \({n\in{\mathbb{R}}^{\text{N}}}\). These factors are introduced to ensure that the extended law of mass action equations (44) is valid even when some species in their corresponding reactions are unstable at equilibrium (i.e., when a species belongs to a phase that is absent from equilibrium). When all species are stable at equilibrium, it follows that \({w_{i}=1}\) and the xLMA equations reduce to the conventional lma equations

$$\begin{aligned} K_{m}=\prod _{i=1}^{\text{N}}a_{i}^{\nu _{mi}}. \end{aligned}$$
(46)

The number of linearly independent chemical reactions among the N species in equilibrium is \({\text{M}=\text{N}-\text{C}}\), where \({\text{C}=\text{rank}(A)}\), and thus whenever the formula matrix A is full rank, \(\text{C}=\text{E}\) and \(\text{M}=\text{N}-\text{E}\). For more information on how to solve these equations and how they are related to the conventional law of mass action equations, see Leal et al. (2016b), Leal et al. (2017).

Appendix 2: Sensitivity Derivatives

After computing the species amounts \(n=(n_{1},\ldots ,n_{\mathrm{N}})\) at a chemical equilibrium state corresponding to constrained temperature T, pressure P, and element amounts \(b=(b_{1},\ldots ,b_{\mathrm{E}})\), we are interested in computing the following sensitivity derivatives:

$$\begin{aligned} \frac{\partial n}{\partial T}=\begin{bmatrix}\dfrac{\partial n_{1}}{\partial T}\\ \vdots \\ \dfrac{\partial n_{\mathrm{N}}}{\partial T} \end{bmatrix},\quad \frac{\partial n}{\partial P}=\begin{bmatrix}\dfrac{\partial n_{1}}{\partial P}\\ \vdots \\ \dfrac{\partial n_{\mathrm{N}}}{\partial P} \end{bmatrix},\quad \frac{\partial n}{\partial b}=\begin{bmatrix}\dfrac{\partial n_{1}}{\partial b_{1}} &{} \cdots &{} \dfrac{\partial n_{1}}{\partial b_{\mathrm{E}}}\\ \vdots &{} \ddots &{} \vdots \\ \dfrac{\partial n_{\mathrm{N}}}{\partial b_{1}} &{} \cdots &{} \dfrac{\partial n_{\mathrm{N}}}{\partial b_{\mathrm{E}}} \end{bmatrix}. \end{aligned}$$
(47)

This can be achieved by applying the respective derivative operators d/dT, d/dP, and d/db on the governing equations used to compute the equilibrium state. To simplify the discussion, we consider the simpler conventional law of mass action (lma) formulation instead of the more advanced extended form (xLMA). Thus, the demonstration considers the system of equations

$$\begin{aligned} \begin{aligned}\nu \ln a-\ln K&=0,\\ An&=b. \end{aligned} \end{aligned}$$
(48)
  • Sensitivity derivatives with respect to temperatureT:

    $$\begin{aligned} \begin{aligned}\nu \frac{\partial (\ln a)}{\partial n} \frac{\partial n}{\partial T}&=\frac{\partial (\ln K)}{\partial T} -\nu \frac{\partial (\ln a)}{\partial T},\\ A\frac{\partial n}{\partial T}&=0. \end{aligned} \end{aligned}$$
    (49)
  • Sensitivity derivatives with respect to pressureP:

    $$\begin{aligned} \begin{aligned}\nu \frac{\partial (\ln a)}{\partial n}\frac{\partial n}{\partial P}&=\frac{\partial (\ln K)}{\partial P}-\nu \frac{\partial (\ln a)}{\partial P},\\ A\frac{\partial n}{\partial P}&=0. \end{aligned} \end{aligned}$$
    (50)
  • Sensitivity derivatives with respect to element amounts\(b=(b_{1},\ldots ,b_{\mathrm{E}})\):

    $$\begin{aligned} \begin{aligned} \nu \frac{\partial (\ln a)}{\partial n}\frac{\partial n}{\partial b}&=0,\\ A\frac{\partial n}{\partial b}&=I. \end{aligned} \end{aligned}$$
    (51)

Note that all these equations are linear and share the same coefficient matrix M:

$$\begin{aligned} M=\begin{bmatrix}\nu \dfrac{\partial (\ln a)}{\partial n}\\ A \end{bmatrix}. \end{aligned}$$
(52)

Let S be the sensitivity matrix of the equilibrium state defined as

$$\begin{aligned} S=\begin{bmatrix} \dfrac{\partial n}{\partial T}&\dfrac{\partial n}{\partial P}&\dfrac{\partial n}{\partial b}\end{bmatrix}=\begin{bmatrix}\dfrac{\partial n_{1}}{\partial T} &{} \dfrac{\partial n_{1}}{\partial P} &{} \dfrac{\partial n_{1}}{\partial b_{1}} &{} \cdots &{} \dfrac{\partial n_{1}}{\partial b_{\mathrm{E}}}\\ \vdots &{} \vdots &{} \vdots &{} \ddots &{} \vdots \\ \dfrac{\partial n_{\mathrm{N}}}{\partial T} &{} \dfrac{\partial n_{\mathrm{N}}}{\partial P} &{} \dfrac{\partial n_{\mathrm{N}}}{\partial b_{1}} &{} \cdots &{} \dfrac{\partial n_{\mathrm{N}}}{\partial b_{\mathrm{E}}} \end{bmatrix}, \end{aligned}$$
(53)

and introduce a matrix B that concatenate, along its columns, the right-hand side vectors in Eqs. (49), (50) and (51):

$$\begin{aligned} B=\begin{bmatrix}{\displaystyle \left( \frac{\partial (\ln K)}{\partial T}-\nu \frac{\partial (\ln a)}{\partial T}\right) } &{} \left({\displaystyle \frac{\partial (\ln K)}{\partial P}-\nu \frac{\partial (\ln a)}{\partial P}}\right) &{} 0\\ 0 &{} 0 &{} I \end{bmatrix}. \end{aligned}$$
(54)

We can then compute S (the sensitivity matrix corresponding to the previously calculated equilibrium state) using

$$\begin{aligned} MS=B, \end{aligned}$$
(55)

which can be performed by decomposing the M matrix once (e.g., in LU factors) and then solving for each column of S.

Note: We compute the derivatives \(\partial (\ln a)/\partial T\), \(\partial (\ln a)/\partial P\), \(\partial (\ln a)/\partial n\), \(\partial (\ln K)/\partial T\) and \(\partial (\ln K)/\partial P\) using automatic differentiation (Leal et al. 2018). In this way, we do not need to be concerned about the specific details and complexity of each thermodynamic model (or equation of state) used to compute the necessary thermodynamic properties of the phases, species, and reactions in the chemical system.

Appendix 3: Mass Conservative Predictions

We demonstrate here that the first-order Taylor prediction (used in the algorithm presented in Sect. 3)

$$\begin{aligned}{\tilde{n}}=\mathring{n}+\frac{\partial \mathring{n}}{\partial T}(T-\mathring{T})+\frac{\partial \mathring{n}}{\partial P}(P-\mathring{P})+\frac{\partial \mathring{n}}{\partial b}(b-\mathring{b}), \end{aligned}$$
(56)

is intrinsically mass conservative. Thus, we want to show that for a given (TPb), the corresponding Taylor estimate \({\tilde{n}}\) satisfies

$$\begin{aligned} A{\tilde{n}}=b, \end{aligned}$$
(57)

where A is the formula matrix of the chemical system (see Sect. 2).

We start by multiplying equation (56) by A:

$$\begin{aligned} A{\tilde{n}}=A\mathring{n}+A\frac{\partial \mathring{n}}{\partial T}(T-\mathring{T})+A\frac{\partial \mathring{n}}{\partial P}(P-\mathring{P})+A\frac{\partial \mathring{n}}{\partial b}(b-\mathring{b}). \end{aligned}$$
(58)

Observe from Eqs. (49), (50), and (51) that the following conditions are imposed for the sensitivity derivatives:

$$\begin{aligned} A\frac{\partial \mathring{n}}{\partial T}=0,\quad A\frac{\partial \mathring{n}}{\partial P}=0,\quad \text{and}\quad A\frac{\partial \mathring{n}}{\partial b}=I. \end{aligned}$$
(59)

Moreover, since \(\mathring{n}\) was computed using a conventional and exact equilibrium algorithm, we have that

$$\begin{aligned} A\mathring{n}=\mathring{b}. \end{aligned}$$
(60)

Combining all these observations, we determine, as desired, that

$$\begin{aligned} A{\tilde{n}}=\underset{\mathring{b}}{{\underbrace{A\mathring{n}}}} +\underset{0}{{\underbrace{A\frac{\partial \mathring{n}}{\partial T}(T-\mathring{T})}}}+\underset{0}{{\underbrace{A\frac{\partial \mathring{n}}{\partial P}(P-\mathring{P})}}}+\underset{b-\mathring{b}}{{\underbrace{A \frac{\partial \mathring{n}}{\partial b}(b-\mathring{b})}}}=b. \end{aligned}$$
(61)

Appendix 4: Reactive Transport Equations

The fundamental mass conservation equations for both fluid and solid species are:

$$\begin{aligned} \frac{\partial n_{i}^{\text{f}}}{\partial t}+\nabla \cdot ({\varvec{v}}n_{i}^{\text{f}}-D\nabla n_{i}^{\text{f}})&=r_{i}^{\text{f}}&\quad&(i=1,\ldots ,\text{N}^{\text{f}}), \end{aligned}$$
(62)
$$\begin{aligned} \frac{\partial n_{i}^{\text{s}}}{\partial t}&=r_{i}^{\text{s}}&(i=1,\ldots ,\text{N}^{\text{s}}), \end{aligned}$$
(63)

where \(n_{i}^{\text{f}}\) and \(n_{i}^{\text{s}}\) are the bulk concentration of the ith fluid and solid species (in mol/\(\hbox{m}^{3}\)), respectively; \({\varvec{v}}\) is the fluid pore velocity (in m/s); D is the diffusion coefficient of the fluid species (in \(\hbox{m}^{2}\)/s); \(r_{i}^{\text{f}}\) and \(r_{i}^{\text{s}}\) are the rates of production/consumption of the ith fluid and solid species (in mol/s), respectively, due to chemical reactions; and \(\text{N}^{\text{f}}\) and \(\text{N}^{\text{s}}\) are the numbers of fluid and solid species, respectively. Note that the above equations assume a single fluid phase and common diffusion coefficients for all fluid species.

By partitioning the species as fluid and solid species, the formula matrix A can be conveniently represented as:

$$\begin{aligned} A=\begin{bmatrix}A^{\text{f}}&A^{\text{s}}\end{bmatrix}, \end{aligned}$$
(64)

where \(A^{\text{f}}\) and \(A^{\text{s}}\) are the formula matrices of the fluid and solid partitions (i.e., the matrices constructed from the columns of A corresponding to fluid and solid species).

The concentrations of elements in both fluid and solid partitions \(b_{j}^{\text{f}}\) and \(b_{j}^{\text{s}}\) can then be calculated from the species concentrations in the same partition using

$$\begin{aligned} b_{j}^{\text{f}}&=\sum _{i=1}^{\text{N}^{\text{f}}}A_{ji}^{\text{f}}n_{i}^{\text{f}}&\quad&(j=1,\ldots ,\text{E}) \end{aligned}$$
(65)

and

$$\begin{aligned} b_{j}^{\text{s}}&=\sum _{i=1}^{\text{N}^{\text{s}}} A_{ji}^{\text{s}}n_{i}^{\text{s}}&(j=1,\ldots ,\text{E}). \end{aligned}$$
(66)

Let \(r_{i}\) denote the rate of production/consumption of the ith species in the system (i.e., using the global index, and not a local index within the fluid or solid partition). From the mass conservation condition for the elements (chemical elements and electrical charge), it follows that

$$\begin{aligned} \underset{\begin{array}{c} \text{rate of production}\\ \text{ of element j} \end{array} }{\underbrace{\sum _{i=1}^{\text{N}}A_{ji}r_{i}}} =\underset{\begin{array}{c} \text{rate of production}\\ \text{ of element j in}\\ \text{the fluid partition} \end{array} }{\underbrace{\sum _{i=1}^{\text{N}^{\text{f}}}A_{ji}^{\text{f}} r_{i}^{\text{f}}}}+\underset{\begin{array}{c} \text{rate of production}\\ \text{ of element j in}\\ \text{the solid partition} \end{array} }{\underbrace{\sum _{i=1}^{\text{N}^{\text{s}}}A_{ji}^{\text{s}} r_{i}^{\text{s}}}}=\quad 0, \end{aligned}$$
(67)

which is the mathematical statement for the fact that elements are neither created nor destroyed during chemical reactions. We can combine this result with Eqs. (62) and (63) to derive the following conservation equations for the elements:

$$\begin{aligned} \frac{\partial b_{j}^{\text{s}}}{\partial t}+\frac{\partial b_{j}^{\text{f}}}{\partial t}+\nabla \cdot ({\varvec{v}}b_{j}^{\text{f}}-D\nabla b_{j}^{\text{f}})=0\quad (j=1,\ldots ,\text{E}). \end{aligned}$$
(68)

Assume that all species, fluid and solid, are in local chemical equilibrium everywhere, at all times. One can then perform operator splitting steps to solve the fundamental mass conservation Eqs. (62) and (63) to calculate the concentrations of the species, \(n_{i}\), over time. Let k denote the current time step and \(\Delta t\) the time step length used in the discretization of the time derivative terms. The operator splitting steps at the kth time step are:

Step 1. We consider Eq. (68) without the \({\partial b_{j}^{\text{s}}}/{\partial t}\) term and compute an intermediate approximation of element concentrations in the fluid partition \({\tilde{b}}^{\text{f}}=({\tilde{b}}_{1}^{\text{f}},\ldots ,{\tilde{b}}_{\mathrm{E}}^{\text{f}})\) at time \(t_{k+1}\) using

$$\begin{aligned} \frac{{\tilde{b}}_{j}^{\text{f},k+1}-{\tilde{b}}_{j}^{\text{f},k}}{\Delta t}+\nabla \cdot ({\varvec{v}}{\tilde{b}}_{j}^{\text{f},k+1} -D\nabla{\tilde{b}}_{j}^{\text{f},k+1})=0\quad (j=1,\ldots ,\text{E}), \end{aligned}$$
(69)

with the following flux boundary condition at \(x=x_{L}\) (on the left boundary inlet face, where we inject the \(\hbox{CO}_{{2}}\)-saturated brine):

$$\begin{aligned} -({\varvec{v}}{\tilde{b}}_{j}^{\mathrm{f},k+1}-D\nabla{\tilde{b}}_{j}^{\mathrm{f},k +1})\cdot \mathbf{n }_{L}=v\phi _{L}{\hat{b}}_{j,L}\quad (j=1,\ldots ,\mathrm{E}), \end{aligned}$$
(70)

where subscript L denotes the left boundary at \(x=x_{L}\), \(\mathbf{n }_{L}\) is the normal vector on the inflow face, \(\phi _{L}\) is the current porosity at \(x=x_{L}\) (which changes with time), and \({\hat{b}}_{j,L}\) (in \(\mathrm{mol}/\mathrm{m}_{\mathrm{fluid}}^{3}\)) is the imposed concentration of the jth element in the injected brine. To match the units of concentrations of the elements in the fluid \([b_{j}]=\mathrm{mol}/\mathrm{m}_{\mathrm{bulk}}^{3}\) and the imposed concentration \([{\hat{b}}_{j,L}]=\mathrm{mol}/\mathrm{m}_{\mathrm{fluid}}^{3}\) , we need to multiply it by \(\phi _{L}\) (\(\mathrm{m}_{\mathrm{fluid}}^{3}/\mathrm{m}_{\mathrm{bulk}}^{3}\)). To discretize the above partial differential equations in space, a finite volume method is applied. The time integration uses an implicit scheme for both advection and diffusion.

Step 2. Update the total concentrations of each element \(b_{j}\) using the previously computed intermediate concentrations of each element in the fluid \({\tilde{b}}_{j}^{\mathrm{f}}\):

$$\begin{aligned} b_{j}^{k+1}={\tilde{b}}_{j}^{\text{f},k+1}+b_{j}^{\text{s},k}. \end{aligned}$$
(71)

Note that each element concentration in the solid partition \(b_{j}^{\mathrm{s}}\) remains constant during the transport calculations in the previous step.

Step 3. Calculate the concentrations of the species, \(n_{i}^{k+1}\), in each mesh cell. For this, use as input the temperature and pressure values of the cell together with the updated local concentrations of elements, \(b_{j}^{k+1}\), from the previous step. Let the on-demand learning algorithm determine, in each cell, if it needs to fully solve the current equilibrium problem or if it can quickly estimate the species amounts \(n=(n_{1},\ldots ,n_{\mathrm{N}})\) using a previously learned problem with similar inputs.

Appendix 5: Normalization in the Smart Chemical Equilibrium Algorithm

The definition of x, y, f, and \(f_{x}\) in Sect. 4 ignores the fact of different dimensions across the entries in x and y. For example, \(x=(T,P,b)\) and \(y=(n,\mu )\). Because the on-demand machine learning algorithm requires a search procedure, which may or may not rely on searching of the nearest neighbor, it can help if the entries in these vectors are dimensionless. Therefore, we introduce below normalized and dimensionless variables

$$\begin{aligned}{\bar{T}}=\frac{T}{T^{\circ }},\quad{\bar{P}}=\frac{P}{P^{\circ }},\quad{\bar{b}}=\frac{b}{b_{\Sigma }},\quad{\bar{n}}=\frac{n}{b_{\Sigma }},\quad{\bar{\mu }}=\frac{\mu }{RT}, \end{aligned}$$
(72)

where \({T^{\circ }=298.15\hbox{K}}\), \({P^{\circ }=1\hbox{bar}}\), and \({b_{\Sigma }=\mathrm{sum}(b)}\). We then use (72) in more proper and preferred definitions of x, y, f , and \(f_{x}\) below, so that these mathematical entities are deprived of dimensions

$$\begin{aligned} x{:}{=}({\bar{T}},{\bar{P}},{\bar{b}}),\quad y{:}{=}({\bar{n}},{\bar{\mu }}),\quad f(x){:}{=}\begin{bmatrix}{\bar{n}}(x)\\{\bar{\mu }}(x) \end{bmatrix},\quad f_{x}(x){:}{=}\begin{bmatrix}\dfrac{\mathrm{d}{\bar{n}}(x)}{\mathrm{d}{\bar{T}}} &{} \dfrac{\mathrm{d}{\bar{n}}(x)}{\mathrm{d}{\bar{P}}} &{} \dfrac{\mathrm{d}{\bar{n}}(x)}{\mathrm{d}{\bar{b}}}\\ \\ \dfrac{\partial{\bar{\mu }}(x)}{\partial{\bar{T}}} &{} \dfrac{\mathrm{d}{\bar{\mu }}(x)}{\mathrm{d}{\bar{P}}} &{} \dfrac{\mathrm{d}{\bar{\mu }}(x)}{\mathrm{d}{\bar{b}}} \end{bmatrix}. \end{aligned}$$
(73)

Finally, the following observations can be made:

  1. 1.

    The evaluation of f(x) can be done as follows: compute \({T={\bar{T}}T^{\circ }}\) and \({P={\bar{P}}P^{\circ }}\), then \({{\bar{n}}=\varphi (T,P,{\bar{b}})}\), using gem or lma, and finally, evaluate the non-ideal thermodynamic model of each phase in the chemical system to compute \(\mu =\mu (T,P,{\bar{n}})\), and then its normalization \({\bar{\mu }}=\mu /RT\).

  2. 2.

    The sensitivity derivatives with and without normalization are related as follows:

    $$\begin{aligned} \frac{\partial n}{\partial T}\equiv \frac{b_{\Sigma }}{T^{\circ }}\frac{\partial{\bar{n}}}{\partial{\bar{T}}},\quad \frac{\partial n}{\partial P}\equiv \frac{b_{\Sigma }}{P^{\circ }}\frac{\partial{\bar{n}}}{\partial{\bar{P}}},\quad \frac{\partial n}{\partial b}\equiv \frac{\partial{\bar{n}}}{\partial{\bar{b}}}. \end{aligned}$$
    (74)

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Leal, A.M.M., Kyas, S., Kulik, D.A. et al. Accelerating Reactive Transport Modeling: On-Demand Machine Learning Algorithm for Chemical Equilibrium Calculations. Transp Porous Med 133, 161–204 (2020). https://doi.org/10.1007/s11242-020-01412-1

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11242-020-01412-1

Navigation