Get 20M+ Full-Text Papers For Less Than $1.50/day. Start a 14-Day Trial for You or Your Team.

Learn More →

Fluctuating hydrodynamics of electrolytes at electroneutral scales

Fluctuating hydrodynamics of electrolytes at electroneutral scales At mesoscopic scales electrolyte solutions are modeled by the fluctuating generalized Poisson-Nernst- Planck (PNP) equations [J.-P. Péraud et al., Phys. Rev. F, 1(7):074103, 2016]. However, at length and time scales larger than the Debye scales, electrolytes are effectively electroneutral, and the charged-fluid PNP equations become too stiff to solve numerically. Here we formulate the isothermal incompressible equations of fluctuating hydrodynamics for reactive multispecies mixtures involving charged species in the electroneutral limit, and design a numerical algorithm to solve these equations. Our model does not assume a dilute electrolyte solution but rather treats all species on an equal footing, accounting for cross-diffusion and non-ideality using Maxwell-Stefan theory. By enforcing local electroneutrality as a constraint, we obtain an elliptic equation for the electric potential that replaces the Poisson equation in the fluctuating PNP equations. We develop a second-order midpoint predictor-corrector algorithm to solve either the charged- fluid or electroneutral equations with only a change of the elliptic solver. We use the electroneutral algorithm to study a gravitational fingering instability, triggered by thermal fluctuations, at an interface where an acid and base react to neutralize each other. Our results demonstrate that, because the four ions diffuse with very different coefficients, one must treat each ion as an individual species, and cannot treat the acid, base, and salt as neutral species. This emphasizes the differences between electrodiffusion and classical Fickian diffusion, even at electroneutral scales. Electronic address: donev@courant.nyu.edu arXiv:1809.08163v3 [physics.comp-ph] 16 Jan 2019 I. INTRODUCTION Better understanding of transport phenomena in electrolytes is important for studying both naturally occurring and man-made systems at small scales. Living cells rely strongly on membrane potentials and the electrodiffusion of ions. Batteries and fuel cells also rely on ionic transport. In both of these examples the length and time scales involved are intractable for molecular dynamics. A more efficient and tractable numerical approach for mesoscopic fluids is fluctuating hydrody- namics (FHD), which extends conventional hydrodynamics by including a random component to the dissipative fluxes in a manner consistent with irreversible thermodynamics and the fluctuation- dissipation theorem. Access to tools to model systems involving complex electrolyte mixtures with the inclusion of their inherent statistical fluctuations would not only increase our understanding of cellular mechanisms, but also provide a path towards better design tools for bio-engineering applications. In our prior work [1] we formulated a charged-fluid form of the equations of fluctuating hy- drodynamics and developed associated algorithms for electrolyte mixtures containing an arbitrary number of ionic or neutral species. Our formulation combined a generalized fluctuating Poisson- Nernst-Planck (PNP) equation based on the Maxwell-Stefan formulation of electrodiffusion with the fluctuating low Mach number Navier-Stokes (NS) equation for the fluid flow. In that formula- tion, the fluid is considered to be a mixture of incompressible but miscible components (species), each with its own density, and it is not necessary to distinguish a single species as a solvent . For very dilute electrolyte solutions, in the absence of fluctuations the deterministic formulation reverts to the classical PNP equations for the composition, coupled to an incompressible NS equa- tion for the fluid velocity. In recent work [2, 3] we have demonstrated that the addition of thermal fluctuations renormalizes the PNP equations to reproduce the Debye-Hückel-Onsager theory for dilute solutions. The charged-fluid formulation is designed for simulations where the spatial grid resolves the Debye length λ , which is typically on the order of a few to tens of nanometers. In particular, the time step size in the algorithm used in [1] was limited by τ = λ /D (see Eq. (86) in [1]), where D is a typical diffusion coefficient. In many practical applications one is interested in modeling bulk electrolytes at length scales much larger than the Debye length, over diffusive time scales much longer than τ . At such scales, the electrolyte is effectively electroneutral, and electrodiffusion is This formulation is also useful for modeling ionic liquids. 2 described by the electroneutral limit of the PNP equations [4, 5]. In this paper, we formulate the electroneutral limit of the generalized fluctuating PNP equations and develop a numerical method to solve these equations. In the electroneutral limit, the evolution is constrained to preserve charge neutrality by replacing the standard Poisson equation for the electric field with a variable coefficient elliptic equation. Thus, with only a change of an elliptic equation solver, our algorithm can switch from charged-fluid to electroneutral, allowing us to use the same code to study a broad range of length and time scales. Implicit in a coarse-grained description like FHD is the assumption that each cell (coarse-graining volume) contains sufficiently many ions to justify neglecting the discrete particle nature of molecules. While this assumption is problematic for charged-fluid FHD except for dilute solutions (for which the Debye length is large compared to the inter-ion spacing), in electroneutral FHD the cell dimensions are much larger than the Debye length and therefore typically contain a large number of ions even for dense solutions (for which the Debye length is comparable or smaller than the inter-ion spacing). Additionally, in this work we incorporate chemical reactions in the charged-fluid and electro- neutral formulations/algorithms following our prior work on non-ionic mixtures [6]. In the approach developed in [6], fluctuating chemistry is treated using a discrete Chemical Master Equation (CME) formulation, while hydrodynamic transport including mass and momentum diffusion is treated using a fluctuating hydrodynamics semi-continuum formulation. Our numerical algorithm is a modification of the algorithm developed in [6] to replace diffusion by electrodiffusion for both formulations. In [6], we modeled recent experiments [7] studying a gravity-driven instability of a front where an acid (HCl) and a base (NaOH) neutralize each other to form a salt (NaCl). In these prior simulations, we followed the literature [7–9] and modeled the acid, base, and salt as neutral species (HCl, NaOH, and NaCl); we will refer to this as the ambipolar approximation. In reality, however, + − + − these species are all strong electrolytes and disassociate into ions (H , OH , Na , and Cl ). It is well-known that electrodiffusion can be very different than ordinary diffusion because of the strong coupling of the motions of the ions via the electric fields they generate; for example, an ionic species can diffuse against its own concentration gradient [10]. In this work, we use the electroneutral formulation to model the fingering instability at an HCl/NaOH front but treating each ion as a separate charged species. This avoids uncontrolled approximations and allows us to assess the quantitative accuracy of the ambipolar approximation in a multispecies electrolyte. We begin by formulating the stochastic partial differential equations of fluctuating hydrody- namics for electrolytes in Section II. We first review the charged-fluid formulation in which the 3 Debye length is resolved in Section II A, and then formulate the electroneutral equations in Sec- tion II B. We also discuss the spectra of concentration fluctuations at thermodynamic equilibrium for both charged-fluid and electroneutral formulations in Section II C. We present a second-order predictor-corrector algorithm for both formulations in Section III. The methodology is applied to study a fingering instability at an acid-base front in Section IV. We conclude with some directions for future research in Section V. II. CHARGED-FLUID AND ELECTRONEUTRAL FLUCTUATING ELECTROHYDRO- DYNAMICS We consider an isothermal isobaric mixture of N species and use the following notation. Vectors (both in the geometrical and in the linear algebra sense), matrices (and tensors), and operators are denoted with bold letters. The mass density of species s is denoted with ρ and its number P P N N s s density with n , giving the total mass density ρ = ρ and total number density n = n . s s s s=1 s=1 The mass fractions are denoted with w, where w = ρ /ρ, while the number or mole fractions are s s denoted with x, where x = n /n; both the mass and number fractions sum to unity. One can s s transform between mass and number fractions by x = mw ¯ /m , where m is the molecular mass s s s s of species s and the mixture-averaged molecular mass is −1 ρ w m ¯ = = . n m s=1 A diagonal matrix whose diagonal is given by a vector is denoted by the corresponding capital letter; for example, W is a diagonal matrix with entries w and M is a diagonal matrix of the molecular masses m. The charges per unit mass are denoted by z with z = V e/m , where e is the elementary charge s s s and V is the valence of species s. The total density of free charges is thus Z = ρ z = ρz w. s s s=1 For an ideal solution the Debye length is given by 1/2 1/2 k T k T B B λ = = , (1) T N ρz WMz ρw m z s s s=1 where  is the dielectric permittivity of the mixture, k is Boltzmann’s constant, and T is the temperature. 4 A. Charged-fluid Formulation In this section we review the fluctuating hydrodynamics equations for an electrolyte mixture, following the notation in [1]. Unlike this prior work, and following [6], here we make a Boussinesq approximation and assume that the density of the mixture changes only weakly with composition, ρ ≈ ρ . This allows us to use an incompressible approximation of the momentum equation, which greatly simplifies the construction of a numerical algorithm [6]. The dependence of the density on composition is only taken into account in the gravity forcing term. This Boussinesq approximation is certainly valid for moderately dilute electrolyte solutions. We neglect the effects of thermodiffusion and barodiffusion on mass transport and assume constant temperature T and thermodynamic pressure P . The incompressible equations of fluctuating hydrodynamics for an isothermal reactive electrolyte mixture can be obtained by combining terms given in [1] with those given in [6]. Here we summarize the resulting equations. 1. Quasi-electrostatic Poisson Equation In the electroquasistatic approximation (magnetic effects are neglected), the electric potential Φ(r, t) satisfies the Poisson equation ∇· (E) = −∇· (∇Φ) = Z, (2) where the electric field is E = −∇Φ, and the dielectric permittivity  (w) can, in principle, depend on composition. The boundary conditions for Φ are standard Neumann conditions for dielectric boundaries or Dirichlet conditions for metallic boundaries. The presence of charges and electric fields leads to a nonzero Lorentz force in the momentum T T equation given by the divergence of the Maxwell stress tensor σ =  EE − E EI/2 , f = ∇· σ = ZE − ∇. E M In this work we assume that the permittivity is constant, which reduces the Lorentz force to f = ZE. Using the Poisson equation (2), we can rewrite this in the equivalent form f = ∇· (E)E = [∇· (∇Φ)]∇Φ, which is suitable for both the charged-fluid and the electroneutral formulations [5]. By contrast, as we explain later, the traditional form f = ZE cannot be used in the electroneutral limit since formally Z → 0 but the Lorentz force does not go to zero in this limit [5]. 5 2. Momentum Equation In the Boussinesq approximation, ρ = ρ and conservation of momentum gives the fluctuating incompressible Navier-Stokes equations ∂ (ρv) + ∇π = −∇·(ρvv ) + ∇·(η∇v + Σ) + ∇· (∇Φ) ∇Φ + f, (3) ∂t ∇·v = 0. (4) Here, v(r, t) is the fluid velocity, π(r, t) is the mechanical pressure (a Lagrange multiplier that ensures the velocity remains divergence free), η(w) is the viscosity, ∇ = ∇ + ∇ is a symmetric gradient, and Σ is the stochastic momentum flux. The buoyancy force f (w, t) is a problem-specific function of w(r, t) and can also be an explicit function of time. Based on the fluctuation-dissipation relation, the stochastic momentum flux Σ is modeled as h i mom mom Σ = ηk T Z + (Z ) , (5) mom where Z (r, t) is a standard Gaussian white noise tensor field with uncorrelated components having δ-function correlations in space and time. The two physical boundary conditions for the charged-fluid equations that we consider here are the no-slip condition v = 0 on the boundary, and the free-slip boundary condition, ∂v ∂v n τ v = v · n = 0 and + = 0, (6) ∂τ ∂n where n is the unit vector normal to the boundary, τ is a unit vector tangential to the boundary, τ · n = 0, and v is the tangential component of the velocity. 3. Species Equations Conservation of mass for each species gives the dynamics of the composition of the mixture, ∂ (ρw ) = −∇·(ρw v)− ∇·F + m Ω , (7) s s s s ∂t where we remind the reader that in the Boussinesq approximation density is constant, i.e., ρ = ρ . The total diffusive mass flux F of species s is composed of a dissipative flux F and fluctuating s s flux F , F = F + F , (8) s s s 6 and Ω is a source term representing stochastic chemistry. Note that by summing up (7) over P P all species we recover (4) since F = 0 and m Ω = 0. The formulation of the chemical s s s s s production rates Ω is taken from [6] and summarized in Appendix A. Diffusion is driven by the gradients of the electrochemical potentials k T μ (x, T, P ) = μ (T, P ) + log(x γ ) + z Φ, (9) s s s s where μ (T, P ) is a reference chemical potential and γ (x, T, P ) is the activity coefficient (for an ideal mixture, γ = 1). This gives the dissipative diffusive mass fluxes [1] m ¯Wz F = −ρWχ Γ∇x + ∇Φ , (10) k T where χ is a symmetric positive semi-definite diffusion matrix that can be computed from the Maxwell-Stefan diffusion coefficients [6, 11]. Here Γ is the matrix of thermodynamic factors, Γ = I + X − xx H, (11) where the symmetric matrix H is the Hessian of the excess free energy per particle; for an ideal mixture H = 0 and Γ is the identity matrix [11]. The stochastic mass fluxes F are given by the fluctuation-dissipation relation, mass F = 2mρ ¯ Wχ Z , (12) 1 1 1 T mass 2 2 2 where χ is a “square root” of χ satisfying χ (χ ) = χ, and Z (r, t) is a standard Gaussian random vector field with uncorrelated components. In summary, the composition follows the equation (7), with electrodiffusive fluxes given by the sum of (10) and (12); the chemical production rates are discussed in Appendix A and given by (A5). For dilute species, the expression for the electrodiffusive dissipative fluxes reduces to that in the familiar PNP equations. Specifically, for a species s that is dilute, x  1, we get the familiar Nernst-Planck-Fick law (see Appendix A in [6]) m D m ¯ w z m w z s s solv s s s s s F ≈ −ρ ∇x + ∇Φ = −ρD ∇w + ∇Φ , (13) s s s s m ¯ k T k T solv B B −1 0 0 where x ≈ m ¯ w /m , and m ¯ = ( 0 w /m ) is the mixture-averaged molecular s s s solv solv s s solvent s mass of the solvent, which could itself be a mixture of liquids. Here D is the trace diffusion coefficient of the dilute species in the solvent, which can be related to the Maxwell-Stefan coefficients 7 involving species s (see (40) in [6]). The stochastic flux also simplifies in the fluctuating PNP equations for dilute species, mass F ≈ 2ρm w D Z . s s s s The boundary conditions for (7) depend on the nature of the physical boundary. We consider non-reactive impermeable walls and reservoirs; reactive boundaries can be accounted for [12] but we do not consider them here. For both kinds of boundaries the normal component of the velocity is zero in the Boussinesq approximation (see Eq. (15) in [13] for a generalization to low Mach number variable-density models). This implies that the normal mass fluxes of all species at walls must be (n) zero, F = F · n = 0. Reservoir boundaries are intended to model a permeable membrane that connects the system to a large reservoir held at a specified concentration w , and correspond to resvr a Dirichlet condition on w. B. Electroneutral Formulation The charged-fluid equations (2,3,4,7) suffer from a well-known stiffness: The characteristic Debye length scale λ is typically much smaller than the macroscopic/device scales of interest. Thin Debye boundary layers develop near physical boundaries, with thickness proportional to λ . Outside of these layers, the fields vary much more smoothly on scales much larger than the Debye length. On such scales, the electrolyte is effectively electroneutral, and electrodiffusion is described the electroneutral limit of the PNP equations [4, 5]. The electroneutral bulk equations can be justified by formal asymptotic analysis [4, 5]. This analysis leads to an elliptic equation for the potential Φ that forces the evolution to preserve charge neutrality. Here we derive this equation by simply invoking charge neutrality as a local linear constraint, Z = ρz w = ρ z w = 0, (14) s s s=1 everywhere in the bulk. By differentiating the constraint Z (r, t) = 0 we get ∂Z ∂ = z (ρw) = z (−∇·(ρw v)− ∇·F + m Ω ) = 0. (15) s s s s s ∂t ∂t s=1 Because advection preserves Z = 0, ! ! N N s s X X z ∇·(ρw v) = ∇· ρ z w v = ∇· (Zv) = 0, (16) s s s s s=1 s=1 8 P and reactions conserve charge, z m Ω = 0, Eq. (15) simplifies to s s s s=1 N N s s X X z ∇·F = ∇· z F = ∇· z F = 0. (17) s s s s s=1 s=1 1. Electroneutral Elliptic Equation Using the expressions (10) and (12) for the diffusive mass fluxes, we can rewrite the condition ∇· z F = 0 as an elliptic PDE for the electric potential, mρ ¯ T T ∇· z WχWz ∇Φ = ∇· z F , (18) k T where F denotes the diffusive fluxes without the electrodiffusion, mass F = −ρWχΓ∇x + 2mρ ¯ Wχ Z . We see that in the electroneutral limit, the electric potential becomes a Lagrange multiplier that enforces the electroneutrality condition. It is given by the solution of the modified elliptic equa- tion (18), and not by the quasielectrostatic Poisson equation (2). In summary, the fluctuating electroneutral equations we consider in this work are given by (3,4,7,18). It is worth pointing out that the validity of the electroneutral limit requires that λ be small −1/2 everywhere in the bulk, where we recall that for an ideal solution λ ∼ z WMz . This requires the presence of some charges everywhere in the domain, that is, one cannot use (18) when parts of the domain are ion-free since in those parts of the domain λ would diverge; an example of a situation not covered by the electroneutral limit would be the diffusive mixing of pure and salty water. In particular, (18) is not uniformly elliptic if in some part of the domain z WχWz → 0, i.e., if z w → 0 for all species s. In practice, for water solutions, it is energetically s s very unfavorable to remove all ions and purify water to the point where the Debye length would approach macroscopic/device scales . We will therefore assume here that there are sufficiently many ions everywhere in the domain to justify the electroneutral limit (3,4,7,18). 2. Boundary Conditions Obtaining proper boundary conditions for the electroneutral equations (3,4,7,18) requires a nontrivial asymptotic analysis matching the electroneutral bulk “outer solution” on the outside of −10 For ultra-pure water the ion mass fractions are ≈ 10 and the Debye length is a few microns. 9 the Debye layer to the boundary layer “inner solution” inside the Debye layer [5, 14, 15]. Since we are interested here in the electroneutral bulk, what we mean by boundary conditions are the conditions not on the physical boundary itself but rather on the outer boundary of the Debye layer. In the electroneutral limit λ /l → 0, where l is the smallest length scale of interest, D min min the thickness of the boundary layer is formally zero and the outer conditions become effective boundary conditions for the electroneutral bulk equations. Though surface reactions can affect the charge density bound to dielectric boundaries (e.g., electron exchange), in this paper we do not consider surface chemistry. Here we will assume that there is no surface conduction in the Debye layer, i.e., we only need to consider normal mass fluxes (the curved surface analysis in [5] shows that curvature does not enter in the leading-order asymptotics) at the outer edge of the double layer. For dielectric boundaries, a careful analysis of the validity of the assumption of no surface currents is carried out in [14], and it is concluded that it is valid only for weakly to moderately charged surfaces. For highly charged dielectric boundaries, surface conduction enters even in the leading-order asymptotic matching. For metals, a careful asymptotic analysis is carried out in [15] and shows that, in regions where the potential jump across the layer is exponentially large (measured with respect to the thermal voltage k T/e), surface conduction also enters. Under the assumption of no surface conduction, we first consider the boundary conditions for the electrodiffusion equations (7,18), and then turn our attention to the velocity equations (3,4). We recall that the electrodiffusive mass flux is mρ ¯ F = F − WχWz ∇Φ. k T T (n) Since the flux must locally preserve the charge neutrality, z F = 0 on the boundary, where we (n) recall that F = n · F denotes the fluxes normal to the boundary. This immediately gives the effective Neumann boundary condition for the potential, −1 ∂Φ mρ ¯ (n) T T = z WχWz z F , (19) ∂n k T (n) where F = n· F . (n) For dilute solutions and impermeable walls, in the deterministic case, one can show that F = 0 which means that (19) becomes a homogeneous Neumann condition for the potential, ∂Φ/∂n = 0, which is the boundary condition for a dielectric boundary with no bound surface charge in the charged-fluid formulation. The derivation is well-known for binary dilute electrolytes [5], and it is straightforward to generalize it to dilute multi-ion solutions as follows. From the electroneutrality 10 T T condition z w = 0 we get z (∂w/∂n) = 0. Focusing on the dilute ions only, we have from (13) that the vanishing of the electrodiffusive flux is equivalent to ∂w (∂Φ/∂n) + MWz = 0. ∂n k T Taking the dot product with z of both sides of this equation, we obtain ∂Φ/∂n = 0 because (n) −2 z MWz ∼ λ > 0. This implies ∂w/∂n = 0 and therefore F = 0. We will assume that D d ∂Φ/∂n = 0 also holds on impermeable walls for general mixtures and even in the presence of fluctuations, even though we have not been able to rigorously justify this. It is worthwhile to note that any choice of Neumann boundary condition on the potential gives identical total electrodiffu- (n) (n) sive flux F ; the only physically-relevant boundary condition is that F vanish at impermeable walls. Only the Lorentz force in (3), which depends on Φ, is affected by the choice of Neumann boundary condition. While the Lorentz force is essential for modeling electrokinetic flows, it plays a minimal role in the problems we study here, so our choice to enforce a homogeneous condition ∂Φ/∂n = 0 for impermeable walls is inconsequential. (n) For reservoir boundaries, F is known at the boundary from the Dirichlet conditions on w, and (19) becomes an inhomogeneous Neumann condition for the potential. In summary, at a physical boundary, we impose the following boundary conditions for (7,18): (n) • F = n· F = 0 and ∂Φ/∂n = 0 for impermeable walls. • w = w with z w = 0 and (19) for reservoirs. resvr resvr Note that the condition (19) applies irrespective of whether the boundary (wall or membrane) is dielectric (polarizable) or metal (conducting); the effective condition for the potential is always Neumann, even if in the charged-fluid formulation there is a Dirichlet condition on the potential. The electroneutral boundary conditions for the velocity equation (3,4) are even harder to derive. In general, the fluid velocity on the outer boundary of the Debye layer is not zero, even for a no- slip boundary. This means that the appropriate velocity boundary condition for the electroneutral equations is a specified-slip condition, v = 0 and v nonzero. However, to our knowledge, the n τ velocity slip has only been computed using asymptotic analysis for binary electrolytes, and this analysis has not, to our knowledge, been generalized to multi-ion mixtures. For dilute electrolytes, slip expressions have been proposed without a careful asymptotic analysis, see for example (4) in [16]. Because an asymptotic analysis for multispecies electrolytes is not available, and because in the example we consider here there are no applied electric fields or highly-charged surfaces (either of which could make the apparent slip velocity large enough to play some role), in this work we 11 will simply use the same boundary condition (no-slip or free-slip) for the electroneutral and the charged-fluid formulations. For no-slip boundaries this means v = 0, which is expected to be a good approximation for dielectric boundaries if the surface charge density is sufficiently small. We emphasize, however, that an effective no-slip boundary condition is not appropriate in general (e.g., slip is important for ionic diffusiophoresis), and each specific application requires a careful consideration of the boundary condition. 3. Effective Salt Diffusion Let us define the vector field −1 mρ ¯ (Φ) T T g = z WχWz z F , (20) amb k T which simplifies for deterministic models of dilute electrolytes to z D ∇w (Φ) s s s g = − (k T ) P . (21) amb m z D w s s s s s For some specific special cases, the solution of the effective Poisson equation (18) is given by (Φ) ∇Φ = g . This is sometimes stated as a fact, see for example Eq. (3) in [16]. However, except amb (Φ) for dilute binary electrolytes and for problems in one dimension, g is, in general, not a gradient, amb unless w (and thus the denominator in (21)) can be approximated to be constant over the domain. For dilute binary electroneutral electrolytes w = −z w /z , which in the absence of fluctuations 2 1 1 2 gives (D − D ) ∇w (D − D ) (Φ) 1 2 1 1 2 −1 (k T ) g = − = − ∇ (ln w ) , (22) B 1 amb (m z D − m z D ) w (m z D − m z D ) 1 1 1 2 2 2 1 1 1 1 2 2 2 (Φ) which is indeed a gradient of a function and therefore ∇Φ = g . Substituting (22) into Fick’s amb law (13) we obtain (m z − m z ) D D 1 1 2 2 1 2 F = −ρ ∇w . (23) 1 1 (m z D − m z D ) 1 1 1 2 2 2 The effective diffusion coefficient of the salt is therefore the weighted harmonic mean (m z − m z ) D D 1 1 2 2 1 2 amb D = , (24) (m z D − m z D ) 1 1 1 2 2 2 which we will refer to as the ambipolar binary diffusion coefficient. (Φ) Note that the boundary condition (19) is consistent with ∇Φ = g on the boundary (cf. (20)). amb 12 This shows that for a dilute binary electrolyte without fluctuations the electroneutral model is equivalent to modeling a binary salt as an uncharged substance with an effective ambipolar diffusion coefficient, i.e., the two ions tend to diffuse together. However, this correspondence is not true in more general cases. Specifically, it is not valid when fluctuations are included, when the system is not dilute, or when there are more than two ions. Although the equivalence is lost, a number of prior studies [6, 7, 9] have used (24) to define effective diffusion coefficients of salts in more general situations. We will refer to this type of approach as the ambipolar approximation and investigate it in detail in Section IV B. C. Thermal Fluctuations Important quantities that can be derived from the fluctuating hydrodynamics equations are the spectra of the fluctuations at thermodynamic equilibrium, referred to as the static structure factors. These structure factors can be obtained from either the more general results derived in [1] for the charged-fluid equations, or, from equilibrium statistical mechanics. It is important to confirm that our electroneutral FHD equations give the correct spectrum of fluctuations in order to justify our formulation of the stochastic fluxes. The matrix of equilibrium structure factors can be expressed either in terms of mass or mole fractions. Here we define the matrix of static structure factors in terms of the fluctuations in the mass fractions δw around the equilibrium concentrations, which for notational brevity we denote in this section with w without any decoration, D   E c c 0 0 S (k) = δw (k) δw (k) . (25) s,s s 0 0 where s and s are two species (including s = s ), k is the wavevector, hat denotes a Fourier transform, and star denotes a complex conjugate. The static factors for an electrolyte mixture with an arbitrary number of species at thermody- namic equilibrium are [1, 11] 1 S zz S 0 0 S = S −  , (26) 2 T k λ + 1 z S z where the structure factor for a mixture of uncharged species (i.e., for z = 0) is [11] h   i −1 m ¯ T T T T S = W − ww Γ X − xx + 11 W − ww , (27) and 1 is the vector of 1’s. The Debye length can be generalized to non-ideal mixtures as 2 h   i −1 ρ mρ ¯ −2 T T T T λ = z S z = z W Γ X − xx + 11 Wz. (28) k T k T B B 13 See Eqs. (41) and (42) in [11] for a simplification for ideal mixtures, including dilute solutions. The structure factor S (k) of the total free charge density Z = ρz w is D   E 2 T T 2 T d d S = ρ z δw z δw = ρ z Sz. (29) Using the generalized definition of the Debye length (28) allows to conveniently express it as 2 2 k λ 2 T 2 T D S = ρ z Sz = ρ z S z . (30) Z 0 2 2 1 + k λ The fact that S (k) tends to zero for small wavenumbers (kλ → 0) is a manifestation of the Z D transition to the electroneutral regime at large length scales. It is important to point out that at scales much larger than the Debye length the fluctuations δw are electroneutral in addition to the electroneutral mean composition w. This means that the composition w + δw strictly remains on the electroneutral constraint at all times, consistent with our electroneutral formulation. At thermodynamic equilibrium, for length scales much larger than the Debye length, the struc- ture factor (26) simplifies to S zz S 0 0 (eln) S = lim S = S − , (31) kλ →0 z S z and this is the spectrum of fluctuations in composition in the electroneutral limit. Note that (eln) S z = 0, as expected from the electroneutrality. For dilute electrolyte solutions, which are necessarily ideal, if we consider two ions of species s and s , we have the explicit formula   −1 (eln) −1 2   S = ρ w m δ 0 − m z w (w m z ) (w 0m 0z 0 ) . (32) s s s,s k k s s s s s s s,s In Appendix B we derive the same result for a dilute binary electrolyte using equilibrium statistical mechanics, without referring to the generalized PNP equations. It can be confirmed that the electroneutral equations (3,4,7,18) are consistent with (31), which demonstrates that nothing special needs to be done in the electroneutral limit to handle the fluctu- ating diffusive fluxes except to include them in the right-hand side of the modified Poisson equation (18). III. NUMERICAL ALGORITHM In this section we describe our charged-fluid and electroneutral numerical algorithms, both of which are second-order accurate in space and time deterministically, and second-order weakly accurate for the linearized fluctuating hydrodynamics equations. The algorithms are closely based 14 on the algorithm developed for isothermal constant-density reactive multispecies mixtures of non- ionic species in our prior work [6]. The handling of the charged species and in particular the quasielectrostatic Poisson equation is described already in detail in our prior work [1]. Here we only briefly sketch the algorithmic details and focus on the key differences with our prior work. We note that special care is taken to ensure that the only difference between the charged-fluid and electroneutral algorithms is that a different elliptic equation is solved to compute the electric potential Φ. We therefore present both cases together and note any differences explicitly where necessary. A. Spatial Discretization Our spatial discretization of reaction-advection-diffusion is identical to the one used in our previous work [6], which is itself a slight modification of the methods described in [1, 11, 17], improved to accurately handle very small numbers of molecules. The spatial discretization is based on a structured-grid finite-volume approach with cell-averaged densities, electric potential, and pressure, and face-averaged (staggered) velocities. We use standard second-order stencils for the gradient, divergence, and spatial averaging in order to satisfy discrete fluctuation-dissipation balance (DFDB) [18]. The discretization of the momentum equation (3,4), including no-slip or free-slip boundary conditions, is the same as our previous works [1, 6, 11, 17], with the important caveat that the Lorentz force is evaluated as ∇· (∇Φ) ∇Φ so that the same implementation works for either the charged-fluid or the electroneutral formulations. Standard centered second-order stencils are used to discretize ∇· (∇Φ) ∇Φ on the faces of the grid. The discretization of the electrodiffusion equations (7,18) is closely based on that developed in [1, 6]. Our implementation independently tracks the densities of all species ρ but ensures the overall mass conservation in the Boussinesq limit, ρ = ρ , in each grid cell to within (Stokes) s 0 s=1 solver tolerance. For each species, we construct the mass fluxes on faces of the grid and employ the standard conservative divergence in order to guarantee conservation of mass for each species. Diffusive fluxes, including the dissipative and stochastic fluxes, are computed as described in [6]. Chemical reaction terms are local and are computed independently in each cell as in [6]. The elliptic equations (2) and (18) are discretized using a standard centered second-order stencil, and the resulting linear system is solved using a geometric multigrid algorithm [1]. For the elec- troneutral elliptic equation (18), W and Wχ are already computed on each grid face to calculate 15 T diffusive mass fluxes (see [6] for details), and therefore the non-constant coefficient ∼ z WχWz can be directly computed on each grid face. Boundary conditions for the electroneutral electrodiffusion equations (7,18) are implemented as (n) follows. For impermeable walls, the condition F = n · F = 0 is trivially implemented in our finite-volume scheme by zeroing the total mass flux (including the stochastic fluxes) on the bound- ary. The modified elliptic equation (18) is then solved with the homogeneous Neumann condition ∂Φ/∂n = 0. For reservoirs, the Dirichlet condition w = w is implemented by computing ∇x resvr at the boundary using one-sided differences and the specified values on the boundary; this then gives the dissipative portion of the diffusive mass flux F = −ρWχΓ∇x. The generation of the stochastic component of the diffusive mass flux F at the boundary is described in prior work [19]. Once F = F +F is computed on the boundary, (18) is solved with an inhomogeneous Neumann d d condition computed using (19). Advective mass fluxes ρ v are computed on each face f of the grid by first computing face- centered densities ρ = ρw = ρ w . Our implementation supports two ways to compute face- f f 0 f centered densities ρ . Centered advection uses two-point averaging of densities to faces, and is non- dissipative and thus preserves DFDB [18]. However, in order to prevent nonphysical oscillations in mass densities in high Péclet number flows with sharp gradients, we also use the Bell-Dawson- Shubin (BDS) second-order Godunov advection scheme [20]; more details about how the BDS scheme is used in our numerical implementations can be found in [17]. We note that BDS advection adds artificial dissipation and does not obey a fluctuation-dissipation principle, but is necessary for simulations where centered advection would fail due to insufficient spatial resolution. An additional complication that arises in the electroneutral limit is ensuring that advection preserves electroneutrality, i.e., ensuring that the spatial discretization maintains the continuum identity (16). Since the advection velocity used in our discretization is discretely divergence free, advection automatically maintains linear constraints on the cell-centered densities if the face den- sities ρ satisfy the linear constraint for each face f. For centered advection this is automatic because the face densities are computed by linear interpolation. For BDS advection, however, the face-centered densities are computed using a complicated space-time extrapolation that involves nonlinear “limiters,” and are not guaranteed to satisfy the same linear constraints as the cell- centered densities. It is therefore necessary to project the densities back onto all linear constraints. One such constraint is the mass conservation ρ = ρ and the other is the electroneutrality s 0 z ρ = 0. Assume we are given a composition w = ρ /ρ on face f, which does not necessar- s s f f 0 T T ily satisfy the two constraints 1 w = 1 and z w = 0. The projection onto both constraints can be 16 accomplished with the following sequence of updates: z w w ← w − z, f f z z w ← . 1 w 2 T The first update is a standard L projection onto the plane z w = 0, and the second is a simple rescaling that preserves 1 w = 1. This choice of projections is not unique and does not affect the second-order accuracy for smooth problems. B. Temporal Discretization Our second-order temporal integrator is taken from our prior work [6] and is summarized in Section III C. Unlike the trapezoidal predictor-corrector used in [1], here we use the midpoint predictor-corrector method described in [6] to accommodate our treatment of chemical reactions, and to dramatically improve the robustness for large Schmidt number [6]. Furthermore, the Boussi- nesq approximation allows us to simplify the algorithm compared to the low Mach version pre- sented in [1]. Note that relative to the algorithm in [6] we need to precompute some terms related to charged species; however, the overall update strategy remains the same. In particular, in the absence of charged species our algorithm is equivalent to that presented in [6]. Our algorithm introduces an important correction term in the right-hand side (r.h.s.) in the modified elliptic equation (18) in the corrector step. Namely, numerical tests revealed that errors due to finite tolerances in the iterative elliptic solver lead to a slow drift away from electroneutrality over many time steps. This drift can be prevented by modifying the elliptic equation as follows. Consider an Euler update of the form w (t + Δt)− w (t) mρ ¯ = −∇· F − WχWz ∇Φ . Δt k T Requiring electroneutrality at the end of the step, z w (t + Δt) = 0, without assuming electroneu- trality at the beginning of the step, we obtain the corrected elliptic equation at time t, mρ ¯ z w T T ∇· z WχWz ∇Φ = ∇· z F − . (33) k T Δt In our numerical algorithm, we only employ this correction to the elliptic equation in the corrector step. We have found this to be sufficient and to lead to a stable algorithm that maintains the charge neutrality to a relative error below solver tolerances . In practice, we find that the numerical errors We have found that in some cases (e.g., equal diffusion coefficients for all species) the r.h.s. of (33) is analytically 17 introduced by the iterative geometric multigrid elliptic solvers create localized charges but not a global charge; therefore the spatial average of the r.h.s. of (33) is zero within roundoff tolerance. Nevertheless, in order to ensure that the elliptic equation (33) is solvable, in our implementation we subtract from the r.h.s. it’s spatial average. By adding charges to the 3-species mixture test described in Section III.C.1 of [11], we have verified (not shown) that our algorithm/code reproduces the correct spectrum of electroneutral equilibrium fluctuations (31), for both ideal and non-ideal mixtures, for either periodic, reservoir, or impermeable boundaries. This validates our formulation and implementation of the stochas- tic mass flux (including boundary conditions). We have also verified (not shown) second-order deterministic accuracy for the acid-base fingering example by initializing the simulations from a smoothly perturbed sine-wave interface. C. Summary of Algorithm th n+1 We now summarize the n time step that computes state at time t = (n + 1) Δt from the state at time t = nΔt. Superscripts denote the time point at which certain quantities are 1 1 n+ /2,∗ n+ /2,∗ evaluated, for example, f = f w , (n + 1/2) Δt denotes the buoyancy force esti- mom mass mated at the midpoint. We denote with (W ) and W (for the predictor stage) and (1) mass W (for the corrector stage) collections of i.i.d. (independent and identically distributed) (2) standard normal random variables generated on control volume faces independently at each time mom T mom mom step, and W ≡ W + W . We denote collections of independent Poisson random variables generated at cell centers independently at each time step with P (predictor stage) and (1) P (corrector stage), and denote [•] ≡ max(•, 0). The notation for computing the divergence of (2) the advective fluxes using the BDS scheme is defined and explained in Section III.B.1 in [17]. We remind the reader that ρ = ρ is a constant in the Boussinesq approximation, maintained by our code to roundoff tolerance. th The n predictor-corrector update consists of the following steps: 1. Calculate predictor diffusive fluxes (deterministic and stochastic), n n 2mρ ¯ 1 n n mass F = (−ρWχΓ∇x) + Wχ W . (34) d (1) ΔV Δt/2 (nearly) zero so that numerically it is dominated by numerical noise. This make the elliptic solver do unnecessary work if we use a standard relative error tolerance based on the magnitude of the r.h.s. Instead, we use a tolerance −12 −9 δ∇· |z| F based on the absolute values of the charges per mass, where δ ∼ 10 − 10 is a relative tolerance for the iterative solver. 18 n 2. Solve the predictor elliptic equation for Φ , n n n ∇· ( ∇Φ ) = −Z if charged-fluid, otherwise (35) h  i  mρ ¯ T n T n ∇· z WχWz ∇Φ = ∇· z F . k T n n 3. Calculate predictor electrodiffusive fluxes F and chemical production rates R , mρ ¯ n n n F =F − WχWz ∇Φ , (36) k T X X n α α R = Δν P ((a ) ΔV Δt/2) . (37) s sr (1) r ΔV Δt/2 r α=± n+1,∗ n+ /2,∗ n+1,∗ 4. Solve the predictor Stokes system for v and π : ∇·v = 0 and n+1,∗ n (ρv) − (ρv) 1 n+ /2,∗ T n n n n+1,∗ n + ∇π = ∇· ρvv + ∇· η ∇v + η ∇v + f Δt 2   η k T mom n   + ∇· W + (∇·(∇Φ)) ∇Φ . ΔV Δt 5. Calculate predictor mass densities,  n n+1,∗  n v +v ρ if centered Δt Δt s 1 2 n+ /2,∗ n n n ρ = ρ + [−∇·F + m R ]− ∇· (38) s s s s n n+1,∗ 2 2 v +v Δt n n BDS ρ , ,∇·F , . s s 2 2 6. Calculate corrector diffusive fluxes,   n n mass mass 1 W + W n+ /2,∗ 1 2mρ ¯ 1 1 (1) (2) n+ /2,∗ n+ /2,∗   F = (−ρWχΓ∇x) + Wχ . ΔV Δt/2 (39) n+ /2,∗ 7. Solve the corrector elliptic equation for Φ , 1 1 1  n+ /2,∗ n+ /2,∗ n+ /2,∗ ∇·  ∇Φ = −Z if charged-fluid, otherwise n+ /2,∗ 1 n+ /2,∗ 1 mρ ¯  T n+ /2,∗ T −1 T n+ /2,∗ ∇· z WχWz ∇Φ = ∇· z F − Δt z w . k T (40) 1 1 n+ /2,∗ n+ /2,∗ 8. Calculate corrector diffusive fluxes F and chemical production rates R , n+ /2,∗ mρ ¯ 1 n+ /2,∗ 1 n+ /2,∗ n+ /2,∗ F =F − WχWz ∇Φ , (41) k T " # X X 1 1 1 1 n+ /2,∗ n α α n+ /2,∗ α n R = R + Δν P 2(a ) − (a ) ΔV Δt/2 . (42) s s sr (2) r r 2 ΔV Δt/2 r α=± 19 9. Update the mass densities, 1 n n+1,∗ n+ /2,∗ v +v h i ρ if centered 1 1 2 n+1 n n+ /2,∗ n+ /2,∗ ρ = ρ +Δt −∇·F + m R −Δt∇· s s s s n n+1,∗ 1  n+ /2,∗ n v +v BDS ρ , ,∇·F , Δt . (43) n+1 n+ /2 n+1 10. Solve the corrector Stokes systems for v and π : ∇·v = 0 and n+1 n n n+1,∗ (ρv) − (ρv) 1 1 n+ /2 T T n n n+1 n+1 ¯ ¯ + ∇π = − ∇· ρvv + ρvv + ∇· η ∇v + η ∇v Δt 2 2    s s n n+1 1 η k T η k T mom 1 B B n+ /2,∗    + ∇· + W + f 2 ΔV Δt ΔV Δt n+ /2,∗ + (∇·(∇Φ)) ∇Φ . IV. NUMERICAL STUDY OF ACID-BASE NEUTRALIZATION In our previous work [6] we studied the development of asymmetric fingering patterns arising from a gravitational instability in the presence of a neutralization reaction. In particular, we performed the first three-dimensional simulations of a double-diffusive instability occurring during the mixing of dilute aqueous solutions of HCl and NaOH in a vertical Hele-Shaw cell, as studied experimentally in [7]. In this prior study, as in all other theoretical and computational studies of this kind of instability [7, 9], we treated HCl, NaOH, and NaCl as uncharged species in the spirit of the ambipolar approximation described in Section II B 3. The acid-base neutralization reaction was written as HCl + NaOH → NaCl + H O. (44) In reality, however, the acid, the base, and the salt are all strong electrolytes and essentially + − + − completely disassociate into Na , Cl , H , and OH ions, and the neutralization reaction is simply the (essentially irreversible) formation of water, + − H + OH → H O, + − with Na and Cl being spectator ions. An important feature of this system is that the trace diffusion coefficients of the four ions are very different; specifically, using cgs units (cm /s) the −5 −5 −5 literature values are D + = 1.33 · 10 , D − = 2.03 · 10 , D + = 9.35 · 10 , and D − = Na Cl H OH −5 5.33· 10 . Although the ambipolar approximation is only strictly valid for dilute binary systems, we define effective diffusion coefficients for the neutral species by harmonic averages of the anion 20 −5 −5 and cation diffusion coefficients following (23) to obtain: D = 3.34· 10 , D = 2.13· 10 , HCl NaOH −5 and D = 1.61· 10 . NaCl Simulating this instability using the charged-fluid formulation would be infeasible because the length scales of interest are on the millimeter scale. In this work we use the electroneutral for- mulation to study this instability and assess the (in)accuracy of the commonly-used ambipolar approximation. Numerical studies based on the ambipolar approximation showed that the finger- ing instability can be triggered on a realistic time scale (as compared to experiments) purely by thermal fluctuations, without any artificial perturbations of the initial interface [6]. The studies also demonstrated that the effect of fluctuations is dominated by the contribution of the stochastic momentum flux, and not by fluctuations in the initial condition, the stochastic mass flux, or the stochastic chemical production rate. This can be understood as a consequence of the fact that advection by thermal velocity fluctuations, which are driven by the stochastic momentum flux, leads to giant concentration fluctuations in the presence of sharp concentration gradients [21–23]. These nonequilibrium fluctuations completely dominate equilibrium fluctuations at the scales of interest, and are sufficiently large to drive the fingering instability. We have confirmed that the same conclusions apply when charges are accounted for. Therefore, in the simulations reported here we do not include stochastic mass fluxes and reaction rate fluctuations, and initialize the simulations from a deterministic initial condition with a sharp interface between the acid and the base and zero fluid velocity. Because of the importance of giant concentration fluctuations to the formation of the instability, in Section IV A we first validate our algorithm and implementation by computing the spectrum of giant fluctuations in a ternary electrolyte. Then, we study the fingering instability at an acid-base neutralization front in Section IV B. A. Giant Nonequilibrium Fluctuations in Electroneutral Ternary Mixtures In this section we examine the giant concentration fluctuations in a non-reactive dilute elec- troneutral ternary electrolyte in the presence of a steady applied concentration gradient. Giant fluctuations in a binary electrolyte were studied using the charged-fluid formulation in Section V.B.2 in [1]. It was concluded there that for small wavenumbers, kλ  1, the electroneutral nonequilibrium fluctuations in a binary electrolyte can be described using the ambipolar formula- tion, as expected. Specifically, the spectrum of the giant fluctuations is the same as it would be in a solution with a single neutral species diffusing with the ambipolar diffusion coefficient (23). 21 However, this conclusion no longer holds for solutions with three or more charged species, even if dilute. Therefore, here we examine the spectrum of the giant fluctuations in a dilute solution of three ions with valencies V = V = 1 and V = −1, in the absence of gravity or reactions. In order to 1 2 3 focus on the nonequilibrium fluctuations we omit the stochastic mass flux from (7), so that the fluctuations are generated entirely by the random velocity. In arbitrary units in which k = 1 and e = 1, we set ρ = 1, T = 1 and assume equal molecular masses m = m = m = 1, and trace 1 2 3 diffusion coefficients D = 1, D = 1/2, and D = 3/2. The viscosity is set to η = 10 to give a 1 2 3 realistically large Schmidt number Sc ∼ 10 , and we set  = 0, which makes λ = 0 and removes the (fluctuating) Lorentz force from the momentum equation. The domain is quasi-two dimensional with L = L = 64 discretized with 64× 64 cells with grid spacing Δx = Δy = 1. The thickness x y of the domain is set to Δz = 10 to give weak fluctuations that can be described by the linearized fluctuating hydrodynamics equations. We impose equal and opposite macroscopic gradients for the co-ion species and no gradient for the counter-ion using reservoir boundary conditions, with −3 −3 −2 −3 imposed w = 4.5· 10 , w = 5.5· 10 , and w = 10 at the y = 0 boundary, and w = 5.5· 10 , 1 2 3 1 −3 −2 w = 4.5· 10 , and w = 10 at the y = L boundary. We set the time step size to Δt = 0.05 and 2 3 y 6 5 perform a total of 10 time steps skipping 10 steps in the beginning to allow the system to reach the steady state, after which we collect statistics on the spectrum of fluctuations S (k , k = 0). x y The theoretical spectrum of the giant fluctuations for a dilute ternary electrolyte can be com- puted by following the computation described in Section III.C in [1], and then taking the elec- troneutral limit kλ → 0. The same result can also be obtained from the electroneutral equations directly; with the help of a computer algebra system the limit kλ → 0 of the charged-fluid S (k) −4 is straightforward to compute, so we follow that route. Just as for non-ionic solutions, a k power −1 law is observed until the confinement effect becomes significant for small k  L . Following [1], we multiply the theoretical result for an unconfined bulk system by a confinement factor [24] to obtain " # k T 1 4 (1− cosh(k L )) B x y 0 0 S (k , k = 0) = f 1 + , (45) x y s,s ss ηD k k L (k L + sinh(k L )) 1 x y x y x y where our theoretical calculations predict f = 147/124, f = 219/124, and f = −177/124. 11 22 12 Note that it is sufficient to examine only the part of S corresponding to two of the charged ions (here the two co-ions), since electroneutrality dictates the spectra involving the third ion, and conservation of mass dictates the spectra involving the solvent. In Fig. 1 we compare our numerical results to the theoretical predictions (45), and find good agreement for all three structure factors. 22 -13 4×10 -13 3×10 -13 2×10 -S -13 1×10 0 0.5 1 1.5 2 Modified wavenumber k Figure 1: Spectrum of giant nonequilibrium concentration fluctuations in a ternary electrolyte mixture in the presence of an imposed concentration gradient of the two co-ions. To account for errors in the discrete approx- imation to the continuum Laplacian, the x axis shows the modified wavenumber k = sin(k Δx/2)/ (Δx/2) x x instead of k . Numerical results (symbols) for the components of k S (k , k = 0) corresponding to the x x y co-ions (positive S and S , and negative S ) are compared to the theoretical prediction (45) (lines). 11 22 12 B. Fingering Instability at an Acid-Base Front In this section we investigate the development of asymmetric fingering patterns arising from a diffusion-driven gravitational instability in the presence of a neutralization reaction. This sys- tem has been studied experimentally and theoretically using a two-dimensional Darcy advection- diffusion-reaction model [7, 9] based on an ambipolar approximation where the acid, base, and salt are treated as uncharged species instead of as disassociated ions. Here we perform large-scale three-dimensional simulations with the ions treated as individual species. Since the fingering instability is driven by the small changes of density with composition, it is crucial to first match the dependence of density on composition between the ambipolar diffusion (molecule-based) model used in Section IV.D in [6] and the electrodiffusion (ion-based) model used k S(k) in this work. Following [6, 7, 9], we assume that the solution density is linearly dependent on the solute concentrations in both cases, which is reasonable since the solutions are dilute. This gives the buoyancy force f (w) = −ρ w ge , (46) s y solute s where α is the solutal expansion coefficient, M is the molecular weight (in g/mol) of solute s, s s and the gravitational acceleration g = −ge acts in the negative y direction. For the ambipolar model, the values of α for s = HCl, NaOH, NaCl are obtained from Table II in [7]. For the ionic + − + − model, we compute the four unknown coefficients α for s = Na , Cl , H , OH by matching the dependence of density on composition between the two models for electroneutral binary solutions of HCl, NaOH, and NaCl. Only three independent coefficients α matter because electroneutrality + − fixes the concentration of the fourth ion, so we arbitrarily require that Na and Cl have the same coefficient α + = α −. It is important to observe that this procedure matches the density Na Cl between an arbitrary dilute solution of HCl, NaOH, and NaCl and the corresponding ionic solution + − − resulting after the molecules disassociate completely into Na , Cl , H , and OH ions. The reverse is not possible, that is, one cannot take an arbitrary solution of the ions and uniquely + − determine a corresponding molecular solution. In particular, a solution of only H and OH would not have a physically-reasonable density according to our model. We will validate shortly that any differences we see between the molecular and ionic models of the instability stem from the difference between standard Fickian diffusion and electrodiffusion, and not from our procedure for matching the buoyancy force. For the model setup and physical parameters, we follow Section IV.D in [6] and mimic the experiment of Lemaigre et al. [7]. We use cgs units unless otherwise specified and assume T = 293 and atmospheric pressure, neglecting any heat release in the reaction as justified in [9]. We set g = 981, ρ = 1, and η = 0.01. We consider a Hele-Shaw cell with side lengths L = L = 1.6 and x y L = 0.05, with the y-axis pointing in the vertical direction, and the z-axis being perpendicular to the glass plates. The domain is divided into 512 × 512 × 16 grid cells, which is twice finer than the grid used in [6] in order to better-resolve the sharp interface in the early stages of the mixing. We start with a gravitationally stable initial configuration, where an aqueous solution of NaOH with molarity 0.4 mol/L is placed on top of a denser aqueous solution of HCl with molarity 1 mol/L. We impose periodic boundary conditions in the x direction, no-slip impermeable walls in the z direction, and in the y direction we use free-slip reservoir boundary conditions with imposed concentrations that match the initial conditions of each layer. We use BDS advection because of 24 the presence of an initially sharp interface. Since the neutralization equilibrium lies far to the product side, we only consider the forward reaction. We use the law of mass action for a dilute solution (A4), and express the reaction propensity in terms of number densities, a = k n n for the molecule-based model, and HCl NaOH + 5 a = k n + n − for the ion-based model . In reality, neutralization is a diffusion-limited reaction H OH 11 −1 that occurs extremely fast (with rate λ ∼ 10 s ), essentially as soon as reactants encounter each −11 3 −1 other. The estimated value of k ∼ 10 cm s is impractically large, and would require an unrea- sonably small grid spacing to resolve the penetration depth (which would be on molecular scales), and an unreasonably small time step size to resolve the reactions. For our simulations, we choose a −19 smaller value k = 10 that is an order of magnitude smaller than the one used in [6], and enlarge −2 the time step size to Δt = 10 by an order of magnitude accordingly. Deterministic numerical −19 −18 studies presented in Appendix B in [6] show that increasing the rate beyond k = 10 − 10 hardly changes the results, so we believe our simulation parameters are realistic. Nevertheless, our main goal here is to compare molecule- and ion-based models and assess the accuracy of the am- bipolar approximation, so in this study it is more important to resolve the spatio-temporal scales in the problem than to match experimental observations. In Fig. 2 we compare the density profiles of Na between the model based on electroneutral electrodiffusion with ions, and that based on molecules using ambipolar diffusion coefficients. For the molecule-based simulations, we compute the density of Na assuming that the acid is com- pletely disassociated. To enable a direct comparison between the two cases, we employ the same sequence of pseudorandom numbers for the stochastic momentum flux in both cases. Although the development of the instability follows similar trends in the two cases, there are clearly-visible differ- ences between the top and bottom rows in the figure. For example, the Na fingers develop sooner and diffuse more for the ion-based simulations. These differences can also be seen by comparing the lines in Fig. 3, where we show the norm of the y component of velocity (corresponding to the progress of the instability) and the total mass of consumed H (corresponding to the production of salt in the molecule-based model) as a function of time. Our findings clearly demonstrate that quantitative predictions can only be made by solving the complete electroneutral electrodiffusion equations presented here. The ambipolar approximation can only be used as a qualitative model of the instability. Observe that the reaction rates are matched between the molecule-based model and the corresponding ion-based + − model because the number density of HCl/NaOH in the non-ionic mixture matches the number density of H /OH in the corresponding ionic mixture. 25 Figure 2: Asymmetric growth of convective fingering patterns in a Hele-Shaw cell, induced by a gravita- tional instability in the presence of a neutralization reaction. The top row corresponds to electroneutral electrodiffusion of ions, while the bottom row corresponds to ambipolar diffusion of acid, base, and salt molecules; both simulations use the same random numbers for the stochastic momentum flux. The density of Na is shown with a color scale at 20, 30, and 40 seconds (columns going left to right) from the beginning of the simulation, initialized without any fluctuations. Two-dimensional slices of the three-dimensional field + + ρ (x, y, z) are shown. The square images show ρ (x, y, z = L /2) (halfway between the glass plates) Na Na z and the thin vertical side bars show the slice ρ + (x = 0, y, z) corresponding to the left edge of the square Na images. To demonstrate that the clear difference between electrodiffusion and ambipolar diffusion is −5 caused by the large difference in the true diffusion coefficients of the ions (D + = 1.33 · 10 , Na −5 −5 −5 D − = 5.33 · 10 , D + = 9.35 · 10 , and D − = 2.03 · 10 ), we also perform simulations OH H Cl where we artificially match the diffusion coefficients for the reactant ions and molecules by setting + − −5 them to fake values, D + = D − = D = 2.13 · 10 (i.e., Na and OH ions diffuse NaOH Na OH −5 + with the same coefficient as NaOH) and D + = D − = D = 3.34 · 10 (i.e., H and Cl H Cl HCl ions diffuse with the same coefficient as HCl). In the molecule-based simulations, the diffusion coefficient of NaCl is set to the harmonic average of the two fake diffusion coefficients of Na and − + −5 Cl ions, D = 2.6 · 10 . Figure 4 compares the density of Na in ion- and molecule-based NaCl simulations using these artificial (fake) values of the diffusion coefficients. The two panels in Fig. 26 1.6e0 - 3 1.0e0 - 5 ions / real Ð ions / real Ð molecules / real Ð molecules / real Ð 8.0e0 - 6 1.2e0 - 3 ions / fake Ð ions / fake Ð molecules / fake Ð molecules / fake Ð 6.0e0 - 6 8.0e0 - 4 4.0e0 - 6 4.0e0 - 4 2.0e0 - 6 0.0e+00 0.0e+00 0 10 20 30 40 50 0 10 20 30 40 50 time t time t Figure 3: Time dependence of the norm of vertical velocity (left panel) and of the total mass of H consumed in the neutralization reaction (right panel). We compare simulations where the species are ions versus those where the species are neutral molecules (see legend). Lines are results based on the true tabulated diffusion values for the ions, while symbols show results for fake values of the ion diffusion coefficients, artificially made to be closer to each other. Figure 4: Density of Na at time t = 30s for the ion-based model (left panel) or the molecule-based model (right panel); both simulations use the same random numbers for the stochastic momentum flux. These simulations use fake values of the ion diffusion coefficients, artificially made to be closer to each other in order to make the difference between electrodiffusion and ambipolar diffusion smaller. 4 are visually almost indistinguishable, showing very little difference between electrodiffusion and ambipolar diffusion, unlike the panels in Fig. 2. This is further demonstrated by the symbols in Figure 3. This demonstrates that the difference between electrodiffusion and standard Fickian diffusion is large when the multiple ions involved diffuse with widely varying coefficients. kv k mass of consumed H V. CONCLUSIONS We formulated the electroneutral reactive generalized PNP equations and included thermal fluctuations using fluctuating hydrodynamics and the chemical master equation. The only differ- ence between the charged-fluid equations and their electroneutral limit is in the elliptic equation for the electric potential. We presented a second-order midpoint predictor-corrector scheme for both sets of equations. We studied giant nonequilibrium fluctuations in ternary electrolytes in the electroneutral limit, and demonstrated that our numerical algorithm accurately reproduces theoretical predictions. We also modeled a fingering instability at an acid-base mixing front and demonstrated that modeling the acid, base, and salt as neutral species diffusing with ambipolar diffusion coefficients leads to quantitatively-incorrect results unless the diffusion coefficients of the ions are very similar. The temporal discretization we used in this work treats mass diffusion explicitly. It can be shown that the electroneutral integrator used here is the limit Δt  λ /D of a method for the charged-fluid equations in which only the potential is treated implicitly, i.e., the Poisson equation (2) is imposed at the end instead of the beginning of an Euler update. A major challenge for the future is to develop algorithms that treat electroneutral electrodiffusion implicitly. This would require solving a coupled linear system for both the composition and the electric potential at the end of the time step. This is in some ways similar to our treatment of the velocity equation where we solve a Stokes problems for both velocity and pressure. The main challenge in developing im- plicit electrodiffusion discretizations is the development of effective preconditioners for the coupled electrodiffusion system. In this work we used Neumann boundary conditions for the potential that were consistent with electroneutrality under the assumption of no surface conduction. Future work should care- fully derive appropriate boundary conditions for the electroneutral electrodiffusion equations using asymptotic analysis, at least in the deterministic context. In this work we used the same velocity boundary conditions for the charged-fluid and electroneutral formulations because of the absence of any asymptotic theory for the effective slip for multispecies mixtures. It is important to carry out such asymptotic theory, even if only for the case of small zeta or applied potentials/fields. Finally, allowing for surface reactions in the formulation also requires changing the boundary conditions. Future developments in these directions would allow us to model catalytic micropumps [25] without having to resolve the thin Debye layers around the catalytic surfaces. 28 Acknowledgments We thank Jean-Philippe Péraud for help with comparisons between charged-fluid and elec- troneutral formulations. We would like to thank Anne De Wit for helpful discussions regarding gravitational instabilities in the presence of neutralization reactions, and thank Ehud Yariv for generously sharing his knowledge about the electroneutral limit. We also acknowledge informative discussions with Charles Peskin. This material is based upon work supported by the U.S. De- partment of Energy, Office of Science, Office of Advanced Scientific Computing Research, Applied Mathematics Program under Award Number DE-SC0008271 and under contract No. DE-AC02- 05CH11231. This research used resources of the National Energy Research Scientific Computing Center, a DOE Office of Science User Facility supported by the Office of Science of the U.S. Depart- ment of Energy under Contract No. DE-AC02-05CH11231. A. Donev was supported in part by the Division of Chemical, Bioengineering, Environmental and Transport Systems of the National Science Foundation under award CBET-1804940. Appendix Appendix A: Chemical Production Rates In this Appendix we summarize how we compute the (deterministic or stochastic) chemical pro- duction rates Ω . We consider a liquid mixture consisting of N species undergoing N elementary s s r reversible reactions of the form N N s s X X + − ν M ν M (r = 1, . . . , N ), (A1) s s r sr sr s=1 s=1 where ν are molecule numbers, and M are chemical symbols. We define the stoichiometric sr + − + coefficient of species s in the forward reaction r as Δν = ν −ν and the coefficient in the reverse sr sr sr − + − s ± reaction as Δν = ν − ν . We assume that each reaction r conserves mass, Δν m = sr sr sr s=1 sr s ± 0, and charge , Δν m z = 0, which is suitable for bulk reactions in liquids (we do not s s sr s=1 consider surface reactions here). It is important to note that all reactions must be reversible for thermodynamic consistency, although in practice some reactions can be effectively considered to be irreversible sufficiently far from thermodynamic equilibrium. The mean number of reaction occurrences in a locally well-mixed reactive cell of volume ΔV ± ± during an infinitesimal time interval dt is given as a ΔV dt, where a are the propensity density r r functions for the forward/reverse (+/−) rates of reaction r. Accordingly, the mean production rate 29 of species s in the deterministic equations is given as X X α α Ω = Δν a . (A2) sr r α=± r=1 The propensity density functions are given by the Law of Mass Action (LMA) kinetics, suitably generalized to non-dilute mixtures [6], ± ± ν sr a = κ (x γ ) , (A3) s s r r s=1 where κ (T, P ) is the rate of the forward/reverse reaction r, and γ (x, T, P ) is the activity coef- ficient of species s (for an ideal mixture, γ = 1). It is important to note that propensity density functions (A3) are expressed in terms of mole fractions x (for ideal mixtures) or activities x γ , s s s and not in terms of number densities. For reactions in a dilute solution (which is necessarily an ideal solution for sufficiently dilution), mole fractions and number densities are proportional, x ≈ m ¯ n /ρ, and one can alternatively write the LMA in the form s solv s ± ± ν sr a = k n for dilute solutions. (A4) r r s s=1 Following [6, 26], we use the Chemical Master Equation (CME) to describe fluctuations in the reaction rates for small numbers of reactive molecules. For reactions in a closed well-mixed cell of volume ΔV , the change in the number of molecules N of species s in a given cell during an infinitesimal time interval dt is expressed in terms of the number of occurrences P (a ΔV dt) of each reaction r, X X α α Ω ΔV dt = Δν P (a ΔV dt), (A5) sr r α=± r=1 where P (m) denotes a Poisson random variable with mean m. Note that the instantaneous rate of change is written as an Ito stochastic term. In the numerical algorithm described in Section III, we use a second-order tau leaping method [27], which discretizes (A5) with a finite time step size Δt. Appendix B: Electroneutral Fluctuations of Composition for a Binary Electrolyte For a binary electroneutral electrolyte, the covariance of the fluctuations of the two charged species (32) is the matrix   m w bm w ρ 1 1 2 1 (eln)   S = ,   ions 1 + b bm w bm w 2 1 2 2 30 where b = −m z /m z = V /V is the ratio of the number of atoms of the two species in one 1 1 2 2 1 2 neutral salt molecule. It is important to observe that this is not what would be predicted from a naive ambipolar approximation where one considers the two ions to be bound and diffusing with the ambipolar diffusion coefficient (24), notably, such an approximation would not give the prefactor −1 (1 + b) . −1 One can understand the prefactor (1 + b) by computing the entropy of mixing of the solution under the constraint of charge neutrality. Consider a dilute ideal solution of N molecules of a solvent species and N  N molecules of one ion and N  N molecules of another counter-ion. 1 0 2 0 For an electroneutral mixture we have the constraint N = bN . The mixture has a free energy of 2 1 mixing N N N bN 1 2 1 1 −1 (k T ) ΔG ≈ N ln − 1 + N ln − 1 = N ln − 1 + bN ln − 1 . B mix 1 2 1 1 N N N N 0 0 0 0 The second derivative of the free energy of mixing, which determines the width of the Gaussian approximation of the entropy and thus the inverse of S , is ∂ ΔG k T mix B = (1 + b) , ∂N N which has the additional prefactor (1 + b) relative to the standard result without the electroneu- trality constraint. [1] Jean-Philippe Péraud, Andy Nonaka, Anuj Chaudhri, John B. Bell, Aleksandar Donev, and Alejan- dro L. Garcia. Low mach number fluctuating hydrodynamics for electrolytes. Phys. Rev. Fluids, 1:074103, 2016. [2] Jean-Philippe Péraud, Andrew J. Nonaka, John B. Bell, Aleksandar Donev, and Alejandro L. Garcia. Fluctuation-enhanced electric conductivity in electrolyte solutions. Proceedings of the National Academy of Sciences, 114(41):10829–10833, 2017. [3] Aleksandar Donev, Alejandro L. Garcia, Jean-Philippe Péraud, Andrew J. Nonaka, and John B. Bell. Fluctuating Hydrodynamics and Debye-Hückel-Onsager Theory for Electrolytes. Current Opinion in Electrochemistry, 13:1 – 10, 2019. [4] Boyce E Griffith and Charles S Peskin. Electrophysiology. Communications on Pure and Applied Mathematics, 66(12):1837–1913, 2013. [5] Ehud Yariv. An asymptotic derivation of the thin-debye-layer limit for electrokinetic phenomena. Chemical Engineering Communications, 197(1):3–17, 2009. [6] C. Kim, A. J. Nonaka, A. L. Garcia, J. B. Bell, and A. Donev. Fluctuating hydrodynamics of reactive liquid mixtures. J. Chem. Phys., 149(8):084113, 2018. 31 [7] L. Lemaigre, M.A. Budroni, L.A. Riolfo, P. Grosfils, and A. De Wit. Asymmetric Rayleigh–Taylor and double-diffusive fingers in reactive systems. Phys. Fluids, 25:014103, 2013. [8] P. M. J. Trevelyan, C. Almarcha, and A. De Wit. Buoyancy-driven instabilities around miscible a+b → c reaction fronts: A general classification. Phys. Rev. E, 91:023001, 2015. [9] Christophe Almarcha, Philip MJ Trevelyan, Patrick Grosfils, and Anne De Wit. Thermal effects on the diffusive layer convection instability of an exothermic acid-base reaction front. Physical Review E, 88(3):033009, 2013. [10] JA Wesselingh, P Vonk, and G Kraaijeveld. Exploring the maxwell-stefan description of ion exchange. The Chemical Engineering Journal and The Biochemical Engineering Journal, 57(2):75–89, 1995. [11] A. Donev, A. J. Nonaka, A. K. Bhattacharjee, A. L. Garcia, and J. B. Bell. Low Mach Number Fluctuating Hydrodynamics of Multispecies Liquid Mixtures. Physics of Fluids, 27(3):037103, 2015. [12] Ehud Yariv. Electrokinetic self-propulsion by inhomogeneous surface kinetics. In Proceedings of the Royal Society of London A: Mathematical, Physical and Engineering Sciences, page rspa20100503. The Royal Society, 2010. [13] A. Donev, A. J. Nonaka, Y. Sun, T. G. Fai, A. L. Garcia, and J. B. Bell. Low Mach Number Fluc- tuating Hydrodynamics of Diffusively Mixing Fluids. Communications in Applied Mathematics and Computational Science, 9(1):47–105, 2014. [14] Ory Schnitzer and Ehud Yariv. Macroscale description of electrokinetic flows at large zeta potentials: Nonlinear surface conduction. Physical Review E, 86(2):021503, 2012. [15] Ory Schnitzer and Ehud Yariv. Induced-charge electro-osmosis beyond weak fields. Physical Review E, 86(6):061506, 2012. [16] Tso-Yi Chiang and Darrell Velegol. Multi-ion diffusiophoresis. Journal of colloid and interface science, 424:120–123, 2014. [17] A. J. Nonaka, Y. Sun, J. B. Bell, and A. Donev. Low Mach Number Fluctuating Hydrodynamics of Binary Liquid Mixtures. Communications in Applied Mathematics and Computational Science, 10(2):163–204, 2015. [18] A. Donev, E. Vanden-Eijnden, A. L. Garcia, and J. B. Bell. On the Accuracy of Finite-Volume Schemes for Fluctuating Hydrodynamics. Communications in Applied Mathematics and Computational Science, 5(2):149–197, 2010. [19] F. Balboa Usabiaga, J. B. Bell, R. Delgado-Buscalioni, A. Donev, T. G. Fai, B. E. Griffith, and C. S. Peskin. Staggered Schemes for Fluctuating Hydrodynamics. SIAM J. Multiscale Modeling and Simulation, 10(4):1369–1408, 2012. [20] J. B. Bell, C. N. Dawson, and G. R. Shubin. An unsplit, higher order Godunov method for scalar conservation laws in multiple dimensions. J. Comput. Phys., 74:1–24, 1988. [21] J. M. O. De Zarate and J. V. Sengers. Hydrodynamic fluctuations in fluids and fluid mixtures. Elsevier Science Ltd, 2006. [22] A. Vailati and M. Giglio. Nonequilibrium fluctuations in time-dependent diffusion processes. Phys. 32 Rev. E, 58(4):4361–4371, 1998. [23] A. Vailati, R. Cerbino, S. Mazzoni, C. J. Takacs, D. S. Cannell, and M. Giglio. Fractal fronts of diffusion in microgravity. Nature Communications, 2:290, 2011. [24] JM Ortiz de Zárate, TR Kirkpatrick, and JV Sengers. Non-equilibrium concentration fluctuations in binary liquids with realistic boundary conditions. The European Physical Journal E, 38(9):1–9, 2015. [25] Maria J Esplandiu, Ali Afshar Farniya, and David Reguera. Key parameters controlling the performance of catalytic motors. The Journal of chemical physics, 144(12):124702, 2016. [26] C. Kim, A. J. Nonaka, A. L. Garcia, J. B. Bell, and A. Donev. Stochastic simulation of reaction- diffusion systems: A fluctuating-hydrodynamics approach. J. Chem. Phys., 146(12), 2017. Software available at https://github.com/BoxLib-Codes/FHD_ReactDiff. [27] D.F. Anderson and J.C. Mattingly. A weak trapezoidal method for a class of stochastic differential equations. Communications in Mathematical Sciences, 9(1):301–318, 2011. http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png Condensed Matter arXiv (Cornell University)

