From e06c7f52545bd91994a007e82e33d2e2c8545701 Mon Sep 17 00:00:00 2001 From: Stefan Kopecz Date: Tue, 27 Aug 2024 09:29:22 +0200 Subject: [PATCH] Implementation of `get_fsalfirstlast` for MPRK schemes (#119) * tried to implement get_fsalfirstlast for MPE * Implemented get_fsalfirstlast for MPRK schemes --- src/PositiveIntegrators.jl | 3 ++- src/mprk.jl | 18 ++++++++++-------- src/sspmprk.jl | 10 ++++------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/PositiveIntegrators.jl b/src/PositiveIntegrators.jl index 82d54784..c2c11ef2 100644 --- a/src/PositiveIntegrators.jl +++ b/src/PositiveIntegrators.jl @@ -35,7 +35,8 @@ import OrdinaryDiffEq: alg_order, isfsal, calculate_residuals, calculate_residuals!, alg_cache, get_tmp_cache, initialize!, perform_step!, - _ode_interpolant, _ode_interpolant! + _ode_interpolant, _ode_interpolant!, + get_fsalfirstlast # 2. Export functionality defining the public API export PDSFunction, PDSProblem diff --git a/src/mprk.jl b/src/mprk.jl index 83f11491..e6b99a84 100644 --- a/src/mprk.jl +++ b/src/mprk.jl @@ -217,6 +217,10 @@ end return nothing end +# We use MPRKMutableCache as supertype for all MPRK scheme caches +abstract type MPRKMutableCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::MPRKMutableCache, rate_prototype) = (nothing, nothing) + ### MPE ##################################################################################### """ MPE([linsolve = ..., small_constant = ...]) @@ -321,7 +325,7 @@ end integrator.u = u end -struct MPECache{PType, uType, tabType, F} <: OrdinaryDiffEqMutableCache +struct MPECache{PType, uType, tabType, F} <: MPRKMutableCache P::PType D::uType σ::uType @@ -330,7 +334,7 @@ struct MPECache{PType, uType, tabType, F} <: OrdinaryDiffEqMutableCache linsolve::F end -struct MPEConservativeCache{PType, uType, tabType, F} <: OrdinaryDiffEqMutableCache +struct MPEConservativeCache{PType, uType, tabType, F} <: MPRKMutableCache P::PType σ::uType tab::tabType @@ -618,8 +622,7 @@ end integrator.u = u end -struct MPRK22Cache{uType, PType, tabType, F} <: - OrdinaryDiffEqMutableCache +struct MPRK22Cache{uType, PType, tabType, F} <: MPRKMutableCache tmp::uType P::PType P2::PType @@ -630,8 +633,7 @@ struct MPRK22Cache{uType, PType, tabType, F} <: linsolve::F end -struct MPRK22ConservativeCache{uType, PType, tabType, F} <: - OrdinaryDiffEqMutableCache +struct MPRK22ConservativeCache{uType, PType, tabType, F} <: MPRKMutableCache tmp::uType P::PType P2::PType @@ -1197,7 +1199,7 @@ end integrator.u = u end -struct MPRK43Cache{uType, PType, tabType, F} <: OrdinaryDiffEqMutableCache +struct MPRK43Cache{uType, PType, tabType, F} <: MPRKMutableCache tmp::uType tmp2::uType P::PType @@ -1211,7 +1213,7 @@ struct MPRK43Cache{uType, PType, tabType, F} <: OrdinaryDiffEqMutableCache linsolve::F end -struct MPRK43ConservativeCache{uType, PType, tabType, F} <: OrdinaryDiffEqMutableCache +struct MPRK43ConservativeCache{uType, PType, tabType, F} <: MPRKMutableCache tmp::uType tmp2::uType P::PType diff --git a/src/sspmprk.jl b/src/sspmprk.jl index 5473033b..30746ef8 100644 --- a/src/sspmprk.jl +++ b/src/sspmprk.jl @@ -201,8 +201,7 @@ end integrator.u = u end -struct SSPMPRK22Cache{uType, PType, tabType, F} <: - OrdinaryDiffEqMutableCache +struct SSPMPRK22Cache{uType, PType, tabType, F} <: MPRKMutableCache tmp::uType P::PType P2::PType @@ -213,8 +212,7 @@ struct SSPMPRK22Cache{uType, PType, tabType, F} <: linsolve::F end -struct SSPMPRK22ConservativeCache{uType, PType, tabType, F} <: - OrdinaryDiffEqMutableCache +struct SSPMPRK22ConservativeCache{uType, PType, tabType, F} <: MPRKMutableCache tmp::uType P::PType P2::PType @@ -709,7 +707,7 @@ end integrator.u = u end -struct SSPMPRK43Cache{uType, PType, tabType, F} <: OrdinaryDiffEqMutableCache +struct SSPMPRK43Cache{uType, PType, tabType, F} <: MPRKMutableCache tmp::uType tmp2::uType P::PType @@ -724,7 +722,7 @@ struct SSPMPRK43Cache{uType, PType, tabType, F} <: OrdinaryDiffEqMutableCache linsolve::F end -struct SSPMPRK43ConservativeCache{uType, PType, tabType, F} <: OrdinaryDiffEqMutableCache +struct SSPMPRK43ConservativeCache{uType, PType, tabType, F} <: MPRKMutableCache tmp::uType tmp2::uType P::PType