GithubHelp home page GithubHelp logo

Solving nonlinear PDE about methodoflines.jl HOT 11 CLOSED

sciml avatar sciml commented on June 18, 2024
Solving nonlinear PDE

from methodoflines.jl.

Comments (11)

DoaaAboelyazeed avatar DoaaAboelyazeed commented on June 18, 2024

ERROR: UndefVarError: u not defined
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:394 [inlined]
[2] macro expansion
@ ~/.julia/packages/Symbolics/DCeQ3/src/build_function.jl:452 [inlined]
[3] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:351 [inlined]
[4] macro expansion
@ ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:129 [inlined]
[5] macro expansion
@ ./none:0 [inlined]
[6] generated_callfunc
@ ./none:0 [inlined]
[7] (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)})(::Vector{Float64}, ::Vector{Float64}, ::Nothing, ::Float64)
@ RuntimeGeneratedFunctions ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:117
[8] f
@ ~/.julia/packages/ModelingToolkit/XinBN/src/systems/diffeqs/abstractodesystem.jl:359 [inlined]
[9] ODEFunction
@ ~/.julia/packages/SciMLBase/GW7GW/src/scimlfunctions.jl:345 [inlined]
[10] initialize!(integrator::OrdinaryDiffEq.ODEIntegrator{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{Float64}, Nothing, Float64, Nothing, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats}, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Vector{Float64}, Float64, Nothing, OrdinaryDiffEq.DefaultInit}, cache::OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/perform_step/low_order_rk_perform_step.jl:627
[11] __init(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{Val{true}}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Nothing, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, dtmin::Nothing, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Rational{Int64}, abstol::Nothing, reltol::Nothing, qmin::Rational{Int64}, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, beta1::Nothing, beta2::Nothing, qoldinit::Rational{Int64}, controller::Nothing, fullnormalize::Bool, failfactor::Int64, maxiters::Int64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), internalopnorm::typeof(LinearAlgebra.opnorm), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:456
[12] __init(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{Val{true}}) (repeats 5 times)
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:67
[13] #__solve#502
@ ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:4 [inlined]
[14] __solve
@ ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:4 [inlined]
[15] #solve_call#39
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:152 [inlined]
[16] solve_call
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:139 [inlined]
[17] #solve_up#41
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:179 [inlined]
[18] solve_up
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:170 [inlined]
[19] #solve#40
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:165 [inlined]
[20] solve(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, args::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
@ DiffEqBase ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:159
[21] top-level scope
@ ~/Julia/SurfaceWater/chk_nonlinearity.jl:47

from methodoflines.jl.

xtalax avatar xtalax commented on June 18, 2024

Hi! Try having your includes be using ModelingToolkit, MethodOfLines, DomainSets, OrdinaryDiffEq.

Your solve needs to be an ODE solve, since you have supplied an undiscretized t dimension. Try sol = solve(prob, Euler(), dt = 3.) - Euler() needs a fixed timestep.

from methodoflines.jl.

xtalax avatar xtalax commented on June 18, 2024

The reason to only use OrdinaryDiffEq rather than DifferentialEquations is to reduce compile times, DE.jl re-exports ODE.jl

from methodoflines.jl.

DoaaAboelyazeed avatar DoaaAboelyazeed commented on June 18, 2024

I tried this code but throwing the same error.

using ModelingToolkit, MethodOfLines, DomainSets, OrdinaryDiffEq

# Define the system of equations
@parameters t x 
@variables u(..) 

Dt = Differential(t)
Dx = Differential(x)


tmin = 0.;
tmax = 6000.;

xmin = 0.;
xmax = 200.;


dx = 10.0;
dt = 3.0;
order = 2; # Order of the finite element approximation, must be even




eqs = [Dt(u(t,x)) + u(t,x) * Dx(u(t,x)) ~ 0.0]
       # Dt(u(t,x)) + 0.5 * Dx(u(t,x)^2) ~ 0.0]    

## Note that we are defining hu(t,x) because we cannot do 
domain = [x ∈ Interval(xmin,xmax), 
          t ∈ Interval(tmin,tmax)]

# Define the BC function 

bcs = [u(tmin, x) ~ 0.,
       u(t, xmin) ~ 0.,
       Dt(u(t, xmax))+ 3 *  Dx(u(t,xmax)) ~ 0.0]


@named pdesys = PDESystem(eqs, bcs, domain, [t, x], [u(t,x)])

# Create discretization


discretization = MOLFiniteDifference([x => dx], t, approx_order = order, grid_align = center_align) # edge_align gives better results with Neumann BCs, though uses extra grid points

prob = ModelingToolkit.discretize(pdesys, discretization)

sol = solve(prob, Euler(), dt = 3.)

from methodoflines.jl.

DoaaAboelyazeed avatar DoaaAboelyazeed commented on June 18, 2024

The error I got:

ERROR: UndefVarError: u not defined
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:394 [inlined]
[2] macro expansion
@ ~/.julia/packages/Symbolics/DCeQ3/src/build_function.jl:452 [inlined]
[3] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:351 [inlined]
[4] macro expansion
@ ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:129 [inlined]
[5] macro expansion
@ ./none:0 [inlined]
[6] generated_callfunc
@ ./none:0 [inlined]
[7] (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)})(::Vector{Float64}, ::Vector{Float64}, ::Nothing, ::Float64)
@ RuntimeGeneratedFunctions ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:117
[8] f
@ ~/.julia/packages/ModelingToolkit/XinBN/src/systems/diffeqs/abstractodesystem.jl:359 [inlined]
[9] ODEFunction
@ ~/.julia/packages/SciMLBase/GW7GW/src/scimlfunctions.jl:345 [inlined]
[10] initialize!(integrator::OrdinaryDiffEq.ODEIntegrator{Euler, true, Vector{Float64}, Nothing, Float64, Nothing, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Euler, OrdinaryDiffEq.InterpolationData{ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}}}, DiffEqBase.DEStats}, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Int64}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Vector{Float64}, Float64, Nothing, OrdinaryDiffEq.DefaultInit}, cache::OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/perform_step/fixed_timestep_perform_step.jl:77
[11] __init(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::Euler, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{Val{true}}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Nothing, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, dtmin::Nothing, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Int64, abstol::Nothing, reltol::Nothing, qmin::Int64, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, beta1::Nothing, beta2::Nothing, qoldinit::Int64, controller::Nothing, fullnormalize::Bool, failfactor::Int64, maxiters::Int64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), internalopnorm::typeof(LinearAlgebra.opnorm), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:456
[12] #__solve#502
@ ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:4 [inlined]
[13] #solve_call#39
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:152 [inlined]
[14] #solve_up#41
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:179 [inlined]
[15] #solve#40
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:165 [inlined]
[16] top-level scope
@ ~/Julia/SurfaceWater/chk_nonlinearity.jl:48

