Skip to content

Commit ce5b07d

Browse files
fix alias deprecation warning (#157)
1 parent 4b4816b commit ce5b07d

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/mpdec.jl

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
A family of arbitrary order modified Patankar-Runge-Kutta algorithms for
55
production-destruction systems. Each member of this family is an adaptive, one-step method which is
66
Kth order accurate, unconditionally positivity-preserving, and linearly
7-
implicit. The integer K must be chosen to satisfy 2 ≤ K ≤ 10.
7+
implicit. The integer K must be chosen to satisfy 2 ≤ K ≤ 10.
88
Available node choices are Lagrange or Gauss-Lobatto nodes, with the latter being the default.
99
These methods support adaptive time stepping, using the numerical solution obtained with one correction step less as a lower-order approximation to estimate the error.
1010
The MPDeC schemes were introduced by Torlo and Öffner (2020) for autonomous conservative production-destruction systems and
1111
further investigated in Torlo, Öffner and Ranocha (2022).
1212
1313
For nonconservative production–destruction systems we use a straight forward extension
1414
analogous to [`MPE`](@ref).
15-
A general discussion of DeC schemes applied to non-autonomous differential equations
15+
A general discussion of DeC schemes applied to non-autonomous differential equations
1616
and using general integration nodes is given by Ong and Spiteri (2020).
1717
1818
The MPDeC methods require the special structure of a
@@ -51,7 +51,7 @@ end
5151

5252
function small_constant_function_MPDeC(type)
5353
if type == Float64
54-
# small_constant is chosen such that
54+
# small_constant is chosen such that
5555
# the testset "Zero initial values" passes.
5656
small_constant = 1e-300
5757
else
@@ -159,7 +159,7 @@ function get_constant_parameters(alg::MPDeC, type)
159159
else
160160
error("MPDeC requires 2 ≤ K ≤ 10.")
161161
end
162-
else # alg.nodes === :gausslobatto
162+
else # alg.nodes === :gausslobatto
163163
if alg.M == 1
164164
nodes = [0, oneType]
165165
theta = [0 oneType/2; 0 oneType/2]
@@ -247,12 +247,12 @@ function build_mpdec_matrix_and_rhs_oop(uprev, m, f, C, p, t, dt, nodes, theta,
247247
small_constant)
248248
N = length(uprev)
249249
if f isa PDSFunction
250-
# Additional destruction terms
250+
# Additional destruction terms
251251
Mmat, rhs = _build_mpdec_matrix_and_rhs_oop(uprev, m, f.p, C, p, t, dt, nodes,
252252
theta,
253253
small_constant, f.d)
254254
else
255-
# No additional destruction terms
255+
# No additional destruction terms
256256
Mmat, rhs = _build_mpdec_matrix_and_rhs_oop(uprev, m, f.p, C, p, t, dt, nodes,
257257
theta,
258258
small_constant)
@@ -479,14 +479,14 @@ function _build_mpdec_matrix_and_rhs!(M::AbstractSparseMatrix, rhs, P::AbstractS
479479
fill!(tmp, zero(eltype(tmp)))
480480

481481
if dt_th 0
482-
for j in 1:n # run through columns of P
482+
for j in 1:n # run through columns of P
483483
for idx_P in nzrange(P, j) # run through rows of P
484484
i = P_rows[idx_P]
485485
dt_th_P = dt_th * P_vals[idx_P]
486486
if i != j
487487
for idx_M in nzrange(M, j)
488488
if M_rows[idx_M] == i
489-
M_vals[idx_M] -= dt_th_P / σ[j] # M_ij <- P_ij
489+
M_vals[idx_M] -= dt_th_P / σ[j] # M_ij <- P_ij
490490
break
491491
end
492492
end
@@ -513,9 +513,9 @@ function _build_mpdec_matrix_and_rhs!(M::AbstractSparseMatrix, rhs, P::AbstractS
513513
end
514514
end
515515
else # dt ≤ 0
516-
for j in 1:n # j is column index
516+
for j in 1:n # j is column index
517517
for idx_P in nzrange(P, j)
518-
i = P_rows[idx_P] # i is row index
518+
i = P_rows[idx_P] # i is row index
519519
dt_th_P = dt_th * P_vals[idx_P]
520520
if i != j
521521
for idx_M in nzrange(M, i)
@@ -635,13 +635,13 @@ function alg_cache(alg::MPDeC, u, rate_prototype, ::Type{uEltypeNoUnits},
635635
P2 = p_prototype(u, f) # stores the linear system matrix
636636
if issparse(P2)
637637
# We need to ensure that evaluating the production function does
638-
# not alter the sparsity pattern given by the production matrix prototype
638+
# not alter the sparsity pattern given by the production matrix prototype
639639
f.p(P2, uprev, p, t)
640640
@assert P.rowval == P2.rowval&&P.colptr == P2.colptr "Evaluation of the production terms must not alter the sparsity pattern given by the prototype."
641641

642642
if alg.K > 2
643643
# Negative weights of MPDeC(K) , K > 2 require
644-
# a symmetric sparsity pattern of the linear system matrix P2
644+
# a symmetric sparsity pattern of the linear system matrix P2
645645
P2 = P + P'
646646
end
647647
end
@@ -657,7 +657,9 @@ function alg_cache(alg::MPDeC, u, rate_prototype, ::Type{uEltypeNoUnits},
657657
# not be altered, since it is needed to compute the adaptive time step
658658
# size.
659659
linprob = LinearProblem(P2, _vec(linsolve_rhs))
660-
linsolve = init(linprob, alg.linsolve, alias_A = true, alias_b = true,
660+
linsolve = init(linprob, alg.linsolve,
661+
alias = LinearSolve.LinearAliasSpecifier(; alias_A = true,
662+
alias_b = true),
661663
assumptions = LinearSolve.OperatorAssumptions(true))
662664

663665
MPDeCConservativeCache(tmp, P, P2, σ, C, C2,
@@ -666,7 +668,9 @@ function alg_cache(alg::MPDeC, u, rate_prototype, ::Type{uEltypeNoUnits},
666668
linsolve)
667669
elseif f isa PDSFunction
668670
linprob = LinearProblem(P2, _vec(linsolve_rhs))
669-
linsolve = init(linprob, alg.linsolve, alias_A = true, alias_b = true,
671+
linsolve = init(linprob, alg.linsolve,
672+
alias = LinearSolve.LinearAliasSpecifier(; alias_A = true,
673+
alias_b = true),
670674
assumptions = LinearSolve.OperatorAssumptions(true))
671675

672676
MPDeCCache(tmp, P, P2, d, σ, C, C2,

0 commit comments

Comments
 (0)