Commit 4e612f1
committed
Add DiffEqBase.stripunits helper and use it for tTypeNoUnits
Adds a narrow "strip units only" primitive that is orthogonal to the existing
`value` (strips everything, including AD) and `unitfulvalue` (strips AD, keeps
units) helpers. Defaults to the identity; Unitful, FlexUnits, and
DynamicQuantities extensions override it to return the underlying numeric value.
Switches the `tTypeNoUnits` derivation in `OrdinaryDiffEqCore/src/solve.jl`
from `DiffEqBase.value(oneunit(first(tspan)))` to
`DiffEqBase.stripunits(oneunit(first(tspan)))` so that ForwardDiff Duals in t0
are preserved through `tTypeNoUnits`. The previous `value`-based form collapsed
Duals to Float64, which then made `NLSolver{true, tTypeNoUnits}` use Float64
fields for ηold etc., and SDIRK solvers (KenCarp4/47/5/58, TRBDF2) that run
with a Dual t0 errored with `MethodError: Float64(::Dual)`.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>1 parent f84ae68 commit 4e612f1
5 files changed
Lines changed: 13 additions & 1 deletion
File tree
- lib
- DiffEqBase
- ext
- src
- OrdinaryDiffEqCore/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
| 320 | + | |
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| |||
0 commit comments