Skip to content

Commit

Permalink
Implementation of get_fsalfirstlast for MPRK schemes (#119)
Browse files Browse the repository at this point in the history
* tried to implement get_fsalfirstlast for MPE

* Implemented get_fsalfirstlast for MPRK schemes
  • Loading branch information
SKopecz authored Aug 27, 2024
1 parent 719311e commit e06c7f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/PositiveIntegrators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 10 additions & 8 deletions src/mprk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ...])
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 4 additions & 6 deletions src/sspmprk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e06c7f5

Please sign in to comment.