Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cantera Units #991

Merged
merged 41 commits into from
Apr 25, 2023
Merged

Cantera Units #991

merged 41 commits into from
Apr 25, 2023

Commits on Apr 22, 2023

  1. Implement unit conversion file into Cantera

    Template file added to Sconscript to autogenerate code in
    solution.py.in
    hallaali authored and bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    6cfd088 View commit details
    Browse the repository at this point in the history
  2. Create test_units.py

    hallaali authored and bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    6dabf1a View commit details
    Browse the repository at this point in the history
  3. Create Python examples with units

    These examples use the units module to implement the existing examples,
    but demonstrate how alternative units can be used for the input and
    output quantities.
    hallaali authored and bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    594e50f View commit details
    Browse the repository at this point in the history
  4. fix tests and update unit examples

    hallaali authored and bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    b7051d4 View commit details
    Browse the repository at this point in the history
  5. Refactor PureFluid derived classes as functions

    Since the only overridden method was __init__, it makes more sense for
    these to be functions than subclasses.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    e7a59fa View commit details
    Browse the repository at this point in the history
  6. Refactor setter and getter templates for units

    * To allow setting properties on the upstream classes, __setattr__ is
      implemented and checks whether the attribute is defined on this
      class. This requires setting the phase instance directly into the
      __dict__ attribute to avoid a recursion error.
    * Class inheritance is not used here because it is not easy to set
      attributes on the super class. By design, super() does not allow
      setting properties, only getting. Furthermore, since the base
      PureFluid class is defined in Cython, the attributes of that class
      cannot be set by subclasses at all, again by design.
    * The PureFluid class implemented here does not inherit from the
      Solution class implemented here because eventually this Solution class
      will include methods and properties related to kinetics and transport,
      which are not implemented for PureFluid. The base PureFluid class is a
      subclass of ThermoPhase only, whereas the base Solution class is a
      subclass of ThermoPhase, Kinetics, and Transport.
    * To reflect the distinction between Solution and ThermoPhase, the
      template variables are renamed.
    * Several methods of the PureFluid are getters only, despite having
      three properties. These attributes are fixed here. TPQ is the only
      three-property attribute with a setter.
    * Setter methods now raise a CanteraError if the unit conversion to base
      units fails due to an AttributeError.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    b1fbaf0 View commit details
    Browse the repository at this point in the history
  7. Use numpy.isclose to compare array Quantities

    The existing assertArrayNear method was causing units to be stripped
    from the array Quantities. Avoiding numpy.asarray conversions and
    using numpy.isclose prevents that from happening.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    8bf0fbb View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    94c5908 View commit details
    Browse the repository at this point in the history
  9. Fix up tests for units module

    * Remove unnecessary tests of the underlying implementation that
      duplicate functionality in the upstream tests.
    * Move some dimensionality tests into the PureFluid tests where the
      saturation and critical attributes exist.
    * Remove unused imports
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    4952189 View commit details
    Browse the repository at this point in the history
  10. fix capitalization error

    hallaali authored and bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    b347d0a View commit details
    Browse the repository at this point in the history
  11. add pint dependency to CI

    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    0755513 View commit details
    Browse the repository at this point in the history
  12. Update rankine_units.py

    hallaali authored and bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    4a03313 View commit details
    Browse the repository at this point in the history
  13. [Doc] Add default python_module key into env

    This prevents KeyError failures if sphinx_docs=y and python_package=n
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    3944c32 View commit details
    Browse the repository at this point in the history
  14. [Units] Add application-level registry

    This supports pickling and unpickling of quantities carrying Pint units.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    f3667ab View commit details
    Browse the repository at this point in the history
  15. [Cython] Fix setuptools warning about data

    The include_package_data config option is redundant with explicitly
    listing the package data, so setuptools was generating warnings. Since
    we explicitly list everything, this can be removed.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    7ae626e View commit details
    Browse the repository at this point in the history
  16. [Cython] Move units package to with_units

    The units package shadowed the units Cython module. This made Cython
    very unhappy and we couldn't import anything from Cantera.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    590ebde View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    443ad26 View commit details
    Browse the repository at this point in the history
  18. [CI] Run examples from installed wheel

    This lets us check whether the wheel is built properly and includes all
    the files necessary for the package to function.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    0f43463 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    cde23e3 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    2effd6d View commit details
    Browse the repository at this point in the history
  21. [Units] Pass through kwargs in constructor

    Allow setting the backed of the Water instance. Fix a typo in the R134a
    instance.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    abd8b4b View commit details
    Browse the repository at this point in the history
  22. [Units] Refactor setter to use a loop

    Rather than checking each value individually with try/except, use the
    ito method and try to convert within a loop. This simplifies testing for
    the error condition and looks a little cleaner.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    cf4c134 View commit details
    Browse the repository at this point in the history
  23. Missing a license header

    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    dfec96f View commit details
    Browse the repository at this point in the history
  24. [Units/Test] Refactor test suite to use pytest

    This increases the line coverage to near 100%, uses pint's testing
    assertions rather than rolling our own, and uses parameterize
    extensively to reduce boilerplate in testing as many properties as
    possible.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    db403b4 View commit details
    Browse the repository at this point in the history
  25. Refactor dimensions tests

    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    7e89b03 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    966a249 View commit details
    Browse the repository at this point in the history
  27. [Units] Add documentation

    Most of the docs are copied from the upstream object. Some updates are
    included for units.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    9d1b533 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    12a6cb4 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    1ae4556 View commit details
    Browse the repository at this point in the history
  30. [CI] Add --pre option to sample installation step

    This is required to find the version of Cantera in the dist folder. By
    default, pip only finds stable versions, and in this case, was going out
    to PyPI to find Cantera rather than use the local artifact. However, we
    can't set --no-index because we also need to install other dependencies
    from PyPI.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    e6941bf View commit details
    Browse the repository at this point in the history
  31. [CI] Don't use PyPI index when installing Cantera

    Ensure that we only install the wheel from the archive and don't
    accidentally reach out to PyPI.
    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    6b554c7 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    582ef72 View commit details
    Browse the repository at this point in the history
  33. Remove some tabs

    bryanwweber committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    085480c View commit details
    Browse the repository at this point in the history
  34. Apply suggestions from code review

    Co-authored-by: Ray Speth <yarmond@gmail.com>
    bryanwweber and speth committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    e382c2a View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2023

  1. Configuration menu
    Copy the full SHA
    094d5fa View commit details
    Browse the repository at this point in the history
  2. General cleanups

    bryanwweber committed Apr 23, 2023
    Configuration menu
    Copy the full SHA
    0f9167b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5396e79 View commit details
    Browse the repository at this point in the history
  4. Address a bunch of review comments

    bryanwweber authored and speth committed Apr 23, 2023
    Configuration menu
    Copy the full SHA
    7459ec3 View commit details
    Browse the repository at this point in the history
  5. Address comments about tests

    bryanwweber authored and speth committed Apr 23, 2023
    Configuration menu
    Copy the full SHA
    ee8bdb6 View commit details
    Browse the repository at this point in the history

Commits on Apr 24, 2023

  1. Docs and AUTHORS

    bryanwweber committed Apr 24, 2023
    Configuration menu
    Copy the full SHA
    3ba8aec View commit details
    Browse the repository at this point in the history

Commits on Apr 25, 2023

  1. Add a bit more docs

    bryanwweber committed Apr 25, 2023
    Configuration menu
    Copy the full SHA
    644bc79 View commit details
    Browse the repository at this point in the history