Repository navigation
Replies: 1 comment 1 reply
|
I am in favor of keeping the unit conversions separate across Fortran/Python, but I am supportive of updating them to the same values, where more precision is preferred. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello!
I've been looking into the unit conversion functions and universal constants, and noticed they're implemented separately in both Python and Fortran (at least those two; I haven't checked the other bindings yet). Atomic weights are the exception -- Python calls straight through to the Fortran atomic_data.f90 rather than maintaining its own copy.
That inconsistency in approach seems to have led to real drift: for example, source/units.f90 hardcodes the mmHg-to-bar conversion as 0.001333 (rounded), while the Python side (source/bind/python/cea/units/init.py) computes a more precise 0.0013322368... -- about a 0.017% relative difference. Small today, but it's the kind of thing that compounds as more constants/conversions get duplicated across languages.
Before I put time into fixing individual files, I wanted to ask about the intended structure: should Python bindings reimplement this kind of logic independently, or call through to Fortran as the single source of truth, the way atomic weights already do?
I checked the documentation site and didn't see guidance either way, but I may have missed it. Thanks!
@markleader
All reactions