Skip to content

Forgetting a variable in PDESystem results in infinite loop #475

Description

@bertini97

Describe the bug 🐞

Consider

using MethodOfLines, ModelingToolkit, DomainSets

@parameters t, v
@variables p(..) S(..)

∂ₜ = Differential(t)
∂ᵥ = Differential(v)

eq = [ S(t, v) ~ - p(t, v) - ∂ᵥ(p(t, v)),
       ∂ₜ(p(t, v)) ~ -∂ᵥ(S(t, v)) ]

bcs = [ p(0.0, v) ~ 1.0, p(t, 20.0) ~ 0.0, ∂ᵥ(p(t, -10.0)) ~ 0.0 ]
domains = [t  Interval(0.0, 1.0), v  Interval(-10.0, 20.0)]

@named sys = PDESystem(eq, bcs, domains, [t, v], [p(t, v) S(t, v)])
discretization = MOLFiniteDifference([v => 0.5], t)
prob = discretize(sys, discretization)

If one forgets to add S(t, v) and just has

@named sys = PDESystem(eq, bcs, domains, [t, v], [p(t, v)])

it will result in infinite printing of

┌ Warning: Expanding derivatives in term Differential(v)(S(t, v)).
└ @ MethodOfLines ~/.julia/packages/MethodOfLines/JDu9X/src/system_parsing/pde_system_transformation.jl:19

Expected behavior

If there is a way to catch and handle this, maybe reporting it to the user, it would be good to have. Otherwise, just close the issue. Thanks!

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions