Switch solver from Rodas5P to Rodas5Pr and log resolved solver settings#33
Open
AnHeuermann wants to merge 7 commits intomainfrom
Open
Switch solver from Rodas5P to Rodas5Pr and log resolved solver settings#33AnHeuermann wants to merge 7 commits intomainfrom
AnHeuermann wants to merge 7 commits intomainfrom
Conversation
Member
Author
|
I might have broken Modelica.Electrical.Analog.Examples.CharacteristicIdealDiodes.bmo on my local version / in this PR. Need to check that before merging. |
Replace Rodas5P with FBDF throughout run_simulate. Before solving, call
init() to resolve all default kwargs (abstol, reltol, adaptive, dense,
saveat) and write them to the simulation log. Fix saveat splatting bug
where a NamedTuple was spread as positional args instead of kwargs,
causing a convert(Vector{Float64}, ::Float64) error when the ODEProblem
carries a scalar saveat in its own kwargs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduce SimulateSettings struct so the ODE solver can be selected via configure_simulate!() or passed directly to run_simulate/test_model/main. Switch the default solver from Rodas5P to Rodas5Pr and log resolved solver settings (abstol, reltol, adaptive, dense, saveat) by calling init() before solve(). Split runtests.jl into per-concern files and add two fixture-based tests that run without OMC: BusUsage (no-state model, saveat-grid path) and AmplifierWithOpAmpDetailed (parse + simulate + reference verification). Copy the required .bmo files and MAP-LIB reference results into test/fixtures/. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37b727e to
9c166c8
Compare
Member
Author
|
The results are very bad with Rodas5Pr:
A lot of models are failing simulation with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Addresses SciML/BaseModelica.jl#101.
Changes
Configurable solver (
SimulateSettings)Add a
SimulateSettingsstruct (analogous toCompareSettings) that holds the ODE solver and thesaveat_ngrid size for purely algebraic systems. A module-level singleton_SIM_SETTINGSis exposed viaconfigure_simulate!()andsimulate_settings(), and the struct can also be passed explicitly torun_simulate,test_model, andmain.Solver switch: Rodas5P → Rodas5Pr (default)
The default solver is now
Rodas5Pr, a Rosenbrock-W variant with additional residual control. The previous switch toFBDFis now opt-in viaSimulateSettings.Purely algebraic system detection
After
structural_simplify, some models have unknowns that are all algebraic (zero rows in the mass matrix). For these, the adaptive step controller has nothing to drive small steps and the dense interpolant error is unbounded.run_simulatenow detects this via the mass matrix diagonal and falls back to a uniformsaveatgrid withadaptive = false.Resolved solver settings in the log
Before solving,
init()is called to resolve all defaults. The simulation log now records the fully-merged settings — solver name,saveat,abstol,reltol,adaptive,dense— so results are reproducible without reading source code.Fixture-based tests (no OMC required)
runtests.jlis split into per-concern files and two new tests run from checked-in.bmofiles and reference CSVs without needing an OMC installation:bus_usage.jl—Modelica.Blocks.Examples.BusUsage: no unknowns after simplification; exercises the no-state saveat path.amplifier_with_op_amp.jl—Modelica.Electrical.Analog.Examples.AmplifierWithOpAmpDetailed: full parse → simulate → reference verification against MAP-LIB results.