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
Tutorial on SIS gives Discretization failed with ArgumentError: dS => 0.5 is not a parameter.
The error can be avoided by using ] compat MethodOfLines =0.11.0, so a bug may have been introduced in later versions of MOL.
Expected behavior
Tutorial is expected to complete its computations.
Minimal Reproducible Example 👇
Simply copy the SIS example (below) and run it on a clean instantiation of julia 1.11.1. It will fail at the call to 'discretize'.
using DifferentialEquations, ModelingToolkit, MethodOfLines, DomainSets, Plots
# Parameters, variables, and derivatives@parameters t x
@parameters dS dI brn ϵ
@variablesS(..) I(..)
Dt =Differential(t)
Dx =Differential(x)
Dxx =Differential(x)^2# Define functionsfunctionγ(x)
y = x +1.0return y
endfunctionratio(x, brn, ϵ)
y = brn + ϵ *sin(2*pi* x)
return y
end# 1D PDE and boundary conditions
eq = [
Dt(S(t, x)) ~ dS *Dxx(S(t, x)) -ratio(x, brn, ϵ) *γ(x) *S(t, x) *I(t, x) / (S(t, x) +I(t, x)) +γ(x) *I(t, x),
Dt(I(t, x)) ~ dI *Dxx(I(t, x)) +ratio(x, brn, ϵ) *γ(x) *S(t, x) *I(t, x) / (S(t, x) +I(t, x)) -γ(x) *I(t, x)]
bcs = [S(0, x) ~0.9+0.1*sin(2*pi* x),
I(0, x) ~0.1+0.1*cos(2*pi* x),
Dx(S(t, 0)) ~0.0,
Dx(S(t, 1)) ~0.0,
Dx(I(t, 0)) ~0.0,
Dx(I(t, 1)) ~0.0]
# Space and time domains
domains = [t ∈Interval(0.0, 10.0),
x ∈Interval(0.0, 1.0)]
# PDE system@named pdesys =PDESystem(eq, bcs, domains, [t, x], [S(t, x), I(t, x)], [dS, dI, brn, ϵ];
defaults =Dict(dS =>0.5, dI =>0.1, brn =>3, ϵ =>0.1))
# Method of lines discretization# Need a small dx here for accuracy
dx =0.01
order =2
discretization =MOLFiniteDifference([x => dx], t)
# Convert the PDE problem into an ODE problem
prob =discretize(pdesys, discretization);
Error & Stacktrace ⚠️
The system of equations is:
Discretization failed, please post an issue on https://github.com/SciML/MethodOfLines.jl with the failing code and system at low point count.
ERROR: ArgumentError: dS =>0.5 is not a parameter.
Stacktrace:
[1] check_parameters
@ ~/.julia/packages/ModelingToolkit/YLJ0I/src/utils.jl:127 [inlined]
[2] ODESystem(tag::UInt64, deqs::Vector{…}, iv::SymbolicUtils.BasicSymbolic{…}, dvs::Vector{…}, ps::Vector{…}, tspan::Nothing, var_to_name::Dict{…}, ctrls::Vector{…}, observed::Vector{…}, tgrad::Base.RefValue{…}, jac::Base.RefValue{…}, ctrl_jac::Base.RefValue{…}, Wfact::Base.RefValue{…}, Wfact_t::Base.RefValue{…}, name::Symbol, description::String, systems::Vector{…}, defaults::Dict{…}, guesses::Dict{…}, torn_matching::Nothing, initializesystem::Nothing, initialization_eqs::Vector{…}, schedule::Nothing, connector_type::Nothing, preface::Nothing, cevents::Vector{…}, devents::Vector{…}, parameter_dependencies::Vector{…}, assertions::Dict{…}, metadata::MethodOfLines.MOLMetadata{…}, gui_metadata::Nothing, is_dde::Bool, tstops::Vector{…}, tearing_state::Nothing, substitutions::Nothing, complete::Bool, index_cache::Nothing, discrete_subsystems::Nothing, solved_unknowns::Nothing, split_idxs::Nothing, parent::Nothing; checks::Bool)
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/YLJ0I/src/systems/diffeqs/odesystem.jl:207
[3] ODESystem
@ ~/.julia/packages/ModelingToolkit/YLJ0I/src/systems/diffeqs/odesystem.jl:194 [inlined]
[4] ODESystem(deqs::Vector{…}, iv::Num, dvs::Vector{…}, ps::Vector{…}; controls::Vector{…}, observed::Vector{…}, systems::Vector{…}, tspan::Nothing, name::Symbol, description::String, default_u0::Dict{…}, default_p::Dict{…}, defaults::Dict{…}, guesses::Dict{…}, initializesystem::Nothing, initialization_eqs::Vector{…}, schedule::Nothing, connector_type::Nothing, preface::Nothing, continuous_events::Nothing, discrete_events::Nothing, parameter_dependencies::Vector{…}, assertions::Dict{…}, checks::Bool, metadata::MethodOfLines.MOLMetadata{…}, gui_metadata::Nothing, is_dde::Nothing, tstops::Vector{…}, discover_from_metadata::Bool)
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/YLJ0I/src/systems/diffeqs/odesystem.jl:301
[5] generate_system(disc_state::PDEBase.EquationState, s::MethodOfLines.DiscreteSpace{…}, u0::Vector{…}, tspan::Tuple{…}, metadata::MethodOfLines.MOLMetadata{…}, disc::MOLFiniteDifference{…})
@ PDEBase ~/.julia/packages/PDEBase/VVGPP/src/discretization_state.jl:40
[6] symbolic_discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…})
@ PDEBase ~/.julia/packages/PDEBase/VVGPP/src/symbolic_discretize.jl:89
[7] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…}; analytic::Nothing, kwargs::@Kwargs{})
@ PDEBase ~/.julia/packages/PDEBase/VVGPP/src/discretization_state.jl:57
[8] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…})
@ PDEBase ~/.julia/packages/PDEBase/VVGPP/src/discretization_state.jl:54
[9] top-level scope
@ ~/Documents/GitHub/SmallLargeClearance/scripts/MOLSIStutorial.jl:1
Some type information was truncated. Use `show(err)` to see complete types.
Environment (please complete the following information):
Describe the bug 🐞
Tutorial on SIS gives Discretization failed with ArgumentError: dS => 0.5 is not a parameter.
The error can be avoided by using
] compat MethodOfLines =0.11.0
, so a bug may have been introduced in later versions of MOL.Expected behavior
Tutorial is expected to complete its computations.
Minimal Reproducible Example 👇
Simply copy the SIS example (below) and run it on a clean instantiation of julia 1.11.1. It will fail at the call to 'discretize'.
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: