Skip to content

Commit

Permalink
Small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikQQY committed Nov 28, 2024
1 parent 3af4f5e commit 351b91e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Pkg = "1.10.0"
Random = "1.10"
ReTestItems = "1.23.1"
Reexport = "1.2"
SciMLBase = "2.60.0"
SciMLBase = "2.64.0"
StaticArrays = "1.9.8"
Test = "1.10"
julia = "1.10"
Expand Down
17 changes: 8 additions & 9 deletions lib/BoundaryValueDiffEqFIRK/src/firk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ function __construct_nlproblem(
resid_collocation = __similar(y, cache.M * (N - 1))

bc_diffmode = if jac_alg.bc_diffmode isa AutoSparse
AutoSparse(jac_alg.bc_diffmode;
AutoSparse(get_dense_ad(jac_alg.bc_diffmode);
sparsity_detector = SparseConnectivityTracer.TracerSparsityDetector(),
coloring_algorithm = GreedyColoringAlgorithm(LargestFirst()))
else
Expand Down Expand Up @@ -634,10 +634,10 @@ function __construct_nlproblem(
end

cache_collocation = if iip
DI.prepare_jacobian(loss_collocation, resid_collocation,
jac_alg.nonbc_diffmode, y, Constant(cache.p))
DI.prepare_jacobian(
loss_collocation, resid_collocation, nonbc_diffmode, y, Constant(cache.p))
else
DI.prepare_jacobian(loss_collocation, jac_alg.nonbc_diffmode, y, Constant(cache.p))
DI.prepare_jacobian(loss_collocation, nonbc_diffmode, y, Constant(cache.p))
end

J_bc = if iip
Expand All @@ -660,13 +660,12 @@ function __construct_nlproblem(

jac = if iip
@closure (J, u, p) -> __firk_mpoint_jacobian!(
J, J_c, u, jac_alg.bc_diffmode, jac_alg.nonbc_diffmode,
cache_bc, cache_collocation, loss_bc, loss_collocation,
resid_bc, resid_collocation, L, cache.p)
J, J_c, u, bc_diffmode, nonbc_diffmode, cache_bc, cache_collocation,
loss_bc, loss_collocation, resid_bc, resid_collocation, L, cache.p)
else
@closure (u, p) -> __firk_mpoint_jacobian(
jac_prototype, J_c, u, jac_alg.bc_diffmode, jac_alg.nonbc_diffmode,
cache_bc, cache_collocation, loss_bc, loss_collocation, L, cache.p)
jac_prototype, J_c, u, bc_diffmode, nonbc_diffmode, cache_bc,
cache_collocation, loss_bc, loss_collocation, L, cache.p)
end

resid_prototype = vcat(resid_bc, resid_collocation)
Expand Down
1 change: 0 additions & 1 deletion lib/BoundaryValueDiffEqFIRK/src/sparse_jacobians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,4 @@ function __generate_sparse_jacobian_prototype(
partition = ifelse((ADTypes.mode(ad) isa ADTypes.ReverseMode), :row, :column))
algo = GreedyColoringAlgorithm()
return coloring(J, problem, algo)
#return ColoredMatrix(J, matrix_colors(J'), matrix_colors(J))
end
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ end
@time sim = test_convergence(
dts, prob, lobattoIIIa_solver(Val(stage)); abstol = 1e-8)
if (stage == 5)
@test_broken sim.𝒪est[:final]2 * stage - 2 atol=testTol
@test_broken sim.𝒪est[:final]2 * stage - 2 atol=0.4
else
@test sim.𝒪est[:final]2 * stage - 2 atol=testTol
end
Expand Down

0 comments on commit 351b91e

Please sign in to comment.