From 5ce7dac0157a8a17df043960a99c2144ff5cc147 Mon Sep 17 00:00:00 2001 From: vyudu Date: Tue, 25 Mar 2025 10:19:42 -0400 Subject: [PATCH 1/3] docs: document DAEProblem constructor --- docs/src/systems/ODESystem.md | 1 + src/systems/diffeqs/abstractodesystem.jl | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/src/systems/ODESystem.md b/docs/src/systems/ODESystem.md index 4be0f6e263..24e2952fc5 100644 --- a/docs/src/systems/ODESystem.md +++ b/docs/src/systems/ODESystem.md @@ -62,6 +62,7 @@ jacobian_sparsity ODEFunction(sys::ModelingToolkit.AbstractODESystem, args...) ODEProblem(sys::ModelingToolkit.AbstractODESystem, args...) SteadyStateProblem(sys::ModelingToolkit.AbstractODESystem, args...) +DAEProblem(sys::ModelingToolkit.AbstractODESystem, args...) ``` ## Expression Constructors diff --git a/src/systems/diffeqs/abstractodesystem.jl b/src/systems/diffeqs/abstractodesystem.jl index 23f20b00ec..05aa3fce94 100644 --- a/src/systems/diffeqs/abstractodesystem.jl +++ b/src/systems/diffeqs/abstractodesystem.jl @@ -941,6 +941,8 @@ DiffEqBase.DAEProblem{iip}(sys::AbstractODESystem, du0map, u0map, tspan, Generates a DAEProblem from an ODESystem and allows for automatically symbolically calculating numerical enhancements. + +Note: Solvers for DAEProblems like DFBDF, DImplicitEuler, DABDF2 are generally slower than the ones for ODEProblems. If possible, it is recommended to formulate your problem in terms of an ODEProblem and use the corresponding ODE Solvers. """ function DiffEqBase.DAEProblem(sys::AbstractODESystem, args...; kwargs...) DAEProblem{true}(sys, args...; kwargs...) @@ -951,7 +953,7 @@ function DiffEqBase.DAEProblem{iip}(sys::AbstractODESystem, du0map, u0map, tspan warn_initialize_determined = true, check_length = true, eval_expression = false, eval_module = @__MODULE__, kwargs...) where {iip} if !iscomplete(sys) - error("A completed system is required. Call `complete` or `structural_simplify` on the system before creating a `DAEProblem`") + error("A completed system is required. Call `complete` or `structural_simplify` on the system before creating a `DAEProblem`.") end f, du0, u0, p = process_SciMLProblem(DAEFunction{iip}, sys, u0map, parammap; implicit_dae = true, du0map = du0map, check_length, From c1bca7445f92eb7ffb4c6d2c0ef3ee4f5c16ee0a Mon Sep 17 00:00:00 2001 From: vyudu Date: Tue, 25 Mar 2025 10:20:25 -0400 Subject: [PATCH 2/3] fix lines --- src/systems/diffeqs/abstractodesystem.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/systems/diffeqs/abstractodesystem.jl b/src/systems/diffeqs/abstractodesystem.jl index 05aa3fce94..63cbf572ce 100644 --- a/src/systems/diffeqs/abstractodesystem.jl +++ b/src/systems/diffeqs/abstractodesystem.jl @@ -942,7 +942,10 @@ DiffEqBase.DAEProblem{iip}(sys::AbstractODESystem, du0map, u0map, tspan, Generates a DAEProblem from an ODESystem and allows for automatically symbolically calculating numerical enhancements. -Note: Solvers for DAEProblems like DFBDF, DImplicitEuler, DABDF2 are generally slower than the ones for ODEProblems. If possible, it is recommended to formulate your problem in terms of an ODEProblem and use the corresponding ODE Solvers. +Note: Solvers for DAEProblems like DFBDF, DImplicitEuler, DABDF2 are +generally slower than the ones for ODEProblems. If possible, it is +recommended to formulate your problem in terms of an ODEProblem and +use the corresponding ODE Solvers. """ function DiffEqBase.DAEProblem(sys::AbstractODESystem, args...; kwargs...) DAEProblem{true}(sys, args...; kwargs...) From 0f1c669fbbc1cf850c845b7f479584485b4e0309 Mon Sep 17 00:00:00 2001 From: vyudu Date: Mon, 7 Apr 2025 10:09:32 -0400 Subject: [PATCH 3/3] adjust docstring --- src/systems/diffeqs/abstractodesystem.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/systems/diffeqs/abstractodesystem.jl b/src/systems/diffeqs/abstractodesystem.jl index 63cbf572ce..f098e437f7 100644 --- a/src/systems/diffeqs/abstractodesystem.jl +++ b/src/systems/diffeqs/abstractodesystem.jl @@ -943,9 +943,8 @@ Generates a DAEProblem from an ODESystem and allows for automatically symbolically calculating numerical enhancements. Note: Solvers for DAEProblems like DFBDF, DImplicitEuler, DABDF2 are -generally slower than the ones for ODEProblems. If possible, it is -recommended to formulate your problem in terms of an ODEProblem and -use the corresponding ODE Solvers. +generally slower than the ones for ODEProblems. We recommend trying +ODEProblem and its solvers for your problem first. """ function DiffEqBase.DAEProblem(sys::AbstractODESystem, args...; kwargs...) DAEProblem{true}(sys, args...; kwargs...)