Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ authors = ["Dennis Ogiermann <termi-official@users.noreply.github.com> and contr
BinaryHeaps = "b2a6c25c-c996-4615-94ab-6e519ffb8690"
CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
NonlinearSolveFirstOrder = "5959db7a-ea39-4486-b5fe-2dd0bf03d60d"
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
OrdinaryDiffEqLowOrderRK = "1344f307-1e59-4825-a18e-ace9aa3fa4c6"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Expand All @@ -22,15 +23,16 @@ BinaryHeaps = "1.0.0"
CommonSolve = "0.2.4"
DiffEqBase = "7.5"
ModelingToolkit = "11"
NonlinearSolveFirstOrder = "2"
OrdinaryDiffEqCore = "4.4"
OrdinaryDiffEqLowOrderRK = "1.7, 2"
OrdinaryDiffEqTsit5 = "1.1.0, 2"
PrecompileTools = "1.1"
RecursiveArrayTools = "3.39.0, 4"
SafeTestsets = "0.1.0"
SciMLBase = "3.36"
SciMLLogging = "2"
SciMLIterators = "1"
SciMLLogging = "2"
SciMLTesting = "2.4"
SymbolicIndexingInterface = "0.3.36"
Test = "1"
Expand Down
16 changes: 16 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,21 @@
Strang = "Strang"
# Citation key for Trotter (Tro:1959:psg) used in docstrings
Tro = "Tro"
# David Ketcheson, in the citation key AuzHofKetKoc:2017:psm
Ket = "Ket"
# Citation keys for the order barrier: Sheng (She:1989:slp), Suzuki (Suz:1991:gtf)
She = "She"
Suz = "Suz"
# Splitting variable name
BA = "BA"
# Citation keys for the IMEX multirate methods: Fish/Reynolds/Roberts
# (FisReyRob:2023:iem), Chinomona/Reynolds (ChiRey:2021:iem),
# Sandu/Günther (SanGun:2015:gsa), Luan/Chinomona/Reynolds (LuaChiRey:2020:nch)
Fis = "Fis"
Rey = "Rey"
Rob = "Rob"
Chi = "Chi"
Gun = "Gun"
Lua = "Lua"
# Anders Kvaerno, whose Prothero-Robinson variant is the KPR convergence test problem
Kvaerno = "Kvaerno"
12 changes: 12 additions & 0 deletions docs/src/api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ GenericSplitFunction
LieTrotterGodunov
StrangMarchuk
PalindromicPairLieTrotterGodunov
Ruth3
Yoshida4
AdjointPair
IMEXMRISR2
IMEXMRISR3
```

### Implicit-explicit multirate

```@docs
OrdinaryDiffEqOperatorSplitting.AbstractIMEXMRISR
OrdinaryDiffEqOperatorSplitting.MRISRCoefficients
```

## Per-node configuration
Expand Down
101 changes: 101 additions & 0 deletions docs/src/assets/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,104 @@ @incollection{Mar:1971:tsm
year={1971},
publisher={Academic Press}
}

@article{Rut:1983:cim,
title={A canonical integration technique},
author={Ruth, Ronald D.},
journal={IEEE Transactions on Nuclear Science},
volume={NS-30},
number={4},
pages={2669--2671},
year={1983},
doi={10.1109/TNS.1983.4332919},
publisher={IEEE}
}

@article{Yos:1990:cho,
title={Construction of higher order symplectic integrators},
author={Yoshida, Haruo},
journal={Physics Letters A},
volume={150},
number={5--7},
pages={262--268},
year={1990},
doi={10.1016/0375-9601(90)90092-3},
publisher={Elsevier}
}

@article{AuzHofKetKoc:2017:psm,
title={Practical splitting methods for the adaptive integration of nonlinear evolution equations. {P}art {I}: {C}onstruction of optimized schemes and pairs of schemes},
author={Auzinger, Winfried and Hofst{\"a}tter, Harald and Ketcheson, David and Koch, Othmar},
journal={BIT Numerical Mathematics},
volume={57},
number={1},
pages={55--74},
year={2017},
doi={10.1007/s10543-016-0626-9},
publisher={Springer}
}

@article{She:1989:slp,
title={Solving linear partial differential equations by exponential splitting},
author={Sheng, Qin},
journal={IMA Journal of Numerical Analysis},
volume={9},
number={2},
pages={199--212},
year={1989},
doi={10.1093/imanum/9.2.199},
publisher={Oxford University Press}
}

@article{Suz:1991:gtf,
title={General theory of fractal path integrals with applications to many-body theories and statistical physics},
author={Suzuki, Masuo},
journal={Journal of Mathematical Physics},
volume={32},
number={2},
pages={400--407},
year={1991},
doi={10.1063/1.529425},
publisher={AIP}
}

@article{FisReyRob:2023:iem,
title={Implicit-explicit multirate infinitesimal stage-restart methods},
author={Fish, Alex C. and Reynolds, Daniel R. and Roberts, Steven B.},
journal={arXiv preprint arXiv:2301.00865},
year={2023},
doi={10.48550/arXiv.2301.00865}
}

@article{ChiRey:2021:iem,
title={Implicit-explicit multirate infinitesimal GARK methods},
author={Chinomona, Rujeko and Reynolds, Daniel R.},
journal={SIAM Journal on Scientific Computing},
volume={43},
number={5},
pages={A3082--A3113},
year={2021},
doi={10.1137/20M1354349}
}

@article{SanGun:2015:gsa,
title={A generalized-structure approach to additive Runge--Kutta methods},
author={Sandu, Adrian and G{\"u}nther, Michael},
Comment on lines +116 to +137

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've seen the OrdinaryDiffEqMultirate(Implicit) things?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but they are still constrained to a subset of multi-rate solvers, right? In OrdinaryDIffEq we cannot sync the subintegrators using different algorithms (and related the easier to fix one is that I also didn't see a canonical way to use a split function with more than two components).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging this into OrdinaryDiffEq is still an open todo, don't understand me wrong, and we can still move algorithms between subpackages. I just want the internals and interfaces to stability a bit before merging into the monorepo. I just do not want to cause any major trouble if I messed something up.

journal={SIAM Journal on Numerical Analysis},
volume={53},
number={1},
pages={17--42},
year={2015},
doi={10.1137/130943224}
}

@article{LuaChiRey:2020:nch,
title={A new class of high-order methods for multirate differential equations},
author={Luan, Vu Thai and Chinomona, Rujeko and Reynolds, Daniel R.},
journal={SIAM Journal on Scientific Computing},
volume={42},
number={2},
pages={A1245--A1268},
year={2020},
doi={10.1137/19M125621X}
}
104 changes: 99 additions & 5 deletions docs/src/devdocs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ prob = OperatorSplittingProblem(f, u0, tspan)
OrdinaryDiffEqOperatorSplitting.AbstractOperatorSplittingAlgorithm
OrdinaryDiffEqOperatorSplitting.AbstractOperatorSplittingCache
OrdinaryDiffEqOperatorSplitting.init_cache
OrdinaryDiffEqOperatorSplitting.init_cache_with_parameters
OrdinaryDiffEqOperatorSplitting.child_node_count
OrdinaryDiffEqOperatorSplitting._perform_step!
OrdinaryDiffEqOperatorSplitting.advance_solution_by!
OrdinaryDiffEqOperatorSplitting.child_failed
Expand Down Expand Up @@ -78,6 +80,23 @@ field named `inner_algs`, because that is how the tree of integrators is built
alongside the tree of split functions. The cache is where a scheme keeps the buffers
it needs beyond `u`/`uprev`.

Two further hooks exist for algorithms that do not fit the "one child per operator,
coupled only through initial conditions" shape. Both have defaults, so an ordinary
scheme never mentions them:

- [`OrdinaryDiffEqOperatorSplitting.child_node_count`](@ref) says how many of the
operators get a child integrator. The default is all of them; an algorithm that only
*evaluates* some operators returns fewer.
- [`OrdinaryDiffEqOperatorSplitting.init_cache_with_parameters`](@ref) is what the tree
actually calls, and it forwards to `init_cache` while dropping the problem
parameters. Override it when the cache itself needs them -- for instance to build a
nonlinear solver around one of the operators.

A node's cache is built *before* its children, so a child's right-hand side may be
wrapped around something the cache owns. `IMEXMRISR3` uses all of this: it builds one
child from the fast operator, wrapped so that each stage's forcing term, which lives in
the cache, is added to the fast right-hand side.

```julia
using SciMLBase, OrdinaryDiffEqOperatorSplitting
import OrdinaryDiffEqOperatorSplitting as OS
Expand Down Expand Up @@ -146,8 +165,9 @@ end

This example is written for exactly two operators. A scheme that works for any number
of them loops over `children` with `Unrolled.@unroll`, as the built-in algorithms in
`src/solver.jl` do; a plain `for` loop over the heterogeneously typed tuple would be
type unstable.
`src/solvers/` do; a plain `for` loop over the heterogeneously typed tuple would be
type unstable. `advance_one_child!` above is `src/solvers/common.jl`'s
`_advance_child!`, which the built-in schemes share.

### Adaptive algorithms

Expand Down Expand Up @@ -177,9 +197,83 @@ end
OrdinaryDiffEqCore interface for the estimate; go through them rather than touching
the `EEst` field, whose location on the integrator is an implementation detail.

See [`PalindromicPairLieTrotterGodunov`](@ref) in `src/solver.jl` for a complete
example, and [Adaptive time stepping](@ref) for how the two layers of adaptivity
interact.
See [`PalindromicPairLieTrotterGodunov`](@ref) in `src/solvers/adjoint_pair.jl` for a
complete example, and [Adaptive time stepping](@ref) for how the two layers of
adaptivity interact.

## Coefficient tables

Schemes of order three and above are not written out as passes over the children.
They are described by a table of coefficients and stepped by one shared traversal,
which lives in `src/solvers/coefficients.jl`; the schemes themselves
(`src/solvers/tables.jl`) are then little more than the table plus two interface
methods. See [Higher order splittings](@ref theory_higher-order) for where the
tables come from.

```@docs
OrdinaryDiffEqOperatorSplitting.SplittingCoefficients
OrdinaryDiffEqOperatorSplitting.coefficients
OrdinaryDiffEqOperatorSplitting.order
```

A table-driven scheme is added by giving it a struct, a table, `coefficients`,
`order`, and an `init_cache` returning the shared
`SplittingCoefficientsCache` — no stepping code of its own:

```julia
struct MyThirdOrder{AlgTupleType <: Tuple} <:
OrdinaryDiffEqOperatorSplitting.AbstractOperatorSplittingAlgorithm
inner_algs::AlgTupleType
end

const MY_COEFFICIENTS = OrdinaryDiffEqOperatorSplitting.SplittingCoefficients(
(7 // 24, 2 // 3), (3 // 4, -2 // 3), (-1 // 24, 1 // 1)
)

OrdinaryDiffEqOperatorSplitting.coefficients(::MyThirdOrder) = MY_COEFFICIENTS
OrdinaryDiffEqOperatorSplitting.order(::MyThirdOrder) = 3

function OrdinaryDiffEqOperatorSplitting.init_cache(
f::GenericSplitFunction, alg::MyThirdOrder;
uprev::AbstractArray, u::AbstractVector,
)
return OrdinaryDiffEqOperatorSplitting.SplittingCoefficientsCache(
u, uprev, OrdinaryDiffEqOperatorSplitting.coefficients(alg))
end
```

Only the consistency condition is checked when the table is built, so a table that
constructs successfully can still fail to reach the order it claims; a convergence
test is the only real check.

Two properties of the traversal are worth knowing when reading or extending it:

- **A zero coefficient is skipped entirely**, synchronization included, since the
flow is the identity. `Yoshida4`'s last stage relies on this.
- **The first flow of a step is always synchronized.** Strang-Marchuk skips that
sync because its reverse pass ends on operator 1, leaving that child's buffer
current; a general table ends on operator `N`, so operator 1's buffer is stale and
the same shortcut would silently corrupt every step after the first.

Because a table with negative coefficients steps some children backward, a
table-driven scheme also depends on the direction reversal described under
[Backward sub-steps](@ref devdocs_backward-substeps).

If the scheme's order is odd, wrapping it in `AdjointPair` makes it adaptive for
free: the adjoint is the same table traversed backwards, so nothing further is
needed from the scheme.

## [Backward sub-steps](@id devdocs_backward-substeps)

An inner integrator fixes its direction of integration when it is constructed, and
a scheme with negative coefficients has to step it the other way. Rather than build
two integrators per child, a sub-step against the child's direction reverses the
child in place, steps, and reverses it back:

```@docs
OrdinaryDiffEqOperatorSplitting.reverse_direction!
OrdinaryDiffEqOperatorSplitting.tstops_and_saveat_heaps
```

## Dense output

Expand Down
12 changes: 8 additions & 4 deletions docs/src/topics/adaptivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ Two independent layers of a splitting tree can adapt their step sizes:
they would outside of this package. Their behavior is governed by the tolerances
and options they receive.
- **Splitting nodes** adapt the splitting step itself. This requires an algorithm
that produces an error estimate of the splitting error;
[`PalindromicPairLieTrotterGodunov`](@ref) is currently the only one. It advances
with the average of the two mutually reversed Lie-Trotter sequences and uses half
their difference as the local error estimate.
that produces an error estimate of the splitting error, which here means running a
scheme together with its adjoint: the average of the two is the solution and half
their difference is the local error estimate (see
[Adjoint pairs](@ref theory_higher-order)).
[`PalindromicPairLieTrotterGodunov`](@ref) is that construction for the
Lie-Trotter sequence, and [`AdjointPair`](@ref) builds it from any odd-order
scheme — `AdjointPair(Ruth3((Tsit5(), Tsit5())))` is a fourth-order adaptive
splitting. Both cost two sweeps per step.

By default every node adapts exactly if its own algorithm can: for

Expand Down
Loading
Loading