betaFeedback

Reading v1View latest version

WorksPhysics and Astronomy

Neural-Network-based Viscosity Closure for Non-Newtonian Multiphase Flows

Abstract

Materials used in polymer-based additive manufacturing processes, such as Digital Light Processing (DLP) and direct ink writing (DIW), typically exhibit non-Newtonian rheology. Carreau-Yasuda and power-law models describe basic shear-thinning and shear-thickening behavior well, but applying them to a new material requires choosing a functional form, deriving it, and re-implementing it inside the flow solver. We present a deployment workflow in which a neural network trained on experimental rheometry data serves as the viscosity closure inside a Cahn-Hilliard-Navier-Stokes (CHNS) finite element solver. The learned closure is generalized Newtonian: viscosity depends only on the local shear rate at the current instant. Lipschitz regularization during training produces smooth viscosity predictions, and the trained network is exported in the Open Neural Network Exchange (ONNX) format and queried by the solver at runtime via the ONNX runtime, without solver modification or network reimplementation. The framework is built on a parallel octree-based adaptive mesh refinement infrastructure that concentrates resolution at the fluid interface. We validate the CHNS solver against benchmark shear-thinning bubble-rise cases from the literature, reproducing reported bubble shapes across varying power-law indices and Weber numbers. We characterized two silicone ink formulations, recorded their rise dynamics in perfluorodecalin on high-speed video, and used the resulting data to test the full workflow. Simulated rise velocities fall within the experimentally measured spread, and the simulated steady-state droplet shape agrees with the observed one. This work contributes to a growing body of literature on integrating neural constitutive closures into multiphysics simulations, and demonstrates a practical path for deploying experimentally trained rheological surrogates inside finite element solvers.

Introduction

Multiphase flows involving non-Newtonian materials are central to a broad class of polymer-based additive manufacturing processes. In Digital Light Processing (DLP), patterned light from a projector cures a photosensitive resin layer by layer; the resin must flow into place for each new layer while solidifying under exposure. In direct ink writing (DIW) and embedded 3D printing, a non-Newtonian ink is extruded into a support bath, and the interaction between the ink and the surrounding fluid governs filament shape, placement, and print fidelity. In both cases, the coupling between flow, solidification, and the shear-dependent rheology of the printing material determines print resolution and the mechanical properties of the final part. This coupling is difficult to probe directly during printing. As a controlled proxy, we analyze the buoyant rise of a non-Newtonian silicone ink droplet through a viscous fluid, a configuration that imposes shear histories comparable to those encountered during extrusion- and resin-based printing.

Many empirical constitutive laws have been developed to describe non-Newtonian viscosity. The Carreau–Yasuda [1] and power-law [2] formulations are the standard tools for shear-thinning and shear-thickening behavior in computational studies, capturing the rheology of many polymeric and soft-matter systems with a small number of interpretable parameters. The fixed, low-dimensional form that gives these models their interpretability also limits them: extending them to viscoelastic, thixotropic, or yield-stress behavior generally requires deriving and implementing a new constitutive law inside the flow solver, and refitting parameters for each new system. Freund and Ewoldt [3] used Bayesian inference to show that good fits to rheological data are insufficient grounds for model selection; models with fewer, well-constrained parameters are more credible than empirical forms that achieve closer fits through added flexibility. The same concern applies to data-driven constitutive surrogates, including neural networks, which carry genuine model-selection risk and require appropriate regularization when used as replacements for parameterized constitutive forms.

The literature on bubble rise in non-Newtonian fluids and on data-driven constitutive modeling has grown substantially, but the two have rarely been coupled: few studies deploy constitutive surrogates trained on experimental rheometry inside high-fidelity multiphase solvers. The remainder of this section reviews three relevant areas: numerical modeling of bubble dynamics in two-phase flow solvers, bubble dynamics in non-Newtonian fluids with established constitutive relations, and recent work on data-driven or machine-learning-assisted constitutive modeling. Bubble dynamics in immiscible fluids has been studied extensively with interface-capturing methods. Two-phase simulations have progressed from qualitative shape comparisons to quantitative benchmarks that track bubble circularity, center-of-mass height, and mean rise velocity, providing reproducible targets for code verification in capillary-sensitive flows [4]. Three-dimensional studies [5, 6, 7, 8] have captured complex deformation, instability, and breakup behavior under varied flow conditions. Tripathi et al. [9] mapped the transitions between axisymmetric rise, skirt formation, path instability, and breakup as functions of the Galilei and Eötvös numbers, and the same group subsequently showed that thermocapillary effects in self-rewetting fluids can reverse or arrest bubble motion [10]. The Cahn–Hilliard–Navier–Stokes (CHNS) formulation [11, 12, 13] has become a standard diffuse-interface approach for interfacial evolution, coalescence, and breakup with thermodynamic consistency [14, 15, 16]. CHNS solvers paired with adaptive mesh refinement [17, 18, 19, 20] resolve steep gradients at phase boundaries efficiently [14].

The studies above mostly concern Newtonian fluids. In non-Newtonian systems [21, 22, 23, 24], viscosity varies with local shear rate and affects bubble deformation, rise velocity, and interfacial stability. Premlata et al. [25] studied an air bubble rising in shear-thinning and shear-thickening liquids with the Carreau–Yasuda model, finding that stronger shear-thinning raises rise velocity and reduces deformation, and that higher Galilei numbers increase shape distortion. Zhang et al. [24] combined experiment and simulation for a single bubble rising in shear-thinning Carreau fluids and reported that stronger shear-thinning lowers local viscosity near the bubble surface, enhances rise velocity, and produces oblate shapes with high-viscosity wakes. Pang and Lu [26] examined bubbles rising in shear-thinning power-law fluids under varied gravity conditions and showed that a lower power-law index produces a detached high-viscosity region behind the bubble, while higher Galilei and Eötvös numbers produce larger wake structures and stronger deformation. Hu and Pang [27] added that the liquid-to-bubble viscosity ratio also affects rise velocity, with high ratios inducing unsteady deformation at low power-law indices.

Data-driven constitutive modeling has emerged as an alternative to fixed parametric forms when the rheology is difficult to capture in closed form. Physics-informed neural networks (PINNs) have been used to infer unknown constitutive relations and material parameters from sparse or indirect flow observations. Tartakovsky et al. [28] showed that PINNs can recover nonlinear diffusion and transport relations from limited state measurements without prescribing a functional form. Reyes et al. [29] extended this approach to non-Newtonian fluids, learning shear-dependent viscosity distributions from velocity data in three-dimensional flows. For viscoelastic fluids, where stress depends on both kinematics and material memory, Thakur et al. [30] introduced ViscoelasticNet, which infers stress fields and material parameters from velocity data alone, even with sparse or noisy inputs.

Mahmoudabdolzchelo and Jamali [31] introduced Rheology-Informed Neural Networks (RhINNs), which embed systems of ordinary differential equations describing thixotropic and viscoelastic behavior into the network architecture. The same model predicts stress evolution under varied flow protocols and infers hidden material parameters from limited experimental data, providing accurate forward and inverse solutions for thixotropic elasto-viscoplastic fluids even under sparse or noisy inputs. A later extension [32] combines sparse regression with automatic differentiation to construct closed-form constitutive relations from experimental data without relying on a predefined model, identifying the dominant physical terms in a material’s stress response and producing compact, thermodynamically consistent equations that generalize across flow protocols. Tucny et al. [33] used PINNs to recover effective viscosity functions in rarefied gas flows governed by the generalized Stokes model, learning transport coefficients consistent with kinetic theory in regimes where continuum assumptions fail. Lardy et al. [34] inferred viscoplastic constitutive laws directly from velocity field data, identifying parameters and selecting between Herschel–Bulkley and Carreau models even under noisy or sparse sampling.