ERROR: UndefVarError: u not defined
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:394 [inlined]
[2] macro expansion
@ ~/.julia/packages/Symbolics/DCeQ3/src/build_function.jl:452 [inlined]
[3] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:351 [inlined]
[4] macro expansion
@ ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:129 [inlined]
[5] macro expansion
@ ./none:0 [inlined]
[6] generated_callfunc
@ ./none:0 [inlined]
[7] (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xf039efa6, 0xfbd119c8, 0xb1b935fc, 0xf73375b6, 0x949ee957)})(::Vector{Float64}, ::Vector{Float64}, ::Nothing, ::Float64)
@ RuntimeGeneratedFunctions ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:117
[8] f
@ ~/.julia/packages/ModelingToolkit/XinBN/src/systems/diffeqs/abstractodesystem.jl:359 [inlined]
[9] ODEFunction
@ ~/.julia/packages/SciMLBase/GW7GW/src/scimlfunctions.jl:345 [inlined]
[10] initialize!(integrator::OrdinaryDiffEq.ODEIntegrator{Euler, true, Vector{Float64}, Nothing, Float64, Nothing, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4a8169cf, 0x220f36dd, 0xd4961033, 0xd55cd981, 0xeb727e83)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xf039efa6, 0xfbd119c8, 0xb1b935fc, 0xf73375b6, 0x949ee957)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Euler, OrdinaryDiffEq.InterpolationData{ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4a8169cf, 0x220f36dd, 0xd4961033, 0xd55cd981, 0xeb727e83)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xf039efa6, 0xfbd119c8, 0xb1b935fc, 0xf73375b6, 0x949ee957)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}}}, DiffEqBase.DEStats}, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4a8169cf, 0x220f36dd, 0xd4961033, 0xd55cd981, 0xeb727e83)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xf039efa6, 0xfbd119c8, 0xb1b935fc, 0xf73375b6, 0x949ee957)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Int64}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Vector{Float64}, Float64, Nothing, OrdinaryDiffEq.DefaultInit}, cache::OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/perform_step/fixed_timestep_perform_step.jl:77
[11] __init(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4a8169cf, 0x220f36dd, 0xd4961033, 0xd55cd981, 0xeb727e83)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xf039efa6, 0xfbd119c8, 0xb1b935fc, 0xf73375b6, 0x949ee957)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::Euler, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{Val{true}}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Nothing, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, dtmin::Nothing, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Int64, abstol::Nothing, reltol::Nothing, qmin::Int64, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, beta1::Nothing, beta2::Nothing, qoldinit::Int64, controller::Nothing, fullnormalize::Bool, failfactor::Int64, maxiters::Int64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), internalopnorm::typeof(LinearAlgebra.opnorm), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:456
[12] #__solve#502
@ ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:4 [inlined]
[13] #solve_call#39
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:152 [inlined]
[14] #solve_up#41
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:179 [inlined]
[15] #solve#40
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:165 [inlined]
[16] top-level scope
@ ~/Julia/SurfaceWater/chk_nonlinearity.jl:48

