Skip to content

About

Code, data and results for: Identifiability of Herschel-Bulkley parameters from pipe velocity profiles: limits for fits, Bayesian inference and neural networks

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

In-line rheometry in a pipe, and three Herschel-Bulkley laws that one velocity profile cannot tell apart

Python Dependencies License

Identifiability of Herschel-Bulkley parameters from pipe velocity profiles

Limits for fits, Bayesian inference and neural networks

Ege Yigit Erbil, College of Computing, Georgia Institute of Technology

This repository holds the code, the digitized experimental data and every result of the paper. Each figure, table and number in the paper is produced by the scripts here.

The question

In-line rheometry infers the rheology of a yield-stress fluid from a velocity profile and the pressure drop measured in the process pipe. A Herschel-Bulkley law is fitted and a yield stress, a consistency and a flow index are reported, by a fit, by Bayesian inference or, more recently, by a neural network trained on simulated flows. What does such a measurement determine, and does an estimator that looks more accurate draw more from the profile or bring knowledge from elsewhere?

Laminar pipe flow of a Herschel-Bulkley fluid has an exact solution. That makes two references computable: the limit set by the measurement (the Cramer-Rao bound) and the best estimate under stated prior knowledge (exact Bayesian inference). Least squares, a maximum a posteriori (MAP) fit, the exact posterior mean and a trained network receive the same velocities and differ only in the prior knowledge they are given. Everything is then applied, without retraining, to 35 measured velocity profiles of eight Carbopol fluids from three laboratories and scored against rheometer data.

What we find

The measurement One profile determines the flow curve far better than the three parameters. With eight velocities, 1% noise and a flow index of 0.55, the flow curve is known to 3% for a plug of half the radius, while the flow index is uncertain by about 0.1 and the yield stress by 9.5% at best. With 96 velocities, 10% still needs a plug that fills about a quarter of the radius. Wall slip raises the bound and a second profile at another pressure gradient lowers it. More points help against noise only: a systematic departure of 1% from the model can move the fitted yield stress by tens of percent however dense the profile.
The estimators No estimator draws more than this from the profile. Least squares stays close to the bound. A fit with prior knowledge, exact Bayesian inference and the network go below it only through that knowledge, and the network comes within a few percent of exact Bayesian inference without surpassing it: it is faster, not more accurate, and with dense profiles a fit is better. A physics-informed network (PINN) trained on each profile behaves as a slow least-squares fit.
Measured flows For the three gels that slip, least-squares fits of single digitized profiles of one gel return yield stresses that differ by a factor of up to 3.8, or no yield stress at all, while their flow curves have median errors of 9.5 to 15%. The digitization uncertainty, about 1% of the velocity, is by itself as large as this scatter for two of the gels (python -m src.sensitivity yield), which is the sensitivity the bound describes. A joint fit of several pressure gradients gives one yield stress, 0.78 and 0.94 times the rheometer value, for two of the five fluids that allow the test. A network trained without wall slip fails on the gels that slip, and subtracting the measured wall velocity repairs it.
In practice Report the flow curve over the shear rates the flow probes. A yield stress from one profile needs a large plug, a second pressure gradient or a statement of the prior behind it.

One measured profile does not determine the yield stress

Left: yield stress from each of the 35 measured profiles over the rheometer value of its fluid; bars show what the digitization uncertainty alone does to one profile. Right: the errors of the least-squares estimates against the plug radius, with the Cramer-Rao bound for 1% noise.

Accuracy with the same prior

Top: distribution of the flow-curve error over 500 simulated test profiles for least squares, the MAP fit, exact Bayesian inference and the network. Bottom: the network approaches the exact Bayesian answer as training simulations are added, and inherits the limits of its training range.

Measured profiles

Top: flow-curve error against the rheometer on the measured profiles. Bottom: distance between the network and exact Bayesian inference under the network's own training model.

Quickstart

Python 3.10 or newer; the only dependencies are NumPy, SciPy, pandas, Matplotlib and PyYAML. Three checks that use standard libraries (large networks in PyTorch, posterior-estimating flows with sbi and a second posterior sampler with emcee) need requirements-ml.txt as well.

git clone https://github.com/EYErbil/yieldbound.git
cd yieldbound
python -m pip install -r requirements.txt     # exact versions used: requirements-lock.txt
python run.py test                            # unit and physics tests

Estimate a Herschel-Bulkley law from eight velocities and the wall shear stress with the trained networks:

import numpy as np
from src.estimate import estimate

u = np.array([0.0190, 0.0190, 0.0189, 0.0185, 0.0182, 0.0159, 0.0113, 0.0041])  # m/s at r/R = 0, 1/7, ..., 1
out = estimate(u, R=0.0075, tau_w=5.0, slip=True, refine=True)

