From 351b91e759376cec4e9734805c9900a2485fbd1b Mon Sep 17 00:00:00 2001 From: Qingyu Qu <2283984853@qq.com> Date: Thu, 28 Nov 2024 19:34:11 +0800 Subject: [PATCH] Small tweaks --- Project.toml | 2 +- lib/BoundaryValueDiffEqFIRK/src/firk.jl | 17 ++++++++--------- .../src/sparse_jacobians.jl | 1 - .../test/expanded/firk_basic_tests.jl | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Project.toml b/Project.toml index e7e75174..ef544294 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/lib/BoundaryValueDiffEqFIRK/src/firk.jl b/lib/BoundaryValueDiffEqFIRK/src/firk.jl index dfb5b3dd..801187bb 100644 --- a/lib/BoundaryValueDiffEqFIRK/src/firk.jl +++ b/lib/BoundaryValueDiffEqFIRK/src/firk.jl @@ -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 @@ -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 @@ -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) diff --git a/lib/BoundaryValueDiffEqFIRK/src/sparse_jacobians.jl b/lib/BoundaryValueDiffEqFIRK/src/sparse_jacobians.jl index b4094d34..de8137b3 100644 --- a/lib/BoundaryValueDiffEqFIRK/src/sparse_jacobians.jl +++ b/lib/BoundaryValueDiffEqFIRK/src/sparse_jacobians.jl @@ -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 diff --git a/lib/BoundaryValueDiffEqFIRK/test/expanded/firk_basic_tests.jl b/lib/BoundaryValueDiffEqFIRK/test/expanded/firk_basic_tests.jl index e87846c8..ca782ad6 100644 --- a/lib/BoundaryValueDiffEqFIRK/test/expanded/firk_basic_tests.jl +++ b/lib/BoundaryValueDiffEqFIRK/test/expanded/firk_basic_tests.jl @@ -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