Skip to content

🐛[BUG]: MHD_PDE equation "B_grad_u" uses v * Bx.diff(y) instead of By * u.diff(y) #2021

Open

Description

@aaguadob

Version

PhysicsNemo 2.1.1

On which installation method(s) does this occur?

No response

Describe the issue

examples/cfd/mhd_pino/losses/mhd_pde.py L58:
    self.equations["B_grad_u"] = Bx * u.diff(x) + v * Bx.diff(y)

(B·∇)u should be Bx * u.diff(x) + By * u.diff(y). The next line (B_grad_v, L59) follows
the correct pattern, as does the hand-written version in losses/loss_mhd.py L539.

Impact: none for the shipped examples as far as I can tell. loss_mhd.py recomputes the
term correctly, and the *_physicsnemo.py losses only evaluate computations 12–24
(B_grad_u is index 2). Anyone reusing MHD_PDE.equations["B_grad_u"] gets a wrong term.

Suggested fix:

  •    ```
    

self.equations["B_grad_u"] = Bx * u.diff(x) + v * Bx.diff(y)

  •    self.equations["B_grad_u"] = Bx * u.diff(x) + By * u.diff(y)
    

Found by checking MHD_PDE against an exact decaying Alfvén wave; all other terms
(u/v/Bx/By/A right-hand sides, div constraints) match it.

### Minimum reproducible example

```shell
cd examples/cfd/mhd_pino/losses
python -c "from mhd_pde import MHD_PDE; print(MHD_PDE().equations['B_grad_u'])"
# prints Bx*u__x + v*Bx__y  — expected Bx*u__x + By*u__y

Relevant log output

Environment details

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ? - Needs TriageNeed team to review and classifybugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions