Skip to content

Sundials v7.8.0 - #1601

Closed
AnHeuermann wants to merge 2 commits into
OpenModelica:masterfrom
AnHeuermann:sundials-v7.8.0-try2
Closed

Sundials v7.8.0#1601
AnHeuermann wants to merge 2 commits into
OpenModelica:masterfrom
AnHeuermann:sundials-v7.8.0-try2

Conversation

@AnHeuermann

Copy link
Copy Markdown
Member

Related Issues

Fresh PR for #1600.

AnHeuermann and others added 2 commits July 24, 2026 17:45
Bump 3rdParty, which replaces the patched sundials-5.4.0 source copy with a
pristine submodule pinned to v7.8.0, and port the solvers to the new API.

In the integrated OpenModelica build (OPENMODELICA_NEW_CMAKE_BUILD) this
block is skipped and we link the SUNDIALS that OMC configured, so the two
option sets have to stay in agreement.

Going from 5.4.0 to 7.8.0 crosses two breaking releases:

- Every SUNDIALS object is now created against a SUNContext. SystemSC,
  SystemSC3 and KinsolSolver each own one and pass it to N_VNew_Serial,
  SUNDenseMatrix, SUNLinSol_Dense, CVodeCreate and KINCreate. It has to be
  created before the first such object and freed after the last one.
- realtype -> sunrealtype.
- KINSetErrHandlerFn is gone; the error handler is pushed onto the SUNContext
  with SUNContext_PushErrHandler and now reports a source location plus a
  SUNErrCode instead of a module name and message string. Package level codes
  (KIN_* and friends) are not SUNErrCodes, so SUNGetErrMsg() is only used when
  SUNDIALS did not supply a message, the same rule its own default handler uses.
- KINSetPrintLevel and KINSetInfoHandlerFn are gone with no equivalent, so
  sundialsInfoHandlerFunction is dropped. KINSOL's progress output only exists
  via the SUNLogger, which is compiled out at the logging level SUNDIALS is
  built with here.
- SUNDIALS no longer writes to a FILE* of its own. Up to SUNDIALS 5 CVODE
  printed to cv_errfp, which defaulted to stderr; the same messages now go
  through the SUNContext error handler chain, whose default handler writes to
  the SUNLogger's error stream. Either way that bypasses OMSimulator's logger,
  so the logger's error and warning streams are muted per context and we report
  through logError as before.

While in here, report the allocation failures in KinsolSolver::NewKinsolSolver
that were silently ignored: the five N_VNew_Serial calls, SUNDenseMatrix and
SUNLinSol_Dense were used without checking for NULL. Also correct two
copy-pasted messages that blamed N_VNew_Serial for a failing SUNDenseMatrix.

Also follow the oms::3rd::cvode/kinsol -> oms::3rd::sundials::cvode/kinsol
alias rename from 3rdParty.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AnHeuermann AnHeuermann added the CI/Update Submodules Allow a pull request to update submodules label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/Update Submodules Allow a pull request to update submodules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant