-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Add Solution to 1D boundaries #1384
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1384 +/- ##
=======================================
Coverage 71.03% 71.03%
=======================================
Files 363 363
Lines 51855 51898 +43
Branches 17362 17366 +4
=======================================
+ Hits 36834 36868 +34
- Misses 12676 12683 +7
- Partials 2345 2347 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I'm curious about the motivation for this change. I didn't see it discussed elsewhere, although I may have missed it 🤪 |
... you didn't miss anything, but the old implementation was imho error-prone. The Python 1D API uses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boundary1D.gas
(which is rarely used) may not hold the expected object
If this is the problem to fix, then enforcing phase
to always be a kwarg is a pretty intrusive change, IMO. As it's always required it has the effect of increasing verbosity and restricting how the function can be called for the default use case of most of the API (although not the main user facing classes, FreeFlame
etc. fortunately). It may as well be positional-only, to have the same effect of enforcing a standard API, no? That's not necessarily a serious suggestion, just to point out that I think it's not a clear win to make this kwarg-only. But this is deliberately a comment not a request-for-change review because in the end it probably doesn't make much of a difference whatever is chosen here.
a1f5c1b
to
4b1773d
Compare
Can you give an example of this? It isn't obvious to me. The signature of cdef class Domain1D:
...
def __init__(self, _SolutionBase phase, *args, name=None, **kwargs): |
@speth ... I just removed the code portions in question (while making it impossible to pass |
@bryanwweber ... based on your feedback, I reverted the changes. Instead, I made the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the impression that this is working toward something a bit larger -- can I ask what that might be, and how this contributes?
Adding Solution
objects to the StFlow
class in #1345 made sense, but I hadn't paid enough attention to the idea that it was also adding a Solution
object to every Domain1D
object. In particular, I think this ends up being a bit messy since for Boundary1D
objects, there are in general two phases that matter: one associated with the bulk/flow domain to the left, and one to the right. Hence the m_phase_left
and m_phase_right
member variables of the Boundary1D
class, which are automatically set when the containing OneDim
object is initialized. I realize, however, that we don't currently provide an implementation of a Boundary1D
that would actually sit between two flow domains, and this idea isn't supported at all in the Python interface.
The only case where a Boundary1D
object has a phase object of its own that isn't already part of a neighboring domain is the ReactingSurf1D
class. Other than that, the newly added Solution
object seems to go unused, as far as I can tell.
See top of page: Preliminary work for Cantera/enhancements#137 I have a reasonable draft for an import of C++ solution arrays from YAML and HDF formats for Sim1D that are already part of 2.6 (which I can post). Edit: I posted #1385 to provide context |
To answer a little more in detail:
This is of course all true. At the same time, Python does provide a Beyond, I see boundary left/right in C++ as part of a more generic internal interface that was never fully implemented, as a dedicated internal boundary object is missing (as you noted). This PR is not trying to change any of that. At the moment, it is also impossible to replace the boundary left/right route as |
@speth … any further comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is generally fine. Just had a few small questions / suggestions.
4b1773d
to
ca559dd
Compare
ca559dd
to
e3c54bd
Compare
Matplotlib 3.6.0 introduced a new incidental warning which has nothing to do with our code. This change ignores that warning so other warnings can still be caught.
@speth ... thanks for the review! I believe I addressed everything. @bryanwweber ... I hope you don't mind me cherry-picking your fix for the matplotlib warning from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me!
Changes proposed in this pull request
This PR is a follow-up to #1345 and adds
Solution
objects to allBoundary1D
specializations instantiated from the Python API.ReactingSurf1D
receives interface (instead of gas)Boundary1D
objects receive gas phase adjacent to boundary (no change)Deprecate support for non-keywordphase
arguments inDomain1D
interfaceIf applicable, fill in the issue number this pull request is fixing
Preliminary work for Cantera/enhancements#137
Checklist
scons build
&scons test
) and unit tests address code coverage