-
-
Notifications
You must be signed in to change notification settings - Fork 231
Closed
Description
Trying to reproduce the Poisson equation example from the JuliaCon talk, I hit a dead end, see also here.
I locally added compat entries for DiffEqOperators.jl
so that it accepts the current version of MTK, but for 2-dimensional PDEs always the same problem seems to be appearing:
julia> depvar_ops = map(x->operation(x.val),pde_system.depvars)
ERROR: type CallWithMetadata has no field val
Stacktrace:
[1] getproperty(x::Symbolics.CallWithMetadata{SymbolicUtils.FnType{Tuple, Real}, Base.ImmutableDict{DataType, Any}}, f::Symbol)
@ Base .\Base.jl:33
[2] (::var"#7#8")(x::Symbolics.CallWithMetadata{SymbolicUtils.FnType{Tuple, Real}, Base.ImmutableDict{DataType, Any}})
@ Main .\REPL[19]:1
[3] iterate
@ .\generator.jl:47 [inlined]
[4] _collect
@ .\array.jl:691 [inlined]
[5] collect_similar(cont::Vector{Symbolics.CallWithMetadata{SymbolicUtils.FnType{Tuple, Real}, Base.ImmutableDict{DataType, Any}}}, itr::Base.Generator{Vector{Symbolics.CallWithMetadata{SymbolicUtils.FnType{Tuple, Real}, Base.ImmutableDict{DataType, Any}}}, var"#7#8"})
@ Base .\array.jl:606
[6] map(f::Function, A::Vector{Symbolics.CallWithMetadata{SymbolicUtils.FnType{Tuple, Real}, Base.ImmutableDict{DataType, Any}}})
@ Base .\abstractarray.jl:2294
[7] top-level scope
@ REPL[19]:1
Here is the Poinsson example that causes this problem:
using ModelingToolkit, DiffEqOperators, DifferentialEquations, DomainSets
import ModelingToolkit: Interval, infimum, supremum
@parameters x y
@variables u(..)
Dxx = Differential(x)^2
Dyy = Differential(y)^2
eq = (Dxx(u(x,y)) + Dyy(u(x,y)) ~ -sin(pi*x)*sin(pi*y))
bcs = [u(0,y) ~ 0.f0, u(1,y) ~ -sin(pi*1)*sin(pi*y),
u(x,0) ~ 0.f0, u(x,1) ~ -sin(pi*x)*sin(pi*1) ]
domains = [x ∈ Interval(0.0,1.0),
y ∈ Interval(0.0,1.0)] # \in
pde_system = PDESystem(eq, bcs, domains, [x,y], [u], name=:Poisson_System)
dx = 0.05; dy = 0.05;
discretization = MOLFiniteDifference([x=>dx, y=>dy], nothing, centered_order=2)
using ModelingToolkit: operation
depvar_ops = map(x->operation(x.val),pde_system.depvars) # copied from DiffEqOperators.jl, which shows the problem.
prob = discretize(pde_system, discretization) # Here the above problem appears
sol = solve(prob)
For a 1D problem, like the diffusion example, the code runs fine.
Any ideas how to fix this for this 2D Poisson equation example?
Metadata
Metadata
Assignees
Labels
No labels