The present work develops a deployment workflow for using neural-network viscosity closures inside a Cahn–Hilliard–Navier–Stokes multiphase flow solver. We train a Lipschitz-regularized neural network on experimental rheometry data to serve as a surrogate for shear-dependent viscosity; the regularization ensures the learned function remains smooth enough to use as a constitutive closure in a flow solver. The trained network is exported to the Open Neural Network Exchange (ONNX) format and queried at each iteration of the finite element solver, allowing neural constitutive models to be integrated into existing multiphase flow frameworks without reimplementation or solver modification. We characterized two silicone ink formulations, recorded their rise dynamics in perfluorodecalin on high-speed video, and used the resulting data to test the full workflow; simulated rise velocities fall within the experimentally measured spread across four independent cases.

The paper is organized as follows. Section 2 presents the governing Cahn–Hilliard–Navier–Stokes equations and their nondimensional form. Section 3 describes the solution strategy and the neural-network-based viscosity model, including its integration into the finite element solver via ONNX. Section 4 details the experimental setup and rheological characterization of the two silicone ink formulations. Section 5 presents the validation results and the comparison against experimental droplet rise dynamics. Section 6 summarizes the findings and outlines directions for future work. The image processing pipeline used to extract rise velocities from the high-speed video is described in Appendix A.

Governing Equations

The governing Cahn-Hilliard-Navier-Stokes [14] equations are given in equations (1a) to (3c). In these equations, u[m s−1]u[\mathrm{m}\,\mathrm{s}^{-1}] is the velocity vector, ρ[kg m−3]\rho[\mathrm{kg}\,\mathrm{m}^{-3}] is the mixture density, J[kg m−2 s−1]J[\mathrm{kg}\,\mathrm{m}^{-2}\,\mathrm{s}^{-1}] is the diffusive flux, σ[N m−1]\sigma[\mathrm{N}\,\mathrm{m}^{-1}] is the surface tension, ϵ[m]\epsilon[\mathrm{m}] is the interfacial thickness, ϕ\phi is the dimensionless phase field, p[N m−2]p[\mathrm{N}\,\mathrm{m}^{-2}] is the pressure, η[N s m−2]\eta[\mathrm{N}\,\mathrm{s}\,\mathrm{m}^{-2}] is the mixture viscosity, g[m s−2]g[\mathrm{m}\,\mathrm{s}^{-2}] is the gravitational acceleration, m[kg−1 m3 s]m[\mathrm{kg}^{-1}\,\mathrm{m}^{3}\,\mathrm{s}] is the mobility and μ[N m−2]\mu[\mathrm{N}\,\mathrm{m}^{-2}] is the chemical potential. The quantities ρ+\rho^{+} and ρ−\rho^{-} denote the densities of the two fluid phases, while η+\eta^{+} and η−\eta^{-} represent their corresponding viscosities. The phase field ϕ\phi distinguishes the two fluids by taking the value +1+1 in one phase and −1-1 in the other, and varies continuously across the interface between them. The index ii and jj denote the number of spatial dimensions. In the present work, η+\eta^{+} denotes the viscosity of the non-Newtonian fluid, while η−\eta^{-} corresponds to that of the Newtonian phase. The non-Newtonian viscosity is evaluated using a neural network trained on rheological data ((5)). The network takes the local shear rate (γ˙[s−1])(\dot{\gamma}[\mathrm{s}^{-1}]) as input and predicts the corresponding viscosity ((6)). The shear rate, in turn, is computed from the strain-rate tensor (Dij[s−1])(D_{ij}[\mathrm{s}^{-1}]) as defined in (7).

∂ui∂xi=0(1)\frac{\partial u_i}{\partial x_i}=0 \tag*{(1)}
∂(ρui)∂t+∂(ρuiuj)∂xj+∂(Jjui)∂xj+σϵ∂∂xj(∂ϕ∂xi∂ϕ∂xj)+∂p∂xi−∂∂xj(η∂ui∂xj)−ρgi=0(2)\frac{\partial(\rho u_i)}{\partial t}+\frac{\partial(\rho u_i u_j)}{\partial x_j}+\frac{\partial(J_j u_i)}{\partial x_j}+\sigma\epsilon\frac{\partial}{\partial x_j}\left(\frac{\partial\phi}{\partial x_i}\frac{\partial\phi}{\partial x_j}\right)+\frac{\partial p}{\partial x_i}-\frac{\partial}{\partial x_j}\left(\eta\frac{\partial u_i}{\partial x_j}\right)-\rho g_i=0 \tag*{(2)}
∂ϕ∂t+∂(uiϕ)∂xi−∂∂xi(m∂μ∂xi)=0(3)\frac{\partial\phi}{\partial t}+\frac{\partial(u_i\phi)}{\partial x_i}-\frac{\partial}{\partial x_i}\left(m\frac{\partial\mu}{\partial x_i}\right)=0 \tag*{(3)}
σϵϕ3−σϵϕ−σϵ∂∂xi(∂ϕ∂xi)−μ=0(4)\frac{\sigma}{\epsilon}\phi^3-\frac{\sigma}{\epsilon}\phi-\sigma\epsilon\frac{\partial}{\partial x_i}\left(\frac{\partial\phi}{\partial x_i}\right)-\mu=0 \tag*{(4)}

Here, Jj=(ρ−−ρ+)2m∂μ∂xjJ_j=\frac{\left(\rho^{-}-\rho^{+}\right)}{2}m\frac{\partial\mu}{\partial x_j}, ρ=ρ++ρ−2+ρ+−ρ−2ϕ\rho=\frac{\rho^{+}+\rho^{-}}{2}+\frac{\rho^{+}-\rho^{-}}{2}\phi and η=η++η−2+η+−η−2ϕ\eta=\frac{\eta^{+}+\eta^{-}}{2}+\frac{\eta^{+}-\eta^{-}}{2}\phi.

η+=η+(Neural Network)(5)\eta^{+} = \eta^{+}(\textit{Neural Network}) \tag*{(5)}
γ˙=2DijDij(6)\dot{\gamma} = \sqrt{2D_{ij}D_{ij}} \tag*{(6)}
Dij=12(∂ui∂xj+∂uj∂xi)(7)D_{ij} = \frac{1}{2}\left(\frac{\partial u_i}{\partial x_j}+\frac{\partial u_j}{\partial x_i}\right) \tag*{(7)}

Dimensionless form of Cahn–Hilliard–Navier–Stokes equations

The dimensionless form of the Cahn–Hilliard–Navier–Stokes equations is obtained by introducing length scale lrl_r, time scale trt_r, velocity scale uru_r, density scale ρr\rho_r, diffusive flux scale JrJ_r, pressure scale prp_r, viscosity scale ηr\eta_r, gravitational acceleration scale grg_r and chemical potential scale μr\mu_r. Surface tension σ\sigma, interfacial thickness ϵ\epsilon and mobility mm are taken as constants. The following are the derived scales, non-dimensional numbers and hence the dimensionless form of the governing equations, where ReRe is the Reynolds number, FrFr is the Froude number, WeWe is the Weber number, PePe is the Peclet number and CnCn is the Cahn number.

