@@ -132,7 +132,7 @@ function create_cache(mesh, equations::BBMBBMEquations1D,
132
132
:: BoundaryConditionPeriodic ,
133
133
RealT, uEltype)
134
134
D = equations. D
135
- invImD2 = inv (I - 1 / 6 * D^ 2 * Matrix (solver. D2))
135
+ invImD2 = factorize (I - 1 / 6 * D^ 2 * sparse (solver. D2))
136
136
return (invImD2 = invImD2,)
137
137
end
138
138
@@ -146,7 +146,7 @@ function create_cache(mesh, equations::BBMBBMEquations1D,
146
146
Pd = BandedMatrix ((- 1 => fill (one (real (mesh)), N - 2 ),), (N, N - 2 ))
147
147
D2d = (sparse (solver. D2) * Pd)[2 : (end - 1 ), :]
148
148
# homogeneous Dirichlet boundary conditions
149
- invImD2d = inv (I - 1 / 6 * D^ 2 * D2d)
149
+ invImD2d = factorize (I - 1 / 6 * D^ 2 * D2d)
150
150
m = diag (M)
151
151
m[1 ] = 0
152
152
m[end ] = 0
@@ -156,10 +156,10 @@ function create_cache(mesh, equations::BBMBBMEquations1D,
156
156
if solver. D1 isa DerivativeOperator ||
157
157
solver. D1 isa UniformCoupledOperator
158
158
D1_b = BandedMatrix (solver. D1)
159
- invImD2n = inv (I + 1 / 6 * D^ 2 * inv (M) * D1_b' * PdM * D1_b)
159
+ invImD2n = factorize (I + 1 / 6 * D^ 2 * inv (M) * D1_b' * PdM * D1_b)
160
160
elseif solver. D1 isa UpwindOperators
161
161
D1plus_b = BandedMatrix (solver. D1. plus)
162
- invImD2n = inv (I + 1 / 6 * D^ 2 * inv (M) * D1plus_b' * PdM * D1plus_b)
162
+ invImD2n = factorize (I + 1 / 6 * D^ 2 * inv (M) * D1plus_b' * PdM * D1plus_b)
163
163
else
164
164
@error " unknown type of first-derivative operator: $(typeof (solver. D1)) "
165
165
end
@@ -202,8 +202,8 @@ function rhs!(du_ode, u_ode, t, mesh, equations::BBMBBMEquations1D, initial_cond
202
202
203
203
@timeit timer () " source terms" calc_sources! (dq, q, t, source_terms, equations, solver)
204
204
205
- @timeit timer () " deta elliptic" deta[:]= invImD2 * deta
206
- @timeit timer () " dv elliptic" dv[:]= invImD2 * dv
205
+ @timeit timer () " deta elliptic" deta[:]= invImD2 \ deta
206
+ @timeit timer () " dv elliptic" dv[:]= invImD2 \ dv
207
207
208
208
return nothing
209
209
end
@@ -241,9 +241,9 @@ function rhs!(du_ode, u_ode, t, mesh, equations::BBMBBMEquations1D, initial_cond
241
241
242
242
@timeit timer () " source terms" calc_sources! (dq, q, t, source_terms, equations, solver)
243
243
244
- @timeit timer () " deta elliptic" deta[:]= invImD2n * deta
244
+ @timeit timer () " deta elliptic" deta[:]= invImD2n \ deta
245
245
@timeit timer () " dv elliptic" begin
246
- dv[2 : (end - 1 )] = invImD2d * dv[2 : (end - 1 )]
246
+ dv[2 : (end - 1 )] = invImD2d \ dv[2 : (end - 1 )]
247
247
dv[1 ] = dv[end ] = zero (eltype (dv))
248
248
end
249
249
0 commit comments