🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

🐛[BUG]: Diffusion(time=True) in darcy_physics_informed/utils.py silently drops the time-derivative term #2020

Open

Description

@aaguadob

Version

physicsnemo 2.1.1

On which installation method(s) does this occur?

No response

Describe the issue

In examples/cfd/darcy_physics_informed/utils.py, Diffusion builds the field as
T_var = Function(T)(*iv.values()) with iv = {x, y} (L52), and when time=True adds
T_var.diff(Symbol("t")) (L57). Since T_var does not depend on t, SymPy evaluates the
derivative to 0, so time=True silently produces the steady equation.

Expected: Derivative(u(x, y, t), t) - DDerivative(u, (x, 2)) - DDerivative(u, (y, 2))

Impact: both Darcy examples use time=False (darcy_physics_informed_fno.py L84,
darcy_physics_informed_deeponet.py L124), so they are unaffected. Anyone reusing the
class for a transient problem (the docstring advertises dT/dt) trains against the
steady equation with no warning.

Suggested fix (after L51):
if time:
iv["t"] = Symbol("t")
With it, the equation vanishes on the exact heat solution
T = exp(-2π²Dt)·sin(πx)·sin(πy) (max residual ~1e-6), and time=False equations are unchanged.

Minimum reproducible example

cd examples/cfd/darcy_physics_informed
python -c "from utils import Diffusion; print(Diffusion(T='u', D=1.0, time=True).equations)"
# {'diffusion_u': -1.0*Derivative(u(x, y), (x, 2)) - 1.0*Derivative(u(x, y), (y, 2))}   <- no d/dt term

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