fluidreaction Fluid Reaction

Introduction

Fluid reactions represent chemical reactions that operate on scalar fields. The reactions are calculated on a voxel-by-voxel basis and can be a function of the local fluid properties, the local species concentration, local particle properties, as well as any global variables or parameters. When a thermal field is active, these reactions can also include the effects of heat of reaction (i.e., exothermic and endothermic reactions)

Download Sample File: Fluid Scalar Reaction

In the Fluid Scalar Reaction model above, we illustrate a system with fluid reactions involving the consumption of \(O_2\) and the production of \(CO_2\). These reactions mimic the respiration of biomass. This system also illustrates convective scalar coupling, in terms of the oxygen transfer to \(CO_2\) stripping from the aqueous phase. This ongoing competition between reaction kinetics, local gas/liquid transfer rates, and fluid mixing lead to spatial variations in local species concentration. For reference, the local pH is calculated from the local \(CO_2\) concentration using the Henderson–Hasselbalch equation and a custom fluid variable.

The reaction kinetics are solved in tandem with the advection-diffusion equation, particle advection, and the fluid transport algorithm. This coupling enables the code to directly predict the effects of changing species concentration on local rheology. Moreover, the code can also predict the behavior of competing processes, such as the competition between species addition, mixing, and reaction kinetics. This functionality is useful when studying systems where reactions are mixing-limited (e.g., systems with low Damköhler numbers).

Mathematically speaking, the fluid reactions are ordinary differential equations which describe how the local species concentration changes as a function of time. Reactions kinetics are written as species-specific rate equations. These rate questions are typically linked to a chemical equation using the law of mass action and an associated reaction rate. This point is discussed in the examples below.

Fluid reactions are typically solved explicitly using either a 1st order Euler or a 4th order Runge-Kutta solver. The solution step size in both approaches is set to the simulation time step. An implicit solver based on the Rosenbrock method is also available for systems with fast reaction kinetics (e.g., stiff equations).

Property Grid

General

Reaction UDF

base units /s | This UDF defines the species-specific rate equations. The number of output variables is equal to the number of scalar fields in the model. The name of each output variable is rate_{Scalar}, where {scalar} is the dynamic name of the scalar field. Each of these reaction rates is defined as a floating point variable. The rate questions are typically linked to a chemical equation using the law of mass action and an associated reaction rate. A reaction rate must be specified for each scalar field.

When a thermal field is active, these reactions can also include the effects of heat of reaction (i.e., exothermic and endothermic reactions). In this case, another output floating point variable named qDot is available for definition in the UDF. The units on this output are W/m 3. This is a local UDF, calculated on a voxel-by-voxel basis using the local fluid properties.

Download Sample File: Reaction

Integration

This setting defines which algorithm will be used to numerically integrate the reaction kinetics.

Euler (1st Order)

A first-order forward Euler method advances species concentration. For species \(A\) with concentration \([A]\), this becomes:

\[[A]_{t + \Delta t} = [A]_t + \frac{d[A]}{dt} \Delta t\]

Where \(\frac{d[A]}{dt}\) is the reaction rate defined in the Reaction UDF and \(\Delta t\) is the simulation time step.

Runge-Kutta (4th Order)

A fourth-order Runge-Kutta method advances species concentration. For species \(A\) with concentration \([A]\), this becomes:

\[[A]_{t + \Delta t} = [A]_t + \frac{\Delta t}{6} \left(k_1 + 2k_2 + 2k_3 + k_4\right)\]

where

\[ \begin{align}\begin{aligned}k_1 = f(t, [A]_t)\\k_2 = f \left( t + \frac{\Delta t}{2}, [A]_t + \frac{\Delta t}{2} \, k_1 \right)\\k_3 = f \left( t + \frac{\Delta t}{2}, [A]_t + \frac{\Delta t}{2} \, k_2 \right)\\k_4 = f \left( t + \Delta t, [A]_t + \Delta t \, k_3 \right)\end{aligned}\end{align} \]

with

\[f(t, [A]_t) = \frac{d[A]}{dt}\]
Rosenbrock (Implicit)

An implicit Rosenbrock method advances species concentrations. This approach is recommended for systems with fast reactions that introduce numerically stiff kinetics. Although more computationally expensive than explicit methods, Rosenbrock is preferred when explicit stability criteria require time steps smaller than those needed to resolve the flow’s behavior.

Rosenbrock methods are a subclass of linearly implicit Runge-Kutta schemes. They linearize the implicit system at each time step, requiring only the solution of linear systems rather than nonlinear ones. The solver evaluates stage derivatives using the Jacobian of the reaction source term without iterative solvers. This structure allows Rosenbrock methods to efficiently integrate stiff chemical kinetics while maintaining second- or higher-order accuracy.

The implementation follows the framework of Sandu et al.

Update Downsampling

The reaction system is updated every \(N\) time steps, where \(N\) is a user-defined downsampling interval. A value of 1 applies the reaction at every time step, while a value of 4 applies it once every four steps. Reaction rates are not interpolated across intermediate steps; instead, the rate is evaluated at the update time and scaled by the interval \(N\) to approximate the cumulative effect. No reaction terms are applied during the skipped steps, effectively treating the system as chemically inactive between updates.