ERROR: UndefVarError: u not defined
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:394 [inlined]
[2] macro expansion
@ ~/.julia/packages/Symbolics/DCeQ3/src/build_function.jl:452 [inlined]
[3] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:351 [inlined]
[4] macro expansion
@ ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:129 [inlined]
[5] macro expansion
@ ./none:0 [inlined]
[6] generated_callfunc
@ ./none:0 [inlined]
[7] (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)})(::Vector{Float64}, ::Vector{Float64}, ::Nothing, ::Float64)
@ RuntimeGeneratedFunctions ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:117
[8] f
@ ~/.julia/packages/ModelingToolkit/XinBN/src/systems/diffeqs/abstractodesystem.jl:359 [inlined]
[9] ODEFunction
@ ~/.julia/packages/SciMLBase/GW7GW/src/scimlfunctions.jl:345 [inlined]
[10] initialize!(integrator::OrdinaryDiffEq.ODEIntegrator{Euler, true, Vector{Float64}, Nothing, Float64, Nothing, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Euler, OrdinaryDiffEq.InterpolationData{ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}}}, DiffEqBase.DEStats}, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Int64}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Vector{Float64}, Float64, Nothing, OrdinaryDiffEq.DefaultInit}, cache::OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/perform_step/fixed_timestep_perform_step.jl:77
[11] __init(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::Euler, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{Val{true}}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Nothing, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, dtmin::Nothing, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Int64, abstol::Nothing, reltol::Nothing, qmin::Int64, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, beta1::Nothing, beta2::Nothing, qoldinit::Int64, controller::Nothing, fullnormalize::Bool, failfactor::Int64, maxiters::Int64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), internalopnorm::typeof(LinearAlgebra.opnorm), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:456
[12] #__solve#502
@ ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:4 [inlined]
[13] #solve_call#39
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:152 [inlined]
[14] #solve_up#41
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:179 [inlined]
[15] #solve#40
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:165 [inlined]
[16] top-level scope
@ ~/Julia/SurfaceWater/chk_nonlinearity.jl:48

