Skip to content

Support built-in Equations in System of Equation#593

Merged
dario-coscia merged 1 commit into
mathLab:devfrom
GiovanniCanali:fix_system_equation
Jul 4, 2025
Merged

Support built-in Equations in System of Equation#593
dario-coscia merged 1 commit into
mathLab:devfrom
GiovanniCanali:fix_system_equation

Conversation

@GiovanniCanali
Copy link
Copy Markdown
Collaborator

@GiovanniCanali GiovanniCanali commented Jul 1, 2025

Description

This PR fixes #592 .

Checklist

  • Code follows the project’s Code Style Guidelines
  • Tests have been added or updated
  • Documentation has been updated if necessary
  • Pull request is linked to an open issue

@GiovanniCanali GiovanniCanali self-assigned this Jul 1, 2025
@GiovanniCanali GiovanniCanali added bug Something isn't working pr-to-fix Label for PR that needs modification low priority Low priority fix labels Jul 1, 2025
@GiovanniCanali GiovanniCanali marked this pull request as ready for review July 1, 2025 10:45
@GiovanniCanali GiovanniCanali linked an issue Jul 1, 2025 that may be closed by this pull request
@GiovanniCanali GiovanniCanali requested a review from Copilot July 1, 2025 12:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 SystemEquation works with FixedValue and FixedGradient, for both constructor and residual
  • 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 equation parameter. Please update the :param section to describe list_equation as a list of equations or callables (or EquationInterface instances) for clarity.
    def __init__(self, list_equation, reduction=None):

tests/test_equations/test_system_equation.py:76

  • [nitpick] Currently only mean reduction is tested for built-in equations. Consider adding a sum reduction case to ensure both reducers work as expected with FixedValue and FixedGradient.
    res = system_eq.residual(pts, u)

Comment thread pina/equation/system_equation.py
Copy link
Copy Markdown
Collaborator

@dario-coscia dario-coscia left a comment

Choose a reason for hiding this comment

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

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!

@GiovanniCanali
Copy link
Copy Markdown
Collaborator Author

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!

Will do, thank you!

@dario-coscia dario-coscia added pr-to-review Label for PR that are ready to been reviewed and removed pr-to-fix Label for PR that needs modification labels Jul 4, 2025
@dario-coscia dario-coscia merged commit 7c1edf5 into mathLab:dev Jul 4, 2025
18 of 19 checks passed
@GiovanniCanali GiovanniCanali deleted the fix_system_equation branch August 28, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working low priority Low priority fix pr-to-review Label for PR that are ready to been reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System of Equation not supporting built-in Equations

4 participants