tr=lrur,pr=σlr,μr=σlr,Jr=ρrmσlr2t_r=\frac{l_r}{u_r},\qquad p_r=\frac{\sigma}{l_r},\qquad\mu_r=\frac{\sigma}{l_r},\qquad J_r=\frac{\rho_r m\sigma}{l_r^2}
Re=urρrlrηr,Fr=urgrlr,We=ρrur2lrσ,Pe=urlr2mσ,Cn=ϵlrRe=\frac{u_r\rho_r l_r}{\eta_r},\qquad Fr=\frac{u_r}{\sqrt{g_r l_r}},\qquad We=\frac{\rho_r u_r^2 l_r}{\sigma},\qquad Pe=\frac{u_r l_r^2}{m\sigma},\qquad Cn=\frac{\epsilon}{l_r}
∂ui∂xi=0(8)\frac{\partial u_i}{\partial x_i}=0 \tag*{(8)}
∂(ρui)∂t+∂(ρuiuj)∂xj+1Pe∂(Jjui)∂xj+CnWe∂∂xj(∂ϕ∂xi∂ϕ∂xj)+1We∂p∂xi−1Re∂∂xj(η∂ui∂xj)−1Fr2ρgi=0(9)\frac{\partial(\rho u_i)}{\partial t}+\frac{\partial(\rho u_i u_j)}{\partial x_j}+\frac{1}{Pe}\frac{\partial(J_j u_i)}{\partial x_j}+\frac{Cn}{We}\frac{\partial}{\partial x_j}\left(\frac{\partial\phi}{\partial x_i}\frac{\partial\phi}{\partial x_j}\right)+\frac{1}{We}\frac{\partial p}{\partial x_i}-\frac{1}{Re}\frac{\partial}{\partial x_j}\left(\eta\frac{\partial u_i}{\partial x_j}\right)-\frac{1}{Fr^2}\rho g_i=0 \tag*{(9)}
∂ϕ∂t+∂(uiϕ)∂xi−1Pe∂∂xi(∂μ∂xi)=0(10)\frac{\partial\phi}{\partial t}+\frac{\partial(u_i\phi)}{\partial x_i}-\frac{1}{Pe}\frac{\partial}{\partial x_i}\left(\frac{\partial\mu}{\partial x_i}\right)=0 \tag*{(10)}
1Cnϕ3−1Cnϕ−Cn∂∂xi(∂ϕ∂xi)−μ=0(11)\frac{1}{Cn}\phi^3-\frac{1}{Cn}\phi-Cn\frac{\partial}{\partial x_i}\left(\frac{\partial\phi}{\partial x_i}\right)-\mu=0 \tag*{(11)}

Here, Jj=(ρ−−ρ+)2∂μ∂xjJ_j=\frac{(\rho^{-}-\rho^{+})}{2}\frac{\partial\mu}{\partial x_j}, ρ=ρ++ρ−2+ρ+−ρ−2ϕ\rho=\frac{\rho^{+}+\rho^{-}}{2}+\frac{\rho^{+}-\rho^{-}}{2}\phi and η=η++η−2+η+−η−2ϕ\eta=\frac{\eta^{+}+\eta^{-}}{2}+\frac{\eta^{+}-\eta^{-}}{2}\phi

η+=η+(Neural Network)\eta^{+}=\eta^{+}(\textit{Neural Network})
γ˙=2DijDij(12)\dot{\gamma}=\sqrt{2D_{ij}D_{ij}} \tag*{(12)}
Dij=12(∂ui∂xj+∂uj∂xi)D_{ij}=\frac{1}{2}\left(\frac{\partial u_i}{\partial x_j}+\frac{\partial u_j}{\partial x_i}\right)

Numerical Methodology

Solution Strategy

The solver builds on the in-house Cahn–Hilliard–Navier–Stokes (CHNS) framework developed by Khanwale et al. [15]. The coupled system is advanced with a block-iterative time-stepping strategy: at each time step, the Cahn–Hilliard equations are solved first, followed by the Navier–Stokes equations (Figure 1). The coupling variables from one equation are held constant during the solve of the other.

Flow chart showing the solution strategy: start time $t=0$, initialize $\phi,\mu,u,p$, begin inner iteration $k=0$, solve Cahn–Hilliard equations and compute $\phi,\mu$, solve Navier–Stokes equations and compute $u,p$ using $\phi,\mu$, check whether $k=k_{\max}$ and advance the inner iteration if not, check whether $t=t_{\max}$ and advance time $t=t+\Delta t$ if not, then end time at $t=t_{\max}$

Figure 1. Flow Chart for the Solution Strategy

The Cahn–Hilliard equation is treated as a nonlinear system and solved with the Newton-Raphson method. For the Navier–Stokes system, a projection-based semi-implicit scheme [15] is used, with the convection term ∂j(uiuj)\partial_j(u_i u_j) linearized [35] using the advecting velocity from the previous time step. The same block-iterative philosophy applies within the Navier–Stokes solve: the velocity prediction, pressure Poisson, and velocity correction equations are solved as separate sub-problems. The projection procedure computes an intermediate velocity using the current pressure, solves a pressure Poisson equation, and corrects the velocity to enforce incompressibility. This decoupling avoids the cost of the fully-coupled saddle-point solve, while preserving second-order accuracy, energy stability, and mass conservation. The residual-based variational multiscale (RBVMS) formulation [35] provides stabilization in advection-dominated regimes. The framework is parallelized with octree-based adaptive mesh refinement (AMR), concentrating resolution near the moving fluid interface. For highly deforming cases such as a rising bubble, the AMR mesh provides a substantial speedup over a uniform fine mesh [15].

Neural Network for Viscosity Prediction

A neural network learns the viscosity-shear-rate relation directly from data, without committing to a functional form such as power-law or Carreau–Yasuda. To keep the learned function smooth and bounded in derivative, Lipschitz regularization [36, 37] is applied during training. Lipschitz continuity bounds how rapidly a function can vary with respect to its input. A function f(x)f(x) is Lipschitz continuous if there exists a constant λL>0\lambda_L > 0 such that

∥f(x1)−f(x2)∥≤λL∥x1−x2∥.\lVert f(x_1) - f(x_2) \rVert\le\lambda_L \lVert x_1 - x_2 \rVert.

For differentiable functions, the Mean Value Theorem ((13)) relates this to the norm of the derivative, so a bounded derivative ((14)) is sufficient for Lipschitz continuity with constant λL\lambda_L.

∥f(x1)−f(x2)∥∥x1−x2∥=∥f′(x)∥(13)\frac{\lVert f(x_1) - f(x_2) \rVert}{\lVert x_1 - x_2 \rVert} = \lVert f'(x) \rVert \tag*{(13)}
∥f′(x)∥≤λL,(14)\lVert f'(x) \rVert\le\lambda_L, \tag*{(14)}

Mean squared error (MSE) loss alone is often insufficient when the training data contains noise: the network can overfit by learning highly oscillatory functions with large derivatives (fig:2a), which then generalize poorly to unseen inputs and produce non-physical viscosity predictions. Lipschitz regularization addresses this by adding a penalty on the input gradient, bounding how rapidly the network output can change with respect to its input (fig:2b). The total loss is given in (15), where α\alpha is the regularization weight and ∇xfθ(x)\nabla_x f_\theta(x) is the gradient of the network output with respect to its input.

Ltotal=MSE⏟data fit+α∥∇xfθ(x)∥⏟smoothness,(15)\mathcal{L}_{\mathrm{total}} = \underbrace{\mathrm{MSE}}_{\text{data fit}} + \alpha\underbrace{\lVert\nabla_x f_\theta(x) \rVert}_{\text{smoothness}}, \tag*{(15)}

We use a fully connected feedforward neural network with two hidden layers of 64 neurons each and hyperbolic-tangent (Tanh) activations. The network takes the scalar shear rate γ˙\dot{\gamma} as input and returns the scalar viscosity η+\eta^+. The shear-rate and viscosity data span several decades, so training is carried out in log–log space, with log⁡10γ˙\log_{10}\dot{\gamma} as input and ln⁡η+\ln\eta^+ as output; the transforms are absorbed into a thin wrapper at export time, so the deployed ONNX model accepts physical shear rate and returns physical viscosity directly. Training uses the Adam optimizer with a

Comparison between regular and Lipschitz regularized neural networks in predicting a noisy function

Figure 2. Comparison between regular and Lipschitz regularized neural networks in predicting a noisy function.

learning rate of 10−310^{-3}, full-batch updates, and 50,000 epochs. The loss function is the Lipschitz-regularized mean-squared error in (15), with regularization weight α=10−4\alpha= 10^{-4} selected by manual tuning. The benchmark networks (Section 5.1) are trained on shear-rate/viscosity pairs generated from the analytical Carreau–Yasuda formula with the parameters in Table 1; one network per parameter set. The droplet-rise networks (Section 5.3) are trained on 31 shear-rate/viscosity pairs per material, obtained by averaging three independent rheometer sweeps over 0.1–100 s−1\mathrm{s}^{-1} as described in Section 4. In both settings the data are split 80/20 into training and validation subsets, and the weights that minimize validation loss are retained for export. Reducing the hidden-layer width from 64 to 16 neurons produces an essentially identical η(γ˙)\eta(\dot{\gamma}) curve, so the result is insensitive to network width over this range. On the silicone-ink rheometer data, where measurement noise is modest, the Lipschitz regularization functions less as a denoising mechanism and more as a smoothness prior that controls extrapolation behavior outside the sampled shear-rate range.

