Skip to content

"surface tension" physical type is registered as J m^2 instead of J / m^2 #20681

Open

Description

@rcgiri-physics

Hi, thanks for maintaining astropy. In astropy/units/physical.py:

(si.W * si.m**2 * si.Hz**-1, "surface tension"),

W m^2 Hz^-1 is J m^2, but surface tension is J / m^2 = N / m. With astropy 8.0.2:

>>> (u.J / u.m**2).physical_type
PhysicalType('spectral flux density')
>>> (u.N / u.m).physical_type
PhysicalType('spectral flux density')
>>> (u.J * u.m**2).physical_type
PhysicalType('surface tension')

J/m^2 has the same dimension as the jansky (kg s^-2). I think the intended fix is to drop this entry and add "surface tension" to the names for the astrophys.Jy dimension, the same way si.J carries {"energy", "work", "torque"}.

I found this while testing physverify, a small verification tool I'm working on, against public codes. The tests and this write-up were done with help from an AI assistant; the numbers come from actually running the code.

Activity

  1. Mrun25 commented on Oct 23, 2026

    @Mrun25
  2. pmocz commented on Oct 23, 2026

    @pmocz
  3. rcgiri-physics commented on Oct 23, 2026

    @rcgiri-physics
    Author

    Thanks @pllim. I checked both, and the behaviour is the same as in 8.0.2:

    7.2.3
    J / m2 -> PhysicalType('spectral flux density')
    N / m -> PhysicalType('spectral flux density')
    m2 J -> PhysicalType('surface tension')
    
    8.1.0.dev835+gce87eb782
    J / m2 -> PhysicalType('spectral flux density')
    N / m -> PhysicalType('spectral flux density')
    m2 J -> PhysicalType('surface tension')
    
  4. pllim commented on Oct 28, 2026

    @pllim
    Member

    Thanks, @rcgiri-physics . I agree with your assessment. Looks like it was added by @namurphy in #11204 , probably ported the definition from PlasmaPy community. Perhaps he could clarify?

  5. namurphy commented on Oct 28, 2026

    @namurphy
    Contributor

    Great catch! A PR was opened a few days ago by @pmocz at #20683 and then automatically closed as per the policy for new contributors. Could this PR be re-opened?

  6. pllim commented on Oct 28, 2026

    @pllim
    Member

    There were actually 2 PRs but unfortunately both appeared to be AI generated, thus similar looking. If we want to adhere to our own AI policy here, at least the author from #20682 made an attempt to introduce human on Slack. @namurphy , do you want me to re-open #20682 for consideration instead? Thanks!

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions