Skip to content

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

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

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