Research simulator — not calibrated for factory production. Results are research simulations, not dyeing recipes.
Research & methodology

The model behind the numbers

DyeFlow Lab implements a conservative finite-bath, two-region model of dye transport into a textile. This page explains what it solves, how it is solved and how the browser engine is verified.

1. Physical picture

A textile is treated as a planar slab of half-thickness L immersed in a well-mixed, finite dye bath. Inside the slab, dye can be in two connected regions:

  • Void (pore) region — liquid-filled pores with volume fraction θvoid, where dye diffuses relatively quickly with Dvoid.
  • Fiber region — the fiber material with fraction θfiber = 1 − θvoid, where dye diffuses slowly with Dfiber and exchanges reversibly with the pores (rate k, partition coefficient K).

The bath loses exactly the dye that crosses the outer textile surface, so the bath concentration falls over time. This is what makes the bath finite.

2. Governing equations

With normalized void concentration u(ξ,τ), fiber concentration v(ξ,τ) and bath concentration b(τ), on 0 ≤ ξ ≤ 1:

∂u/∂τ = ∂²u/∂ξ² − α(u − v)void region ∂v/∂τ = δ ∂²v/∂ξ² + α β(u − v)fiber region db/dτ = −χ Bi (b − u(1,τ))finite bath

Initially the textile is dye-free and the bath holds all the dye: u = v = 0, b = 1.

3. Boundary conditions

  • Symmetry at the slab centre: ∂u/∂ξ = 0 and ∂v/∂ξ = 0 at ξ = 0.
  • Robin (mass-transfer) condition at the void surface: ∂u/∂ξ = Bi (b − u) at ξ = 1.
  • No direct fiber–bath flux: ∂v/∂ξ = 0 at ξ = 1. Fiber dye enters only through exchange with the pores.

4. Mass invariant and equilibrium

Because the bath loses exactly what the slab gains, total dye is conserved. In normalized form:

∫₀¹ [ u + vβ ] dξ + bχ = 1χconserved for all τ

For Bi > 0 the system approaches a uniform equilibrium u = v = b = beq, which sets the long-run limit on bath exhaustion:

beq = 11 + χ(1 + 1/β),    Exhaustion∞ = 100 (1 − beq) %

With Bi = 0 the bath is sealed from the textile and exhaustion stays at 0%.

5. Dimensionless groups

In Engineering mode, physical SI inputs are mapped to the model groups exactly as follows. β is a capacity ratio, not the partition coefficient itself.

GroupDefinitionMeaning
αk L² / DvoidVoid ↔ fiber exchange strength
δDfiber / DvoidRelative fiber diffusivity
βθvoid / [K (1 − θvoid)]Void vs fiber storage capacity
Bih L / DvoidBath-to-surface transfer (Biot number)
χθvoid Awet L / VbathTextile pore capacity relative to the bath
τt Dvoid / L²Dimensionless time

Fabric type, dye name, temperature, pH and fabric weight do not enter these definitions. In Basic mode, fabric weight only scales the wetted area through the material profile’s declared m²/kg value.

6. Numerical method

  • Space: cell-centred finite volumes with 16, 24 or 32 cells per region. The Robin face flux uses the effective transfer coefficient r = Bi / (1 + Bi Δξ / 2), and the same face flux is removed from the bath. This makes the discrete scheme conserve mass exactly.
  • Time: implicit (backward) Euler with Δτ ≤ 0.018, using a pivoted LU factorization computed once per run. Implicit Euler is L-stable and keeps concentrations non-negative for this operator. It is first-order accurate in time.
  • Output: 81 evenly spaced samples. Mass residual, minimum concentration and monotonic bath decrease are checked on every run.
  • Reference: the Python implementation in the repository builds the same finite-volume operator and integrates it with SciPy’s BDF method (rtol 10⁻¹⁰).

7. Verification

The browser solver is compared against the Python reference on four cases (also re-runnable live in Engineering mode):

CaseαδβBiχτ endPython exhaustion

Automated tests require agreement within 0.5 percentage points and a mass-balance drift below 10⁻⁸. The observed difference is about 0.02 pp or less. This is numerical verification: it shows that the equations are solved correctly. It does not show that the equations describe a particular real fabric.

8. Exhaustion vs fixation

Bath exhaustion is the fraction of dye that has left the liquid bath. It equals the dye stored in the textile’s pores and fiber region. Fixation is the fraction that becomes permanently bound and survives washing. The model contains no fixation chemistry. A high exhaustion value therefore does not guarantee colour yield or fastness.

9. Limitations

  • No experimentally validated material profiles are shipped. All built-in values are illustrative.
  • Coefficients are constant in time: no temperature ramps, pH or salt effects, and no dye aggregation or reaction kinetics.
  • The geometry is a planar symmetric slab with a well-mixed bath, not real yarn or fabric architecture or machine flow.
  • The model makes no prediction of shade, K/S, ΔE, fixation, wash fastness, energy, cost or effluent.
  • Time integration is first-order. Results are indicative within the verified parameter domain (τ ≤ 50).
  • Industrial use requires independent calibration and validation experiments for each fabric, dye and process combination.