ERROR: UndefVarError: u not defined
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:394 [inlined]
[2] macro expansion
@ ~/.julia/packages/Symbolics/DCeQ3/src/build_function.jl:452 [inlined]
[3] macro expansion
@ ~/.julia/packages/SymbolicUtils/v2ZkM/src/code.jl:351 [inlined]
[4] macro expansion
@ ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:129 [inlined]
[5] macro expansion
@ ./none:0 [inlined]
[6] generated_callfunc
@ ./none:0 [inlined]
[7] (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)})(::Vector{Float64}, ::Vector{Float64}, ::Nothing, ::Float64)
@ RuntimeGeneratedFunctions ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:117
[8] f
@ ~/.julia/packages/ModelingToolkit/XinBN/src/systems/diffeqs/abstractodesystem.jl:359 [inlined]
[9] ODEFunction
@ ~/.julia/packages/SciMLBase/GW7GW/src/scimlfunctions.jl:345 [inlined]
[10] initialize!(integrator::OrdinaryDiffEq.ODEIntegrator{Euler, true, Vector{Float64}, Nothing, Float64, Nothing, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Euler, OrdinaryDiffEq.InterpolationData{ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}}}, DiffEqBase.DEStats}, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Int64}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Vector{Float64}, Float64, Nothing, OrdinaryDiffEq.DefaultInit}, cache::OrdinaryDiffEq.EulerCache{Vector{Float64}, Vector{Float64}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/perform_step/fixed_timestep_perform_step.jl:77
[11] __init(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ODEFunction{true, ModelingToolkit.var"#f#387"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x4c4154f6, 0xbb86308e, 0x85432ba4, 0x923a1391, 0xc5700931)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x2b970efe, 0x46b1d18b, 0xa5d74119, 0xcabd81c4, 0xeae8dda5)}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#377#generated_observed#394"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::Euler, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{Val{true}}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Nothing, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, dtmin::Nothing, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Int64, abstol::Nothing, reltol::Nothing, qmin::Int64, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, beta1::Nothing, beta2::Nothing, qoldinit::Int64, controller::Nothing, fullnormalize::Bool, failfactor::Int64, maxiters::Int64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), internalopnorm::typeof(LinearAlgebra.opnorm), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:456
[12] #__solve#502
@ ~/.julia/packages/OrdinaryDiffEq/i4AYD/src/solve.jl:4 [inlined]
[13] #solve_call#39
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:152 [inlined]
[14] #solve_up#41
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:179 [inlined]
[15] #solve#40
@ ~/.julia/packages/DiffEqBase/ziNGu/src/solve.jl:165 [inlined]
[16] top-level scope
@ ~/Julia/SurfaceWater/chk_nonlinearity.jl:48

from methodoflines.jl.

xtalax avatar xtalax commented on June 18, 2024

This works for me

using ModelingToolkit, MethodOfLines, DomainSets, OrdinaryDiffEq

# Define the system of equations
@parameters t x
@variables u(..) v(..)

Dt = Differential(t)
Dx = Differential(x)


tmin = 0.;
tmax = 6000.;

xmin = 0.;
xmax = 200.;


dx = 10.0;
dt = 3.0;
order = 2; # Order of the finite element approximation, must be even



eqs = [#Dt(u(t,x)) + u(t,x) * Dx(u(t,x)) ~ 0.0
        Dt(u(t,x)) + 0.5 * Dx(v(t,x)) ~ 0.0,
        v(t,x) ~ u(t,x)^2
        ]

## Note that we are defining hu(t,x) because we cannot do
domain = [x  Interval(xmin,xmax),
          t  Interval(tmin,tmax)]

# Define the BC function

bcs = [u(tmin, x) ~ 0.,
       v(tmin, x) ~ 0.,
       u(t, xmin) ~ 0.,
       Dt(u(t, xmax))+ 3 *  Dx(u(t,xmax)) ~ 0.0]


@named pdesys = PDESystem(eqs, bcs, domain, [t, x], [u(t,x), v(t,x)])

# Create discretization


discretization = MOLFiniteDifference([x => dx], t, approx_order = order, grid_align = center_align) # edge_align gives better results with Neumann BCs, though uses extra grid points

prob = ModelingToolkit.discretize(pdesys, discretization)

sol = solve(prob, Rosenbrock23())

Note the auxiliary variable v(t, x), see the docs section 'known limitations' for more.

Use the kwarg saveat=0.1 in the solve to get the result at specific evenly spaced times.

from methodoflines.jl.

DoaaAboelyazeed avatar DoaaAboelyazeed commented on June 18, 2024

so you must specify just initial boundary condition for v(t,x) in this case??

from methodoflines.jl.

xtalax avatar xtalax commented on June 18, 2024

In this case no, since it has an explicit rather than differential equation.

from methodoflines.jl.

xtalax avatar xtalax commented on June 18, 2024

Hey @DoaaAboelyazeed a bug has been reported that will affect this - please move your advection terms to the rhs and see if this affects things.

from methodoflines.jl.

YichengDWu avatar YichengDWu commented on June 18, 2024

Hey @DoaaAboelyazeed a bug has been reported that will affect this - please move your advection terms to the rhs and see if this affects things.

Hi, can u clarify what is the difference between

Dt(u(t,x)) + u(t,x) * Dx(u(t,x)) ~ 0.0
        
Dt(u(t,x)) + 0.5 * Dx(v(t,x)) ~ 0.0

from methodoflines.jl.

xtalax avatar xtalax commented on June 18, 2024

For one, u is not 0.5 in general, nor is it equal to v, so that will affect the velocity of the advection. In general you will also need an eqn for v in the second case, so I can't speak to the dynamics of this equation without more info.

from methodoflines.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.