Fluctuating hydrodynamics of electrolytes at electroneutral scales

Loading next page...
 
/lp/arxiv-cornell-university/fluctuating-hydrodynamics-of-electrolytes-at-electroneutral-scales-5PRnNOgSnZ

References

References for this paper are not available at this time. We will be adding them shortly, thank you for your patience.

ISSN
2469-990X
eISSN
ARCH-3331
DOI
10.1103/PhysRevFluids.4.043701
Publisher site
See Article on Publisher Site

Abstract

At mesoscopic scales electrolyte solutions are modeled by the fluctuating generalized Poisson-Nernst- Planck (PNP) equations [J.-P. Péraud et al., Phys. Rev. F, 1(7):074103, 2016]. However, at length and time scales larger than the Debye scales, electrolytes are effectively electroneutral, and the charged-fluid PNP equations become too stiff to solve numerically. Here we formulate the isothermal incompressible equations of fluctuating hydrodynamics for reactive multispecies mixtures involving charged species in the electroneutral limit, and design a numerical algorithm to solve these equations. Our model does not assume a dilute electrolyte solution but rather treats all species on an equal footing, accounting for cross-diffusion and non-ideality using Maxwell-Stefan theory. By enforcing local electroneutrality as a constraint, we obtain an elliptic equation for the electric potential that replaces the Poisson equation in the fluctuating PNP equations. We develop a second-order midpoint predictor-corrector algorithm to solve either the charged- fluid or electroneutral equations with only a change of the elliptic solver. We use the electroneutral algorithm to study a gravitational fingering instability, triggered by thermal fluctuations, at an interface where an acid and base react to neutralize each other. Our results demonstrate that, because the four ions diffuse with very different coefficients, one must treat each ion as an individual species, and cannot treat the acid, base, and salt as neutral species. This emphasizes the differences between electrodiffusion and classical Fickian diffusion, even at electroneutral scales. Electronic address: donev@courant.nyu.edu arXiv:1809.08163v3 [physics.comp-ph] 16 Jan 2019 I. INTRODUCTION Better understanding of transport phenomena in electrolytes is important for studying both naturally occurring and man-made systems at small scales. Living cells rely strongly on membrane potentials and the electrodiffusion of ions. Batteries and fuel cells also rely on ionic transport. In both of these examples the length and time scales involved are intractable for molecular dynamics. A more efficient and tractable numerical approach for mesoscopic fluids is fluctuating hydrody- namics (FHD), which extends conventional hydrodynamics by including a random component to the dissipative fluxes in a manner consistent with irreversible thermodynamics and the fluctuation- dissipation theorem. Access to tools to model systems involving complex electrolyte mixtures with the inclusion of their inherent statistical fluctuations would not only increase our understanding of cellular mechanisms, but also provide a path towards better design tools for bio-engineering applications. In our prior work [1] we formulated a charged-fluid form of the equations of fluctuating hy- drodynamics and developed associated algorithms for electrolyte mixtures containing an arbitrary number of ionic or neutral species. Our formulation combined a generalized fluctuating Poisson- Nernst-Planck (PNP) equation based on the Maxwell-Stefan formulation of electrodiffusion with the fluctuating low Mach number Navier-Stokes (NS) equation for the fluid flow. In that formula- tion, the fluid is considered to be a mixture of incompressible but miscible components (species), each with its own density, and it is not necessary to distinguish a single species as a solvent . For very dilute electrolyte solutions, in the absence of fluctuations the deterministic formulation reverts to the classical PNP equations for the composition, coupled to an incompressible NS equa- tion for the fluid velocity. In recent work [2, 3] we have demonstrated that the addition of thermal fluctuations renormalizes the PNP equations to reproduce the Debye-Hückel-Onsager theory for dilute solutions. The charged-fluid formulation is designed for simulations where the spatial grid resolves the Debye length λ , which is typically on the order of a few to tens of nanometers. In particular, the time step size in the algorithm used in [1] was limited by τ = λ /D (see Eq. (86) in [1]), where D is a typical diffusion coefficient. In many practical applications one is interested in modeling bulk electrolytes at length scales much larger than the Debye length, over diffusive time scales much longer than τ . At such scales, the electrolyte is effectively electroneutral, and electrodiffusion is This formulation is also useful for modeling ionic liquids. 2 described by the electroneutral limit of the PNP equations [4, 5]. In this paper, we formulate the electroneutral limit of the generalized fluctuating PNP equations and develop a numerical method to solve these equations. In the electroneutral limit, the evolution is constrained to preserve charge neutrality by replacing the standard Poisson equation for the electric field with a variable coefficient elliptic equation. Thus, with only a change of an elliptic equation solver, our algorithm can switch from charged-fluid to electroneutral, allowing us to use the same code to study a broad range of length and time scales. Implicit in a coarse-grained description like FHD is the assumption that each cell (coarse-graining volume) contains sufficiently many ions to justify neglecting the discrete particle nature of molecules. While this assumption is problematic for charged-fluid FHD except for dilute solutions (for which the Debye length is large compared to the inter-ion spacing), in electroneutral FHD the cell dimensions are much larger than the Debye length and therefore typically contain a large number of ions even for dense solutions (for which the Debye length is comparable or smaller than the inter-ion spacing). Additionally, in this work we incorporate chemical reactions in the charged-fluid and electro- neutral formulations/algorithms following our prior work on non-ionic mixtures [6]. In the approach developed in [6], fluctuating chemistry is treated using a discrete Chemical Master Equation (CME) formulation, while hydrodynamic transport including mass and momentum diffusion is treated using a fluctuating hydrodynamics semi-continuum formulation. Our numerical algorithm is a modification of the algorithm developed in [6] to replace diffusion by electrodiffusion for both formulations. In [6], we modeled recent experiments [7] studying a gravity-driven instability of a front where an acid (HCl) and a base (NaOH) neutralize each other to form a salt (NaCl). In these prior simulations, we followed the literature [7–9] and modeled the acid, base, and salt as neutral species (HCl, NaOH, and NaCl); we will refer to this as the ambipolar approximation. In reality, however, + − + − these species are all strong electrolytes and disassociate into ions (H , OH , Na , and Cl ). It is well-known that electrodiffusion can be very different than ordinary diffusion because of the strong coupling of the motions of the ions via the electric fields they generate; for example, an ionic species can diffuse against its own concentration gradient [10]. In this work, we use the electroneutral formulation to model the fingering instability at an HCl/NaOH front but treating each ion as a separate charged species. This avoids uncontrolled approximations and allows us to assess the quantitative accuracy of the ambipolar approximation in a multispecies electrolyte. We begin by formulating the stochastic partial differential equations of fluctuating hydrody- namics for electrolytes in Section II. We first review the charged-fluid formulation in which the 3 Debye length is resolved in Section II A, and then formulate the electroneutral equations in Sec- tion II B. We also discuss the spectra of concentration fluctuations at thermodynamic equilibrium for both charged-fluid and electroneutral formulations in Section II C. We present a second-order predictor-corrector algorithm for both formulations in Section III. The methodology is applied to study a fingering instability at an acid-base front in Section IV. We conclude with some directions for future research in Section V. II. CHARGED-FLUID AND ELECTRONEUTRAL FLUCTUATING ELECTROHYDRO- DYNAMICS We consider an isothermal isobaric mixture of N species and use the following notation. Vectors (both in the geometrical and in the linear algebra sense), matrices (and tensors), and operators are denoted with bold letters. The mass density of species s is denoted with ρ and its number P P N N s s density with n , giving the total mass density ρ = ρ and total number density n = n . s s s s=1 s=1 The mass fractions are denoted with w, where w = ρ /ρ, while the number or mole fractions are s s denoted with x, where x = n /n; both the mass and number fractions sum to unity. One can s s transform between mass and number fractions by x = mw ¯ /m , where m is the molecular mass s s s s of species s and the mixture-averaged molecular mass is −1 ρ w m ¯ = = . n m s=1 A diagonal matrix whose diagonal is given by a vector is denoted by the corresponding capital letter; for example, W is a diagonal matrix with entries w and M is a diagonal matrix of the molecular masses m. The charges per unit mass are denoted by z with z = V e/m , where e is the elementary charge s s s and V is the valence of species s. The total density of free charges is thus Z = ρ z = ρz w. s s s=1 For an ideal solution the Debye length is given by 1/2 1/2 k T k T B B λ = = , (1) T N ρz WMz ρw m z s s s=1 where  is the dielectric permittivity of the mixture, k is Boltzmann’s constant, and T is the temperature. 4 A. Charged-fluid Formulation In this section we review the fluctuating hydrodynamics equations for an electrolyte mixture, following the notation in [1]. Unlike this prior work, and following [6], here we make a Boussinesq approximation and assume that the density of the mixture changes only weakly with composition, ρ ≈ ρ . This allows us to use an incompressible approximation of the momentum equation, which greatly simplifies the construction of a numerical algorithm [6]. The dependence of the density on composition is only taken into account in the gravity forcing term. This Boussinesq approximation is certainly valid for moderately dilute electrolyte solutions. We neglect the effects of thermodiffusion and barodiffusion on mass transport and assume constant temperature T and thermodynamic pressure P . The incompressible equations of fluctuating hydrodynamics for an isothermal reactive electrolyte mixture can be obtained by combining terms given in [1] with those given in [6]. Here we summarize the resulting equations. 1. Quasi-electrostatic Poisson Equation In the electroquasistatic approximation (magnetic effects are neglected), the electric potential Φ(r, t) satisfies the Poisson equation ∇· (E) = −∇· (∇Φ) = Z, (2) where the electric field is E = −∇Φ, and the dielectric permittivity  (w) can, in principle, depend on composition. The boundary conditions for Φ are standard Neumann conditions for dielectric boundaries or Dirichlet conditions for metallic boundaries. The presence of charges and electric fields leads to a nonzero Lorentz force in the momentum T T equation given by the divergence of the Maxwell stress tensor σ =  EE − E EI/2 , f = ∇· σ = ZE − ∇. E M In this work we assume that the permittivity is constant, which reduces the Lorentz force to f = ZE. Using the Poisson equation (2), we can rewrite this in the equivalent form f = ∇· (E)E = [∇· (∇Φ)]∇Φ, which is suitable for both the charged-fluid and the electroneutral formulations [5]. By contrast, as we explain later, the traditional form f = ZE cannot be used in the electroneutral limit since formally Z → 0 but the Lorentz force does not go to zero in this limit [5]. 5 2. Momentum Equation In the Boussinesq approximation, ρ = ρ and conservation of momentum gives the fluctuating incompressible Navier-Stokes equations ∂ (ρv) + ∇π = −∇·(ρvv ) + ∇·(η∇v + Σ) + ∇· (∇Φ) ∇Φ + f, (3) ∂t ∇·v = 0. (4) Here, v(r, t) is the fluid velocity, π(r, t) is the mechanical pressure (a Lagrange multiplier that ensures the velocity remains divergence free), η(w) is the viscosity, ∇ = ∇ + ∇ is a symmetric gradient, and Σ is the stochastic momentum flux. The buoyancy force f (w, t) is a problem-specific function of w(r, t) and can also be an explicit function of time. Based on the fluctuation-dissipation relation, the stochastic momentum flux Σ is modeled as h i mom mom Σ = ηk T Z + (Z ) , (5) mom where Z (r, t) is a standard Gaussian white noise tensor field with uncorrelated components having δ-function correlations in space and time. The two physical boundary conditions for the charged-fluid equations that we consider here are the no-slip condition v = 0 on the boundary, and the free-slip boundary condition, ∂v ∂v n τ v = v · n = 0 and + = 0, (6) ∂τ ∂n where n is the unit vector normal to the boundary, τ is a unit vector tangential to the boundary, τ · n = 0, and v is the tangential component of the velocity. 3. Species Equations Conservation of mass for each species gives the dynamics of the composition of the mixture, ∂ (ρw ) = −∇·(ρw v)− ∇·F + m Ω , (7) s s s s ∂t where we remind the reader that in the Boussinesq approximation density is constant, i.e., ρ = ρ . The total diffusive mass flux F of species s is composed of a dissipative flux F and fluctuating s s flux F , F = F + F , (8) s s s 6 and Ω is a source term representing stochastic chemistry. Note that by summing up (7) over P P all species we recover (4) since F = 0 and m Ω = 0. The formulation of the chemical s s s s s production rates Ω is taken from [6] and summarized in Appendix A. Diffusion is driven by the gradients of the electrochemical potentials k T μ (x, T, P ) = μ (T, P ) + log(x γ ) + z Φ, (9) s s s s where μ (T, P ) is a reference chemical potential and γ (x, T, P ) is the activity coefficient (for an ideal mixture, γ = 1). This gives the dissipative diffusive mass fluxes [1] m ¯Wz F = −ρWχ Γ∇x + ∇Φ , (10) k T where χ is a symmetric positive semi-definite diffusion matrix that can be computed from the Maxwell-Stefan diffusion coefficients [6, 11]. Here Γ is the matrix of thermodynamic factors, Γ = I + X − xx H, (11) where the symmetric matrix H is the Hessian of the excess free energy per particle; for an ideal mixture H = 0 and Γ is the identity matrix [11]. The stochastic mass fluxes F are given by the fluctuation-dissipation relation, mass F = 2mρ ¯ Wχ Z , (12) 1 1 1 T mass 2 2 2 where χ is a “square root” of χ satisfying χ (χ ) = χ, and Z (r, t) is a standard Gaussian random vector field with uncorrelated components. In summary, the composition follows the equation (7), with electrodiffusive fluxes given by the sum of (10) and (12); the chemical production rates are discussed in Appendix A and given by (A5). For dilute species, the expression for the electrodiffusive dissipative fluxes reduces to that in the familiar PNP equations. Specifically, for a species s that is dilute, x  1, we get the familiar Nernst-Planck-Fick law (see Appendix A in [6]) m D m ¯ w z m w z s s solv s s s s s F ≈ −ρ ∇x + ∇Φ = −ρD ∇w + ∇Φ , (13) s s s s m ¯ k T k T solv B B −1 0 0 where x ≈ m ¯ w /m , and m ¯ = ( 0 w /m ) is the mixture-averaged molecular s s s solv solv s s solvent s mass of the solvent, which could itself be a mixture of liquids. Here D is the trace diffusion coefficient of the dilute species in the solvent, which can be related to the Maxwell-Stefan coefficients 7 involving species s (see (40) in [6]). The stochastic flux also simplifies in the fluctuating PNP equations for dilute species, mass F ≈ 2ρm w D Z . s s s s The boundary conditions for (7) depend on the nature of the physical boundary. We consider non-reactive impermeable walls and reservoirs; reactive boundaries can be accounted for [12] but we do not consider them here. For both kinds of boundaries the normal component of the velocity is zero in the Boussinesq approximation (see Eq. (15) in [13] for a generalization to low Mach number variable-density models). This implies that the normal mass fluxes of all species at walls must be (n) zero, F = F · n = 0. Reservoir boundaries are intended to model a permeable membrane that connects the system to a large reservoir held at a specified concentration w , and correspond to resvr a Dirichlet condition on w. B. Electroneutral Formulation The charged-fluid equations (2,3,4,7) suffer from a well-known stiffness: The characteristic Debye length scale λ is typically much smaller than the macroscopic/device scales of interest. Thin Debye boundary layers develop near physical boundaries, with thickness proportional to λ . Outside of these layers, the fields vary much more smoothly on scales much larger than the Debye length. On such scales, the electrolyte is effectively electroneutral, and electrodiffusion is described the electroneutral limit of the PNP equations [4, 5]. The electroneutral bulk equations can be justified by formal asymptotic analysis [4, 5]. This analysis leads to an elliptic equation for the potential Φ that forces the evolution to preserve charge neutrality. Here we derive this equation by simply invoking charge neutrality as a local linear constraint, Z = ρz w = ρ z w = 0, (14) s s s=1 everywhere in the bulk. By differentiating the constraint Z (r, t) = 0 we get ∂Z ∂ = z (ρw) = z (−∇·(ρw v)− ∇·F + m Ω ) = 0. (15) s s s s s ∂t ∂t s=1 Because advection preserves Z = 0, ! ! N N s s X X z ∇·(ρw v) = ∇· ρ z w v = ∇· (Zv) = 0, (16) s s s s s=1 s=1 8 P and reactions conserve charge, z m Ω = 0, Eq. (15) simplifies to s s s s=1 N N s s X X z ∇·F = ∇· z F = ∇· z F = 0. (17) s s s s s=1 s=1 1. Electroneutral Elliptic Equation Using the expressions (10) and (12) for the diffusive mass fluxes, we can rewrite the condition ∇· z F = 0 as an elliptic PDE for the electric potential, mρ ¯ T T ∇· z WχWz ∇Φ = ∇· z F , (18) k T where F denotes the diffusive fluxes without the electrodiffusion, mass F = −ρWχΓ∇x + 2mρ ¯ Wχ Z . We see that in the electroneutral limit, the electric potential becomes a Lagrange multiplier that enforces the electroneutrality condition. It is given by the solution of the modified elliptic equa- tion (18), and not by the quasielectrostatic Poisson equation (2). In summary, the fluctuating electroneutral equations we consider in this work are given by (3,4,7,18). It is worth pointing out that the validity of the electroneutral limit requires that λ be small −1/2 everywhere in the bulk, where we recall that for an ideal solution λ ∼ z WMz . This requires the presence of some charges everywhere in the domain, that is, one cannot use (18) when parts of the domain are ion-free since in those parts of the domain λ would diverge; an example of a situation not covered by the electroneutral limit would be the diffusive mixing of pure and salty water. In particular, (18) is not uniformly elliptic if in some part of the domain z WχWz → 0, i.e., if z w → 0 for all species s. In practice, for water solutions, it is energetically s s very unfavorable to remove all ions and purify water to the point where the Debye length would approach macroscopic/device scales . We will therefore assume here that there are sufficiently many ions everywhere in the domain to justify the electroneutral limit (3,4,7,18). 2. Boundary Conditions Obtaining proper boundary conditions for the electroneutral equations (3,4,7,18) requires a nontrivial asymptotic analysis matching the electroneutral bulk “outer solution” on the outside of −10 For ultra-pure water the ion mass fractions are ≈ 10 and the Debye length is a few microns. 9 the Debye layer to the boundary layer “inner solution” inside the Debye layer [5, 14, 15]. Since we are interested here in the electroneutral bulk, what we mean by boundary conditions are the conditions not on the physical boundary itself but rather on the outer boundary of the Debye layer. In the electroneutral limit λ /l → 0, where l is the smallest length scale of interest, D min min the thickness of the boundary layer is formally zero and the outer conditions become effective boundary conditions for the electroneutral bulk equations. Though surface reactions can affect the charge density bound to dielectric boundaries (e.g., electron exchange), in this paper we do not consider surface chemistry. Here we will assume that there is no surface conduction in the Debye layer, i.e., we only need to consider normal mass fluxes (the curved surface analysis in [5] shows that curvature does not enter in the leading-order asymptotics) at the outer edge of the double layer. For dielectric boundaries, a careful analysis of the validity of the assumption of no surface currents is carried out in [14], and it is concluded that it is valid only for weakly to moderately charged surfaces. For highly charged dielectric boundaries, surface conduction enters even in the leading-order asymptotic matching. For metals, a careful asymptotic analysis is carried out in [15] and shows that, in regions where the potential jump across the layer is exponentially large (measured with respect to the thermal voltage k T/e), surface conduction also enters. Under the assumption of no surface conduction, we first consider the boundary conditions for the electrodiffusion equations (7,18), and then turn our attention to the velocity equations (3,4). We recall that the electrodiffusive mass flux is mρ ¯ F = F − WχWz ∇Φ. k T T (n) Since the flux must locally preserve the charge neutrality, z F = 0 on the boundary, where we (n) recall that F = n · F denotes the fluxes normal to the boundary. This immediately gives the effective Neumann boundary condition for the potential, −1 ∂Φ mρ ¯ (n) T T = z WχWz z F , (19) ∂n k T (n) where F = n· F . (n) For dilute solutions and impermeable walls, in the deterministic case, one can show that F = 0 which means that (19) becomes a homogeneous Neumann condition for the potential, ∂Φ/∂n = 0, which is the boundary condition for a dielectric boundary with no bound surface charge in the charged-fluid formulation. The derivation is well-known for binary dilute electrolytes [5], and it is straightforward to generalize it to dilute multi-ion solutions as follows. From the electroneutrality 10 T T condition z w = 0 we get z (∂w/∂n) = 0. Focusing on the dilute ions only, we have from (13) that the vanishing of the electrodiffusive flux is equivalent to ∂w (∂Φ/∂n) + MWz = 0. ∂n k T Taking the dot product with z of both sides of this equation, we obtain ∂Φ/∂n = 0 because (n) −2 z MWz ∼ λ > 0. This implies ∂w/∂n = 0 and therefore F = 0. We will assume that D d ∂Φ/∂n = 0 also holds on impermeable walls for general mixtures and even in the presence of fluctuations, even though we have not been able to rigorously justify this. It is worthwhile to note that any choice of Neumann boundary condition on the potential gives identical total electrodiffu- (n) (n) sive flux F ; the only physically-relevant boundary condition is that F vanish at impermeable walls. Only the Lorentz force in (3), which depends on Φ, is affected by the choice of Neumann boundary condition. While the Lorentz force is essential for modeling electrokinetic flows, it plays a minimal role in the problems we study here, so our choice to enforce a homogeneous condition ∂Φ/∂n = 0 for impermeable walls is inconsequential. (n) For reservoir boundaries, F is known at the boundary from the Dirichlet conditions on w, and (19) becomes an inhomogeneous Neumann condition for the potential. In summary, at a physical boundary, we impose the following boundary conditions for (7,18): (n) • F = n· F = 0 and ∂Φ/∂n = 0 for impermeable walls. • w = w with z w = 0 and (19) for reservoirs. resvr resvr Note that the condition (19) applies irrespective of whether the boundary (wall or membrane) is dielectric (polarizable) or metal (conducting); the effective condition for the potential is always Neumann, even if in the charged-fluid formulation there is a Dirichlet condition on the potential. The electroneutral boundary conditions for the velocity equation (3,4) are even harder to derive. In general, the fluid velocity on the outer boundary of the Debye layer is not zero, even for a no- slip boundary. This means that the appropriate velocity boundary condition for the electroneutral equations is a specified-slip condition, v = 0 and v nonzero. However, to our knowledge, the n τ velocity slip has only been computed using asymptotic analysis for binary electrolytes, and this analysis has not, to our knowledge, been generalized to multi-ion mixtures. For dilute electrolytes, slip expressions have been proposed without a careful asymptotic analysis, see for example (4) in [16]. Because an asymptotic analysis for multispecies electrolytes is not available, and because in the example we consider here there are no applied electric fields or highly-charged surfaces (either of which could make the apparent slip velocity large enough to play some role), in this work we 11 will simply use the same boundary condition (no-slip or free-slip) for the electroneutral and the charged-fluid formulations. For no-slip boundaries this means v = 0, which is expected to be a good approximation for dielectric boundaries if the surface charge density is sufficiently small. We emphasize, however, that an effective no-slip boundary condition is not appropriate in general (e.g., slip is important for ionic diffusiophoresis), and each specific application requires a careful consideration of the boundary condition. 3. Effective Salt Diffusion Let us define the vector field −1 mρ ¯ (Φ) T T g = z WχWz z F , (20) amb k T which simplifies for deterministic models of dilute electrolytes to z D ∇w (Φ) s s s g = − (k T ) P . (21) amb m z D w s s s s s For some specific special cases, the solution of the effective Poisson equation (18) is given by (Φ) ∇Φ = g . This is sometimes stated as a fact, see for example Eq. (3) in [16]. However, except amb (Φ) for dilute binary electrolytes and for problems in one dimension, g is, in general, not a gradient, amb unless w (and thus the denominator in (21)) can be approximated to be constant over the domain. For dilute binary electroneutral electrolytes w = −z w /z , which in the absence of fluctuations 2 1 1 2 gives (D − D ) ∇w (D − D ) (Φ) 1 2 1 1 2 −1 (k T ) g = − = − ∇ (ln w ) , (22) B 1 amb (m z D − m z D ) w (m z D − m z D ) 1 1 1 2 2 2 1 1 1 1 2 2 2 (Φ) which is indeed a gradient of a function and therefore ∇Φ = g . Substituting (22) into Fick’s amb law (13) we obtain (m z − m z ) D D 1 1 2 2 1 2 F = −ρ ∇w . (23) 1 1 (m z D − m z D ) 1 1 1 2 2 2 The effective diffusion coefficient of the salt is therefore the weighted harmonic mean (m z − m z ) D D 1 1 2 2 1 2 amb D = , (24) (m z D − m z D ) 1 1 1 2 2 2 which we will refer to as the ambipolar binary diffusion coefficient. (Φ) Note that the boundary condition (19) is consistent with ∇Φ = g on the boundary (cf. (20)). amb 12 This shows that for a dilute binary electrolyte without fluctuations the electroneutral model is equivalent to modeling a binary salt as an uncharged substance with an effective ambipolar diffusion coefficient, i.e., the two ions tend to diffuse together. However, this correspondence is not true in more general cases. Specifically, it is not valid when fluctuations are included, when the system is not dilute, or when there are more than two ions. Although the equivalence is lost, a number of prior studies [6, 7, 9] have used (24) to define effective diffusion coefficients of salts in more general situations. We will refer to this type of approach as the ambipolar approximation and investigate it in detail in Section IV B. C. Thermal Fluctuations Important quantities that can be derived from the fluctuating hydrodynamics equations are the spectra of the fluctuations at thermodynamic equilibrium, referred to as the static structure factors. These structure factors can be obtained from either the more general results derived in [1] for the charged-fluid equations, or, from equilibrium statistical mechanics. It is important to confirm that our electroneutral FHD equations give the correct spectrum of fluctuations in order to justify our formulation of the stochastic fluxes. The matrix of equilibrium structure factors can be expressed either in terms of mass or mole fractions. Here we define the matrix of static structure factors in terms of the fluctuations in the mass fractions δw around the equilibrium concentrations, which for notational brevity we denote in this section with w without any decoration, D   E c c 0 0 S (k) = δw (k) δw (k) . (25) s,s s 0 0 where s and s are two species (including s = s ), k is the wavevector, hat denotes a Fourier transform, and star denotes a complex conjugate. The static factors for an electrolyte mixture with an arbitrary number of species at thermody- namic equilibrium are [1, 11] 1 S zz S 0 0 S = S −  , (26) 2 T k λ + 1 z S z where the structure factor for a mixture of uncharged species (i.e., for z = 0) is [11] h   i −1 m ¯ T T T T S = W − ww Γ X − xx + 11 W − ww , (27) and 1 is the vector of 1’s. The Debye length can be generalized to non-ideal mixtures as 2 h   i −1 ρ mρ ¯ −2 T T T T λ = z S z = z W Γ X − xx + 11 Wz. (28) k T k T B B 13 See Eqs. (41) and (42) in [11] for a simplification for ideal mixtures, including dilute solutions. The structure factor S (k) of the total free charge density Z = ρz w is D   E 2 T T 2 T d d S = ρ z δw z δw = ρ z Sz. (29) Using the generalized definition of the Debye length (28) allows to conveniently express it as 2 2 k λ 2 T 2 T D S = ρ z Sz = ρ z S z . (30) Z 0 2 2 1 + k λ The fact that S (k) tends to zero for small wavenumbers (kλ → 0) is a manifestation of the Z D transition to the electroneutral regime at large length scales. It is important to point out that at scales much larger than the Debye length the fluctuations δw are electroneutral in addition to the electroneutral mean composition w. This means that the composition w + δw strictly remains on the electroneutral constraint at all times, consistent with our electroneutral formulation. At thermodynamic equilibrium, for length scales much larger than the Debye length, the struc- ture factor (26) simplifies to S zz S 0 0 (eln) S = lim S = S − , (31) kλ →0 z S z and this is the spectrum of fluctuations in composition in the electroneutral limit. Note that (eln) S z = 0, as expected from the electroneutrality. For dilute electrolyte solutions, which are necessarily ideal, if we consider two ions of species s and s , we have the explicit formula   −1 (eln) −1 2   S = ρ w m δ 0 − m z w (w m z ) (w 0m 0z 0 ) . (32) s s s,s k k s s s s s s s,s In Appendix B we derive the same result for a dilute binary electrolyte using equilibrium statistical mechanics, without referring to the generalized PNP equations. It can be confirmed that the electroneutral equations (3,4,7,18) are consistent with (31), which demonstrates that nothing special needs to be done in the electroneutral limit to handle the fluctu- ating diffusive fluxes except to include them in the right-hand side of the modified Poisson equation (18). III. NUMERICAL ALGORITHM In this section we describe our charged-fluid and electroneutral numerical algorithms, both of which are second-order accurate in space and time deterministically, and second-order weakly accurate for the linearized fluctuating hydrodynamics equations. The algorithms are closely based 14 on the algorithm developed for isothermal constant-density reactive multispecies mixtures of non- ionic species in our prior work [6]. The handling of the charged species and in particular the quasielectrostatic Poisson equation is described already in detail in our prior work [1]. Here we only briefly sketch the algorithmic details and focus on the key differences with our prior work. We note that special care is taken to ensure that the only difference between the charged-fluid and electroneutral algorithms is that a different elliptic equation is solved to compute the electric potential Φ. We therefore present both cases together and note any differences explicitly where necessary. A. Spatial Discretization Our spatial discretization of reaction-advection-diffusion is identical to the one used in our previous work [6], which is itself a slight modification of the methods described in [1, 11, 17], improved to accurately handle very small numbers of molecules. The spatial discretization is based on a structured-grid finite-volume approach with cell-averaged densities, electric potential, and pressure, and face-averaged (staggered) velocities. We use standard second-order stencils for the gradient, divergence, and spatial averaging in order to satisfy discrete fluctuation-dissipation balance (DFDB) [18]. The discretization of the momentum equation (3,4), including no-slip or free-slip boundary conditions, is the same as our previous works [1, 6, 11, 17], with the important caveat that the Lorentz force is evaluated as ∇· (∇Φ) ∇Φ so that the same implementation works for either the charged-fluid or the electroneutral formulations. Standard centered second-order stencils are used to discretize ∇· (∇Φ) ∇Φ on the faces of the grid. The discretization of the electrodiffusion equations (7,18) is closely based on that developed in [1, 6]. Our implementation independently tracks the densities of all species ρ but ensures the overall mass conservation in the Boussinesq limit, ρ = ρ , in each grid cell to within (Stokes) s 0 s=1 solver tolerance. For each species, we construct the mass fluxes on faces of the grid and employ the standard conservative divergence in order to guarantee conservation of mass for each species. Diffusive fluxes, including the dissipative and stochastic fluxes, are computed as described in [6]. Chemical reaction terms are local and are computed independently in each cell as in [6]. The elliptic equations (2) and (18) are discretized using a standard centered second-order stencil, and the resulting linear system is solved using a geometric multigrid algorithm [1]. For the elec- troneutral elliptic equation (18), W and Wχ are already computed on each grid face to calculate 15 T diffusive mass fluxes (see [6] for details), and therefore the non-constant coefficient ∼ z WχWz can be directly computed on each grid face. Boundary conditions for the electroneutral electrodiffusion equations (7,18) are implemented as (n) follows. For impermeable walls, the condition F = n · F = 0 is trivially implemented in our finite-volume scheme by zeroing the total mass flux (including the stochastic fluxes) on the bound- ary. The modified elliptic equation (18) is then solved with the homogeneous Neumann condition ∂Φ/∂n = 0. For reservoirs, the Dirichlet condition w = w is implemented by computing ∇x resvr at the boundary using one-sided differences and the specified values on the boundary; this then gives the dissipative portion of the diffusive mass flux F = −ρWχΓ∇x. The generation of the stochastic component of the diffusive mass flux F at the boundary is described in prior work [19]. Once F = F +F is computed on the boundary, (18) is solved with an inhomogeneous Neumann d d condition computed using (19). Advective mass fluxes ρ v are computed on each face f of the grid by first computing face- centered densities ρ = ρw = ρ w . Our implementation supports two ways to compute face- f f 0 f centered densities ρ . Centered advection uses two-point averaging of densities to faces, and is non- dissipative and thus preserves DFDB [18]. However, in order to prevent nonphysical oscillations in mass densities in high Péclet number flows with sharp gradients, we also use the Bell-Dawson- Shubin (BDS) second-order Godunov advection scheme [20]; more details about how the BDS scheme is used in our numerical implementations can be found in [17]. We note that BDS advection adds artificial dissipation and does not obey a fluctuation-dissipation principle, but is necessary for simulations where centered advection would fail due to insufficient spatial resolution. An additional complication that arises in the electroneutral limit is ensuring that advection preserves electroneutrality, i.e., ensuring that the spatial discretization maintains the continuum identity (16). Since the advection velocity used in our discretization is discretely divergence free, advection automatically maintains linear constraints on the cell-centered densities if the face den- sities ρ satisfy the linear constraint for each face f. For centered advection this is automatic because the face densities are computed by linear interpolation. For BDS advection, however, the face-centered densities are computed using a complicated space-time extrapolation that involves nonlinear “limiters,” and are not guaranteed to satisfy the same linear constraints as the cell- centered densities. It is therefore necessary to project the densities back onto all linear constraints. One such constraint is the mass conservation ρ = ρ and the other is the electroneutrality s 0 z ρ = 0. Assume we are given a composition w = ρ /ρ on face f, which does not necessar- s s f f 0 T T ily satisfy the two constraints 1 w = 1 and z w = 0. The projection onto both constraints can be 16 accomplished with the following sequence of updates: z w w ← w − z, f f z z w ← . 1 w 2 T The first update is a standard L projection onto the plane z w = 0, and the second is a simple rescaling that preserves 1 w = 1. This choice of projections is not unique and does not affect the second-order accuracy for smooth problems. B. Temporal Discretization Our second-order temporal integrator is taken from our prior work [6] and is summarized in Section III C. Unlike the trapezoidal predictor-corrector used in [1], here we use the midpoint predictor-corrector method described in [6] to accommodate our treatment of chemical reactions, and to dramatically improve the robustness for large Schmidt number [6]. Furthermore, the Boussi- nesq approximation allows us to simplify the algorithm compared to the low Mach version pre- sented in [1]. Note that relative to the algorithm in [6] we need to precompute some terms related to charged species; however, the overall update strategy remains the same. In particular, in the absence of charged species our algorithm is equivalent to that presented in [6]. Our algorithm introduces an important correction term in the right-hand side (r.h.s.) in the modified elliptic equation (18) in the corrector step. Namely, numerical tests revealed that errors due to finite tolerances in the iterative elliptic solver lead to a slow drift away from electroneutrality over many time steps. This drift can be prevented by modifying the elliptic equation as follows. Consider an Euler update of the form w (t + Δt)− w (t) mρ ¯ = −∇· F − WχWz ∇Φ . Δt k T Requiring electroneutrality at the end of the step, z w (t + Δt) = 0, without assuming electroneu- trality at the beginning of the step, we obtain the corrected elliptic equation at time t, mρ ¯ z w T T ∇· z WχWz ∇Φ = ∇· z F − . (33) k T Δt In our numerical algorithm, we only employ this correction to the elliptic equation in the corrector step. We have found this to be sufficient and to lead to a stable algorithm that maintains the charge neutrality to a relative error below solver tolerances . In practice, we find that the numerical errors We have found that in some cases (e.g., equal diffusion coefficients for all species) the r.h.s. of (33) is analytically 17 introduced by the iterative geometric multigrid elliptic solvers create localized charges but not a global charge; therefore the spatial average of the r.h.s. of (33) is zero within roundoff tolerance. Nevertheless, in order to ensure that the elliptic equation (33) is solvable, in our implementation we subtract from the r.h.s. it’s spatial average. By adding charges to the 3-species mixture test described in Section III.C.1 of [11], we have verified (not shown) that our algorithm/code reproduces the correct spectrum of electroneutral equilibrium fluctuations (31), for both ideal and non-ideal mixtures, for either periodic, reservoir, or impermeable boundaries. This validates our formulation and implementation of the stochas- tic mass flux (including boundary conditions). We have also verified (not shown) second-order deterministic accuracy for the acid-base fingering example by initializing the simulations from a smoothly perturbed sine-wave interface. C. Summary of Algorithm th n+1 We now summarize the n time step that computes state at time t = (n + 1) Δt from the state at time t = nΔt. Superscripts denote the time point at which certain quantities are 1 1 n+ /2,∗ n+ /2,∗ evaluated, for example, f = f w , (n + 1/2) Δt denotes the buoyancy force esti- mom mass mated at the midpoint. We denote with (W ) and W (for the predictor stage) and (1) mass W (for the corrector stage) collections of i.i.d. (independent and identically distributed) (2) standard normal random variables generated on control volume faces independently at each time mom T mom mom step, and W ≡ W + W . We denote collections of independent Poisson random variables generated at cell centers independently at each time step with P (predictor stage) and (1) P (corrector stage), and denote [•] ≡ max(•, 0). The notation for computing the divergence of (2) the advective fluxes using the BDS scheme is defined and explained in Section III.B.1 in [17]. We remind the reader that ρ = ρ is a constant in the Boussinesq approximation, maintained by our code to roundoff tolerance. th The n predictor-corrector update consists of the following steps: 1. Calculate predictor diffusive fluxes (deterministic and stochastic), n n 2mρ ¯ 1 n n mass F = (−ρWχΓ∇x) + Wχ W . (34) d (1) ΔV Δt/2 (nearly) zero so that numerically it is dominated by numerical noise. This make the elliptic solver do unnecessary work if we use a standard relative error tolerance based on the magnitude of the r.h.s. Instead, we use a tolerance −12 −9 δ∇· |z| F based on the absolute values of the charges per mass, where δ ∼ 10 − 10 is a relative tolerance for the iterative solver. 18 n 2. Solve the predictor elliptic equation for Φ , n n n ∇· ( ∇Φ ) = −Z if charged-fluid, otherwise (35) h  i  mρ ¯ T n T n ∇· z WχWz ∇Φ = ∇· z F . k T n n 3. Calculate predictor electrodiffusive fluxes F and chemical production rates R , mρ ¯ n n n F =F − WχWz ∇Φ , (36) k T X X n α α R = Δν P ((a ) ΔV Δt/2) . (37) s sr (1) r ΔV Δt/2 r α=± n+1,∗ n+ /2,∗ n+1,∗ 4. Solve the predictor Stokes system for v and π : ∇·v = 0 and n+1,∗ n (ρv) − (ρv) 1 n+ /2,∗ T n n n n+1,∗ n + ∇π = ∇· ρvv + ∇· η ∇v + η ∇v + f Δt 2   η k T mom n   + ∇· W + (∇·(∇Φ)) ∇Φ . ΔV Δt 5. Calculate predictor mass densities,  n n+1,∗  n v +v ρ if centered Δt Δt s 1 2 n+ /2,∗ n n n ρ = ρ + [−∇·F + m R ]− ∇· (38) s s s s n n+1,∗ 2 2 v +v Δt n n BDS ρ , ,∇·F , . s s 2 2 6. Calculate corrector diffusive fluxes,   n n mass mass 1 W + W n+ /2,∗ 1 2mρ ¯ 1 1 (1) (2) n+ /2,∗ n+ /2,∗   F = (−ρWχΓ∇x) + Wχ . ΔV Δt/2 (39) n+ /2,∗ 7. Solve the corrector elliptic equation for Φ , 1 1 1  n+ /2,∗ n+ /2,∗ n+ /2,∗ ∇·  ∇Φ = −Z if charged-fluid, otherwise n+ /2,∗ 1 n+ /2,∗ 1 mρ ¯  T n+ /2,∗ T −1 T n+ /2,∗ ∇· z WχWz ∇Φ = ∇· z F − Δt z w . k T (40) 1 1 n+ /2,∗ n+ /2,∗ 8. Calculate corrector diffusive fluxes F and chemical production rates R , n+ /2,∗ mρ ¯ 1 n+ /2,∗ 1 n+ /2,∗ n+ /2,∗ F =F − WχWz ∇Φ , (41) k T " # X X 1 1 1 1 n+ /2,∗ n α α n+ /2,∗ α n R = R + Δν P 2(a ) − (a ) ΔV Δt/2 . (42) s s sr (2) r r 2 ΔV Δt/2 r α=± 19 9. Update the mass densities, 1 n n+1,∗ n+ /2,∗ v +v h i ρ if centered 1 1 2 n+1 n n+ /2,∗ n+ /2,∗ ρ = ρ +Δt −∇·F + m R −Δt∇· s s s s n n+1,∗ 1  n+ /2,∗ n v +v BDS ρ , ,∇·F , Δt . (43) n+1 n+ /2 n+1 10. Solve the corrector Stokes systems for v and π : ∇·v = 0 and n+1 n n n+1,∗ (ρv) − (ρv) 1 1 n+ /2 T T n n n+1 n+1 ¯ ¯ + ∇π = − ∇· ρvv + ρvv + ∇· η ∇v + η ∇v Δt 2 2    s s n n+1 1 η k T η k T mom 1 B B n+ /2,∗    + ∇· + W + f 2 ΔV Δt ΔV Δt n+ /2,∗ + (∇·(∇Φ)) ∇Φ . IV. NUMERICAL STUDY OF ACID-BASE NEUTRALIZATION In our previous work [6] we studied the development of asymmetric fingering patterns arising from a gravitational instability in the presence of a neutralization reaction. In particular, we performed the first three-dimensional simulations of a double-diffusive instability occurring during the mixing of dilute aqueous solutions of HCl and NaOH in a vertical Hele-Shaw cell, as studied experimentally in [7]. In this prior study, as in all other theoretical and computational studies of this kind of instability [7, 9], we treated HCl, NaOH, and NaCl as uncharged species in the spirit of the ambipolar approximation described in Section II B 3. The acid-base neutralization reaction was written as HCl + NaOH → NaCl + H O. (44) In reality, however, the acid, the base, and the salt are all strong electrolytes and essentially + − + − completely disassociate into Na , Cl , H , and OH ions, and the neutralization reaction is simply the (essentially irreversible) formation of water, + − H + OH → H O, + − with Na and Cl being spectator ions. An important feature of this system is that the trace diffusion coefficients of the four ions are very different; specifically, using cgs units (cm /s) the −5 −5 −5 literature values are D + = 1.33 · 10 , D − = 2.03 · 10 , D + = 9.35 · 10 , and D − = Na Cl H OH −5 5.33· 10 . Although the ambipolar approximation is only strictly valid for dilute binary systems, we define effective diffusion coefficients for the neutral species by harmonic averages of the anion 20 −5 −5 and cation diffusion coefficients following (23) to obtain: D = 3.34· 10 , D = 2.13· 10 , HCl NaOH −5 and D = 1.61· 10 . NaCl Simulating this instability using the charged-fluid formulation would be infeasible because the length scales of interest are on the millimeter scale. In this work we use the electroneutral for- mulation to study this instability and assess the (in)accuracy of the commonly-used ambipolar approximation. Numerical studies based on the ambipolar approximation showed that the finger- ing instability can be triggered on a realistic time scale (as compared to experiments) purely by thermal fluctuations, without any artificial perturbations of the initial interface [6]. The studies also demonstrated that the effect of fluctuations is dominated by the contribution of the stochastic momentum flux, and not by fluctuations in the initial condition, the stochastic mass flux, or the stochastic chemical production rate. This can be understood as a consequence of the fact that advection by thermal velocity fluctuations, which are driven by the stochastic momentum flux, leads to giant concentration fluctuations in the presence of sharp concentration gradients [21–23]. These nonequilibrium fluctuations completely dominate equilibrium fluctuations at the scales of interest, and are sufficiently large to drive the fingering instability. We have confirmed that the same conclusions apply when charges are accounted for. Therefore, in the simulations reported here we do not include stochastic mass fluxes and reaction rate fluctuations, and initialize the simulations from a deterministic initial condition with a sharp interface between the acid and the base and zero fluid velocity. Because of the importance of giant concentration fluctuations to the formation of the instability, in Section IV A we first validate our algorithm and implementation by computing the spectrum of giant fluctuations in a ternary electrolyte. Then, we study the fingering instability at an acid-base neutralization front in Section IV B. A. Giant Nonequilibrium Fluctuations in Electroneutral Ternary Mixtures In this section we examine the giant concentration fluctuations in a non-reactive dilute elec- troneutral ternary electrolyte in the presence of a steady applied concentration gradient. Giant fluctuations in a binary electrolyte were studied using the charged-fluid formulation in Section V.B.2 in [1]. It was concluded there that for small wavenumbers, kλ  1, the electroneutral nonequilibrium fluctuations in a binary electrolyte can be described using the ambipolar formula- tion, as expected. Specifically, the spectrum of the giant fluctuations is the same as it would be in a solution with a single neutral species diffusing with the ambipolar diffusion coefficient (23). 21 However, this conclusion no longer holds for solutions with three or more charged species, even if dilute. Therefore, here we examine the spectrum of the giant fluctuations in a dilute solution of three ions with valencies V = V = 1 and V = −1, in the absence of gravity or reactions. In order to 1 2 3 focus on the nonequilibrium fluctuations we omit the stochastic mass flux from (7), so that the fluctuations are generated entirely by the random velocity. In arbitrary units in which k = 1 and e = 1, we set ρ = 1, T = 1 and assume equal molecular masses m = m = m = 1, and trace 1 2 3 diffusion coefficients D = 1, D = 1/2, and D = 3/2. The viscosity is set to η = 10 to give a 1 2 3 realistically large Schmidt number Sc ∼ 10 , and we set  = 0, which makes λ = 0 and removes the (fluctuating) Lorentz force from the momentum equation. The domain is quasi-two dimensional with L = L = 64 discretized with 64× 64 cells with grid spacing Δx = Δy = 1. The thickness x y of the domain is set to Δz = 10 to give weak fluctuations that can be described by the linearized fluctuating hydrodynamics equations. We impose equal and opposite macroscopic gradients for the co-ion species and no gradient for the counter-ion using reservoir boundary conditions, with −3 −3 −2 −3 imposed w = 4.5· 10 , w = 5.5· 10 , and w = 10 at the y = 0 boundary, and w = 5.5· 10 , 1 2 3 1 −3 −2 w = 4.5· 10 , and w = 10 at the y = L boundary. We set the time step size to Δt = 0.05 and 2 3 y 6 5 perform a total of 10 time steps skipping 10 steps in the beginning to allow the system to reach the steady state, after which we collect statistics on the spectrum of fluctuations S (k , k = 0). x y The theoretical spectrum of the giant fluctuations for a dilute ternary electrolyte can be com- puted by following the computation described in Section III.C in [1], and then taking the elec- troneutral limit kλ → 0. The same result can also be obtained from the electroneutral equations directly; with the help of a computer algebra system the limit kλ → 0 of the charged-fluid S (k) −4 is straightforward to compute, so we follow that route. Just as for non-ionic solutions, a k power −1 law is observed until the confinement effect becomes significant for small k  L . Following [1], we multiply the theoretical result for an unconfined bulk system by a confinement factor [24] to obtain " # k T 1 4 (1− cosh(k L )) B x y 0 0 S (k , k = 0) = f 1 + , (45) x y s,s ss ηD k k L (k L + sinh(k L )) 1 x y x y x y where our theoretical calculations predict f = 147/124, f = 219/124, and f = −177/124. 11 22 12 Note that it is sufficient to examine only the part of S corresponding to two of the charged ions (here the two co-ions), since electroneutrality dictates the spectra involving the third ion, and conservation of mass dictates the spectra involving the solvent. In Fig. 1 we compare our numerical results to the theoretical predictions (45), and find good agreement for all three structure factors. 22 -13 4×10 -13 3×10 -13 2×10 -S -13 1×10 0 0.5 1 1.5 2 Modified wavenumber k Figure 1: Spectrum of giant nonequilibrium concentration fluctuations in a ternary electrolyte mixture in the presence of an imposed concentration gradient of the two co-ions. To account for errors in the discrete approx- imation to the continuum Laplacian, the x axis shows the modified wavenumber k = sin(k Δx/2)/ (Δx/2) x x instead of k . Numerical results (symbols) for the components of k S (k , k = 0) corresponding to the x x y co-ions (positive S and S , and negative S ) are compared to the theoretical prediction (45) (lines). 11 22 12 B. Fingering Instability at an Acid-Base Front In this section we investigate the development of asymmetric fingering patterns arising from a diffusion-driven gravitational instability in the presence of a neutralization reaction. This sys- tem has been studied experimentally and theoretically using a two-dimensional Darcy advection- diffusion-reaction model [7, 9] based on an ambipolar approximation where the acid, base, and salt are treated as uncharged species instead of as disassociated ions. Here we perform large-scale three-dimensional simulations with the ions treated as individual species. Since the fingering instability is driven by the small changes of density with composition, it is crucial to first match the dependence of density on composition between the ambipolar diffusion (molecule-based) model used in Section IV.D in [6] and the electrodiffusion (ion-based) model used k S(k) in this work. Following [6, 7, 9], we assume that the solution density is linearly dependent on the solute concentrations in both cases, which is reasonable since the solutions are dilute. This gives the buoyancy force f (w) = −ρ w ge , (46) s y solute s where α is the solutal expansion coefficient, M is the molecular weight (in g/mol) of solute s, s s and the gravitational acceleration g = −ge acts in the negative y direction. For the ambipolar model, the values of α for s = HCl, NaOH, NaCl are obtained from Table II in [7]. For the ionic + − + − model, we compute the four unknown coefficients α for s = Na , Cl , H , OH by matching the dependence of density on composition between the two models for electroneutral binary solutions of HCl, NaOH, and NaCl. Only three independent coefficients α matter because electroneutrality + − fixes the concentration of the fourth ion, so we arbitrarily require that Na and Cl have the same coefficient α + = α −. It is important to observe that this procedure matches the density Na Cl between an arbitrary dilute solution of HCl, NaOH, and NaCl and the corresponding ionic solution + − − resulting after the molecules disassociate completely into Na , Cl , H , and OH ions. The reverse is not possible, that is, one cannot take an arbitrary solution of the ions and uniquely + − determine a corresponding molecular solution. In particular, a solution of only H and OH would not have a physically-reasonable density according to our model. We will validate shortly that any differences we see between the molecular and ionic models of the instability stem from the difference between standard Fickian diffusion and electrodiffusion, and not from our procedure for matching the buoyancy force. For the model setup and physical parameters, we follow Section IV.D in [6] and mimic the experiment of Lemaigre et al. [7]. We use cgs units unless otherwise specified and assume T = 293 and atmospheric pressure, neglecting any heat release in the reaction as justified in [9]. We set g = 981, ρ = 1, and η = 0.01. We consider a Hele-Shaw cell with side lengths L = L = 1.6 and x y L = 0.05, with the y-axis pointing in the vertical direction, and the z-axis being perpendicular to the glass plates. The domain is divided into 512 × 512 × 16 grid cells, which is twice finer than the grid used in [6] in order to better-resolve the sharp interface in the early stages of the mixing. We start with a gravitationally stable initial configuration, where an aqueous solution of NaOH with molarity 0.4 mol/L is placed on top of a denser aqueous solution of HCl with molarity 1 mol/L. We impose periodic boundary conditions in the x direction, no-slip impermeable walls in the z direction, and in the y direction we use free-slip reservoir boundary conditions with imposed concentrations that match the initial conditions of each layer. We use BDS advection because of 24 the presence of an initially sharp interface. Since the neutralization equilibrium lies far to the product side, we only consider the forward reaction. We use the law of mass action for a dilute solution (A4), and express the reaction propensity in terms of number densities, a = k n n for the molecule-based model, and HCl NaOH + 5 a = k n + n − for the ion-based model . In reality, neutralization is a diffusion-limited reaction H OH 11 −1 that occurs extremely fast (with rate λ ∼ 10 s ), essentially as soon as reactants encounter each −11 3 −1 other. The estimated value of k ∼ 10 cm s is impractically large, and would require an unrea- sonably small grid spacing to resolve the penetration depth (which would be on molecular scales), and an unreasonably small time step size to resolve the reactions. For our simulations, we choose a −19 smaller value k = 10 that is an order of magnitude smaller than the one used in [6], and enlarge −2 the time step size to Δt = 10 by an order of magnitude accordingly. Deterministic numerical −19 −18 studies presented in Appendix B in [6] show that increasing the rate beyond k = 10 − 10 hardly changes the results, so we believe our simulation parameters are realistic. Nevertheless, our main goal here is to compare molecule- and ion-based models and assess the accuracy of the am- bipolar approximation, so in this study it is more important to resolve the spatio-temporal scales in the problem than to match experimental observations. In Fig. 2 we compare the density profiles of Na between the model based on electroneutral electrodiffusion with ions, and that based on molecules using ambipolar diffusion coefficients. For the molecule-based simulations, we compute the density of Na assuming that the acid is com- pletely disassociated. To enable a direct comparison between the two cases, we employ the same sequence of pseudorandom numbers for the stochastic momentum flux in both cases. Although the development of the instability follows similar trends in the two cases, there are clearly-visible differ- ences between the top and bottom rows in the figure. For example, the Na fingers develop sooner and diffuse more for the ion-based simulations. These differences can also be seen by comparing the lines in Fig. 3, where we show the norm of the y component of velocity (corresponding to the progress of the instability) and the total mass of consumed H (corresponding to the production of salt in the molecule-based model) as a function of time. Our findings clearly demonstrate that quantitative predictions can only be made by solving the complete electroneutral electrodiffusion equations presented here. The ambipolar approximation can only be used as a qualitative model of the instability. Observe that the reaction rates are matched between the molecule-based model and the corresponding ion-based + − model because the number density of HCl/NaOH in the non-ionic mixture matches the number density of H /OH in the corresponding ionic mixture. 25 Figure 2: Asymmetric growth of convective fingering patterns in a Hele-Shaw cell, induced by a gravita- tional instability in the presence of a neutralization reaction. The top row corresponds to electroneutral electrodiffusion of ions, while the bottom row corresponds to ambipolar diffusion of acid, base, and salt molecules; both simulations use the same random numbers for the stochastic momentum flux. The density of Na is shown with a color scale at 20, 30, and 40 seconds (columns going left to right) from the beginning of the simulation, initialized without any fluctuations. Two-dimensional slices of the three-dimensional field + + ρ (x, y, z) are shown. The square images show ρ (x, y, z = L /2) (halfway between the glass plates) Na Na z and the thin vertical side bars show the slice ρ + (x = 0, y, z) corresponding to the left edge of the square Na images. To demonstrate that the clear difference between electrodiffusion and ambipolar diffusion is −5 caused by the large difference in the true diffusion coefficients of the ions (D + = 1.33 · 10 , Na −5 −5 −5 D − = 5.33 · 10 , D + = 9.35 · 10 , and D − = 2.03 · 10 ), we also perform simulations OH H Cl where we artificially match the diffusion coefficients for the reactant ions and molecules by setting + − −5 them to fake values, D + = D − = D = 2.13 · 10 (i.e., Na and OH ions diffuse NaOH Na OH −5 + with the same coefficient as NaOH) and D + = D − = D = 3.34 · 10 (i.e., H and Cl H Cl HCl ions diffuse with the same coefficient as HCl). In the molecule-based simulations, the diffusion coefficient of NaCl is set to the harmonic average of the two fake diffusion coefficients of Na and − + −5 Cl ions, D = 2.6 · 10 . Figure 4 compares the density of Na in ion- and molecule-based NaCl simulations using these artificial (fake) values of the diffusion coefficients. The two panels in Fig. 26 1.6e0 - 3 1.0e0 - 5 ions / real Ð ions / real Ð molecules / real Ð molecules / real Ð 8.0e0 - 6 1.2e0 - 3 ions / fake Ð ions / fake Ð molecules / fake Ð molecules / fake Ð 6.0e0 - 6 8.0e0 - 4 4.0e0 - 6 4.0e0 - 4 2.0e0 - 6 0.0e+00 0.0e+00 0 10 20 30 40 50 0 10 20 30 40 50 time t time t Figure 3: Time dependence of the norm of vertical velocity (left panel) and of the total mass of H consumed in the neutralization reaction (right panel). We compare simulations where the species are ions versus those where the species are neutral molecules (see legend). Lines are results based on the true tabulated diffusion values for the ions, while symbols show results for fake values of the ion diffusion coefficients, artificially made to be closer to each other. Figure 4: Density of Na at time t = 30s for the ion-based model (left panel) or the molecule-based model (right panel); both simulations use the same random numbers for the stochastic momentum flux. These simulations use fake values of the ion diffusion coefficients, artificially made to be closer to each other in order to make the difference between electrodiffusion and ambipolar diffusion smaller. 4 are visually almost indistinguishable, showing very little difference between electrodiffusion and ambipolar diffusion, unlike the panels in Fig. 2. This is further demonstrated by the symbols in Figure 3. This demonstrates that the difference between electrodiffusion and standard Fickian diffusion is large when the multiple ions involved diffuse with widely varying coefficients. kv k mass of consumed H V. CONCLUSIONS We formulated the electroneutral reactive generalized PNP equations and included thermal fluctuations using fluctuating hydrodynamics and the chemical master equation. The only differ- ence between the charged-fluid equations and their electroneutral limit is in the elliptic equation for the electric potential. We presented a second-order midpoint predictor-corrector scheme for both sets of equations. We studied giant nonequilibrium fluctuations in ternary electrolytes in the electroneutral limit, and demonstrated that our numerical algorithm accurately reproduces theoretical predictions. We also modeled a fingering instability at an acid-base mixing front and demonstrated that modeling the acid, base, and salt as neutral species diffusing with ambipolar diffusion coefficients leads to quantitatively-incorrect results unless the diffusion coefficients of the ions are very similar. The temporal discretization we used in this work treats mass diffusion explicitly. It can be shown that the electroneutral integrator used here is the limit Δt  λ /D of a method for the charged-fluid equations in which only the potential is treated implicitly, i.e., the Poisson equation (2) is imposed at the end instead of the beginning of an Euler update. A major challenge for the future is to develop algorithms that treat electroneutral electrodiffusion implicitly. This would require solving a coupled linear system for both the composition and the electric potential at the end of the time step. This is in some ways similar to our treatment of the velocity equation where we solve a Stokes problems for both velocity and pressure. The main challenge in developing im- plicit electrodiffusion discretizations is the development of effective preconditioners for the coupled electrodiffusion system. In this work we used Neumann boundary conditions for the potential that were consistent with electroneutrality under the assumption of no surface conduction. Future work should care- fully derive appropriate boundary conditions for the electroneutral electrodiffusion equations using asymptotic analysis, at least in the deterministic context. In this work we used the same velocity boundary conditions for the charged-fluid and electroneutral formulations because of the absence of any asymptotic theory for the effective slip for multispecies mixtures. It is important to carry out such asymptotic theory, even if only for the case of small zeta or applied potentials/fields. Finally, allowing for surface reactions in the formulation also requires changing the boundary conditions. Future developments in these directions would allow us to model catalytic micropumps [25] without having to resolve the thin Debye layers around the catalytic surfaces. 28 Acknowledgments We thank Jean-Philippe Péraud for help with comparisons between charged-fluid and elec- troneutral formulations. We would like to thank Anne De Wit for helpful discussions regarding gravitational instabilities in the presence of neutralization reactions, and thank Ehud Yariv for generously sharing his knowledge about the electroneutral limit. We also acknowledge informative discussions with Charles Peskin. This material is based upon work supported by the U.S. De- partment of Energy, Office of Science, Office of Advanced Scientific Computing Research, Applied Mathematics Program under Award Number DE-SC0008271 and under contract No. DE-AC02- 05CH11231. This research used resources of the National Energy Research Scientific Computing Center, a DOE Office of Science User Facility supported by the Office of Science of the U.S. Depart- ment of Energy under Contract No. DE-AC02-05CH11231. A. Donev was supported in part by the Division of Chemical, Bioengineering, Environmental and Transport Systems of the National Science Foundation under award CBET-1804940. Appendix Appendix A: Chemical Production Rates In this Appendix we summarize how we compute the (deterministic or stochastic) chemical pro- duction rates Ω . We consider a liquid mixture consisting of N species undergoing N elementary s s r reversible reactions of the form N N s s X X + − ν M ν M (r = 1, . . . , N ), (A1) s s r sr sr s=1 s=1 where ν are molecule numbers, and M are chemical symbols. We define the stoichiometric sr + − + coefficient of species s in the forward reaction r as Δν = ν −ν and the coefficient in the reverse sr sr sr − + − s ± reaction as Δν = ν − ν . We assume that each reaction r conserves mass, Δν m = sr sr sr s=1 sr s ± 0, and charge , Δν m z = 0, which is suitable for bulk reactions in liquids (we do not s s sr s=1 consider surface reactions here). It is important to note that all reactions must be reversible for thermodynamic consistency, although in practice some reactions can be effectively considered to be irreversible sufficiently far from thermodynamic equilibrium. The mean number of reaction occurrences in a locally well-mixed reactive cell of volume ΔV ± ± during an infinitesimal time interval dt is given as a ΔV dt, where a are the propensity density r r functions for the forward/reverse (+/−) rates of reaction r. Accordingly, the mean production rate 29 of species s in the deterministic equations is given as X X α α Ω = Δν a . (A2) sr r α=± r=1 The propensity density functions are given by the Law of Mass Action (LMA) kinetics, suitably generalized to non-dilute mixtures [6], ± ± ν sr a = κ (x γ ) , (A3) s s r r s=1 where κ (T, P ) is the rate of the forward/reverse reaction r, and γ (x, T, P ) is the activity coef- ficient of species s (for an ideal mixture, γ = 1). It is important to note that propensity density functions (A3) are expressed in terms of mole fractions x (for ideal mixtures) or activities x γ , s s s and not in terms of number densities. For reactions in a dilute solution (which is necessarily an ideal solution for sufficiently dilution), mole fractions and number densities are proportional, x ≈ m ¯ n /ρ, and one can alternatively write the LMA in the form s solv s ± ± ν sr a = k n for dilute solutions. (A4) r r s s=1 Following [6, 26], we use the Chemical Master Equation (CME) to describe fluctuations in the reaction rates for small numbers of reactive molecules. For reactions in a closed well-mixed cell of volume ΔV , the change in the number of molecules N of species s in a given cell during an infinitesimal time interval dt is expressed in terms of the number of occurrences P (a ΔV dt) of each reaction r, X X α α Ω ΔV dt = Δν P (a ΔV dt), (A5) sr r α=± r=1 where P (m) denotes a Poisson random variable with mean m. Note that the instantaneous rate of change is written as an Ito stochastic term. In the numerical algorithm described in Section III, we use a second-order tau leaping method [27], which discretizes (A5) with a finite time step size Δt. Appendix B: Electroneutral Fluctuations of Composition for a Binary Electrolyte For a binary electroneutral electrolyte, the covariance of the fluctuations of the two charged species (32) is the matrix   m w bm w ρ 1 1 2 1 (eln)   S = ,   ions 1 + b bm w bm w 2 1 2 2 30 where b = −m z /m z = V /V is the ratio of the number of atoms of the two species in one 1 1 2 2 1 2 neutral salt molecule. It is important to observe that this is not what would be predicted from a naive ambipolar approximation where one considers the two ions to be bound and diffusing with the ambipolar diffusion coefficient (24), notably, such an approximation would not give the prefactor −1 (1 + b) . −1 One can understand the prefactor (1 + b) by computing the entropy of mixing of the solution under the constraint of charge neutrality. Consider a dilute ideal solution of N molecules of a solvent species and N  N molecules of one ion and N  N molecules of another counter-ion. 1 0 2 0 For an electroneutral mixture we have the constraint N = bN . The mixture has a free energy of 2 1 mixing N N N bN 1 2 1 1 −1 (k T ) ΔG ≈ N ln − 1 + N ln − 1 = N ln − 1 + bN ln − 1 . B mix 1 2 1 1 N N N N 0 0 0 0 The second derivative of the free energy of mixing, which determines the width of the Gaussian approximation of the entropy and thus the inverse of S , is ∂ ΔG k T mix B = (1 + b) , ∂N N which has the additional prefactor (1 + b) relative to the standard result without the electroneu- trality constraint. [1] Jean-Philippe Péraud, Andy Nonaka, Anuj Chaudhri, John B. Bell, Aleksandar Donev, and Alejan- dro L. Garcia. Low mach number fluctuating hydrodynamics for electrolytes. Phys. Rev. Fluids, 1:074103, 2016. [2] Jean-Philippe Péraud, Andrew J. Nonaka, John B. Bell, Aleksandar Donev, and Alejandro L. Garcia. Fluctuation-enhanced electric conductivity in electrolyte solutions. Proceedings of the National Academy of Sciences, 114(41):10829–10833, 2017. [3] Aleksandar Donev, Alejandro L. Garcia, Jean-Philippe Péraud, Andrew J. Nonaka, and John B. Bell. Fluctuating Hydrodynamics and Debye-Hückel-Onsager Theory for Electrolytes. Current Opinion in Electrochemistry, 13:1 – 10, 2019. [4] Boyce E Griffith and Charles S Peskin. Electrophysiology. Communications on Pure and Applied Mathematics, 66(12):1837–1913, 2013. [5] Ehud Yariv. An asymptotic derivation of the thin-debye-layer limit for electrokinetic phenomena. Chemical Engineering Communications, 197(1):3–17, 2009. [6] C. Kim, A. J. Nonaka, A. L. Garcia, J. B. Bell, and A. Donev. Fluctuating hydrodynamics of reactive liquid mixtures. J. Chem. Phys., 149(8):084113, 2018. 31 [7] L. Lemaigre, M.A. Budroni, L.A. Riolfo, P. Grosfils, and A. De Wit. Asymmetric Rayleigh–Taylor and double-diffusive fingers in reactive systems. Phys. Fluids, 25:014103, 2013. [8] P. M. J. Trevelyan, C. Almarcha, and A. De Wit. Buoyancy-driven instabilities around miscible a+b → c reaction fronts: A general classification. Phys. Rev. E, 91:023001, 2015. [9] Christophe Almarcha, Philip MJ Trevelyan, Patrick Grosfils, and Anne De Wit. Thermal effects on the diffusive layer convection instability of an exothermic acid-base reaction front. Physical Review E, 88(3):033009, 2013. [10] JA Wesselingh, P Vonk, and G Kraaijeveld. Exploring the maxwell-stefan description of ion exchange. The Chemical Engineering Journal and The Biochemical Engineering Journal, 57(2):75–89, 1995. [11] A. Donev, A. J. Nonaka, A. K. Bhattacharjee, A. L. Garcia, and J. B. Bell. Low Mach Number Fluctuating Hydrodynamics of Multispecies Liquid Mixtures. Physics of Fluids, 27(3):037103, 2015. [12] Ehud Yariv. Electrokinetic self-propulsion by inhomogeneous surface kinetics. In Proceedings of the Royal Society of London A: Mathematical, Physical and Engineering Sciences, page rspa20100503. The Royal Society, 2010. [13] A. Donev, A. J. Nonaka, Y. Sun, T. G. Fai, A. L. Garcia, and J. B. Bell. Low Mach Number Fluc- tuating Hydrodynamics of Diffusively Mixing Fluids. Communications in Applied Mathematics and Computational Science, 9(1):47–105, 2014. [14] Ory Schnitzer and Ehud Yariv. Macroscale description of electrokinetic flows at large zeta potentials: Nonlinear surface conduction. Physical Review E, 86(2):021503, 2012. [15] Ory Schnitzer and Ehud Yariv. Induced-charge electro-osmosis beyond weak fields. Physical Review E, 86(6):061506, 2012. [16] Tso-Yi Chiang and Darrell Velegol. Multi-ion diffusiophoresis. Journal of colloid and interface science, 424:120–123, 2014. [17] A. J. Nonaka, Y. Sun, J. B. Bell, and A. Donev. Low Mach Number Fluctuating Hydrodynamics of Binary Liquid Mixtures. Communications in Applied Mathematics and Computational Science, 10(2):163–204, 2015. [18] A. Donev, E. Vanden-Eijnden, A. L. Garcia, and J. B. Bell. On the Accuracy of Finite-Volume Schemes for Fluctuating Hydrodynamics. Communications in Applied Mathematics and Computational Science, 5(2):149–197, 2010. [19] F. Balboa Usabiaga, J. B. Bell, R. Delgado-Buscalioni, A. Donev, T. G. Fai, B. E. Griffith, and C. S. Peskin. Staggered Schemes for Fluctuating Hydrodynamics. SIAM J. Multiscale Modeling and Simulation, 10(4):1369–1408, 2012. [20] J. B. Bell, C. N. Dawson, and G. R. Shubin. An unsplit, higher order Godunov method for scalar conservation laws in multiple dimensions. J. Comput. Phys., 74:1–24, 1988. [21] J. M. O. De Zarate and J. V. Sengers. Hydrodynamic fluctuations in fluids and fluid mixtures. Elsevier Science Ltd, 2006. [22] A. Vailati and M. Giglio. Nonequilibrium fluctuations in time-dependent diffusion processes. Phys. 32 Rev. E, 58(4):4361–4371, 1998. [23] A. Vailati, R. Cerbino, S. Mazzoni, C. J. Takacs, D. S. Cannell, and M. Giglio. Fractal fronts of diffusion in microgravity. Nature Communications, 2:290, 2011. [24] JM Ortiz de Zárate, TR Kirkpatrick, and JV Sengers. Non-equilibrium concentration fluctuations in binary liquids with realistic boundary conditions. The European Physical Journal E, 38(9):1–9, 2015. [25] Maria J Esplandiu, Ali Afshar Farniya, and David Reguera. Key parameters controlling the performance of catalytic motors. The Journal of chemical physics, 144(12):124702, 2016. [26] C. Kim, A. J. Nonaka, A. L. Garcia, J. B. Bell, and A. Donev. Stochastic simulation of reaction- diffusion systems: A fluctuating-hydrodynamics approach. J. Chem. Phys., 146(12), 2017. Software available at https://github.com/BoxLib-Codes/FHD_ReactDiff. [27] D.F. Anderson and J.C. Mattingly. A weak trapezoidal method for a class of stochastic differential equations. Communications in Mathematical Sciences, 9(1):301–318, 2011.

Journal

Condensed MatterarXiv (Cornell University)

Published: Sep 21, 2018

There are no references for this article.