# Modelling pH as function of time and position

I already posted this on the Engineering Stack Exchange under Chemical Engineering as I don't know where it's a better fit. I have a system whose initial state consists of three different sections with different chemical composition. All sections are aqueous solutions of different $$\mathrm{pH}$$ that are brought into contact for $$t \gt 0$$. The system is isothermal in each section and is of equal temperature in all sections and is assumed to remain isothermal, as heat generation is not considered. Section 1 (the leftmost section) is basic and contains reagent 1, section 2, the middle section, contains just water at a $$\textrm{pH}$$ of 7 and section 3, the rightmost section, is acidic. Section 1 and 3 are of equal size, whereas section 2 is larger. The system is three-dimensional, but can be reduced to one dimension due to symmetry (it is a tube in which angular and radial coordinates are assumed to not play a role). All sections can be considered equal in terms of physical properties (viscosity, density, etc.). I would like to model the $$\mathrm{pH}$$ as a function of time and position as there are reactions occurring whose reaction rate is a function of $$\mathrm{pH}$$. There is no convection, only diffusion. I already tried setting up a PDE system using $$\frac{\partial c_i}{\partial t}= D\nabla^2 c_i + r_i(\mathrm{pH},T)$$ and solving it in Matlab, while setting a very high rate constant for the recombination of $$\ce{H+}$$ and $$\ce{OH-}$$. The Matlab solver fails as the recombination kinetics are too fast, but lowering them is not an option, as this wouldn't represent reality anymore (acid-base reactions are thought of the be instantaneous). How could I rewrite my PDE system to model the evolution of the $$\mathrm{pH}$$ at every position as well as calculate the concentrations of products and educts of reactions that depend on $$\mathrm{pH}$$ (but are only catalysed by it), without using reaction kinetics for the recombination of $$\ce{H+}$$ and $$\ce{OH-}$$ to make use of the fact that this reaction is instantaneous?

• First I doubt that there is a closed solution. Second you have not given key details to even begin to work on the problem. All sections start at the same temperature? What is the physical shape of the three sections? Viscosity of the three sections the same? and so on...
– MaxW
Sep 8, 2020 at 22:27
• Just updated the question to contain more information Sep 9, 2020 at 0:56
• When reaction is instantaneous, there's no reason to consider it at all. Sep 9, 2020 at 1:21
• Often in cases like this its is necessary to use scaled units, say time in microsec, distance in mm etc to whatever suits your system. This may need some fiddling to get right. Sometimes dimensionless units are used but these are often hard to workout. Black-box integrators can be 'too smart for their own good ' and coding up, say, a simple modified Euler method will work, where the integrator fails, and can give essentially identical results. Sep 9, 2020 at 7:30
• continues..The true H+OH reaction rate constant is so large that it will be diffusion limited (or controlled) ($k_{effective}=4\pi N RD$, R sum of radii, N Avogadro const, D diff coeff.) and so you may be able to use this to simplify the scheme. Sep 9, 2020 at 7:30

To answer my own question: Using either the diffusion limited or the literature values of the acid-base neutralisation (Baldyga et al., Non-isothermal Micromixing in Turbulent Liquids: Theory and Experiment), I was able to simulate the $$\mathrm{pH}$$ as a function of time by making the simplifying assumption of equal diffusion coefficients of proton and hydroxide ions. I re-expressed the proton concentration in terms of $$\mathrm{pH}$$: $$\frac{\textrm{d} c_{\textrm{H^+}}}{\textrm{d} \mathrm{pH}} = -\ln (10) \cdot 10^{-\mathrm{pH}}$$ plugged this into my original equation and made everything dimensionless.