Validation/Miscible mixing
Two miscible liquids across a step
The exact solution says three separate things — where the front is, how wide it is, and how much mixture there is — and they fail separately. A run can be right about two of them and a third too wide.
Why this case
The miscible-mixing family had nothing behind it. Its solver is interFoam with the interface compression taken out and a diffusivity put in: the two liquids mix instead of holding a surface. That makes its phase fraction obey an advection–diffusion equation, and with the fluid at rest and no turbulence model, pure diffusion — which has an exact solution for a step.
The point of the case is that the exact solution says three separate things, and they fail separately. Where the front is. How wide it is. And how much mixture there is altogether. A run can be right about the first and the third while being wrong by a third about the second, and one of the fixtures below is exactly that.
| Physics | Two miscible liquids at rest — twoLiquidMixingFoam, laminar, equal densities |
|---|---|
| Domain | 0.8 m tall with the step at y = 0.4 m, which is what the application writes into its own setFieldsDict |
| Diffusivity | Dab = 0.002 m²/s, asked of the product and asserted in the written case |
| Fluids | ρ = 998.2 kg/m³ on both phases and ν = 10⁻⁶ m²/s, so there is no buoyancy |
| Meshes | 32, 64 and 128 cells in y; 4 × 4 across, kept as real cells so the transverse check means something |
| Time | To 2.0 s at a fixed 10⁻³ s — 2000 steps |
| Reference | The erfc similarity solution of the one-dimensional diffusion equation |
| Agreement | Transition width 0.120587 m against an exact 0.120656 m (−0.057 %), at an observed order of 1.93 and 1.82 under refinement — 2.019 and 1.994 once the study is run without the confound described below |
The exact solution
The phase fraction in this solver obeys
d(alpha)/dt + div(phi alpha) = laplacian(Dab + alphatab nut, alpha)
With the fluid at rest, φ vanishes; with no turbulence model, nut vanishes; and what is left is the one-dimensional diffusion equation with constant D. A step at y₀ then has the similarity solution
alpha(y, t) = 0.5 erfc( (y - y0) / (2 sqrt(D t)) )
Three consequences, and the case measures all three:
- The half-height does not move. Pure diffusion is symmetric about the step, so any displacement at all is something advecting the mixture — buoyancy from a density difference, or a spurious current at the interface.
- The width grows as √(Dt). Measured as the distance from α = 0.75 to α = 0.25, it is 1.908 √(Dt), which at t = 2 s is 0.1206564 m. This is the strong check: it is a rate, and it is the only thing on the page that says the diffusivity reaching the solve is the one the case was given. Numerical diffusion and physical diffusivity are indistinguishable in the answer itself.
- The integral of α is constant — to round-off, not to a discretisation error, because the fluid is at rest in a box it cannot leave. A scheme can sit on the erfc curve through the middle of the domain while losing material at a boundary.
The reference is the infinite-domain solution, so it is only usable while the transition stays away from the walls. Both boundaries are 6.3 √(Dt) from the step, where the exact solution differs from 0 and 1 by 3.872 × 10⁻⁶ — three orders below the agreement being measured. That is computed and checked by the harness rather than asserted.
Result
| Quantity | Measured | Exact | Difference |
|---|---|---|---|
| Transition width, α = 0.75 to α = 0.25 | 0.1205872 m | 0.1206564 m | −0.057 % |
| Half-height position | 0.4000000 m | 0.4000000 m | exactly |
| Integral of α | 0.499999829 | 0.5 | −3.4 × 10⁻⁷ |
| max|U| at the end of the run | 1.2 × 10⁻¹⁶ m/s | 0 | the fluid genuinely never moves |
| α range | 1.36 × 10⁻⁶ to 0.9999914 | within [0, 1] | no overshoot |
| Variation of α across x and z within one layer | 7.0 × 10⁻⁶ | 0 | the case is one-dimensional |
The last two rows are there because the comparison stops meaning anything without them. If α varied across x and z, the profile being compared with a one-dimensional closed form would be an average over cells that disagree, and the agreement reported would be an average of disagreements. And the erfc solution is the pure diffusion one; with the fluid moving there would be an advection term in the equation being solved that is not in the equation being compared against.
Mesh refinement, which is what makes this a verification
One width within a tenth of a per cent of a closed form is a number that happens to be close. A sequence of them approaching it at the scheme’s own order is the claim.
| Cells in y | Cell size | Width (m) | vs exact | L1 error in α | Observed order |
|---|---|---|---|---|---|
| 32 | 0.025 m | 0.1196395 | −0.843 % | 7.624 × 10⁻⁴ | — |
| 64 | 0.0125 m | 0.1205409 | −0.096 % | 1.998 × 10⁻⁴ | 1.93 |
| 128 | 0.00625 m | 0.1205872 | −0.057 % | 5.662 × 10⁻⁵ | 1.82 |
The time step is refined separately on the finest mesh, and it barely moves the answer — which is the statement that what remains is spatial:
| Time step | Diffusion number | Width (m) | vs exact | L1 error in α |
|---|---|---|---|---|
| 4 × 10⁻³ s | 0.205 | 0.1205275 | −0.107 % | 8.819 × 10⁻⁵ |
| 2 × 10⁻³ s | 0.102 | 0.1205639 | −0.077 % | 6.873 × 10⁻⁵ |
| 1 × 10⁻³ s | 0.051 | 0.1205872 | −0.057 % | 5.662 × 10⁻⁵ |
Three fixtures, each a product default left on
The turbulence model is why the width is the measurement. The product’s default for this family is k-omega SST, and the α equation diffuses with Dab + alphatab·nut. Left on, nothing about the run looks unwell: it converges, α stays inside [0, 1], every process exits 0, max|U| is 1.3 × 10⁻¹⁶ m/s so the fluid never moves at all, and the mixture is centred exactly where it started. The only thing that sees it is the width, which comes out 0.156471 m — 29.68 % wide. The L1 error also stops falling: 0.02688, 0.02718 and 0.02725 on the three meshes, an observed order of −0.016 and −0.004, so refining the mesh makes it very slightly worse rather than better.
The adaptive time step is why the order is here. With the product’s own adjustTimeStep yes, the width (−0.20 %), the position (0.000 %), the mass (−4.0 × 10⁻⁷) and the velocity all sit comfortably inside every band above, on every mesh. Only the refinement study says anything: the observed order is 1.57 then 0.94, against 1.93 and 1.82 for the same case at a fixed step. The run takes 207 steps at 32 cells and 207 steps at 128 — this solver’s α equation is explicit, so its step is bounded by a diffusion number and not only by a Courant number, and the product’s adaptive controls are convective. At rest they run to maxDeltaT and stay there however fine the mesh gets. Without a refinement study this benchmark would have passed that run and reported a verified solver.
The default densities are the one that passes. The staged phase pair is water over air, a density ratio of 815 held up by nothing, and the benchmark sets them equal so the fluid is genuinely at rest. Run with the defaults instead, every check still passes — width −0.047 %, order 1.97 on both mesh pairs — but max|U| is no longer round-off. It is 1.06 × 10⁻⁴, 1.61 × 10⁻⁴ and 2.70 × 10⁻⁴ m/s on the three meshes: small, but growing under refinement rather than shrinking, and the half-height moves 3.6 µm off the step. Both stay far inside the harness’s limits and the fixture is recorded as passing; it is reported here because a velocity that grows when the mesh is refined is not converging to zero.
What this page does not establish
- Only the mesh has a convergence study behind it. The time step was varied and the answer moved very little, which is consistent with the spatial error dominating, but no temporal order is claimed from three points where the residual spatial error is the larger term.
- The mass drift is 10⁻⁷, not round-off, and it is not fully explained. The analysis says the integral of α is constant to machine precision. Measured, it is −6.9 × 10⁻⁷, −4.3 × 10⁻⁷ and −3.4 × 10⁻⁷ on the three meshes — seven orders above round-off. It shrinks under refinement rather than staying put, which is how a discretisation loss behaves and not how a leak behaves, and the harness’s tolerance is set against what was measured rather than against what the mathematics promises. But no run here isolates where it comes from.
- One diffusivity, one end time, one geometry. D = 0.002 m²/s at t = 2 s in the box the application writes. The width check is a check on √(Dt) at a single point on that curve.
- The domain is finite and the reference is not. The comparison holds because the transition is 6.3 √(Dt) from each wall, where erfc is 3.9 × 10⁻⁶ from its limits. Run for longer and the reference stops applying — which is a property of this case, not of the solver.
One caveat on the orders themselves. This mesh study holds the time step fixed while the cell size halves, so the diffusion number D Δt/Δx² quadruples at every level — 0.0032, 0.0128, 0.0512 — and the sweep reads that climb as well as the mesh. Repeating it with the diffusion number held at 0.0032 gives L1 orders of 2.019 and 1.994, with an L1 lower by 5.9 % and 16.6 % on the two finer meshes.
So the 1.93 and 1.82 above are what a confounded study measures, and they understate the scheme rather than flatter it. They are left in place because they are what this benchmark’s fixture holds and what its gate judges. The same confound was found in two other benchmarks — in one of them it removes convergence altogether — and is recorded in the project’s gaps ledger.
Repeat this yourself
Every case here is set up from the worked examples in the product, with no hand-editing of solver files — so you can run it, and get the same numbers. The free tier runs real cases up to 250,000 cells of fluids, or 100,000 nodes of solid, with no account needed to download and no time limit.
Other cases
- Advected scalar frontThe width is the measurement, not the position. Numerical diffusion is indistinguishable from physical diffusion in the answer, and the fixture that proves it is a real afternoon spent chasing a diffusivity that never reached the solve.
- How much of the answer is the meshEvery other page here asks how far the answer is from a reference. This one asks how much of it is the mesh — and puts an uncertainty on a result that has no reference at all.
- A manufactured solutionThe only case here that checks the arithmetic rather than the answer. Pick the solution first, work out what source term it needs, and the error is then known exactly on every mesh.
All validation cases · Written by the team building SHD Sim.