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, is the velocity vector, is the mixture density, is the diffusive flux, is the surface tension, is the interfacial thickness, is the dimensionless phase field, is the pressure, is the mixture viscosity, is the gravitational acceleration, is the mobility and is the chemical potential. The quantities and denote the densities of the two fluid phases, while and represent their corresponding viscosities. The phase field distinguishes the two fluids by taking the value in one phase and in the other, and varies continuously across the interface between them. The index and denote the number of spatial dimensions. In the present work, denotes the viscosity of the non-Newtonian fluid, while 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 as input and predicts the corresponding viscosity ((6)). The shear rate, in turn, is computed from the strain-rate tensor as defined in (7).
Here, , and .
Dimensionless form of Cahn–Hilliard–Navier–Stokes equations
The dimensionless form of the Cahn–Hilliard–Navier–Stokes equations is obtained by introducing length scale , time scale , velocity scale , density scale , diffusive flux scale , pressure scale , viscosity scale , gravitational acceleration scale and chemical potential scale . Surface tension , interfacial thickness and mobility are taken as constants. The following are the derived scales, non-dimensional numbers and hence the dimensionless form of the governing equations, where is the Reynolds number, is the Froude number, is the Weber number, is the Peclet number and is the Cahn number.
Here, , and
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.

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 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 is Lipschitz continuous if there exists a constant such that
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 .
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 is the regularization weight and is the gradient of the network output with respect to its input.
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 as input and returns the scalar viscosity . The shear-rate and viscosity data span several decades, so training is carried out in log–log space, with as input and 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

