@@ -335,7 +335,7 @@ function Base.convert(::Type{AbstractMatrix}, W::WOperator{IIP}) where {IIP}
335
335
else
336
336
# Non-allocating already updated
337
337
# _W = W._concrete_form
338
- # jacobian2W!(_W, W.mass_matrix, W.gamma, convert(AbstractMatrix, W.J) , W.transform)
338
+ # jacobian2W!(_W, W.mass_matrix, W.gamma, W.J, W.transform)
339
339
end
340
340
return W. _concrete_form
341
341
end
@@ -392,10 +392,6 @@ function Base.:\(W::WOperator, x::Number)
392
392
end
393
393
end
394
394
395
- function LinearSolve. defaultalg (W:: WOperator , b, assump:: OperatorAssumptions{Bool} )
396
- LinearSolve. defaultalg (W. J, b, assump)
397
- end
398
-
399
395
function LinearAlgebra. mul! (Y:: AbstractVecOrMat , W:: WOperator , B:: AbstractVecOrMat )
400
396
if W. transform
401
397
# Compute mass_matrix * B
@@ -455,11 +451,7 @@ function do_newJW(integrator, alg, nlsolver, repeat_step)::NTuple{2, Bool}
455
451
integrator. iter <= 1 && return true , true # at least one JW eval at the start
456
452
repeat_step && return false , false
457
453
islin, _ = islinearfunction (integrator)
458
- if islin
459
- # no further J eval when it's linear
460
- # W eval needed if not adaptive
461
- return false , ! integrator. opts. adaptive
462
- end
454
+ islin && return false , false # no further JW eval when it's linear
463
455
! integrator. opts. adaptive && return true , true # Not adaptive will always refactorize
464
456
errorfail = integrator. EEst > one (integrator. EEst)
465
457
if alg isa DAEAlgorithm
@@ -708,22 +700,12 @@ function calc_W!(W, integrator, nlsolver::Union{Nothing, AbstractNLSolver}, cach
708
700
else
709
701
update_coefficients! (W, uprev, p, t; transform = W_transform, dtgamma)
710
702
end
711
- if W. J != = nothing && (W . J isa MatrixOperator || ! (W. J isa AbstractSciMLOperator) )
703
+ if W. J != = nothing && ! (W. J isa AbstractSciMLOperator)
712
704
islin, isode = islinearfunction (integrator)
713
- if islin
714
- J = isode ? f. f : f. f1. f
715
- elseif new_jac
716
- calc_J! (W. J, integrator, lcache, next_step)
717
- end
718
- if W. J isa MatrixOperator
719
- J = J. A
720
- end
721
- if mass_matrix isa MatrixOperator
722
- mass_matrix = mass_matrix. A
723
- end
724
- if new_W && ! isdae
705
+ islin ? (J = isode ? f. f : f. f1. f) :
706
+ (new_jac && (calc_J! (W. J, integrator, lcache, next_step)))
707
+ new_W && ! isdae &&
725
708
jacobian2W! (W. _concrete_form, mass_matrix, dtgamma, J, W_transform)
726
- end
727
709
end
728
710
elseif W isa AbstractSciMLOperator && ! (W isa StaticWOperator)
729
711
update_coefficients! (W, uprev, p, t; transform = W_transform, dtgamma)
@@ -929,7 +911,6 @@ function build_J_W(alg, u, uprev, p, t, dt, f::F, ::Type{uEltypeNoUnits},
929
911
else
930
912
deepcopy (f. jac_prototype)
931
913
end
932
-
933
914
W = if alg isa DAEAlgorithm
934
915
J
935
916
elseif IIP
0 commit comments