Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIRK methods failed on swirling flow III when viscosity parameter is small #153

Closed
ErikQQY opened this issue Dec 21, 2023 · 0 comments · Fixed by #155
Closed

MIRK methods failed on swirling flow III when viscosity parameter is small #153

ErikQQY opened this issue Dec 21, 2023 · 0 comments · Fixed by #155
Labels

Comments

@ErikQQY
Copy link
Member

ErikQQY commented Dec 21, 2023

Describe the bug 🐞

$\epsilon$ is the viscosity parameter, when it is set to 0.1, we can successfully get the solution, but when we set $\epsilon$ as 0.01 or smaller, MIRK methods throw error.

Minimal Reproducible Example 👇

using BoundaryValueDiffEq
eps = 0.01
function test!(du, u, p, t)
    eps = p
    du[1] = u[2]
    du[2] = (u[1]*u[4] - u[3]*u[2])/eps
    du[3] = u[4]
    du[4] = u[5]
    du[5] = u[6]
    du[6] = (-u[3]*u[6] - u[1]*u[2])/eps
end

function bc!(res, u, p, t)
    res[1] = u[1][1] + 1.0
    res[2] = u[1][3]
    res[3] = u[1][4]
    res[4] = u[end][1] - 1.0
    res[5] = u[end][3]
    res[6] = u[end][4]
end
tspan = (0.0, 1.0)
u0 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
prob = BVProblem(test!, bc!, u0, tspan, eps)
sol=solve(prob, MIRK4(), dt=0.01)

Error & Stacktrace ⚠️