ParameterCase 1Case 2Case 3Case 4
Reynolds numberReRe3333
Weber NumberWeWe2020205
Froude NumberFrFr1.01.01.01.0
Cahn NumberCnCn0.010.010.010.01
Peclet NumberPePe3333.333333.333333.333333.33
Density of heavy fluidρ+\rho^{+}1.01.01.01.0
Density of light fluidρ−\rho^{-}0.0010.0010.0010.001
Zero-shear viscosity of heavy fluidηo+\eta_{o}^{+}1.01.01.01.0
Infinite-shear viscosity of heavy fluidη∞+\eta_{\infty}^{+}1/501/501/501/50
Viscosity of light fluidη−\eta^{-}0.010.010.010.01
Power-law indexnn0.80.40.60.6
Relaxation time constantλ\lambda48.548.548.548.5

Table 1. Benchmark simulation parameters for the four bubble-shape comparison cases. For each case, synthetic shear-rate/viscosity training data are generated from the Carreau–Yasuda formula with the listed parameters, and a dedicated neural network is trained on that dataset and used as the viscosity closure in the simulation.

The architecture is shown in Figure 3. The trained network is exported to the Open Neural Network Exchange (ONNX) format [38], a framework-independent representation of machine learning models. The exported model is loaded into the flow solver at runtime via the ONNX runtime: at each iteration, the solver passes the local shear rate to the model and receives the corresponding viscosity. This avoids reimplementing the network inside the solver, and avoids the overhead of calling out to a separate Python process for each evaluation.

Neural network architecture

Figure 3. Neural network architecture

Experimental Set Up

Bubble Rise with Non-Newtonian Fluid Droplet

Silicone oil (polydimethylsiloxane, PDMS, 1000 cSt, Gelest), fumed silicon dioxide, and perfluorodecalin was purchased from ThermoFisher Scientific and a pigment, Silc Blue Pig, was purchased from Smooth-on. Droplet inks were made by combining PDMS with 1.0 weight percent Silc Blue Pig to provide visual contrast within the high-speed motion videos. Either 1.0 weight percent fumed silicon dioxide (Material A) or 0.5 weight percent fumed silicon dioxide (Material B) was also incorporated to provide different viscous behavior. Each ink formulation was rigorously mixed using a Hauschild SpeedMixer at 3000 rpm for three minutes.

The experimental setup for the bubble rise is shown in Figure 4. An acrylic box was made to protect the experiment from external air drafts or dust contamination. The needle to form droplets, either a 20G (outer diameter of 0.908 mm) or 25G (outer diameter of 0.515 mm), was attached to a customized acrylic cuvette. The dimensions of the cuvette were chosen to mitigate edge effects on the rising droplet. The cuvette was mounted on a lab jack with a 1/4-inch breadboard and placed on an isolation table to remove external vibrations.

Schematic for rising droplet experimental setup

Figure 4. Schematic for rising droplet experimental setup.

Samples were loaded into a syringe and connected to the needle in the acrylic cuvette by appropriately sized tubing. The syringe was driven by a syringe pump, where minimum pressure was applied to allow droplets to form in the bath in the cuvette and to snap off with minimal initial velocity. The cuvette was filled with perfluorodecalin to maximize the travel height of each droplet within the imaging frame. Videos were captured using a Phantom Miro C211 with a 20 mm lens and a frame rate of 1000 fps. Videos were processed using PCC software (Phantom) and ImageJ.

Bubble Ink Characterization

Shear rate vs. viscosity plots were generated using an AR-G2 Rheometer from TA Instruments using 40 mm parallel plates at a gap height of 0.5 mm. Samples were pre-sheared at 100 s−1100\ \mathrm{s}^{-1} for 60 seconds, followed by an equilibration time of 60 minutes to account for thixotropic behavior. After equilibration, logarithmic sweeps were performed from 0.1 s−10.1\ \mathrm{s}^{-1} to 100 s−1100\ \mathrm{s}^{-1}. This was repeated three times for each material and averaged to be used for simulations. The averaged shear-rate–viscosity curves for the two materials are shown in Figure 5.

Steady-shear viscosity curves for Materials A and B

Figure 5. Steady-shear viscosity as a function of shear rate for the two silicone ink formulations used in the droplet rise experiments.

The surface tension of the fluids was measured by performing reverse pendant drop tensiometry using a Theta Flex tensiometer from Biolin Scientific. A customized acrylic cuvette, similar to the cuvette in Figure 4, was filled with perfluorodecalin. A 1 mL precision syringe with a hooked needle attachment to form the pendant drop was filled with either Material A or Material B, which was then submerged into the cuvette. The surface tension was measured by taking the average of three separate 10-second videos.

Rise velocities and droplet trajectories were extracted from the high-speed video recordings using a custom OpenCV-based image processing algorithm that performs adaptive thresholding, morphological cleanup, and interface tracking across successive frames. A full description of the algorithm, together with a representative illustration of the detected interfaces, is provided in Appendix A; the implementation is available at https://github.com/baskargroup/fluidFlowVideoAnalysis.

Results and Discussion

Validation with Benchmark Problems

We validate the framework against the benchmark of a single bubble rising in a quiescent shear-thinning fluid reported by Pang and Lu [26], in which the background fluid follows the Carreau–Yasuda law. We compare bubble shapes at a quasi-steady time across four cases at varying power-law index nn and Weber number WeWe (Cases 1–4, Table 1). For each case we compare three shapes: the one reported by Pang and Lu, the one from our solver with the analytical Carreau–Yasuda closure, and the one from our solver with a Lipschitz-regularized neural network closure trained on synthetic shear-rate/viscosity data generated from the same analytical formula and exported to ONNX. For an additional case at Re=3Re = 3, We=5We = 5, n=0.4n = 0.4 (Case 5), we also compare the simulated rise velocity against the terminal velocity reported by Pang and Lu. Agreement between the analytical-CY and NN runs isolates the neural-constitutive pipeline itself, encompassing the trained network, its ONNX export, and its integration with the solver; agreement of both with Pang and Lu confirms that the underlying solver is consistent with prior work.

The non-dimensional Carreau–Yasuda law used by Pang and Lu [26] is

ηo+(γ˙)=η∞++(ηo+−η∞+)[1+(λγ˙)2](n−1)/2(16)\eta_o^+(\dot{\gamma}) = \eta_\infty^+ + \left(\eta_o^+ - \eta_\infty^+\right)\left[1 + \left(\lambda\dot{\gamma}\right)^2\right]^{(n-1)/2} \tag*{(16)}

where, in non-dimensional form, ηo+\eta_o^+ and η∞+\eta_\infty^+ are the zero-shear and infinite-shear viscosities, λ\lambda is the relaxation time constant, nn is the power-law index, and γ˙\dot{\gamma} is the shear rate defined in (12). We use this law in two ways: as the analytical reference closure inside our solver, and as the generator of synthetic training data for the neural-network closure. Parameters for the four shape-comparison cases are given in Table 1. Case 5 shares the structural settings of Case 4, with the power-law index changed to n=0.4n = 0.4.

