PyBaMM icon indicating copy to clipboard operation
PyBaMM copied to clipboard

Automate source wrap

Open ArivoliR opened this issue 7 months ago • 2 comments

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes #1410

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #)

Important checks:

Please confirm the following before marking the PR as ready for review:

  • No style issues: nox -s pre-commit
  • All tests pass: nox -s tests
  • The documentation builds: nox -s doctests
  • Code is commented for hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

ArivoliR avatar Apr 11 '25 08:04 ArivoliR

Thanks taking this on! For it to work properly we need to wrap all the terms that aren’t a spatial operator in source, eg see https://github.com/pybamm-team/PyBaMM/blob/9415db5037ca5978a91723ff9a64c3c44d85e0e0/src/pybamm/models/submodels/thermal/pouch_cell/pouch_cell_2D_current_collectors.py#L89

I’m not sure this is what your solution does. Can you add a test to show that pybamm.laplacian(a) + b gets turned into pybamm.laplacian(a) + pybamm.source(b) to show this works in the simplest case? Then we can go from there.

rtimms avatar Apr 19 '25 09:04 rtimms

Okay I've made a huge mistake clearly, will try to figure out if there's a way to handle all these cases by just modifying the wrap_source function that I've made. Have my final exams going on, will continue my attempt at solving this issue in a few weeks

ArivoliR avatar May 01 '25 11:05 ArivoliR

Hi @ArivoliR, If you are still on it - feel free to let us know in case you need help.

arjxn-py avatar Aug 13 '25 08:08 arjxn-py

I spent a while on this, could not get far. Will be closing this draft PR. Thanks a lot for your guidance!

ArivoliR avatar Aug 16 '25 05:08 ArivoliR