|
1 | 1 | using OrdinaryDiffEq, SparseArrays, LinearSolve, LinearAlgebra
|
2 | 2 | using SimpleUnPack
|
3 | 3 | using ComponentArrays
|
4 |
| -using Symbolics |
5 | 4 |
|
6 | 5 | function enclosethetimedifferential(parameters::NamedTuple)::Function
|
7 | 6 | @info "Enclosing the time differential"
|
@@ -124,9 +123,12 @@ odeprob = ODEProblem(dudt,
|
124 | 123 | (0, 2.1),
|
125 | 124 | parameters.prior);
|
126 | 125 | du0 = copy(odeprob.u0);
|
127 |
| -jac_sparsity = Symbolics.jacobian_sparsity((du, u) -> dudt(du, u, parameters.prior, 0.0), |
128 |
| - du0, |
129 |
| - odeprob.u0); |
| 126 | +# Hardcoded sparsity pattern for 15 spatial points + 3 state variables (18x18 matrix) |
| 127 | +# Previously computed using: Symbolics.jacobian_sparsity((du, u) -> dudt(du, u, parameters.prior, 0.0), du0, odeprob.u0) |
| 128 | +# This avoids the dependency on Symbolics in tests |
| 129 | +I = [1, 2, 16, 18, 1, 2, 3, 18, 2, 3, 4, 18, 3, 4, 5, 18, 4, 5, 6, 18, 5, 6, 7, 18, 6, 7, 8, 18, 7, 8, 9, 18, 8, 9, 10, 18, 9, 10, 11, 18, 10, 11, 12, 18, 11, 12, 13, 18, 12, 13, 14, 18, 13, 14, 15, 18, 14, 15, 17, 18, 1, 16, 17, 15, 17, 18, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18] |
| 130 | +J = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18] |
| 131 | +jac_sparsity = sparse(I, J, ones(Bool, length(I)), 18, 18); |
130 | 132 | f = ODEFunction(dudt;
|
131 | 133 | jac_prototype = float.(jac_sparsity));
|
132 | 134 | sparseodeprob = ODEProblem(f,
|
|
0 commit comments