Figure 6 shows the problem setup. The simulations in this section are two-dimensional, matching the setup of Pang and Lu [26]. The computational domain has length l=4.0l = 4.0 and height h=8.0h = 8.0, with a circular bubble of radius ro=0.5r_o = 0.5 placed initially at (xo,yo)=(2.0,2.0)(x_o, y_o) = (2.0, 2.0). With no characteristic velocity available, the reference velocity is chosen so that the Froude number is unity, ur=grlu_r = \sqrt{g r_l}. The Peclet number follows from the scaling relation Pe=1/(3Cn2)Pe = 1/(3Cn^2) for the chosen Cahn number CnCn [39]. The bubble diameter is the length scale (lr=2rol_r = 2r_o), and the heavier fluid sets the density and viscosity scales (ρr=ρ+\rho_r = \rho^+, ηr=η+\eta_r = \eta^+). The top and bottom walls are no-slip (ui=0u_i = 0). The side walls use free-slip (u1=0u_1 = 0, ∂u2/∂x1=0\partial u_2/\partial x_1 = 0). The phase field is given zero normal gradient on all walls (ni ∂ϕ/∂xi=0n_i\,\partial\phi/\partial x_i = 0, ni ∂μ/∂xi=0n_i\,\partial\mu/\partial x_i = 0).

Schematic for droplet rising problem

Figure 6. Schematic for droplet rising problem.

For Case 5, Pang and Lu [26] report a terminal velocity, which lets us compare it against both of our simulated trajectories. Figure 7 shows the normalized rise velocities from our solver with the analytical Carreau–Yasuda closure and with the trained neural-network closure, along with the Pang and Lu terminal velocity as a horizontal dashed line. All values are normalized by the corresponding n=0.2n = 0.2 terminal velocity, matching the convention of Pang and Lu’s Figure 10. Both simulated trajectories rise monotonically, reach a peak, and settle onto a quasi-steady plateau. The NN plateau is 0.9608 and the analytical-CY plateau is 0.9609, a difference of about 0.01%. Both differ from the Pang and Lu reference value of 0.9533 by approximately 0.8%.

Normalized rise velocity versus non-dimensional time for Case 5

Figure 7. Normalized rise velocity versus non-dimensional time for Case 5 (Re=3Re = 3, We=5We = 5, n=0.4n = 0.4). Velocities are normalized by the corresponding n=0.2n = 0.2 terminal velocity, matching the convention of Figure 10 in Pang and Lu [26]. The solid blue curve uses the analytical Carreau–Yasuda closure and the dashed red curve uses the trained neural-network closure; the black dashed horizontal line is the terminal velocity reported by Pang and Lu for the Ga=3Ga = 3, Eo=5Eo = 5, n=0.4n = 0.4 case. The two simulated trajectories are visually indistinguishable and both plateau close to the Pang and Lu reference.

Bubble shape at quasi-steady time

Figure 10. (a) Bubble shape at quasi-steady time.

Figure 8 shows the three-way shape comparisons for the four cases. In each case, the analytical-CY and neural-network shapes are visually indistinguishable, confirming that the neural closure reproduces the analytical target inside the solver. Both also agree with the shapes reported by Pang and Lu [26], confirming solver consistency with prior work.

Comparison of bubble shapes for four cases, showing Pang and Lu, Analytical Carreau–Yasuda, and Neural network results; (a) Case 1 ($n = 0.8$, $We = 20$), (b) Case 2 ($n = 0.4$, $We = 20$), (c) Case 3 ($n = 0.6$, $We = 20$), and (d) Case 4 ($n = 0.6$, $We = 5$)

Figure 8. Comparison of the bubble shape between experimental, analytical, and our neural network-based approach.

The shapes vary with the governing dimensionless parameters in the expected way. Across Cases 1–3 (all at We=20We = 20, fig:8a–fig:8c), reducing the power-law index nn from 0.8 to 0.4 produces progressively greater deformation and a more pronounced skirted shape: lower nn means stronger shear-thinning, which lowers the effective viscosity around the bubble and lets it deform more easily under buoyancy. Comparing Case 3 (n=0.6n = 0.6, We=20We = 20, fig:8c) with Case 4 (n=0.6n = 0.6, We=5We = 5, fig:8d) shows the effect of Weber number: at We=5We = 5, surface tension dominates inertia and the bubble retains a near-elliptical shape. The agreement among Pang and Lu [26], the analytical-CY runs, and the NN runs across this range of nn and WeWe supports both the solver and the neural-constitutive pipeline.

Synthetic Non-Monotonic Case

The benchmark cases in Section 5.1 use a Carreau–Yasuda constitutive law, which is monotone in shear rate. To test the pipeline on a viscosity shape outside this family, we construct a synthetic constitutive law in which η(γ˙)\eta(\dot{\gamma}) first decreases with shear rate and then increases at high shear:

η+(γ˙)=η∞++(η0+−η∞+)[1+(λγ˙)2](n1−1)/2+Kγ˙n2.(17)\eta^{+}(\dot{\gamma}) = \eta_{\infty}^{+} + \left(\eta_{0}^{+} - \eta_{\infty}^{+}\right)\left[1 + (\lambda\dot{\gamma})^2\right]^{(n_{1}-1)/2} + K\dot{\gamma}^{n_{2}}. \tag*{(17)}

The first two terms reproduce a Carreau–Yasuda-type shear-thinning branch with zero-shear viscosity η0+\eta_{0}^{+}, infinite-shear floor η∞+\eta_{\infty}^{+}, relaxation time λ\lambda, and exponent n1<1n_{1} < 1. The third term adds a power-law thickening branch with coefficient KK and exponent n2>1n_{2} > 1, so the viscosity curve is non-monotonic in γ˙\dot{\gamma}. Parameters are listed in Table 2.

ParameterSymbolValue
Zero-shear viscosityηo+\eta_o^+20.0
Infinite-shear viscosityη∞+\eta_\infty^+0.2
Relaxation timeλ\lambda8.0
Shear-thinning exponentn1n_10.35
Thickening coefficientKK0.015
Thickening exponentn2n_21.3

Table 2. Constitutive parameters for the synthetic non-monotonic case.

Synthetic non-monotonic constitutive law

Figure 9. Synthetic non-monotonic constitutive law.

Shear-thinning–to–thickening crossovers of this kind are reported for associative polymer solutions and concentrated particulate suspensions [40].

The flow setup matches Case 4 of Section 5.1: Re=3Re = 3, We=5We = 5, Fr=1Fr = 1, Cn=0.01Cn = 0.01, Pe=3333.33Pe = 3333.33, with the same domain, initial bubble position, and boundary conditions. Only the constitutive law changes. We run two simulations: one in which the solver evaluates (17) directly at each iteration, and one in which the solver evaluates a Lipschitz-regularized neural network trained on shear-rate/viscosity pairs generated from (17) and exported to ONNX. The training procedure is the same as in Section 5.1.

fig:10a compares the bubble shapes at the quasi-steady time, and Figure 10b compares the rise velocity trajectories. The analytical-law and network simulations produce matching results in both. This shows that the workflow handles a constitutive shape outside the standard shear-thinning class without modification to the network architecture, training procedure, or solver. Compared with the purely shear-thinning benchmark Case 4 at the same flow conditions, the bubble here remains nearly spherical. This is consistent with the non-monotonic constitutive law: the shear-thickening branch increases viscosity in regions of high strain rate, which resists deformation.

Rise velocity versus non-dimensional time

Figure 10b. (b) Rise velocity versus non-dimensional time.

Droplet Rise Simulations

The experiments use two silicone-based materials, Material A and Material B, containing 1.0 and 0.5 weight percent silica respectively. Their measured viscosity-shear-rate curves are shown in Figure 5; Material A has the higher zero-shear viscosity. For each material, the viscosity at each shear rate was averaged over three independent rheometer trials, and the averaged data were used as input to the simulations. Droplets were generated using two needle gauges, 20G (outer diameter 0.908 mm) and 25G (outer diameter 0.515 mm). Cases 1 and 3 use the 20G needle and Cases 2 and 4 use the 25G needle. In our setup the droplet size at detachment is set by the combined effects of needle geometry, ink viscosity, and pinch-off dynamics, and is only weakly sensitive to needle outer diameter in the range tested; the four cases therefore span two ink formulations and two release conditions, giving an independent test of the framework for each material.

