You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Benchmark the MOL-discretized Laplace operator on a large-ish grid against my own implementation.
Therefore, simply set up a PDESystem for the Laplace operator and use MethodOfLines.jl to discretize it.
Code
using OrdinaryDiffEq, ModelingToolkit, MethodOfLines, DomainSets
@parameters t x y
@variablesu(..)
Dt =Differential(t)
Dxx =Differential(x)^2
Dyy =Differential(y)^2
eq =Dt(u(t, x, y)) ~0.01* (Dxx(u(t, x, y)) +Dyy(u(t, x, y)))
domains = [x ∈Interval(0.0, 1.0),
y ∈Interval(0.0, 1.0),
t ∈Interval(0.0, 1.0)]
initf(t, x, y) = x # not relevant
bcs = [u(0.0, x, y) ~initf(t, x, y),
u(t, 0.0, y) ~0.0,
u(t, x, 0.0) ~0.0,
u(t, 1.0, y) ~0.0,
u(t, x, 1.0) ~0.0,
]
@named pdesys =PDESystem(eq, bcs, domains, [t, x, y], [u(t, x, y)])
N =100
dx =1.0/ N
discretization =MOLFiniteDifference([x => dx, y => dx], t, approx_order=2)
prob =discretize(pdesys, discretization)
Error
Then, calling
out =similar(prob.u0)
prob.f(out, prob.u0, nothing, 0.0)
Ok, since the defaults are an array of pairs of symbols to values, similar won't work this way, please extract the shape of u0 and use it with zeros for example.
Extremely weird that it works with small systems though.
Goal
Benchmark the MOL-discretized Laplace operator on a large-ish grid against my own implementation.
Therefore, simply set up a
PDESystem
for the Laplace operator and use MethodOfLines.jl to discretize it.Code
Error
Then, calling
yields
What is really interesting:
For
N = 30
, i.e. a smaller grid, it works.System
Please let me know, if you need more information.
Thanks a lot in advance for your help!
The text was updated successfully, but these errors were encountered: