From ce0fd742e8815d2a40a03149881aaf15d401eb28 Mon Sep 17 00:00:00 2001 From: oscarddssmith Date: Tue, 8 Oct 2024 11:56:02 -0400 Subject: [PATCH] fix-init-FBDF --- lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl | 10 ++++++++++ lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl b/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl index bca93c4d01..c352bee0ef 100644 --- a/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl +++ b/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl @@ -1066,6 +1066,11 @@ function initialize!(integrator, cache::FBDFConstantCache) integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast + + u_modified = integrator.u_modified + integrator.u_modified = true + reinitFBDF!(integrator, cache) + integrator.u_modified = u_modified end function perform_step!(integrator, cache::FBDFConstantCache{max_order}, @@ -1222,6 +1227,11 @@ function initialize!(integrator, cache::FBDFCache) integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + + u_modified = integrator.u_modified + integrator.u_modified = true + reinitFBDF!(integrator, cache) + integrator.u_modified = u_modified end function perform_step!(integrator, cache::FBDFCache{max_order}, diff --git a/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl b/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl index d372a89a5e..7c62c3b302 100644 --- a/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl +++ b/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl @@ -229,6 +229,11 @@ function initialize!(integrator, cache::DFBDFConstantCache) integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast + + u_modified = integrator.u_modified + integrator.u_modified = true + reinitFBDF!(integrator, cache) + integrator.u_modified = u_modified end function perform_step!(integrator, cache::DFBDFConstantCache{max_order}, @@ -355,6 +360,11 @@ function initialize!(integrator, cache::DFBDFCache) integrator.k[2] = integrator.fsallast #integrator.f(integrator.fsalfirst, integrator.du, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point #OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) + + u_modified = integrator.u_modified + integrator.u_modified = true + reinitFBDF!(integrator, cache) + integrator.u_modified = u_modified end function perform_step!(integrator, cache::DFBDFCache{max_order},