SKopecz / PositiveIntegrators.jl

A Julia library of positivity-preserving time integration methods
https://skopecz.github.io/PositiveIntegrators.jl/
MIT License
13 stars 4 forks source link

Inplace MPE does not work #34

Closed ranocha closed 7 months ago

ranocha commented 7 months ago
julia> using PositiveIntegrators

julia> function linmodP!(P, u, p, t)
           P .= 0
           P[1, 2] = u[2]
           P[2, 1] = 5.0 * u[1]
           return nothing
       end
linmodP! (generic function with 1 method)

julia> linmod_ip = ConservativePDSProblem(linmodP!, [0.9, 0.1], (0.0, 1.5), [5.0, 1.0])
ODEProblem with uType Vector{Float64} and tType Float64. In-place: true
timespan: (0.0, 1.5)
u0: 2-element Vector{Float64}:
 0.9
 0.1

julia> sol = sol_linmod_ip_MPE = solve(linmod_ip, MPE(), dt = 0.25)
ERROR: MethodError: objects of type Tuple{LinearAlgebra.UniformScaling{Bool}, LinearAlgebra.UniformScaling{Bool}} are not callable
Stacktrace:
 [1] alg_cache(alg::MPE{…}, u::Vector{…}, rate_prototype::Vector{…}, ::Type{…}, ::Type{…}, ::Type{…}, uprev::Vector{…}, uprev2::Vector{…}, f::ConservativePDSFunction{…}, t::Float64, dt::Float64, reltol::Float64, p::Vector{…}, calck::Bool, ::Val{…})
   @ PositiveIntegrators ~/.julia/dev/PositiveIntegrators/src/mprk.jl:143
 [2] __init(prob::ODEProblem{…}, alg::MPE{…}, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{…}; 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::Float64, 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), progress_id::Symbol, userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::@Kwargs{})
   @ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZbQoo/src/solve.jl:344
 [3] __solve(::ODEProblem{…}, ::MPE{…}; kwargs::@Kwargs{…})
   @ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/ZbQoo/src/solve.jl:6
 [4] solve_call(_prob::ODEProblem{…}, args::MPE{…}; merge_callbacks::Bool, kwargshandle::Nothing, kwargs::@Kwargs{…})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/8vI1R/src/solve.jl:612
 [5] solve_up(prob::ODEProblem{…}, sensealg::Nothing, u0::Vector{…}, p::Vector{…}, args::MPE{…}; kwargs::@Kwargs{…})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/8vI1R/src/solve.jl:1080
 [6] solve(prob::ODEProblem{…}, args::MPE{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{…})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/8vI1R/src/solve.jl:1003
 [7] top-level scope
   @ REPL[10]:1
Some type information was truncated. Use `show(err)` to see complete types.
ranocha commented 7 months ago

Closed in 8b5dc545706f1a481ce43e8e9c9ef11b69c89175