out["network"]        # {'tau_y': ..., 'K': ..., 'n': ..., 'slip_velocity': ...}
out["misfit"]         # how well the estimate reproduces the measured profile
out["alarm"]          # True if the misfit exceeds the alarm level found on simulated profiles
out["least_squares"]  # a free fit beside the network; a large disagreement is a warning
out["map_fit"]        # a MAP fit started at the network's answer

python -m src.estimate runs this on a simulated profile and prints the true law next to the estimates.

Reproducing the paper

python run.py paper     # every figure, table and number from the stored results (about two minutes)
python run.py all       # every result from scratch (roughly half a day on two CPU cores)
python run.py libraries # the checks with PyTorch, sbi and emcee (requirements-ml.txt; a GPU helps)

python run.py without arguments lists the individual steps. Simulated data are regenerated from fixed seeds; only the two main benchmark sets are stored. Trained networks are stored in checkpoints/, and retraining reproduces them exactly. python -m src.paper_numbers writes every number quoted in the paper to paper/journal/numbers.tex.

The networks are small multilayer perceptrons written in NumPy, with gradients tested against finite differences. src/scaleup.py repeats the main comparison with the same network in PyTorch, with a residual network of 1.3 million weights on up to a million simulations, and with normalizing flows from the sbi package.

Repository layout

path contents
src/ physics (physics.py, models.py, duct.py), estimators (fit_nls.py, mlp.py, train_synthetic.py, uq.py, estimate.py, pinn_baseline.py), the duct with wall slip (duct_slip.py, duct_slip_study.py), the exact Bayesian reference (posterior.py, bayes_reference.py, bayes_measured.py), the checks with standard libraries (scaleup.py, posterior_check.py), one module per study, figures (paper_figures.py) and the numbers of the text (paper_numbers.py)
configs/ one YAML file per simulated study: prior, sizes, measurement points, noise, network settings
data/experimental/ digitized experimental profiles, the raw digitization records and the rheometer metadata
checkpoints/ trained networks
results/ every prediction and summary table behind the numbers in the paper
paper/ the generated figures and tables, and every number quoted in the text (journal/numbers.tex)
tests/ tests of the exact solution, the duct solver, the gradients, the exact posterior, the data splits and the analyses

Experimental data

The profiles are digitized from published figures. They are not the original measurement files, which the authors of data sets A and B told us are no longer available. The reference for scoring is always the rheometer measurement published with each data set, never the original authors' fits to the velocity profiles.

set source pipe, technique fluids, profiles reference
A B. Hadj Arab, M. Mahfoud, Z. Louna, K. Bekkour, P. R. de Souza Mendes, Applied Rheology 34(1), 2024, doi:10.1515/arh-2024-0015, CC BY 4.0 15 mm, LDV F1, F2, F3; 17 vane rheometer
B J. Peixinho, PhD thesis, Université Henri Poincaré, Nancy 1, 2004, HAL tel-01748373 30 mm, LDV P1, P2; 4 cone-plate rheometer
C Y. J. García-Blanco et al., Rheologica Acta 62:93-110, 2023, doi:10.1007/s00397-022-01379-4 25.9 mm, PIV C1, C2, C3; 14 cross-hatched parallel plates

How the values were obtained, and three things to know before using them:

  • Data set A. The figure images were calibrated on their tick marks and each profile traced by marker colour and binned at 0.1 mm, with the digitization uncertainty of each point stored. F1 and F2 are the same 0.1 wt% solution at 20 and 26 °C. The value at the wall is the outermost bin and is the least certain part of each profile.
  • Data set B. The scanned thesis figures were calibrated on their axis frames and the markers located by template matching. No pressure drops are reported, so the wall shear stress is the value at which the rheometer law reproduces the measured flow rate; the data set therefore tests the shape of a flow curve and not its level. One figure caption lists bulk velocities that contradict its own Reynolds and Herschel-Bulkley numbers and plug radius. A single factor of 3.52 reconciles them and is used (flagged in the data; results without it are reported in the paper).
  • Data set C. The figures are vector graphics, so the marker positions were read exactly. For fluids C2 and C3 the published rheometer law does not reproduce the measured profiles, and every estimator disagrees with it by about 40%.

Citation

@article{erbil2026profile,
  author  = {Erbil, Ege Yigit},
  title   = {Identifiability of {H}erschel--{B}ulkley parameters from pipe velocity profiles: limits for fits, {B}ayesian inference and neural networks},
  year    = {2026},
  note    = {Manuscript}
}

License

The code is released under the MIT license. The digitized data are not covered by it: see the data notice in LICENSE, and cite the original sources when using them.

About

Code, data and results for: Identifiability of Herschel-Bulkley parameters from pipe velocity profiles: limits for fits, Bayesian inference and neural networks

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages