|
25 | 25 | du[1] = cos(u[2]) - u[1] |
26 | 26 | du[2] = sin(u[1] + u[2]) + u[2] |
27 | 27 | end |
28 | | - explicitfun1(cache,sols) = nothing |
29 | | - prob1 = NonlinearProblem(NonlinearFunction{true, SciMLBase.NoSpecialize}(f1), zeros(2), cache) |
| 28 | + explicitfun1(cache, sols) = nothing |
| 29 | + prob1 = NonlinearProblem( |
| 30 | + NonlinearFunction{true, SciMLBase.NoSpecialize}(f1), zeros(2), cache) |
30 | 31 | sol1 = solve(prob1, NewtonRaphson()) |
31 | 32 |
|
32 | 33 | function f2(du, u, (cache, p)) |
33 | 34 | du[1] = 2u[2] + u[1] + 1.0 |
34 | 35 | du[2] = u[3]^2 + u[2] |
35 | 36 | du[3] = u[1]^2 + u[3] |
36 | 37 | end |
37 | | - explicitfun2(cache,sols) = nothing |
38 | | - prob2 = NonlinearProblem(NonlinearFunction{true, SciMLBase.NoSpecialize}(f2), zeros(3), cache) |
| 38 | + explicitfun2(cache, sols) = nothing |
| 39 | + prob2 = NonlinearProblem( |
| 40 | + NonlinearFunction{true, SciMLBase.NoSpecialize}(f2), zeros(3), cache) |
39 | 41 | sol2 = solve(prob2, NewtonRaphson()) |
40 | 42 |
|
41 | 43 | function f3(du, u, (cache, p)) |
42 | 44 | du[1] = cache[1] + 2.0u[1] + 2.5u[2] + 1.5u[3] |
43 | 45 | du[2] = cache[2] + 4.0u[1] - 1.5u[2] + 1.5u[3] |
44 | 46 | du[3] = cache[3] + +u[1] - u[2] - u[3] |
45 | 47 | end |
46 | | - prob3 = NonlinearProblem(NonlinearFunction{true, SciMLBase.NoSpecialize}(f3), zeros(3), cache) |
47 | | - function explicitfun3(cache,sols) |
| 48 | + prob3 = NonlinearProblem( |
| 49 | + NonlinearFunction{true, SciMLBase.NoSpecialize}(f3), zeros(3), cache) |
| 50 | + function explicitfun3(cache, sols) |
48 | 51 | cache[1] = sols[1][1] + sols[1][2] + sols[2][1] + sols[2][2] + sols[2][3] |
49 | 52 | cache[2] = sols[1][1] + sols[1][2] + sols[2][1] + 2.0sols[2][2] + sols[2][3] |
50 | 53 | cache[3] = sols[1][1] + 2.0sols[1][2] + 3.0sols[2][1] + 5.0sols[2][2] + |
|
54 | 57 | sol3 = solve(prob3, NewtonRaphson()) |
55 | 58 | manualscc = [sol1; sol2; sol3] |
56 | 59 |
|
57 | | - sccprob = SciMLBase.SCCNonlinearProblem([prob1,prob2,prob3], SciMLBase.Void{Any}.([explicitfun1,explicitfun2,explicitfun3])) |
| 60 | + sccprob = SciMLBase.SCCNonlinearProblem([prob1, prob2, prob3], |
| 61 | + SciMLBase.Void{Any}.([explicitfun1, explicitfun2, explicitfun3])) |
58 | 62 | scc_sol = solve(sccprob, NewtonRaphson()) |
59 | 63 | @test sol ≈ manualscc ≈ scc_sol |
60 | 64 | end |
0 commit comments