Figure 10: Synthetic non-monotonic case. (a) Bubble shape at quasi-steady time. (b) Rise velocity versus non-dimensional time. In both panels: solid blue is the solver with the analytical constitutive law as closure; red is the solver with the neural-network closure trained on data from the analytical law.

Comparison of neural network prediction and experimental data for Material B

Figure 11b. (b) Material B (0.5 wt% fumed silica)

Figure 11: Comparison of the trained Lipschitz-regularized neural network closure with the averaged rheometer measurements for the two silicone ink formulations. Open circles: experimental rheometer data. Solid blue line: prediction from the trained neural network used as the viscosity closure in the droplet rise simulations. Both axes are non-dimensional, scaled by the reference quantities defined in Section 5.3.

Comparison of neural network prediction and experimental data for Material A

Figure 11. (a) Material A (1.0 wt% fumed silica)

The simulations in this section are three-dimensional, matching the experiments. We non-dimensionalize using the following reference scales. The reference length lrl_r is the maximum horizontal extent of the initial droplet shape extracted from the experiment. The reference density and viscosity are those of the Newtonian background fluid (perfluorodecalin): ρr=ρbg=1920 kg/m3\rho_r = \rho_{bg} = 1920\ \mathrm{kg/m^3} and ηr=ηbg=0.0051 Pa⋅s\eta_r = \eta_{bg} = 0.0051\ \mathrm{Pa \cdot s}. The reference gravity is gr=9.81 m/s2g_r = 9.81\ \mathrm{m/s^2}. With no characteristic velocity available from the experiments, the reference velocity is set so that the Froude number is unity, ur=grlru_r = \sqrt{g_r l_r}, with corresponding time scale tr=lr/urt_r = l_r/u_r. The Peclet number follows from the scaling relation Pe=1/(3Cn2)Pe = 1/(3Cn^2) for the chosen Cahn number CnCn [39].

Figure 11 shows the trained network alongside the rheometer measurements in non-dimensional form. Figures 13–16 show the phase-field evolution for the four cases. Each simulation is initialized with the droplet shape extracted directly from the corresponding experimental frame, so the initial geometries differ between cases. In every case, the droplet evolves toward a near-spherical shape as it rises, regardless of its initial shape.

The Material B curve shows a mild change in slope around γ˙∗≈5×10−3\dot{\gamma}^{*} \approx5 \times10^{-3}, suggesting more than one shear-thinning regime. The neural closure learns this shape directly from the data, without committing to a functional form.

To quantify shape agreement, we compute the Hausdorff [41] and Chamfer [42] distances between the simulated droplet contour and the experimental contour extracted from the high-speed video, for each of the four cases. For two finite point sets AA and BB, these are defined as

ParameterCase 1Case 2Case 3Case 4
MaterialAABB
Reynolds numberReRe53.814953.998464.439960.5272
Froude NumberFrFr1.01.01.01.0
Cahn NumberCnCn0.010.010.010.01
Peclet NumberPePe3333.333333.333333.333333.33
Weber NumberWeWe6.5366.5668.3117.645
Density of background fluidρbg\rho_{bg}1.01.01.01.0
Density of dropletρd\rho_{d}0.510.510.510.51
Viscosity of background fluidηbg\eta_{bg}1.01.01.01.0

Table 4. Simulation parameters for the droplet rise cases — non-dimensional.

dH(A,B)=max⁡{max⁡a∈Amin⁡b∈B∥a−b∥, max⁡b∈Bmin⁡a∈A∥a−b∥},(18)d_H(A,B) = \max\left\{ \max_{a \in A}\min_{b \in B}\lVert a-b\rVert,\ \max_{b \in B}\min_{a \in A}\lVert a-b\rVert\right\}, \tag*{(18)}
dC(A,B)=1∣A∣∑a∈Amin⁡b∈B∥a−b∥+1∣B∣∑b∈Bmin⁡a∈A∥a−b∥,(19)d_C(A,B) = \frac{1}{\lvert A\rvert}\sum_{a \in A}\min_{b \in B}\lVert a-b\rVert+ \frac{1}{\lvert B\rvert}\sum_{b \in B}\min_{a \in A}\lVert a-b\rVert, \tag*{(19)}

where ∥⋅∥\lVert\cdot\rVert is the Euclidean norm. The Hausdorff distance is the worst-case nearest-neighbor deviation; the Chamfer distance is the symmetric mean nearest-neighbor deviation. Table 5 reports the values for all four cases.

MetricCase 1Case 2Case 3Case 4
Hausdorff distance0.0442820.0788210.0507320.066279
Chamfer distance0.0402800.0622290.0515140.056702

Table 5. Hausdorff and Chamfer distances between the simulated and experimentally observed droplet contours for the four droplet rise cases. Each contour is normalized by the average of its horizontal and vertical extents (lr,avgl_{r,\mathrm{avg}}) before comparison, accounting for the changing aspect ratio of deforming droplets; the reported values are dimensionless fractions of the average droplet size. Normalizing instead by the initial droplet horizontal extent dd (Table 3) yields relative errors within the same range. Smaller values indicate closer agreement.

ParameterCase 1Case 2Case 3Case 4
MaterialAABB
Needle gauge20G25G20G25G
Density of background fluid (kg/m3kg/m^{3})ρbg\rho_{bg}1920192019201920
Density of droplet (kg/m3kg/m^{3})ρd\rho_{d}970970970970
Viscosity of background fluid (Pa⋅sPa \cdot s)ηbg\eta_{bg}0.00510.00510.00510.0051
Horizontal Extent of droplet (mmmm)dd1.27711.28001.44011.3812
Surface Tension (N/mN/m)σ\sigma0.00470.00470.00470.0047

Table 3. Simulation parameters for the droplet rise cases — dimensional.

Case 1 phase-field evolution at four times

Figure 13. Case 1 (Material A, 20G needle): phase-field evolution.

Case 2 phase-field evolution at four times

Figure 14. Case 2 (Material A, 25G needle): phase-field evolution.

Four panels showing Case 3 phase-field evolution at $t = 0$, $t = 2.5$, $t = 5$, and $t = 10$ for a Material B, 20G needle

Figure 15. Case 3 (Material B, 20G needle): phase-field evolution.

Four panels showing Case 4 phase-field evolution at $t = 0$, $t = 2.5$, $t = 5$, and $t = 10$ for a Material B, 25G needle

Figure 16. Case 4 (Material B, 25G needle): phase-field evolution.

The Hausdorff distances span 0.044–0.079 and the Chamfer distances span 0.040–0.062, with the smallest values for Case 1 and the largest for Case 2. Each contour is normalized by the average of its horizontal and vertical extents before comparison, so these values are fractions of the average droplet size: simulated and experimental contour points are within 4–6% of the average droplet size (Chamfer), and the worst-case deviation is bounded by about 8% (Hausdorff). Figure 12 shows the simulated and experimental contours overlaid for each case, with the simulated shape closely tracking the experimental one across all four. The neural-constitutive workflow therefore reproduces the experimentally observed droplet shape to within a few percent across all four cases.

Overlay of simulated and experimental droplet contours for the four cases

Figure 12. Overlay of simulated and experimental droplet contours for the four cases. Solid red line: experimental contour. Dashed blue line: simulated contour.

Figure 17 shows the rise velocity for all four cases. The simulations use one trained Lipschitz-regularized neural network per material as the non-Newtonian viscosity closure, trained on the rheometer data in Figure 5 and exported to ONNX. The rise velocity is computed by tracking the topmost point of the droplet interface in both simulation and experiment. The violin plots show the distribution of measured rise velocities across each experimental trial. The simulated trajectory increases, reaches a peak, and oscillates around a quasi-steady value, falling within the experimental spread for all four cases.

Computed and experimentally measured rise velocities for the four droplet cases

Figure 17. Computed and experimentally measured rise velocities for the four droplet cases (Cases 1–2: Material A; Cases 3–4: Material B). The violin plots show the distribution of measured rise velocities over the duration of each droplet’s rise, and the curve shows the simulated rise velocity from the neural-constitutive CHNS solver.

