Support built-in Equations in System of Equation#593
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for using built-in equation types (FixedValue, FixedGradient) inside a SystemEquation and updates tests accordingly.
- Tests now import and verify
SystemEquationworks withFixedValueandFixedGradient, for both constructor andresidual - Refactored
SystemEquation.__init__to build its internal list with a comprehension
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_equations/test_system_equation.py | Import and add tests for FixedValue/FixedGradient use cases |
| pina/equation/system_equation.py | Simplified list building of self.equations with isinstance |
Comments suppressed due to low confidence (2)
pina/equation/system_equation.py:17
- The docstring still describes a single callable
equationparameter. Please update the:paramsection to describelist_equationas a list of equations or callables (orEquationInterfaceinstances) for clarity.
def __init__(self, list_equation, reduction=None):
tests/test_equations/test_system_equation.py:76
- [nitpick] Currently only
meanreduction is tested for built-in equations. Consider adding asumreduction case to ensure both reducers work as expected withFixedValueandFixedGradient.
res = system_eq.residual(pts, u)
dario-coscia
approved these changes
Jul 1, 2025
Collaborator
dario-coscia
left a comment
There was a problem hiding this comment.
To me looks good!
Just one thing, in the documentation we should modify equation to also have Equation object and not just callables. Also an example in the doc would nice!
Collaborator
Author
Will do, thank you! |
8cda42b to
4f77f39
Compare
FilippoOlivo
approved these changes
Jul 3, 2025
dario-coscia
approved these changes
Jul 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes #592 .
Checklist