julia> sol = solve(prob, MIRK4(), dt=0.01)
ERROR: MethodError: no method matching (::BoundaryValueDiffEq.var"#119#125"{BoundaryValueDiffEq.MIRKCache{true, Float64, Tuple{Int64}, BVPFunction{true, SciMLBase.FullSpecialize, true, typeof(test!), Tuple{typeof(bca!), typeof(bcb!)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, RecursiveArrayTools.ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing}, Tuple{typeof(bca!), typeof(bcb!)}, BVProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, BVPFunction{true, SciMLBase.FullSpecialize, true, typeof(test!), Tuple{typeof(bca!), typeof(bcb!)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, RecursiveArrayTools.ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing}, TwoPointBVProblem{true}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, TwoPointBVProblem{true}, SciMLBase.NullParameters, MIRK4{Nothing, BVPJacobianAlgorithm{AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}}}, BoundaryValueDiffEq.MIRKTableau{Int64, Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}}, BoundaryValueDiffEq.MIRKInterpTableau{Int64, Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{PreallocationTools.DiffCache{Matrix{Float64}, Vector{Float64}}}, Vector{Matrix{Float64}}, Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Tuple{Tuple{Int64}, Tuple{Int64}}, NamedTuple{(:defect_threshold, :MxNsub, :abstol, :dt, :adaptive), Tuple{Float64, Int64, Float64, Float64, Bool}}}, TwoPointBVProblem{true}})(::Vector{Float64}, ::Vector{Float64})

Closest candidates are:
  (::BoundaryValueDiffEq.var"#119#125")(::Any, ::Any, ::Any)
   @ BoundaryValueDiffEq ~/.julia/packages/BoundaryValueDiffEq/SrG4p/src/solve/mirk.jl:208

Stacktrace:
  [1] (::NonlinearFunction{true, SciMLBase.FullSpecialize, BoundaryValueDiffEq.var"#119#125"{BoundaryValueDiffEq.MIRKCache{true, Float64, Tuple{Int64}, BVPFunction{true, SciMLBase.FullSpecialize, true, typeof(test!), Tuple{typeof(bca!), typeof(bcb!)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, RecursiveArrayTools.ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing}, Tuple{typeof(bca!), typeof(bcb!)}, BVProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, BVPFunction{true, SciMLBase.FullSpecialize, true, typeof(test!), Tuple{typeof(bca!), typeof(bcb!)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, RecursiveArrayTools.ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing}, TwoPointBVProblem{true}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, TwoPointBVProblem{true}, SciMLBase.NullParameters, MIRK4{Nothing, BVPJacobianAlgorithm{AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}}}, BoundaryValueDiffEq.MIRKTableau{Int64, Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}}, BoundaryValueDiffEq.MIRKInterpTableau{Int64, Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{PreallocationTools.DiffCache{Matrix{Float64}, Vector{Float64}}}, Vector{Matrix{Float64}}, Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Tuple{Tuple{Int64}, Tuple{Int64}}, NamedTuple{(:defect_threshold, :MxNsub, :abstol, :dt, :adaptive), Tuple{Float64, Int64, Float64, Float64, Bool}}}, TwoPointBVProblem{true}}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, BoundaryValueDiffEq.var"#147#151"{SparseDiffTools.ForwardDiffJacobianCache{SparseDiffTools.MatrixColoringResult{Vector{Int64}, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}, ArrayInterface.BandedMatrixIndex, ArrayInterface.BandedMatrixIndex}, ForwardColorJacCache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{BoundaryValueDiffEq.BoundaryValueDiffEqTag, Float64}, Float64, 8}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{BoundaryValueDiffEq.BoundaryValueDiffEqTag, Float64}, Float64, 8}}, Vector{Float64}, Vector{Vector{NTuple{8, Float64}}}, Vector{Int64}, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}, Vector{Float64}, Vector{Float64}}, Vector{Float64}, BoundaryValueDiffEq.var"#145#149"{BoundaryValueDiffEq.MIRKCache{true, Float64, Tuple{Int64}, BVPFunction{true, SciMLBase.FullSpecialize, true, typeof(test!), Tuple{typeof(bca!), typeof(bcb!)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, RecursiveArrayTools.ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing}, Tuple{typeof(bca!), typeof(bcb!)}, BVProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, BVPFunction{true, SciMLBase.FullSpecialize, true, typeof(test!), Tuple{typeof(bca!), typeof(bcb!)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, RecursiveArrayTools.ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing}, TwoPointBVProblem{true}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, TwoPointBVProblem{true}, SciMLBase.NullParameters, MIRK4{Nothing, BVPJacobianAlgorithm{AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}}}, BoundaryValueDiffEq.MIRKTableau{Int64, Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}}, BoundaryValueDiffEq.MIRKInterpTableau{Int64, Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{PreallocationTools.DiffCache{Matrix{Float64}, Vector{Float64}}}, Vector{Matrix{Float64}}, Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Tuple{Tuple{Int64}, Tuple{Int64}}, NamedTuple{(:defect_threshold, :MxNsub, :abstol, :dt, :adaptive), Tuple{Float64, Int64, Float64, Float64, Bool}}}, BoundaryValueDiffEq.var"#119#125"{BoundaryValueDiffEq.MIRKCache{true, Float64, Tuple{Int64}, BVPFunction{true, SciMLBase.FullSpecialize, true, typeof(test!), Tuple{typeof(bca!), typeof(bcb!)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, RecursiveArrayTools.ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing}, Tuple{typeof(bca!), typeof(bcb!)}, BVProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, BVPFunction{true, SciMLBase.FullSpecialize, true, typeof(test!), Tuple{typeof(bca!), typeof(bcb!)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, RecursiveArrayTools.ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing}, TwoPointBVProblem{true}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, TwoPointBVProblem{true}, SciMLBase.NullParameters, MIRK4{Nothing, BVPJacobianAlgorithm{AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}}}, BoundaryValueDiffEq.MIRKTableau{Int64, Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}}, BoundaryValueDiffEq.MIRKInterpTableau{Int64, Vector{Float64}, Vector{Float64}, Vector{Float64}, Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{PreallocationTools.DiffCache{Matrix{Float64}, Vector{Float64}}}, Vector{Matrix{Float64}}, Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}}, Vector{Vector{Float64}}, Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Vector{Float64}}, Vector{Vector{Float64}}, Tuple{Tuple{Int64}, Tuple{Int64}}, NamedTuple{(:defect_threshold, :MxNsub, :abstol, :dt, :adaptive), Tuple{Float64, Int64, Float64, Float64, Bool}}}, TwoPointBVProblem{true}}}, BVPJacobianAlgorithm{AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}, AutoSparseForwardDiff{nothing, BoundaryValueDiffEq.BoundaryValueDiffEqTag}}}, Nothing, Nothing, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}, BandedMatrices.BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Vector{Int64}, Nothing, Vector{Float64}})(::Vector{Float64}, ::Vararg{Vector{Float64}})

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
julia> Pkg.status()
Status `~/.julia/environments/v1.9/Project.toml`
  [ded0fc24] BVProblemLibrary v0.1.4
⌃ [6e4b80f9] BenchmarkTools v1.3.2
  [764a87c0] BoundaryValueDiffEq v5.6.0
  [54ca160b] ODEInterface v0.5.0
  • Output of versioninfo()
julia> versioninfo()
Julia Version 1.9.2
Commit e4ee485e909 (2023-07-05 09:39 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 1 on 8 virtual cores
@ErikQQY ErikQQY added the bug label Dec 21, 2023
@avik-pal avik-pal linked a pull request Mar 22, 2024 that will close this issue
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant