|
2 | 2 |
|
3 | 3 | This tutorial is for getting into the extra features of using NonlinearSolve.jl. Solving
|
4 | 4 | ill-conditioned nonlinear systems requires specializing the linear solver on properties of
|
5 |
| -the Jacobian in order to cut down on the `\mathcal{O}(n^3)` linear solve and the |
6 |
| -`\mathcal{O}(n^2)` back-solves. This tutorial is designed to explain the advanced usage of |
| 5 | +the Jacobian in order to cut down on the ``\mathcal{O}(n^3)`` linear solve and the |
| 6 | +``\mathcal{O}(n^2)`` back-solves. This tutorial is designed to explain the advanced usage of |
7 | 7 | NonlinearSolve.jl by solving the steady state stiff Brusselator partial differential
|
8 | 8 | equation (BRUSS) using NonlinearSolve.jl.
|
9 | 9 |
|
10 | 10 | ## Definition of the Brusselator Equation
|
11 | 11 |
|
12 | 12 | !!! note
|
13 |
| - |
| 13 | + |
14 | 14 | Feel free to skip this section: it simply defines the example problem.
|
15 | 15 |
|
16 | 16 | The Brusselator PDE is defined as follows:
|
@@ -117,11 +117,11 @@ However, if you know the sparsity of your problem, then you can pass a different
|
117 | 117 | type. For example, a `SparseMatrixCSC` will give a sparse matrix. Other sparse matrix types
|
118 | 118 | include:
|
119 | 119 |
|
120 |
| -- Bidiagonal |
121 |
| -- Tridiagonal |
122 |
| -- SymTridiagonal |
123 |
| -- BandedMatrix ([BandedMatrices.jl](https://github.com/JuliaLinearAlgebra/BandedMatrices.jl)) |
124 |
| -- BlockBandedMatrix ([BlockBandedMatrices.jl](https://github.com/JuliaLinearAlgebra/BlockBandedMatrices.jl)) |
| 120 | + - Bidiagonal |
| 121 | + - Tridiagonal |
| 122 | + - SymTridiagonal |
| 123 | + - BandedMatrix ([BandedMatrices.jl](https://github.com/JuliaLinearAlgebra/BandedMatrices.jl)) |
| 124 | + - BlockBandedMatrix ([BlockBandedMatrices.jl](https://github.com/JuliaLinearAlgebra/BlockBandedMatrices.jl)) |
125 | 125 |
|
126 | 126 | ## Approximate Sparsity Detection & Sparse Jacobians
|
127 | 127 |
|
@@ -167,7 +167,7 @@ and `u` and call `jacobian_sparsity` on our function with the example arguments,
|
167 | 167 | kick out a sparse matrix with our pattern, that we can turn into our `jac_prototype`.
|
168 | 168 |
|
169 | 169 | !!! tip
|
170 |
| - |
| 170 | + |
171 | 171 | Alternatively you can use the `SparseConnectivityTracer.jl` package to automatically
|
172 | 172 | generate a sparse Jacobian.
|
173 | 173 |
|
@@ -224,7 +224,7 @@ choices, see the
|
224 | 224 | `linsolve` choices are any valid [LinearSolve.jl](https://linearsolve.sciml.ai/dev/) solver.
|
225 | 225 |
|
226 | 226 | !!! note
|
227 |
| - |
| 227 | + |
228 | 228 | Switching to a Krylov linear solver will automatically change the nonlinear problem
|
229 | 229 | solver into Jacobian-free mode, dramatically reducing the memory required. This can be
|
230 | 230 | overridden by adding `concrete_jac=true` to the algorithm.
|
@@ -330,7 +330,7 @@ prob_brusselator_2d_exact_tracer = NonlinearProblem(
|
330 | 330 | u0, p; abstol = 1e-10, reltol = 1e-10)
|
331 | 331 | prob_brusselator_2d_approx_di = NonlinearProblem(
|
332 | 332 | NonlinearFunction(brusselator_2d_loop;
|
333 |
| - sparsity = DenseSparsityDetector(AutoForwardDiff(); atol=1e-4)), |
| 333 | + sparsity = DenseSparsityDetector(AutoForwardDiff(); atol = 1e-4)), |
334 | 334 | u0, p; abstol = 1e-10, reltol = 1e-10)
|
335 | 335 |
|
336 | 336 | @btime solve(prob_brusselator_2d_exact_symbolics, NewtonRaphson());
|
|
0 commit comments