Skip to content

DDt timestep helper passes a raw pint Quantity to uw.non_dimensionalise, which returns its magnitude unscaled #701

Closed

Description

@lmoresi

systems/ddt.py::_as_float (used by every DDt flavour's update_pre_solve through the _dt bookkeeping, and by the BDF coefficient update) carries a TODO(BUG): a raw pint.Quantity reaching uw.non_dimensionalise() is not scaled by the active reference quantities, and the helper then takes .magnitude. Measured with set_reference_quantities(length=1000 km, time=1 Myr) and an SLCN solver stepped with timestep=100 kyr: DuDt._dt = 100.0 kiloyear, and the DDt's runtime constant delta_t.sym = 100.0 where the non-dimensional value is 0.1. The semi-Lagrangian solvers do not read that constant (they pass their own non-dimensional delta_t into the kernels), and the composing solvers of #688 non-dimensionalise before writing it, so no current solve is wrong; a solver that composes DDt.time_derivative() while passing a quantity straight to update_pre_solve would be. The fix belongs in uw.non_dimensionalise (accept a raw quantity) or in one shared timestep helper used by the solvers and the DDt alike (solvers._nondimensionalise_timestep does it right). Found by the review of #688.

🤖 Generated with Claude Code

https://claude.ai/code/session_018T2VHUGaZiQVJ95qQ4DiSL

Activity

  1. lmoresi commented on Sep 7, 2026

    @lmoresi
    MemberAuthor

    Fixed in 4f65d0f on #688 (branch feature/navier-stokes-supg): ddt._as_float now non-dimensionalises a quantity through uw.non_dimensionalise instead of taking its magnitude; tests/test_1057_ddt_transport_plugin.py::test_dimensional_timestep_reaches_the_manager_non_dimensional covers the UW quantity, the raw Pint quantity and an SLCN step under reference scales, with the no-scales magnitude as the negative control. Reopen if #688 does not land.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_018T2VHUGaZiQVJ95qQ4DiSL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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