Skip to content

shear_flow: shipped dimensions/y spans [0, 1] but the README (and the field data) say the domain is [-1, 1] #99

Description

@arturtoshev

The shear_flow README states:

Spatial domain size: $0\leq x \leq 1$ horizontally, and $-1 \leq y \leq 1$ vertically.

The shipped coordinate disagrees: dimensions/y is 512 points spanning 0 → 1, so the recorded wall-normal extent is half the documented one, and the origin is shifted.

Reproduction

import h5py, numpy as np

with h5py.File("shear_flow_Reynolds_1e5_Schmidt_2e0.hdf5") as f:
    x, y = f["dimensions/x"][:], f["dimensions/y"][:]

print(x.size, x.min(), x.max(), np.diff(x)[0])   # 256, 0.0, 1.0, 1/255
print(y.size, y.min(), y.max(), np.diff(y)[0])   # 512, 0.0, 1.0, 1/511  <- documented as [-1, 1]

The field data agrees with the README, not with the coordinate

The domain is doubly periodic and the flow is incompressible, so ∂ₓvₓ + ∂_y v_y = 0 exactly and both derivatives can be computed spectrally.

Using the recorded extents, on shear_flow_Reynolds_1e4_Schmidt_1e-1, frame 100:

test with Ly = 1 (recorded) with Ly = 2 (documented)
relative divergence residual 0.333 0.0041
slope of ∂_y v_y on ∂ₓvₓ −1.99964 (corr −0.99989) −1.0
dy / dx 0.499 0.998

Incompressibility demands a slope of exactly −1. Measuring −1.99964 at correlation 0.99989 says dy is understated by exactly a factor of 2, and correcting it also makes the grid isotropic, which a 512×256 array on a 2:1 domain should be. Reproduced on a second file (Reynolds_1e5_Schmidt_1e0, 0.4473 → 0.0108).

Note the divergence test constrains only the spacing, so it cannot see the origin on its own — the README is what establishes that the corrected coordinate is y = 2·y_shipped − 1, i.e. [-1, 1], rather than [0, 2].

Impact

Any consumer taking a wall-normal derivative from the recorded coordinate is off by 2×, and any consumer using absolute y positions is additionally offset by 1.

This may already have cost someone: issue #62 reported implausibly large PDE residuals on shear_flow, and the discussion attributed it entirely to a finite-difference vs pseudospectral mismatch before closing. A 2× error in dy produces exactly that symptom, and the coordinate was never examined.

Suggested fix

Ship dimensions/y as 512 points spanning [-1, 1] (dy = 2/511), matching the README. dimensions/x is already correct.

Checked before filing

Swept all open and closed issues and all merged PRs. Nothing mentions the shear_flow domain size. PR #13 ("Fix shear_flow README.md") touched the resolution and initial-condition description but not the domain line, and issue #62 is the near-miss described above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions