Skip to content

Commit

Permalink
Fix Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Nov 1, 2023
1 parent c47db0a commit 042ab37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/NonlinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PrecompileTools.@recompile_invalidations begin

import ADTypes: AbstractFiniteDifferencesMode
import ArrayInterface: undefmatrix,
matrix_colors, parameterless_type, ismutable, issingular,fast_scalar_indexing
matrix_colors, parameterless_type, ismutable, issingular, fast_scalar_indexing
import ConcreteStructs: @concrete
import EnumX: @enumx
import ForwardDiff
Expand Down
7 changes: 4 additions & 3 deletions src/pseudotransient.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ end
function perform_step!(cache::PseudoTransientCache{true})
@unpack u, u_prev, fu1, f, p, alg, J, linsolve, du, alpha = cache
jacobian!!(J, cache)
inv_alpha = inv(alpha)

inv_alpha = inv(alpha)
if J isa SciMLBase.AbstractSciMLOperator
J = J - inv_alpha * I
else
Expand Down Expand Up @@ -142,14 +142,15 @@ function perform_step!(cache::PseudoTransientCache{false})
@unpack u, u_prev, fu1, f, p, alg, linsolve, alpha = cache

cache.J = jacobian!!(cache.J, cache)
inv_alpha = inv(alpha)

inv_alpha = inv(alpha)
cache.J = cache.J - inv_alpha * I
# u = u - J \ fu
if linsolve === nothing
cache.du = fu1 / cache.J
else
linres = dolinsolve(alg.precs, linsolve; A = cache.J,b = _vec(fu1),linu = _vec(cache.du), p, reltol = cache.abstol)
linres = dolinsolve(alg.precs, linsolve; A = cache.J, b = _vec(fu1),
linu = _vec(cache.du), p, reltol = cache.abstol)
cache.linsolve = linres.cache
end
cache.u = @. u - cache.du # `u` might not support mutation
Expand Down

0 comments on commit 042ab37

Please sign in to comment.