Figure 2. Comparison between regular and Lipschitz regularized neural networks in predicting a noisy function.
learning rate of , full-batch updates, and 50,000 epochs. The loss function is the Lipschitz-regularized mean-squared error in (15), with regularization weight 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 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 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.
| Parameter | Case 1 | Case 2 | Case 3 | Case 4 | |
| Reynolds number | 3 | 3 | 3 | 3 | |
| Weber Number | 20 | 20 | 20 | 5 | |
| Froude Number | 1.0 | 1.0 | 1.0 | 1.0 | |
| Cahn Number | 0.01 | 0.01 | 0.01 | 0.01 | |
| Peclet Number | 3333.33 | 3333.33 | 3333.33 | 3333.33 | |
| Density of heavy fluid | 1.0 | 1.0 | 1.0 | 1.0 | |
| Density of light fluid | 0.001 | 0.001 | 0.001 | 0.001 | |
| Zero-shear viscosity of heavy fluid | 1.0 | 1.0 | 1.0 | 1.0 | |
| Infinite-shear viscosity of heavy fluid | 1/50 | 1/50 | 1/50 | 1/50 | |
| Viscosity of light fluid | 0.01 | 0.01 | 0.01 | 0.01 | |
| Power-law index | 0.8 | 0.4 | 0.6 | 0.6 | |
| Relaxation time constant | 48.5 | 48.5 | 48.5 | 48.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.

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.

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 for 60 seconds, followed by an equilibration time of 60 minutes to account for thixotropic behavior. After equilibration, logarithmic sweeps were performed from to . 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.

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 and Weber number (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 , , (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
where, in non-dimensional form, and are the zero-shear and infinite-shear viscosities, is the relaxation time constant, is the power-law index, and 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 .
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 and height , with a circular bubble of radius placed initially at . With no characteristic velocity available, the reference velocity is chosen so that the Froude number is unity, . The Peclet number follows from the scaling relation for the chosen Cahn number [39]. The bubble diameter is the length scale (), and the heavier fluid sets the density and viscosity scales (, ). The top and bottom walls are no-slip (). The side walls use free-slip (, ). The phase field is given zero normal gradient on all walls (, ).

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 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%.

Figure 7. Normalized rise velocity versus non-dimensional time for Case 5 (, , ). Velocities are normalized by the corresponding 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 , , case. The two simulated trajectories are visually indistinguishable and both plateau close to the Pang and Lu reference.

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.

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 , fig:8a–fig:8c), reducing the power-law index from 0.8 to 0.4 produces progressively greater deformation and a more pronounced skirted shape: lower means stronger shear-thinning, which lowers the effective viscosity around the bubble and lets it deform more easily under buoyancy. Comparing Case 3 (, , fig:8c) with Case 4 (, , fig:8d) shows the effect of Weber number: at , 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 and 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 first decreases with shear rate and then increases at high shear:
The first two terms reproduce a Carreau–Yasuda-type shear-thinning branch with zero-shear viscosity , infinite-shear floor , relaxation time , and exponent . The third term adds a power-law thickening branch with coefficient and exponent , so the viscosity curve is non-monotonic in . Parameters are listed in Table 2.
| Parameter | Symbol | Value |
| Zero-shear viscosity | 20.0 | |
| Infinite-shear viscosity | 0.2 | |
| Relaxation time | 8.0 | |
| Shear-thinning exponent | 0.35 | |
| Thickening coefficient | 0.015 | |
| Thickening exponent | 1.3 |
Table 2. Constitutive parameters for the synthetic non-monotonic case.

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: , , , , , 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.

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.

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.

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 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): and . The reference gravity is . With no characteristic velocity available from the experiments, the reference velocity is set so that the Froude number is unity, , with corresponding time scale . The Peclet number follows from the scaling relation for the chosen Cahn number [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 , 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 and , these are defined as
| Parameter | Case 1 | Case 2 | Case 3 | Case 4 | |
| Material | A | A | B | B | |
| Reynolds number | 53.8149 | 53.9984 | 64.4399 | 60.5272 | |
| Froude Number | 1.0 | 1.0 | 1.0 | 1.0 | |
| Cahn Number | 0.01 | 0.01 | 0.01 | 0.01 | |
| Peclet Number | 3333.33 | 3333.33 | 3333.33 | 3333.33 | |
| Weber Number | 6.536 | 6.566 | 8.311 | 7.645 | |
| Density of background fluid | 1.0 | 1.0 | 1.0 | 1.0 | |
| Density of droplet | 0.51 | 0.51 | 0.51 | 0.51 | |
| Viscosity of background fluid | 1.0 | 1.0 | 1.0 | 1.0 |
Table 4. Simulation parameters for the droplet rise cases — non-dimensional.
where 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.
| Metric | Case 1 | Case 2 | Case 3 | Case 4 |
| Hausdorff distance | 0.044282 | 0.078821 | 0.050732 | 0.066279 |
| Chamfer distance | 0.040280 | 0.062229 | 0.051514 | 0.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 () 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 (Table 3) yields relative errors within the same range. Smaller values indicate closer agreement.
| Parameter | Case 1 | Case 2 | Case 3 | Case 4 | |
| Material | A | A | B | B | |
| Needle gauge | 20G | 25G | 20G | 25G | |
| Density of background fluid () | 1920 | 1920 | 1920 | 1920 | |
| Density of droplet () | 970 | 970 | 970 | 970 | |
| Viscosity of background fluid () | 0.0051 | 0.0051 | 0.0051 | 0.0051 | |
| Horizontal Extent of droplet () | 1.2771 | 1.2800 | 1.4401 | 1.3812 | |
| Surface Tension () | 0.0047 | 0.0047 | 0.0047 | 0.0047 |
Table 3. Simulation parameters for the droplet rise cases — dimensional.

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

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

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

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.

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.

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 , 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.

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: (frame directory), (frame template), (parameter set)
Ensure: (set of bubbles with kinematic data)
Image Preprocessing:
for each frame do
Convert to grayscale representation
Apply adaptive thresholding:
Apply morphological closing with kernel size
Generate labeled components with connectivity
Filter components by area threshold
if then
Fill enclosed regions in remaining components
end if
Store binary frame
end for
Interface Detection and Tracking:
Initialize bubble set
for each binary frame in temporal sequence do
Extract connected regions representing bubble-surrounding interfaces
for each interface region do
Extract interface properties (centroid , area, shape, boundary curvature)
Find potential matching interfaces in existing tracked bubbles based on proximity
if interface match found then
Select best match using interface position, area, and morphological similarity
Update existing bubble trajectory with new interface position
else
Initialize new bubble with current interface position and properties
end if
end for
end for
Data Export and Visualization:
Generate trajectory plots with consistent axis scales
Export interface data for subsequent analysis
References
- [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]T. F. Tadros, Rheology of dispersions: principles and applications, John Wiley & Sons, 2011.
- [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]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]B. Bunner, G. Tryggvason, Direct numerical simulations of three-dimensional bubbly flows, Physics of Fluids 11 (1999) 1967–1969.
- [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]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]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]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]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]R. Chella, J. Vinals, Mixing of a two-phase fluid by cavity flow, Physical Review E 53 (1996) 3832.
- [12]D. Jacqmin, Calculation of two-phase navier–stokes flows using phase-field modeling, Journal of computational physics 155 (1999) 96–127.
- [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]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]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]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]M. J. Berger, P. Colella, Local adaptive mesh refinement for shock hydrodynamics, Journal of computational Physics 82 (1989) 64–84.
- [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]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]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]R. P. Chhabra, S. A. Patel, Bubbles, drops, and particles in non-Newtonian fluids, CRC press, 2023.
- [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]R. Clift, J. Grace, M. Weber, Drops, bubbles and particles, 1978.
- [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]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]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]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]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]B. Reyes, A. A. Howard, P. Perdikaris, A. M. Tartakovsky, Learning unknown physics of non-newtonian fluids, Physical Review Fluids 6 (2021) 073301.
- [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]M. Mahmoudabadbozchelou, S. Jamali, Rheology-informed neural networks (RhINNs) for forward and inverse metamodelling of complex fluids, Scientific reports 11 (2021) 12015.
- [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]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]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]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]E. Negrini, G. Citti, L. Capogna, System identification through lipschitz regularized deep neural networks, Journal of Computational Physics 444 (2021) 110549.
- [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]O. R. developers, Onnx runtime, https://onnxruntime.ai/, 2021. Version: 1.15.1.
- [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]N. J. Wagner, J. F. Brady, Shear thickening in colloidal dispersions, Physics Today 62 (2009) 27–32.
- [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]G. Borgefors, Hierarchical chamfer matching: A parametric edge matching algorithm, IEEE Transactions on pattern analysis and machine intelligence 10 (1988) 849–865.