Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreyas-Ekanathan committed Sep 27, 2024
1 parent 775d6ba commit 377e8ed
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions lib/OrdinaryDiffEqFIRK/src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ struct AdaptiveRadau{CS, AD, F, P, FDT, ST, CJ, Tol, C1, C2, StepLimiter} <:
new_W_γdt_cutoff::C2
controller::Symbol
step_limiter!::StepLimiter
min_num_stages::Int
max_num_stages::Int
min_stages::Int
max_stages::Int
end

function AdaptiveRadau(; chunk_size = Val{0}(), autodiff = Val{true}(),
standardtag = Val{true}(), concrete_jac = nothing,
diff_type = Val{:forward}, min_num_stages = 3, max_num_stages = 7,
diff_type = Val{:forward}, min_stages = 3, max_stages = 7,
linsolve = nothing, precs = DEFAULT_PRECS,
extrapolant = :dense, fast_convergence_cutoff = 1 // 5,
new_W_γdt_cutoff = 1 // 5,
Expand All @@ -187,6 +187,6 @@ function AdaptiveRadau(; chunk_size = Val{0}(), autodiff = Val{true}(),
fast_convergence_cutoff,
new_W_γdt_cutoff,
controller,
step_limiter!, min_num_stages, max_num_stages)
step_limiter!, min_stages, max_stages)
end

6 changes: 3 additions & 3 deletions lib/OrdinaryDiffEqFIRK/src/controllers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
q
end

function step_accept_controller!(integrator, controller::PredictiveController, alg::Union{RadauIIA3, RadauIIA5, RadauIIA9}, q)
function step_accept_controller!(integrator, controller::PredictiveController, alg, q)
@unpack qmin, qmax, gamma, qsteady_min, qsteady_max = integrator.opts

EEst = DiffEqBase.value(integrator.EEst)
Expand Down Expand Up @@ -74,9 +74,9 @@ function step_accept_controller!(integrator, controller::PredictiveController, a
@show cache.num_stages
if (step > 10)
Ψ = θ * θprev
if<= 0.001 && num_stages < alg.max_num_stages)
if<= 0.001 && num_stages < alg.max_stages)
cache.num_stages += 2
elseif ((Ψ >= 0.1 || cache.status == VerySlowConvergence || cache.status == Divergence) && num_stages > alg.min_num_stages)
elseif ((Ψ >= 0.1 || cache.status == VerySlowConvergence || cache.status == Divergence) && num_stages > alg.min_stages)
cache.num_stages -= 2
cache.step = 1
end
Expand Down
10 changes: 5 additions & 5 deletions lib/OrdinaryDiffEqFIRK/src/firk_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,12 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
::Val{false}) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
uf = UDerivativeWrapper(f, t, p)
uToltype = constvalue(uBottomEltypeNoUnits)
num_stages = alg.min_num_stages
max = alg.max_num_stages
num_stages = alg.min_stages
max = alg.max_stages
tabs = [BigRadauIIA5Tableau(uToltype, constvalue(tTypeNoUnits)), BigRadauIIA9Tableau(uToltype, constvalue(tTypeNoUnits)), BigRadauIIA13Tableau(uToltype, constvalue(tTypeNoUnits))]

i = 9
while i <= alg.max_num_stages
while i <= alg.max_stages
push!(tabs, adaptiveRadauTableau(uToltype, constvalue(tTypeNoUnits), i))
i += 2
end
Expand Down Expand Up @@ -570,8 +570,8 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
uf = UJacobianWrapper(f, t, p)
uToltype = constvalue(uBottomEltypeNoUnits)

min = alg.min_num_stages
max = alg.max_num_stages
min = alg.min_stages
max = alg.max_stages

num_stages = min

Expand Down
2 changes: 1 addition & 1 deletion lib/OrdinaryDiffEqFIRK/test/ode_firk_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ prob_ode_2Dlinear_big = remake(prob_ode_2Dlinear, u0 = big.(prob_ode_2Dlinear.u0

for i in [3, 5, 7, 9], prob in [prob_ode_linear_big, prob_ode_2Dlinear_big]
dts = 1 ./ 2 .^ (4.25:-1:0.25)
sim21 = test_convergence(dts, prob, AdaptiveRadau(min_num_stages = i, max_num_stages = i))
sim21 = test_convergence(dts, prob, AdaptiveRadau(min_stages = i, max_stages = i))
@test sim21.𝒪est[:final] (2 * i - 1) atol=testTol
end

Expand Down

0 comments on commit 377e8ed

Please sign in to comment.