66# ! format: noindent
77
88# Abstract base type for time integration schemes of storage class `2N`
9- abstract type SimpleAlgorithm2N end
9+ abstract type SimpleAlgorithm2N <: AbstractTimeIntegrationAlgorithm end
1010
1111"""
1212 CarpenterKennedy2N54()
@@ -75,25 +75,25 @@ struct CarpenterKennedy2N43 <: SimpleAlgorithm2N
7575end
7676
7777# This struct is needed to fake https://github.com/SciML/OrdinaryDiffEq.jl/blob/0c2048a502101647ac35faabd80da8a5645beac7/src/integrators/type.jl#L1
78- mutable struct SimpleIntegrator2NOptions {Callback}
78+ mutable struct SimpleIntegratorOptions {Callback}
7979 callback:: Callback # callbacks; used in Trixi.jl
8080 adaptive:: Bool # whether the algorithm is adaptive; ignored
8181 dtmax:: Float64 # ignored
8282 maxiters:: Int # maximal number of time steps
8383 tstops:: Vector{Float64} # tstops from https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/#Output-Control-1; ignored
8484end
8585
86- function SimpleIntegrator2NOptions (callback, tspan; maxiters = typemax (Int), kwargs... )
87- SimpleIntegrator2NOptions {typeof(callback)} (callback, false , Inf , maxiters,
88- [last (tspan)])
86+ function SimpleIntegratorOptions (callback, tspan; maxiters = typemax (Int), kwargs... )
87+ SimpleIntegratorOptions {typeof(callback)} (callback, false , Inf , maxiters,
88+ [last (tspan)])
8989end
9090
9191# This struct is needed to fake https://github.com/SciML/OrdinaryDiffEq.jl/blob/0c2048a502101647ac35faabd80da8a5645beac7/src/integrators/type.jl#L77
9292# This implements the interface components described at
9393# https://diffeq.sciml.ai/v6.8/basics/integrator/#Handing-Integrators-1
9494# which are used in Trixi.jl.
9595mutable struct SimpleIntegrator2N{RealT <: Real , uType, Params, Sol, F, Alg,
96- SimpleIntegrator2NOptions } <: AbstractTimeIntegrator
96+ SimpleIntegratorOptions } <: AbstractTimeIntegrator
9797 u:: uType
9898 du:: uType
9999 u_tmp:: uType
@@ -105,19 +105,10 @@ mutable struct SimpleIntegrator2N{RealT <: Real, uType, Params, Sol, F, Alg,
105105 sol:: Sol # faked
106106 f:: F # `rhs!` of the semidiscretization
107107 alg:: Alg # SimpleAlgorithm2N
108- opts:: SimpleIntegrator2NOptions
108+ opts:: SimpleIntegratorOptions
109109 finalstep:: Bool # added for convenience
110110end
111111
112- # Forward integrator.stats.naccept to integrator.iter (see GitHub PR#771)
113- function Base. getproperty (integrator:: SimpleIntegrator2N , field:: Symbol )
114- if field === :stats
115- return (naccept = getfield (integrator, :iter ),)
116- end
117- # general fallback
118- return getfield (integrator, field)
119- end
120-
121112function init (ode:: ODEProblem , alg:: SimpleAlgorithm2N ;
122113 dt, callback:: Union{CallbackSet, Nothing} = nothing , kwargs... )
123114 u = copy (ode. u0)
@@ -127,8 +118,8 @@ function init(ode::ODEProblem, alg::SimpleAlgorithm2N;
127118 iter = 0
128119 integrator = SimpleIntegrator2N (u, du, u_tmp, t, dt, zero (dt), iter, ode. p,
129120 (prob = ode,), ode. f, alg,
130- SimpleIntegrator2NOptions (callback, ode. tspan;
131- kwargs... ), false )
121+ SimpleIntegratorOptions (callback, ode. tspan;
122+ kwargs... ), false )
132123
133124 # initialize callbacks
134125 if callback isa CallbackSet
@@ -143,31 +134,6 @@ function init(ode::ODEProblem, alg::SimpleAlgorithm2N;
143134 return integrator
144135end
145136
146- # Fakes `solve`: https://diffeq.sciml.ai/v6.8/basics/overview/#Solving-the-Problems-1
147- function solve (ode:: ODEProblem , alg:: SimpleAlgorithm2N ;
148- dt, callback = nothing , kwargs... )
149- integrator = init (ode, alg, dt = dt, callback = callback; kwargs... )
150-
151- # Start actual solve
152- solve! (integrator)
153- end
154-
155- function solve! (integrator:: SimpleIntegrator2N )
156- @unpack prob = integrator. sol
157-
158- integrator. finalstep = false
159-
160- @trixi_timeit timer () " main loop" while ! integrator. finalstep
161- step! (integrator)
162- end # "main loop" timer
163-
164- finalize_callbacks (integrator)
165-
166- return TimeIntegratorSolution ((first (prob. tspan), integrator. t),
167- (prob. u0, integrator. u),
168- integrator. sol. prob)
169- end
170-
171137function step! (integrator:: SimpleIntegrator2N )
172138 @unpack prob = integrator. sol
173139 @unpack alg = integrator
@@ -225,22 +191,11 @@ function step!(integrator::SimpleIntegrator2N)
225191end
226192
227193# get a cache where the RHS can be stored
228- get_du (integrator:: SimpleIntegrator2N ) = integrator. du
229194get_tmp_cache (integrator:: SimpleIntegrator2N ) = (integrator. u_tmp,)
230195
231196# some algorithms from DiffEq like FSAL-ones need to be informed when a callback has modified u
232197u_modified! (integrator:: SimpleIntegrator2N , :: Bool ) = false
233198
234- # used by adaptive timestepping algorithms in DiffEq
235- function set_proposed_dt! (integrator:: SimpleIntegrator2N , dt)
236- integrator. dt = dt
237- end
238-
239- # Required e.g. for `glm_speed_callback`
240- function get_proposed_dt (integrator:: SimpleIntegrator2N )
241- return integrator. dt
242- end
243-
244199# stop the time integration
245200function terminate! (integrator:: SimpleIntegrator2N )
246201 integrator. finalstep = true
0 commit comments