Split out of #426, which was closed by PR #434. #434 fixed the coordinate half (dimensional .coords into a non-dimensional kd-tree). This is the other half, deliberately left out of that PR.
The defect
SwarmVariable._create_proxy_variable builds the proxy MeshVariable without forwarding units=:
var = swarm.add_variable(name="rho", size=1, proxy_degree=1, units="kg/m^3")
var.units # kilogram / meter ** 3
var._meshVar.units # None
So var.sym — which is the proxy's symbol, and the thing that ends up in constitutive expressions — is dimensionless even though the swarm variable it stands for is not.
Confirmed on development after #434.
Why it was not fixed alongside the coordinate bug
Attaching units to the proxy makes var.sym unit-aware, which changes symbolic behaviour everywhere a proxied swarm variable is composed into an expression — constitutive models, buoyancy terms, DDt history. That is a design decision about the units boundary, not a one-word coordinate fix, and bundling it into a bugfix PR would have made the diff unreviewable.
What needs deciding
- Should the proxy carry the swarm variable's units, or is the proxy deliberately a non-dimensional internal object with units living only on the
SwarmVariable?
- If the former: what happens to existing expressions that currently compose a dimensionless
var.sym?
MeshVariable.data is documented as always non-dimensional, so the storage does not change either way — this is purely about what .units and .sym advertise.
Reference: docs/developer/design/UNITS_SIMPLIFIED_DESIGN_2025-11.md is the governing document for the units boundary.
Split out of #426, which was closed by PR #434. #434 fixed the coordinate half (dimensional
.coordsinto a non-dimensional kd-tree). This is the other half, deliberately left out of that PR.The defect
SwarmVariable._create_proxy_variablebuilds the proxyMeshVariablewithout forwardingunits=:So
var.sym— which is the proxy's symbol, and the thing that ends up in constitutive expressions — is dimensionless even though the swarm variable it stands for is not.Confirmed on
developmentafter #434.Why it was not fixed alongside the coordinate bug
Attaching units to the proxy makes
var.symunit-aware, which changes symbolic behaviour everywhere a proxied swarm variable is composed into an expression — constitutive models, buoyancy terms, DDt history. That is a design decision about the units boundary, not a one-word coordinate fix, and bundling it into a bugfix PR would have made the diff unreviewable.What needs deciding
SwarmVariable?var.sym?MeshVariable.datais documented as always non-dimensional, so the storage does not change either way — this is purely about what.unitsand.symadvertise.Reference:
docs/developer/design/UNITS_SIMPLIFIED_DESIGN_2025-11.mdis the governing document for the units boundary.