Examples


Example 1: Single Step Reaction

Consider a reaction between reactants \(A\) and \(B\) to form a product \(C\),

\[aA + bB \xrightarrow{k} cC\]

where \(A\) and \(B\) are reactants, and \(C\) is a product. Within this representation, \(a\), \(b\), and \(c\) are the stoichiometric coefficients associated with each species. These stoichiometric coefficients must represent a species-balanced reaction.

Download Sample File: Simple Reaction

Per the principle of action, the corresponding rate equations are then defined as:

\[ \begin{align}\begin{aligned}\frac{d[A]}{dt} = -k[A]^m[B]^n\\\frac{d[B]}{dt} = -k[A]^m[B]^n\\\frac{d[C]}{dt} = k[A]^m[B]^n\end{aligned}\end{align} \]

where \([A]\), \([B]\), and \([C]\) represent the molar concentrations substances \(A\), \(B\) and \(C\). The exponents \(m\) and \(n\) are called the orders of reactions. For elementary reactions with a single step, the reaction orders will be equal to the stoichiometric coefficient for each reactant. For more complex reactions, the reaction orders must be determined experimentally. The reaction rate constant is proportionality constant which quantifies the rate (and direction) of a chemical reaction. Rate constants are determined experimentally or from first principles simulations.


Example 2: Equilibrium Reactions

Consider the bicarbonate buffer system:

\[\text{CO}_2 + \text{H}_2\text{O} \overset{k_{12}}{\underset{k_{21}}{\rightleftharpoons}} \text{H}_2\text{CO}_3 \overset{k_{23}}{\underset{k_{32}}{\rightleftharpoons}} \text{H}^+ + \text{HCO}_3^-\]

which represents the balance between carbon dioxide, carbonic acid, and bicarbonate within aqueous systems. For this equilibrium system, the \(k_{12}\) represents the rate constant for the reaction of \(CO_2\) with water to form carbonic acid \(H_2 CO_3\), and \(k_{21}\) represents the rate at which carbonic acid dissociates into \(CO_2\) and water. The \(k_{23}\) term represents the rate constant for the deprotonation of carbonic acid, and \(k_{32}\) represents the rate at which hydrogen ions and bicarbonate buffer \(HCO_3^-\) combined to form carbonic acid. (Oliviera et al)

Download Sample File: Equilibrium Reactions

Per the principle of mass action, the corresponding rate equations for each species are then defined as:

\[ \begin{align}\begin{aligned}\frac{d[\mathrm{CO_2}]}{dt} &= -k_{12}[\mathrm{CO_2}][\mathrm{H_2O}] + k_{21}[\mathrm{H_2CO_3}] (1)\\ \frac{d[\mathrm{H_2CO_3}]}{dt} &= k_{12}[\mathrm{CO_2}][\mathrm{H_2O}] - (k_{21} + k_{23})[\mathrm{H_2CO_3}] + k_{32}[\mathrm{H^+}][\mathrm{HCO_3^-}] (2)\\ \frac{d[\mathrm{HCO_3^-}]}{dt} &= k_{23}[\mathrm{H_2CO_3}] - k_{32}[\mathrm{H^+}][\mathrm{HCO_3^-}] (3)\\\frac{d[\mathrm{H^+}]}{dt} &= k_{23}[\mathrm{H_2CO_3}] - k_{32}[\mathrm{H^+}][\mathrm{HCO_3^-}] (4)\end{aligned}\end{align} \]

where \(CO_2\), \(H_2 CO_3\), \(HCO_3^-\), and \(H^+\) represent the molar concentrations of the reacting species.

In the example above, we model this equilibrium system with delayed \(CO_2\) gas sparging. During the first fractions of a second before sparing begins, the system equilibrates from the initial species concentrations to new equilibrium values. The timescale of this equilibration process is governed by the individual reaction rates. The final equilibrium values are defined by the ratios of the forward and backward reaction rate constants. The \(CO_2\) sparging begins after 1 second of simulated time. This sparging process transfers \(CO_2\) from the bubbles to the aqueous phase.

Per equation 2, this additional \(CO_2\) increases the production of carbonic acid. Then, via equation 4, this additional carbonic acid increases the production of hydrogen ions. The overall net-effect of the \(CO_2\) transfer is therefore a decrease in fluid pH as the system becomes increasingly acidic. In many systems, the rate at which \(CO_2\) is transferred from the bubbles to the aqueous phase is orders-of-magnitude slower than the rate at which \(CO_2\) is converted into hydrogen ions. As such, the change in pH is limited over time by the volumetric mass transfer coefficient of the bubbles.

Fluid Reaction Toolbar

Context-Specific Toolbar Forms

Description

help Help

The Help command launches the M-Star reference documentation in your web browser.

For a full description of each option, see Context-Specific Toolbar selections.

Additional Resources

For more on this subject, check out the following:

Webinars

Publications