@@ -41,14 +41,14 @@ println(" ------------------------------------------------------------ ")
4141use_relax = false
4242lohners_type = 2
4343prob_num = 1
44- ticks = 100 .0
45- steps = 100 .0
46- tend = 1 * steps/ ticks # lo 7.6100
44+ ticks = 50 .0
45+ steps = 50 .0
46+ tend = 0.02 * steps/ ticks # lo 7.6100
4747
4848if prob_num == 1
4949 x0 (p) = [9.0 ]
5050 function f! (dx, x, p, t)
51- dx[1 ] = p[1 ] - x[1 ]* x[1 ]
51+ dx[1 ] = p[1 ] - x[1 ]^ 2 # x[1] *x[1]
5252 nothing
5353 end
5454 tspan = (0.0 , tend)
@@ -72,7 +72,7 @@ tol = 1E-5
7272
7373if lohners_type == 1
7474 integrator = DiscretizeRelax (prob, DynamicBoundspODEsDiscrete. LohnerContractor {5} (), h = 1 / ticks,
75- repeat_limit = 1 , skip_step2 = false , step_limit = steps, relax = false , tol= tol)
75+ repeat_limit = 1 , skip_step2 = false , step_limit = steps, relax = use_relax , tol= tol)
7676elseif lohners_type == 2
7777 integrator = DiscretizeRelax (prob, DynamicBoundspODEsDiscrete. HermiteObreschkoff (3 , 3 ), h = 1 / ticks,
7878 repeat_limit = 1 , skip_step2 = false , step_limit = steps, relax = use_relax, tol= tol)
@@ -90,58 +90,10 @@ elseif lohners_type == 3
9090 relax = false , Jx! = iJx!, Jp! = iJp!, tol= tol)
9191end
9292
93- #=
94- integrator = DiscretizeRelax(prob, DynamicBoundspODEsDiscrete.AdamsMoulton(4), h = 0.01,
95- repeat_limit = 1, skip_step2 = false, step_limit = 3, relax = use_relax)
96-
97- integrator = DiscretizeRelax(prob, DynamicBoundspODEsDiscrete.HermiteObreschkoff(3, 3), h = 0.01,
98- repeat_limit = 1, skip_step2 = false, step_limit = 5, relax = use_relax)
99- =#
100- #=
101- function iJx!(dx, x, p, t)
102- dx[1] = -2.0*x[1]
103- nothing
104- end
105- function iJp!(dx, x, p, t)
106- dx[1] = one(p[1])
107- nothing
108- end
109- integrator = DiscretizeRelax(prob, PLMS(4, AdamsMoulton()), h = 0.01, skip_step2 = false, relax = false, Jx! = iJx!, Jp! = iJp!)
110- =#
111-
11293ratio = rand (1 )
11394pstar = pL.* ratio .+ pU.* (1.0 .- ratio)
11495setall! (integrator, ParameterValue (), [0.0 ])
11596DynamicBoundsBase. relax! (integrator)
116-
117- # ratio = rand(1)
118- # pstar = pL.*ratio .+ pU.*(1.0 .- ratio)
119- # setall!(integrator, ParameterValue(), [0.0])
120- # DynamicBoundsBase.relax!(integrator)
121-
122- # println("alloc_num: $(alloc_num)")
123-
124-
125- # function relax_test()
126- # ratio = rand(1)
127- # pstar = pL.*ratio .+ pU.*(1.0 .- ratio)
128- # setall!(integrator, ParameterValue(), [0.0])
129- # DynamicBoundsBase.relax!(integrator)
130- # return nothing
131- # end
132- # @btime relax_test()
133-
134- d = integrator
135-
136- # @code_warntype DynamicBoundspODEsPILMS.single_step!(d.step_result, d.step_params, d.method_f!, d.set_tf!, d.Δ, d.A, d.P, d.rP, d.p)
137- #=
138- method_f! = d.method_f!
139- @code_warntype method_f!(d.step_result.steps, d.step_result.times, d.step_result.unique_result.X, d.step_result.Xⱼ,
140- d.step_result.xⱼ, d.A, d.Δ, d.P, d.rP, d.p, d.step_result.unique_result.fk)
141- =#
142- # using BenchmarkTools
143- # @btime DynamicBoundsBase.relax!($integrator)
144-
14597integrate! (integrator)
14698
14799t_vec = integrator. time
@@ -151,27 +103,11 @@ if !use_relax
151103else
152104 lo_vec = getfield .(getfield .(getindex .(integrator. storage[:],1 ), :Intv ), :lo )
153105 hi_vec = getfield .(getfield .(getindex .(integrator. storage[:],1 ), :Intv ), :hi )
154- # lo_vec = getfield.(getindex.(integrator.storage[:],1), :cv)
155- # hi_vec = getfield.(getindex.(integrator.storage[:],1), :cc)
156106end
157107
158108plt = plot (t_vec , lo_vec, label= " Interval Bounds 0.0" , marker = (:hexagon , 2 , 0.6 , :green ), linealpha = 0.0 , legend= :bottomleft )
159109plot! (plt, t_vec , hi_vec, label= " " , linealpha = 0.0 , marker = (:hexagon , 2 , 0.6 , :green ))
160- #=
161- prob = DynamicBoundsBase.ODERelaxProb(f!, tspan, x0, pL, pU)
162- integrator = DiscretizeRelax(prob, h = 0.01, skip_step2 = false, k = kval)
163- ratio = rand(1)
164- pstar = pL.*ratio .+ pU.*(1.0 .- ratio)
165- setall!(integrator, ParameterValue(), [1.0])
166- DynamicBoundsBase.relax!(integrator)
167110
168- t_vec = integrator.time
169- lo_vec = getfield.(getindex.(integrator.storage[:],1), :lo)
170- hi_vec = getfield.(getindex.(integrator.storage[:],1), :hi)
171- plot!(plt, t_vec , lo_vec, label="Interval Bounds 1.0", linecolor = :green, linestyle = :dash,
172- lw=1.5, legend=:bottomleft)
173- plot!(plt, t_vec , hi_vec, label="", linecolor = :green, linestyle = :dash, lw=1.5)
174- =#
175111prob = ODEProblem (f!, [9.0 ], tspan, [- 1.0 ])
176112sol = solve (prob, Tsit5 (), reltol= 1e-8 , abstol= 1e-8 )
177113plot! (plt, sol. t , sol[1 ,:], label= " " , linecolor = :red , linestyle = :solid , lw= 1.5 )
@@ -182,116 +118,4 @@ plot!(plt, sol.t , sol[1,:], label="", linecolor = :red, linestyle = :solid, lw=
182118
183119ylabel! (" x[1] (M)" )
184120xlabel! (" Time (seconds)" )
185- display (plt)
186-
187- status_code = get (integrator, TerminationStatus ())
188- println (" status code: $(status_code) " )
189- d = integrator
190- t = 2.3
191-
192- # @code_warntype DynamicBoundspODEsPILMS.single_step!(d.step_result, d.step_params, d.method_f!, d.set_tf!, d.Δ, d.A, d.P, d.rP, d.p, t)
193- # @btime DynamicBoundspODEsPILMS.single_step!($(d.step_result), $(d.step_params), $(d.method_f!),
194- # $(d.set_tf!), $(d.Δ), $(d.A), $(d.P), $(d.rP), $(d.p), $t)
195-
196-
197- # println("INTERNAL TESTS 1!")
198- #=
199- @code_warntype DynamicBoundspODEsPILMS.existence_uniqueness!(integrator.step_result,
200- integrator.set_tf!,
201- integrator.step_params.hmin,
202- integrator.P,
203- t)
204- =#
205- #=
206- println("INTERNAL TESTS 2!")
207- out = d.step_result
208- lf = integrator.method_f!
209- =#
210- #=
211- @code_warntype lf(out.hj, out.unique_result.X, out.Xⱼ, out.xⱼ, d.A, d.Δ,
212- d.P, d.rP, d.p, t)
213- =#
214- #=
215- hj = out.hj
216- urX = out.unique_result.X
217- Xⱼ = out.Xⱼ
218- xⱼ = out.xⱼ
219- A = d.A
220- del = d.Δ
221- P = d.P
222- rP = d.rP
223- p = d.p
224- =#
225- # @btime ($lf)($hj, $urX, $Xⱼ, $xⱼ, $A, $del, $P, $rP, $p, $t)
226-
227- # println("INTERNAL TESTS 3!")
228- # jacfunc = lf.jac_tf!
229- # @code_warntype DynamicBoundspODEsPILMS.set_JxJp!(jacfunc, out.Xⱼ, d.P, t)
230- # @btime DynamicBoundspODEsPILMS.set_JxJp!($jacfunc, $(out.Xⱼ), $(d.P), $t)
231-
232- # @code_warntype DynamicBoundspODEsPILMS.jacobian_taylor_coeffs!(jacfunc, out.Xⱼ, d.P, t)
233- # @btime DynamicBoundspODEsPILMS.jacobian_taylor_coeffs!($jacfunc, $(out.Xⱼ), $(d.P), $t)
234- #=
235- r = jacfunc.result
236- aot = jacfunc.out
237- yot = jacfunc.y
238- cfg = jacfunc.cfg
239-
240- println(" ")
241- println(" ")
242- println("jacobian stuff")
243- =#
244- # @code_warntype ForwardDiff.jacobian!(r, jacfunc, aot, yot, compare_config)
245- # @btime ForwardDiff.jacobian!($r, $jacfunc, $aot, $yot, $compare_config)
246-
247- # println(" ")
248- # println(" ")
249- # println("jacobian functor stuff")
250- # outy = [integrator.method_f!.jac_tf!.x[1] for i in 1:21]
251- # iny = [integrator.method_f!.jac_tf!.x[1], integrator.method_f!.jac_tf!.p[1]]
252- # @code_warntype jacfunc(outy, iny)
253- # @btime ($jacfunc)($outy, $iny)
254-
255- #=
256- order = 20
257- val = Val(21-1)
258- xtaylor = [STaylor1(integrator.method_f!.jac_tf!.x[1], val)]
259- xaux = deepcopy(xtaylor)
260- dx = deepcopy(xtaylor)
261- eqdiffs = jacfunc.g!
262- P = integrator.method_f!.jac_tf!.p[1]
263- println("jetcoeffs stuff")
264- vnxt = fill(0, 1)
265- fnxt = fill(0.0, 1)
266- =#
267- # @code_warntype DynamicBoundspODEsPILMS.jetcoeffs!(eqdiffs, t, xtaylor, xaux, dx, order, P, vnxt, fnxt)
268- # @btime DynamicBoundspODEsPILMS.jetcoeffs!($eqdiffs, $t, $xtaylor, $xaux, $dx, $order, $P, $vnxt, $fnxt)
269-
270- # println("recurse taylor")
271- # @code_warntype DynamicBoundspODEsPILMS.recurse_taylor!(dx, xtaylor, vnxt)
272- # @btime DynamicBoundspODEsPILMS.recurse_taylor!($dx, $xtaylor, $vnxt)
273-
274- println (" copy recurse" )
275- # sdx = dx[1]
276- # sxtaylor = xtaylor[1]
277- # cflt = 1.0
278- # @code_warntype DynamicBoundspODEsPILMS.copy_recurse(sdx, sxtaylor, 1, cflt)
279- # @btime DynamicBoundspODEsPILMS.copy_recurse($sdx, $sxtaylor, 1, $cflt)
280- #=
281- s = integrator.step_result
282- @code_warntype DynamicBoundspODEsPILMS.existence_uniqueness!(s.unique_result, integrator.set_tf!, s.Xⱼ, s.hj,
283- integrator.step_params.hmin, s.f, s.∂f∂x,
284- s.∂f∂p, integrator.P, s.h, t)
285- =#
286- #=
287- ratio = rand(6)
288- pstar = pL.*ratio .+ pU.*(1.0 .- ratio)
289- setall!(integrator, ParameterValue(), pstar)
290- integrate!(integrator)
291- plot!(plt, integrator.local_problem_storage.integrator_t,
292- integrator.local_problem_storage.pode_x[1,:], label="Trajectories", linecolor = :green,
293- markershape = :+, markercolor = :green, linestyle = :dash, markersize = 2, lw=0.75)
294- =#
295-
296-
297- # seed!(xdual, x, cfg.seeds)
121+ display (plt)
0 commit comments