Scope of the Validation and Practical Considerations

The two validation studies test different aspects of the framework. In the benchmark cases (Section 5.1), the neural network is trained on synthetic data generated from an analytical Carreau–Yasuda law, and the analytical law is also available as a reference inside our solver, so the comparison checks the neural-constitutive pipeline against a known target. In the droplet cases (Section 5.3), the network is trained on experimental rheometry and the “true” constitutive law is unknown, so the comparison checks the full end-to-end workflow on real data. Agreement in both is needed before drawing conclusions from the pipeline. In Figure 17, the violin plots show the distribution of measured rise velocities over the duration of each droplet’s rise. We compare the simulated quasi-steady rise velocity against this distribution; in all four cases it falls within the measured range. ONNX inference for a scalar-input, scalar-output network of this size is cheap compared to the linear-algebra cost of the Navier–Stokes and Cahn–Hilliard solves at each time step, so replacing the analytical viscosity evaluation with a neural one adds negligible runtime overhead.

The rheometer sweeps cover shear rates from 0.1 to 100 s−1s^{-1}, while local shear rates near the droplet interface can briefly exceed this range. In this regime the Lipschitz regularization bounds the rate at which the predicted viscosity can change with respect to input shear rate, which prevents unphysical oscillations outside the training distribution.

Conclusions

We presented a deployment workflow for data-driven constitutive modeling in non-Newtonian multiphase flows, with a Lipschitz-regularized neural network as the viscosity closure inside a Cahn–Hilliard–Navier–Stokes finite element solver. The network is trained on experimental rheological data and exported in the Open Neural Network Exchange (ONNX) format, so it can be loaded into the solver at runtime without reimplementation or solver modification. We validated the underlying CHNS solver against benchmark bubble rise cases in shear-thinning fluids, with agreement on bubble shape across varying power-law indices and Weber numbers. We then applied the workflow to silicone ink droplets rising in perfluorodecalin. Simulated rise velocities fell within the experimentally measured spread for all four cases, and simulated and experimental droplet contours agreed in Hausdorff distance to within approximately 8% and in Chamfer distance to within approximately 6% of the average droplet size.

Code and Data Availability

The trained ONNX viscosity models, training scripts, averaged rheometer data, and benchmark input data supporting this study are available at https://github.com/baskargroup/neuralViscosityCHNS. The image processing pipeline used to extract rise velocities from the high-speed video is available at https://github.com/baskargroup/fluidFlowVideoAnalysis.

Acknowledgments

This work was funded by the National Science Foundation under award number DMREF 2323715/2323716.

Image Processing Framework

To extract rise velocity and trajectory data from the high-speed videos, a custom image processing algorithm was developed for systematic detection and tracking of bubble interfaces across successive video frames. Bubble interfaces are the boundaries between the bubble and surrounding medium that appear as distinct contours in video recordings. The methodology employs a series of image processing steps to transform raw video frames into clearly defined bubble boundaries that can be tracked over time. The processing pipeline begins with frame-by-frame preprocessing to enhance the visibility of interfaces. Each frame undergoes grayscale conversion, adaptive thresholding to handle varying lighting conditions, and morphological operations to clean up noise and enhance boundary definition. This process results in binary images where the bubble interfaces appear as connected black regions against a white background.

Bubble tracking process showing original video frames and corresponding frames with tracked bubbles

Figure A.18. Bubble tracking process showing original video frames (top row) and corresponding frames with tracked bubbles after detection (bottom row).

Once the interfaces are identified in each frame, a tracking system follows their movement across the video sequence. The tracking algorithm uses multiple features to establish correspondence between interfaces in consecutive frames. For each detected interface, the system extracts key properties including its central position, area, shape characteristics, and boundary curvature. These properties serve as a “signature” that helps identify the same interface in subsequent frames. The tracking process works by comparing interface properties between frames and establishing the most likely matches based on several factors: spatial proximity (interfaces typically move limited distances between frames), area consistency (interfaces usually maintain similar size), and morphological similarity (shape characteristics tend to evolve gradually). When a match is found, the interface position is added to the existing trajectory. If no suitable match exists, a new interface track is initialized.

The algorithm is implemented using OpenCV for image processing with Python as the base language. This implementation efficiently handles challenges such as occlusion, bubble merging or splitting, and tracking multiple interfaces simultaneously. The system maintains unique identifiers for each tracked interface, enabling consistent analysis of individual bubble behavior throughout the video sequence. The code repository is available at https://github.com/baskargroup/fluidFlowVideoAnalysis.

Algorithm 1 Bubble Interface Detection and Tracking

Require: F\mathcal{F} (frame directory), τ\tau (frame template), Θ\Theta (parameter set)

Ensure: B\mathcal{B} (set of bubbles with kinematic data)

  1. Image Preprocessing:

  2. for each frame fi∈Ff_i \in\mathcal{F} do

  3. Convert fif_i to grayscale representation IiI_i

  4. Apply adaptive thresholding: Ti=AdaptiveThreshold⁡(Ii,ΘblockSize,ΘconstantSub)T_i = \operatorname{AdaptiveThreshold}(I_i, \Theta_{\text{blockSize}}, \Theta_{\text{constantSub}})

  5. Apply morphological closing with kernel size Θkernel\Theta_{\text{kernel}}

  6. Generate labeled components with connectivity Θconnectivity\Theta_{\text{connectivity}}

  7. Filter components by area threshold ΘminSize\Theta_{\text{minSize}}

  8. if ΘfillHoles=True\Theta_{\text{fillHoles}} = \text{True} then

  9. Fill enclosed regions in remaining components

  10. end if

  11. Store binary frame BiB_i

  12. end for

  13. Interface Detection and Tracking:

  14. Initialize bubble set B←∅\mathcal{B} \leftarrow\varnothing

  15. for each binary frame BiB_i in temporal sequence do

  16. Extract connected regions representing bubble-surrounding interfaces Ri={ri,1,ri,2,…,ri,k}R_i = \{r_{i,1}, r_{i,2}, \ldots, r_{i,k}\}

  17. for each interface region ri,j∈Rir_{i,j} \in R_i do

  18. Extract interface properties (centroid xi,jx_{i,j}, area, shape, boundary curvature)

  19. Find potential matching interfaces in existing tracked bubbles based on proximity

  20. if interface match found then

  21. Select best match using interface position, area, and morphological similarity

  22. Update existing bubble trajectory with new interface position

  23. else

  24. Initialize new bubble with current interface position and properties

  25. end if

  26. end for

  27. end for

  28. Data Export and Visualization:

  29. Generate trajectory plots with consistent axis scales

  30. Export interface data for subsequent analysis

