Skip to content

Bug: J/kg auto-simplifies to Gy (Gray) in non-radiation contexts #104

@parneetsingh022

Description

@parneetsingh022

When composing units that algebraically reduce to J/kg (e.g., Pa / (J/(kg·K)) in gas density calculations), the unit simplifier replaces J/kg with Gy (Gray), the SI unit for absorbed radiation dose.
This is dimensionally correct (1 Gy = 1 J kg⁻¹) but semantically misleading outside radiological applications.

Example:

p  = 101325 * u.Pa
R  = 287.05 * u.J / (u.kg * u.K)
T  = 20 * u.degC
dT = T - (0 * u.degC)
rho = p / (R * dT)
print(rho.unit.name)
# -> 'Pa/kGy'   # semantically odd, though dimensionally correct

Expected:

Either 'kg/m³' or 'Pa/(J/kg)'not 'Gy'

Impact

This affects thermodynamic and mechanical contexts (e.g., gas laws, energy density, specific heat, etc.) where J/kg should not be expressed as Gy.
It doesnt break dimensional correctness but causes confusing unit labels in outputs and logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions