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

[python] Fix dimension of sliced SolutionArray methods #1726

Merged
merged 2 commits into from
Jun 30, 2024

Conversation

ischoegl
Copy link
Member

@ischoegl ischoegl commented Jun 26, 2024

Changes proposed in this pull request

  • Fix dimension of 'inherited' Solution methods
  • Disable some problematic SolutionArray methods when phase is an Interface

If applicable, fill in the issue number this pull request is fixing

Closes #1717

If applicable, provide an example illustrating new features this pull request is introducing

In [1]: import cantera as ct
   ...: gas = ct.Solution("h2o2.yaml")
   ...: gas.TPY = 900, 1.e05, {"H2": 1.0, "O2": 1.0}

In [2]: arr = ct.SolutionArray(gas, states=[list(gas.state)] * 10)

In [3]: arr("H2").Y.shape
Out[3]: (10, 1)

In [4]: arr("H2").net_production_rates.shape
Out[4]: (10, 1)

Comments

This is to make the interface somewhat consistent with Solution; there are some differences, e.g. round vs square brackets, or passing of lists vs argument lists, where fixes go beyond the scope of this PR. Also, Solution currently does not slice gas["O2"].binary_diff_coeffs correctly, so this PR merely ensures that implementations are mostly consistent.

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

@ischoegl ischoegl marked this pull request as ready for review June 26, 2024 10:06
@ischoegl ischoegl requested a review from a team June 26, 2024 10:07
Copy link

codecov bot commented Jun 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.80%. Comparing base (bc24169) to head (b9a8936).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1726   +/-   ##
=======================================
  Coverage   72.79%   72.80%           
=======================================
  Files         381      381           
  Lines       54011    54020    +9     
  Branches     9207     9210    +3     
=======================================
+ Hits        39319    39328    +9     
  Misses      11707    11707           
  Partials     2985     2985           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ischoegl ischoegl changed the title [python] Fix dimension of sliced SolutionArrays [python] Fix dimension of sliced SolutionArray methods Jun 26, 2024
@ischoegl ischoegl force-pushed the fix-1717 branch 8 times, most recently from 678810d to bf29f32 Compare June 27, 2024 07:41
Copy link
Member

@speth speth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ischoegl, this looks good to me. Disabling just the problematic kinetics-related properties makes a lot more sense than my initial suggestion.

@speth speth merged commit dd56a70 into Cantera:main Jun 30, 2024
48 checks passed
@ischoegl ischoegl deleted the fix-1717 branch July 1, 2024 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants