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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import OrdinaryDiffEqCore: OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCac
trivial_limiter!, get_fsalfirstlast,
generic_solver_docstring,
full_cache,
_bool_to_ADType
_bool_to_ADType, @SciMLMessage
import OrdinaryDiffEqLowOrderRK: BS3ConstantCache, BS3Cache, RK4ConstantCache, RK4Cache
import RecursiveArrayTools: recursivefill!
using MuladdMacro, FastBroadcast
Expand Down
2 changes: 1 addition & 1 deletion lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!,
step_reject_controller!, post_newton_controller!,
u_modified!, DAEAlgorithm, _unwrap_val, DummyController,
get_fsalfirstlast, generic_solver_docstring, _bool_to_ADType,
_process_AD_choice
_process_AD_choice, @SciMLMessage
using OrdinaryDiffEqSDIRK: ImplicitEulerConstantCache, ImplicitEulerCache

using TruncatedStacktraces: @truncate_stacktrace
Expand Down
4 changes: 4 additions & 0 deletions lib/OrdinaryDiffEqCore/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "1.36.0"
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
Expand All @@ -25,6 +26,7 @@ Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
SciMLLogging = "a6db7da4-7206-11f0-1eab-35f2a5dbe1d1"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand All @@ -50,6 +52,7 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SafeTestsets = "0.1.0"
SciMLOperators = "1.4"
Accessors = "0.1.36"
ConcreteStructs = "0.2"
StaticArraysCore = "1.4.3"
SciMLStructures = "1.7"
FunctionWrappersWrappers = "0.1"
Expand All @@ -67,6 +70,7 @@ LinearAlgebra = "1.10"
TruncatedStacktraces = "1.4"
SimpleUnPack = "1.1"
SciMLBase = "2.115"
SciMLLogging = "1.3.1"
FastClosures = "0.3"
DataStructures = "0.18.22, 0.19"
Static = "1.2"
Expand Down
7 changes: 7 additions & 0 deletions lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,14 @@ 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

using SymbolicIndexingInterface: state_values, parameter_values

using ConcreteStructs: @concrete

const CompiledFloats = Union{Float32, Float64}
import Preferences

Expand Down Expand Up @@ -136,6 +142,7 @@ end

include("doc_utils.jl")
include("misc_utils.jl")
include("verbosity.jl")

include("algorithms.jl")
include("composite_algs.jl")
Expand Down
12 changes: 6 additions & 6 deletions lib/OrdinaryDiffEqCore/src/initdt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@
# because it also checks if partials are NaN
# https://discourse.julialang.org/t/incorporating-forcing-functions-in-the-ode-model/70133/26
if isnan(d₁)
if integrator.opts.verbose
@warn("First function call produced NaNs. Exiting. Double check that none of the initial conditions, parameters, or timespan values are NaN.")
end

@SciMLMessage("First function call produced NaNs. Exiting. Double check that none of the initial conditions, parameters, or timespan values are NaN.",
integrator.opts.verbose, :init_NaN)
return tdir * dtmin
end

Expand Down Expand Up @@ -249,8 +247,10 @@ end
d₀ = internalnorm(u0 ./ sk, t)

f₀ = f(u0, p, t)
if integrator.opts.verbose && any(x -> any(isnan, x), f₀)
@warn("First function call produced NaNs. Exiting. Double check that none of the initial conditions, parameters, or timespan values are NaN.")

if any(x -> any(isnan, x), f₀)
@SciMLMessage("First function call produced NaNs. Exiting. Double check that none of the initial conditions, parameters, or timespan values are NaN.",
integrator.opts.verbose, :init_NaN)
end

inferredtype = Base.promote_op(/, typeof(u0), typeof(oneunit(t)))
Expand Down
4 changes: 3 additions & 1 deletion lib/OrdinaryDiffEqCore/src/integrators/controllers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,9 @@ end
k = min(alg_order(alg), alg_adaptive_order(alg)) + 1
dt_factor = err1^(beta1 / k) * err2^(beta2 / k) * err3^(beta3 / k)
if isnan(dt_factor)
@warn "unlimited dt_factor" dt_factor err1 err2 err3 beta1 beta2 beta3 k
@SciMLMessage("unlimited dt_factor",
integrator.opts.verbose, :unlimited_dt)
#@warn "unlimited dt_factor" dt_factor err1 err2 err3 beta1 beta2 beta3 k
end
dt_factor = controller.limiter(dt_factor)

Expand Down
2 changes: 1 addition & 1 deletion lib/OrdinaryDiffEqCore/src/integrators/type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mutable struct DEOptions{absType, relType, QT, tType, Controller, F1, F2, F3, F4
callback::F4
isoutofdomain::F5
unstable_check::F7
verbose::Bool
verbose::ODEVerbosity
calck::Bool
force_dtmin::Bool
advance_to_tstop::Bool
Expand Down
25 changes: 18 additions & 7 deletions lib/OrdinaryDiffEqCore/src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function SciMLBase.__init(
internalopnorm = opnorm,
isoutofdomain = ODE_DEFAULT_ISOUTOFDOMAIN,
unstable_check = ODE_DEFAULT_UNSTABLE_CHECK,
verbose = true,
verbose = ODEVerbosity(),
timeseries_errors = true,
dense_errors = false,
advance_to_tstop = false,
Expand Down Expand Up @@ -96,14 +96,25 @@ function SciMLBase.__init(
error("This solver is not able to use mass matrices. For compatible solvers see https://docs.sciml.ai/DiffEqDocs/stable/solvers/dae_solve/")
end

if verbose isa Bool
if verbose
verbose = ODEVerbosity()
else
verbose = ODEVerbosity(None())
end
elseif verbose isa AbstractVerbosityPreset
verbose = ODEVerbosity(verbose)
end

if alg isa OrdinaryDiffEqRosenbrockAdaptiveAlgorithm &&
# https://github.com/SciML/OrdinaryDiffEq.jl/pull/2079 fixes this for Rosenbrock23 and 32
!only_diagonal_mass_matrix(alg) &&
prob.f.mass_matrix isa AbstractMatrix &&
all(isequal(0), prob.f.mass_matrix)
# technically this should also warn for zero operators but those are hard to check for
if (dense || !isempty(saveat)) && verbose
@warn("Rosenbrock methods on equations without differential states do not bound the error on interpolations.")
if (dense || !isempty(saveat))
@SciMLMessage("Rosenbrock methods on equations without differential states do not bound the error on interpolations.",
verbose, :rosenbrock_no_differential_states)
end
end

Expand All @@ -114,7 +125,8 @@ function SciMLBase.__init(
end

if !isempty(saveat) && dense
@warn("Dense output is incompatible with saveat. Please use the SavingCallback from the Callback Library to mix the two behaviors.")
@SciMLMessage("Dense output is incompatible with saveat. Please use the SavingCallback from the Callback Library to mix the two behaviors.",
verbose, :dense_output_saveat)
end

progress && @logmsg(LogLevel(-1), progress_name, _id=progress_id, progress=0)
Expand Down Expand Up @@ -641,9 +653,8 @@ function handle_dt!(integrator)
error("Automatic dt setting has the wrong sign. Exiting. Please report this error.")
end
if isnan(integrator.dt)
if integrator.opts.verbose
@warn("Automatic dt set the starting dt as NaN, causing instability. Exiting.")
end
@SciMLMessage("Automatic dt set the starting dt as NaN, causing instability. Exiting.",
integrator.opts.verbose, :dt_NaN)
end
elseif integrator.opts.adaptive && integrator.dt > zero(integrator.dt) &&
integrator.tdir < 0
Expand Down
Loading
Loading