Skip to content

Commit 834647d

Browse files
authored
fix docstring of ARKODE
1 parent 1cff2a4 commit 834647d

File tree

1 file changed

+73
-72
lines changed

1 file changed

+73
-72
lines changed

src/common_interface/algorithms.jl

Lines changed: 73 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -302,25 +302,24 @@ end
302302
"""
303303
```julia
304304
ARKODE(stiffness=Sundials.Implicit();
305-
method=:Newton,linear_solver=:Dense,
306-
jac_upper=0,jac_lower=0,stored_upper = jac_upper+jac_lower,
307-
non_zero=0,krylov_dim=0,
308-
max_hnil_warns = 10,
309-
max_error_test_failures = 7,
310-
max_nonlinear_iters = 3,
311-
max_convergence_failures = 10,
312-
predictor_method = 0,
313-
nonlinear_convergence_coefficient = 0.1,
314-
dense_order = 3,
315-
order = 4,
316-
set_optimal_params = false,
317-
crdown = 0.3,
318-
dgmax = 0.2,
319-
rdiv = 2.3,
320-
msbp = 20,
321-
adaptivity_method = 0,
322-
prec = nothing, psetup = nothing, prec_side = 0
323-
)
305+
method=:Newton,linear_solver=:Dense,
306+
jac_upper=0,jac_lower=0,stored_upper = jac_upper+jac_lower,
307+
non_zero=0,krylov_dim=0,
308+
max_hnil_warns = 10,
309+
max_error_test_failures = 7,
310+
max_nonlinear_iters = 3,
311+
max_convergence_failures = 10,
312+
predictor_method = 0,
313+
nonlinear_convergence_coefficient = 0.1,
314+
dense_order = 3,
315+
order = 4,
316+
set_optimal_params = false,
317+
crdown = 0.3,
318+
dgmax = 0.2,
319+
rdiv = 2.3,
320+
msbp = 20,
321+
adaptivity_method = 0,
322+
prec = nothing, psetup = nothing, prec_side = 0)
324323
```
325324
326325
ARKODE: Explicit and ESDIRK Runge-Kutta methods of orders 2-8 depending on choice of options.
@@ -330,87 +329,89 @@ ARKODE: Explicit and ESDIRK Runge-Kutta methods of orders 2-8 depending on choic
330329
The main options for ARKODE are the choice between explicit and implicit and the method
331330
order, given via:
332331
332+
```julia
333333
ARKODE(Sundials.Explicit()) # Solve with explicit tableau of default order 4
334-
ARKODE(Sundials.Implicit(),order = 3) # Solve with explicit tableau of order 3
334+
ARKODE(Sundials.Implicit(), order = 3) # Solve with explicit tableau of order 3
335+
```
335336
336337
The order choices for explicit are 2 through 8 and for implicit 3 through 5. Specific
337338
methods can also be set through the etable and itable options for explicit and implicit
338339
tableaus respectively. The available tableaus are:
339340
340-
etable:
341-
342-
* HEUN_EULER_2_1_2: 2nd order Heun's method
343-
* BOGACKI_SHAMPINE_4_2_3:
344-
* ARK324L2SA_ERK_4_2_3: explicit portion of Kennedy and Carpenter's 3rd order method
345-
* ZONNEVELD_5_3_4: 4th order explicit method
346-
* ARK436L2SA_ERK_6_3_4: explicit portion of Kennedy and Carpenter's 4th order method
347-
* SAYFY_ABURUB_6_3_4: 4th order explicit method
348-
* CASH_KARP_6_4_5: 5th order explicit method
349-
* FEHLBERG_6_4_5: Fehlberg's classic 5th order method
350-
* DORMAND_PRINCE_7_4_5: the classic 5th order Dormand-Prince method
351-
* ARK548L2SA_ERK_8_4_5: explicit portion of Kennedy and Carpenter's 5th order method
352-
* VERNER_8_5_6: Verner's classic 5th order method
353-
* FEHLBERG_13_7_8: Fehlberg's 8th order method
354-
355-
itable:
356-
357-
* SDIRK_2_1_2: An A-B-stable 2nd order SDIRK method
358-
* BILLINGTON_3_3_2: A second order method with a 3rd order error predictor of less stability
359-
* TRBDF2_3_3_2: The classic TR-BDF2 method
360-
* KVAERNO_4_2_3: an L-stable 3rd order ESDIRK method
361-
* ARK324L2SA_DIRK_4_2_3: implicit portion of Kennedy and Carpenter's 3th order method
362-
* CASH_5_2_4: Cash's 4th order L-stable SDIRK method
363-
* CASH_5_3_4: Cash's 2nd 4th order L-stable SDIRK method
364-
* SDIRK_5_3_4: Hairer's 4th order SDIRK method
365-
* KVAERNO_5_3_4: Kvaerno's 4th order ESDIRK method
366-
* ARK436L2SA_DIRK_6_3_4: implicit portion of Kennedy and Carpenter's 4th order method
367-
* KVAERNO_7_4_5: Kvaerno's 5th order ESDIRK method
368-
* ARK548L2SA_DIRK_8_4_5: implicit portion of Kennedy and Carpenter's 5th order method
341+
`etable`:
342+
343+
* `HEUN_EULER_2_1_2`: 2nd order Heun's method
344+
* `BOGACKI_SHAMPINE_4_2_3`: third-order method of Bogacki and Shampine
345+
* `ARK324L2SA_ERK_4_2_3`: explicit portion of Kennedy and Carpenter's 3rd order method
346+
* `ZONNEVELD_5_3_4`: 4th order explicit method
347+
* `ARK436L2SA_ERK_6_3_4`: explicit portion of Kennedy and Carpenter's 4th order method
348+
* `SAYFY_ABURUB_6_3_4`: 4th order explicit method
349+
* `CASH_KARP_6_4_5`: 5th order explicit method
350+
* `FEHLBERG_6_4_5`: Fehlberg's classic 5th order method
351+
* `DORMAND_PRINCE_7_4_5`: the classic 5th order Dormand-Prince method
352+
* `ARK548L2SA_ERK_8_4_5`: explicit portion of Kennedy and Carpenter's 5th order method
353+
* `VERNER_8_5_6`: Verner's classic 5th order method
354+
* `FEHLBERG_13_7_8`: Fehlberg's 8th order method
355+
356+
`itable`:
357+
358+
* `SDIRK_2_1_2`: An A-B-stable 2nd order SDIRK method
359+
* `BILLINGTON_3_3_2`: A second order method with a 3rd order error predictor of less stability
360+
* `TRBDF2_3_3_2`: The classic TR-BDF2 method
361+
* `KVAERNO_4_2_3`: an L-stable 3rd order ESDIRK method
362+
* `ARK324L2SA_DIRK_4_2_3`: implicit portion of Kennedy and Carpenter's 3th order method
363+
* `CASH_5_2_4`: Cash's 4th order L-stable SDIRK method
364+
* `CASH_5_3_4`: Cash's 2nd 4th order L-stable SDIRK method
365+
* `SDIRK_5_3_4`: Hairer's 4th order SDIRK method
366+
* `KVAERNO_5_3_4`: Kvaerno's 4th order ESDIRK method
367+
* `ARK436L2SA_DIRK_6_3_4`: implicit portion of Kennedy and Carpenter's 4th order method
368+
* `KVAERNO_7_4_5`: Kvaerno's 5th order ESDIRK method
369+
* `ARK548L2SA_DIRK_8_4_5`: implicit portion of Kennedy and Carpenter's 5th order method
369370
370371
These can be set for example via:
371372
372373
```julia
373-
ARKODE(Sundials.Explicit(),etable = Sundials.DORMAND_PRINCE_7_4_5)
374-
ARKODE(Sundials.Implicit(),itable = Sundials.KVAERNO_4_2_3)
374+
ARKODE(Sundials.Explicit(), etable = Sundials.DORMAND_PRINCE_7_4_5)
375+
ARKODE(Sundials.Implicit(), itable = Sundials.KVAERNO_4_2_3)
375376
```
376377
377378
### Method Choices
378379
379-
* method - This is the method for solving the implicit equation. For BDF this defaults to
380-
:Newton while for Adams this defaults to :Functional. These choices match the
381-
recommended pairing in the Sundials.jl manual. However, note that using the :Newton
382-
method may take less iterations but requires more memory than the :Function iteration
380+
* `method` - This is the method for solving the implicit equation. For BDF this defaults to
381+
`:Newton` while for Adams this defaults to `:Functional`. These choices match the
382+
recommended pairing in the Sundials.jl manual. However, note that using the `:Newton`
383+
method may take less iterations but requires more memory than the `:Function` iteration
383384
approach.
384-
* linear_solver - This is the linear solver which is used in the :Newton method.
385+
* `linear_solver` - This is the linear solver which is used in the `:Newton` method.
385386
386387
### Linear Solver Choices
387388
388389
The choices for the linear solver are:
389390
390-
* :Dense - A dense linear solver.
391-
* :Band - A solver specialized for banded Jacobians. If used, you must set the position of the upper and lower non-zero diagonals via jac_upper and jac_lower.
392-
* :LapackDense - A version of the dense linear solver that uses the Julia-provided OpenBLAS-linked LAPACK for multithreaded operations. This will be faster than :Dense on larger systems but has noticeable overhead on smaller (<100 ODE) systems.
393-
* :LapackBand - A version of the banded linear solver that uses the Julia-provided OpenBLAS-linked LAPACK for multithreaded operations. This will be faster than :Band on larger systems but has noticeable overhead on smaller (<100 ODE) systems.
394-
* :Diagonal - This method is specialized for diagonal Jacobians.
395-
* :GMRES - A GMRES method. Recommended first choice Krylov method
396-
* :BCG - A Biconjugate gradient method.
397-
* :PCG - A preconditioned conjugate gradient method. Only for symmetric linear systems.
398-
* :TFQMR - A TFQMR method.
399-
* :KLU - A sparse factorization method. Requires that the user specifies a Jacobian. The Jacobian must be set as a sparse matrix in the ODEProblem type.
391+
* `:Dense` - A dense linear solver.
392+
* `:Band` - A solver specialized for banded Jacobians. If used, you must set the position of the upper and lower non-zero diagonals via jac_upper and jac_lower.
393+
* `:LapackDense` - A version of the dense linear solver that uses the Julia-provided OpenBLAS-linked LAPACK for multithreaded operations. This will be faster than :Dense on larger systems but has noticeable overhead on smaller (<100 ODE) systems.
394+
* `:LapackBand` - A version of the banded linear solver that uses the Julia-provided OpenBLAS-linked LAPACK for multithreaded operations. This will be faster than :Band on larger systems but has noticeable overhead on smaller (<100 ODE) systems.
395+
* `:Diagonal` - This method is specialized for diagonal Jacobians.
396+
* `:GMRES` - A GMRES method. Recommended first choice Krylov method
397+
* `:BCG` - A Biconjugate gradient method.
398+
* `:PCG` - A preconditioned conjugate gradient method. Only for symmetric linear systems.
399+
* `:TFQMR` - A TFQMR method.
400+
* `:KLU` - A sparse factorization method. Requires that the user specifies a Jacobian. The Jacobian must be set as a sparse matrix in the ODEProblem type.
400401
401402
### Preconditioners
402403
403404
Note that here `prec` is a preconditioner function
404-
`prec(z,r,p,t,y,fy,gamma,delta,lr)` where:
405+
`prec(z, r, p, t, y, fy, gamma, delta, lr)` where:
405406
406407
- `z`: the computed output vector
407408
- `r`: the right-hand side vector of the linear system
408409
- `p`: the parameters
409410
- `t`: the current independent variable
410411
- `du`: the current value of `f(u,p,t)`
411-
- `gamma`: the `gamma` of `W = M - gamma*J`
412+
- `gamma`: the `gamma` of `W = M - gamma * J`
412413
- `delta`: the iterative method tolerance
413-
- `lr`: a flag for whether `lr=1` (left) or `lr=2` (right)
414+
- `lr`: a flag for whether `lr = 1` (left) or `lr = 2` (right)
414415
preconditioning
415416
416417
and `psetup` is the preconditioner setup function for pre-computing Jacobian
@@ -422,8 +423,8 @@ information `psetup(p, t, u, du, jok, jcurPtr, gamma)`. Where:
422423
- `du`: the current `f(u,p,t)`
423424
- `jok`: a bool indicating whether the Jacobian needs to be updated
424425
- `jcurPtr`: a reference to an Int for whether the Jacobian was updated.
425-
`jcurPtr[]=true` should be set if the Jacobian was updated, and
426-
`jcurPtr[]=false` should be set if the Jacobian was not updated.
426+
`jcurPtr[] = true` should be set if the Jacobian was updated, and
427+
`jcurPtr[] = false` should be set if the Jacobian was not updated.
427428
- `gamma`: the `gamma` of `W = M - gamma*J`
428429
429430
`psetup` is optional when `prec` is set.
@@ -462,7 +463,7 @@ struct ARKODE{Method, LinearSolver, MassLinearSolver, T, T1, T2, P, PS} <:
462463
prec_side::Int
463464
end
464465

465-
Base.@pure function ARKODE(stiffness = Implicit();
466+
function ARKODE(stiffness = Implicit();
466467
method = :Newton,
467468
linear_solver = :Dense,
468469
mass_linear_solver = :Dense,

0 commit comments

Comments
 (0)