References

  1. [1]K. Yasuda, R. Armstrong, R. Cohen, Shear flow properties of concentrated solutions of linear and star branched polystyrenes, Rheologica Acta 20 (1981) 163–178.
  2. [2]T. F. Tadros, Rheology of dispersions: principles and applications, John Wiley & Sons, 2011.
  3. [3]J. B. Freund, R. H. Ewoldt, Quantitative rheological model selection: good fits versus credible models using bayesian inference, Journal of Rheology 59 (2015) 667–701.
  4. [4]S. Hysing, S. Turek, D. Kuzmin, N. Parolini, E. Burman, S. Ganesan, L. Tobiska, Quantitative benchmark computations of two-dimensional bubble dynamics, International Journal for Numerical Methods in Fluids 60 (2009) 1259–1288.
  5. [5]B. Bunner, G. Tryggvason, Direct numerical simulations of three-dimensional bubbly flows, Physics of Fluids 11 (1999) 1967–1969.
  6. [6]M. Sussman, E. G. Puckett, A coupled level set and volume-of-fluid method for computing 3d and axisymmetric incompressible two-phase flows, Journal of computational physics 162 (2000) 301–337.
  7. [7]J. Hua, J. F. Stene, P. Lin, Numerical simulation of 3d bubbles rising in viscous liquids using a front tracking method, Journal of Computational Physics 227 (2008) 3358–3382.
  8. [8]M. R. Pivello, M. M. Villar, R. Serfaty, A. M. Roma, A. d. Silveira-Neto, A fully adaptive front tracking method for the simulation of two phase flows, International Journal of Multiphase Flow 58 (2014) 72–82.
  9. [9]M. K. Tripathi, K. C. Sahu, R. Govindarajan, Dynamics of an initially spherical bubble rising in quiescent liquid, Nature communications 6 (2015) 6268.DOI
  10. [10]M. K. Tripathi, K. Sahu, G. Karapetsas, K. Sefiane, O. Matar, Non-isothermal bubble rise: non-monotonic dependence of surface tension on temperature, Journal of Fluid Mechanics 763 (2015) 82–108.DOI
  11. [11]R. Chella, J. Vinals, Mixing of a two-phase fluid by cavity flow, Physical Review E 53 (1996) 3832.
  12. [12]D. Jacqmin, Calculation of two-phase navier–stokes flows using phase-field modeling, Journal of computational physics 155 (1999) 96–127.
  13. [13]V. E. Badalassi, H. D. Ceniceros, S. Banerjee, Computation of multiphase systems with phase field models, Journal of computational physics 190 (2003) 371–397.
  14. [14]M. A. Khanwale, Energy stable and conservative numerical schemes for simulating two-phase flows using Cahn-Hilliard Navier Stokes equations, Ph.D. thesis, Iowa State University, 2021.
  15. [15]M. A. Khanwale, K. Saurabh, M. Ishii, H. Sundar, J. A. Rossmanith, B. Ganapathysubramanian, A projection-based, semi-implicit time-stepping approach for the cahn-hilliard navier-stokes equations on adaptive octree meshes, Journal of Computational Physics 475 (2023) 111874.
  16. [16]A. Rabeh, M. A. Khanwale, J. J. Lee, B. Ganapathysubramanian, Modeling and simulations of high-density two-phase flows using projection-based cahn-hilliard navier-stokes equations, arXiv preprint arXiv:2406.17933 (2024).arxiv.org/abs/2406.17933
  17. [17]M. J. Berger, P. Colella, Local adaptive mesh refinement for shock hydrodynamics, Journal of computational Physics 82 (1989) 64–84.
  18. [18]K. Schmidmayer, F. Petitpas, E. Daniel, Adaptive mesh refinement algorithm based on dual trees for cells and faces for multiphase compressible flows, Journal of Computational Physics 388 (2019) 252–278.
  19. [19]C.-H. Yang, G. Scovazzi, A. Krishnamurthy, B. Ganapathysubramanian, Simulating incompressible flows over complex geometries using the shifted boundary method with incomplete adaptive octree meshes, Journal of Computational Physics (2025) 114334.
  20. [20]C.-H. Yang, G. Scovazzi, A. Krishnamurthy, B. Ganapathysubramanian, Octree-based adaptive mesh refinement and the shifted boundary method for efficient fluid dynamics simulations, Advances in Computational Science and Engineering 4 (2025) 57–84.
  21. [21]R. P. Chhabra, S. A. Patel, Bubbles, drops, and particles in non-Newtonian fluids, CRC press, 2023.
  22. [22]J. Tsamopoulos, Y. Dimakopoulos, N. Chatzidai, G. Karapetsas, M. Pavlidis, Steady bubble rise and deformation in newtonian and viscoplastic fluids and conditions for bubble entrapment, Journal of Fluid Mechanics 601 (2008) 123–164.
  23. [23]R. Clift, J. Grace, M. Weber, Drops, bubbles and particles, 1978.
  24. [24]L. Zhang, C. Yang, Z.-S. Mao, Numerical simulation of a bubble rising in shear-thinning fluids, Journal of Non-Newtonian Fluid Mechanics 165 (2010) 555–567.
  25. [25]A. Premlata, M. K. Tripathi, B. Karri, K. C. Sahu, Dynamics of an air bubble rising in a non-newtonian liquid in the axisymmetric regime, Journal of non-Newtonian fluid mechanics 239 (2017) 53–61.
  26. [26]M. Pang, M. Lu, Numerical study on dynamics of single bubble rising in shear-thinning power-law fluid in different gravity environment, Vacuum 153 (2018) 101–111.
  27. [27]B. Hu, M. Pang, Numerical study on the influence of liquid viscosity ratio on the hydrodynamics of a single bubble in shear-thinning liquid, Applied Mathematical Modelling 103 (2022) 122–140.
  28. [28]A. M. Tartakovsky, C. O. Marrero, P. Perdikaris, G. D. Tartakovsky, D. Barajas-Solano, Learning parameters and constitutive relationships with physics informed deep neural networks, arXiv preprint arXiv:1808.03398 (2018).arxiv.org/abs/1808.03398
  29. [29]B. Reyes, A. A. Howard, P. Perdikaris, A. M. Tartakovsky, Learning unknown physics of non-newtonian fluids, Physical Review Fluids 6 (2021) 073301.
  30. [30]S. Thakur, M. Raissi, A. M. Ardekani, Viscoelasticnet: A physics informed neural network framework for stress discovery and model selection, Journal of Non-Newtonian Fluid Mechanics 330 (2024) 105265.
  31. [31]M. Mahmoudabadbozchelou, S. Jamali, Rheology-informed neural networks (RhINNs) for forward and inverse metamodelling of complex fluids, Scientific reports 11 (2021) 12015.
  32. [32]M. Mahmoudabadbozchelou, K. M. Kamani, S. A. Rogers, S. Jamali, Unbiased construction of constitutive relations for soft materials from experiments via rheology-informed neural networks, Proceedings of the National Academy of Sciences 121 (2024) e2313658121.
  33. [33]J.-M. Tucny, M. Durve, A. Montessori, S. Succi, Learning of viscosity functions in rarefied gas flows with physics-informed neural networks, Computers & Fluids 269 (2024) 106114.
  34. [34]M. Lardy, S. Tlili, S. Gsell, Inferring viscoplastic models from velocity fields: a physics-informed neural network approach, arXiv preprint arXiv:2506.17681 (2025).arxiv.org/abs/2506.17681
  35. [35]B. Khara, S. Murugaivan, S. Dhakshinam moorthy, M. Khanwale, M.-C. Hsu, B. Ganapathysubramanian, A semi-implicit variational multiscale formulation for the incompressible navier–stokes equations via exact adjoint linearization, arXiv preprint arXiv:2512.21773 (2025).arxiv.org/abs/2512.21773
  36. [36]E. Negrini, G. Citti, L. Capogna, System identification through lipschitz regularized deep neural networks, Journal of Computational Physics 444 (2021) 110549.
  37. [37]H.-T. D. Liu, F. Williams, A. Jacobson, S. Fidler, O. Litany, Learning smooth neural functions via lipschitz regularization, in: ACM SIGGRAPH 2022 Conference Proceedings, 2022, pp. 1–13.
  38. [38]O. R. developers, Onnx runtime, https://onnxruntime.ai/, 2021. Version: 1.15.1.
  39. [39]F. Magaletti, F. Picano, M. Chinappi, L. Marino, C. M. Casciola, The sharp-interface limit of the cahn–hilliard/navier–stokes model for binary fluids, Journal of Fluid Mechanics 714 (2013) 95–126.
  40. [40]N. J. Wagner, J. F. Brady, Shear thickening in colloidal dispersions, Physics Today 62 (2009) 27–32.
  41. [41]D. P. Huttenlocher, G. A. Klanderman, W. J. Rucklidge, Comparing images using the hausdorff distance, IEEE Transactions on pattern analysis and machine intelligence 15 (2002) 850–863.
  42. [42]G. Borgefors, Hierarchical chamfer matching: A parametric edge matching algorithm, IEEE Transactions on pattern analysis and machine intelligence 10 (1988) 849–865.

Paper details

vlnc:W_rs5z3d3b
Published
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents