-
-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathOrdinaryDiffEqCore.jl
More file actions
177 lines (129 loc) · 4.81 KB
/
OrdinaryDiffEqCore.jl
File metadata and controls
177 lines (129 loc) · 4.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
module OrdinaryDiffEqCore
if isdefined(Base, :Experimental) &&
isdefined(Base.Experimental, Symbol("@max_methods"))
@eval Base.Experimental.@max_methods 1
end
import DocStringExtensions
import Reexport: @reexport
using Reexport: @reexport
@reexport using SciMLBase
import DiffEqBase
import Logging: @logmsg, LogLevel
using MuladdMacro: @muladd
using LinearAlgebra: opnorm, I, UniformScaling, diag, rank, isdiag
import PrecompileTools
import FastPower: fastpower
# Interfaces
import SciMLBase: solve!, step!, isadaptive
import DiffEqBase: initialize!
# DAE Initialization algorithms
import DiffEqBase: DefaultInit, ShampineCollocationInit, BrownFullBasicInit
# Internal utils
import DiffEqBase: ODE_DEFAULT_NORM,
ODE_DEFAULT_ISOUTOFDOMAIN, ODE_DEFAULT_PROG_MESSAGE,
ODE_DEFAULT_UNSTABLE_CHECK
import SciMLOperators: AbstractSciMLOperator, AbstractSciMLScalarOperator,
MatrixOperator, FunctionOperator,
update_coefficients, update_coefficients!, DEFAULT_UPDATE_FUNC,
isconstant
using DiffEqBase: DEIntegrator
import Random
import RecursiveArrayTools: chain, recursivecopy!, recursivecopy, recursive_bottom_eltype, recursive_unitless_bottom_eltype, recursive_unitless_eltype, copyat_or_push!, DiffEqArray, recursivefill!
import RecursiveArrayTools
using DataStructures: BinaryHeap, FasterForward
import DataStructures
using ArrayInterface: ArrayInterface, issingular
import TruncatedStacktraces: @truncate_stacktrace, VERBOSE_MSG
import StaticArraysCore: SArray, MVector, SVector, StaticArray, MMatrix,
StaticMatrix
# Integrator Interface
import SciMLBase: resize!, deleteat!, addat!, full_cache, user_cache, u_cache, du_cache,
resize_non_user_cache!, deleteat_non_user_cache!, addat_non_user_cache!,
terminate!, get_du, get_dt, get_proposed_dt, set_proposed_dt!,
u_modified!, savevalues!,
add_tstop!, has_tstop, first_tstop, pop_tstop!,
add_saveat!, set_reltol!,
set_abstol!, postamble!, last_step_failed,
isautodifferentiable
import DiffEqBase: get_tstops, get_tstops_array, get_tstops_max
using DiffEqBase: check_error!, @def, _vec, _reshape
using FastBroadcast: @.., True, False
using SciMLBase: NoInit, CheckInit, OverrideInit, AbstractDEProblem, _unwrap_val,
ODEAliasSpecifier
import SciMLBase: AbstractNonlinearProblem, alg_order, LinearAliasSpecifier
import SciMLBase: unwrap_cache,
islinear
import DiffEqBase: calculate_residuals,
calculate_residuals!, @tight_loop_macros,
timedepentdtmin
import Polyester
# MacroTools and Adapt imported but not directly used in OrdinaryDiffEqCore
# using MacroTools, Adapt
import ADTypes: AutoFiniteDiff, AutoForwardDiff, AbstractADType, AutoSparse, dense_ad
import Accessors: @reset
# SciMLStructures symbols imported but not directly used in OrdinaryDiffEqCore
# using SciMLStructures: canonicalize, Tunable, isscimlstructure
using SciMLLogging: SciMLLogging, @SciMLMessage, AbstractVerbositySpecifier, AbstractVerbosityPreset,
None, Minimal, Standard, Detailed, All, Silent, InfoLevel, WarnLevel, ErrorLevel,
CustomLevel, AbstractMessageLevel, @verbosity_specifier
using SymbolicIndexingInterface: state_values, parameter_values
using ConcreteStructs: @concrete
import EnzymeCore
const CompiledFloats = Union{Float32, Float64}
import Preferences
abstract type AbstractNLSolverCache end
abstract type AbstractNLSolverAlgorithm end
abstract type AbstractNLSolver{algType, iip} end
function set_new_W! end
function set_W_γdt! end
function get_W end
function isfirstcall end
function isfirststage end
function isJcurrent end
function get_new_W_γdt_cutoff end
resize_J_W!(args...) = nothing
resize_nlsolver!(args...) = nothing
@enum MethodType begin
DIRK
COEFFICIENT_MULTISTEP
NORDSIECK_MULTISTEP
GLM
end
@enum NLStatus::Int8 begin
FastConvergence = 2
Convergence = 1
SlowConvergence = 0
VerySlowConvergence = -1
Divergence = -2
end
const TryAgain = SlowConvergence
DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothing
isdiscretecache(cache) = false
@static if isdefined(DiffEqBase, :unitfulvalue)
unitfulvalue(x) = DiffEqBase.unitfulvalue(x)
else
unitfulvalue(x) = DiffEqBase.ForwardDiff.value(x)
end
include("doc_utils.jl")
include("misc_utils.jl")
include("verbosity.jl")
include("algorithms.jl")
include("composite_algs.jl")
include("alg_utils.jl")
include("caches/basic_caches.jl")
include("integrators/type.jl")
include("integrators/controllers.jl")
include("integrators/integrator_interface.jl")
include("integrators/integrator_utils.jl")
include("cache_utils.jl")
include("initialize_dae.jl")
include("perform_step/composite_perform_step.jl")
include("disco.jl")
include("dense/generic_dense.jl")
include("iterator_interface.jl")
include("solve.jl")
include("initdt.jl")
include("interp_func.jl")
include("enzyme_rules.jl")
include("precompilation_setup.jl")
end