Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Extra CVODE options

Extra CVODE options

Hello Everyone,

I am working with a co-simulation and I am experiencing some difficulties. For this we are using the following procedure.
We firstly generate the system FMU with OMPython in co-simulation mode. For this we choose the CVODE solver using the compiler option "--fmiFlags=s:cvode,nls:hybrid". For the co-simulation per se, we are using the PyFMI module for loading, initializing and solving the system. At first, the system initialization would always fail. When we generated the FMU with the extra compiler option "--homotopyApproach=adaptiveGlobal", the system finally got initialized successfully. However, during the simulation, the solver would fail with the following error:

[CVODE ERROR]  CVode tout too close to t0 to start integration.

Here are the messages thrown by the solver at the beginning of the simulation:

LOG_SOLVER        | info    | CVODE linear multistep method CV_BDF
LOG_SOLVER        | info    | CVODE maximum integration order CV_ITER_NEWTON
LOG_SOLVER        | info    | CVODE use equidistant time grid YES
LOG_SOLVER        | info    | CVODE Using relative error tolerance 1.000000e-06
LOG_SOLVER        | info    | CVODE Using dense internal linear solver SUNLinSol_Dense.
LOG_SOLVER        | info    | CVODE Use internal dense numeric jacobian method.
LOG_SOLVER        | info    | CVODE uses internal root finding method NO
LOG_SOLVER        | info    | CVODE maximum absolut step size 0
LOG_SOLVER        | info    | CVODE initial step size is set automatically
LOG_SOLVER        | info    | CVODE maximum integration order 5
LOG_SOLVER        | info    | CVODE maximum number of nonlinear convergence failures permitted during one step 10
LOG_SOLVER        | info    | CVODE BDF stability limit detection algorithm OFF

So, is there a way to pass additional arguments to CVODE solver at the moment we generate the FMU? For example, an argument for enabling the internal root finding method?

I would be deeply grateful if anyone could shed some light on this.

Re: Extra CVODE options

marcelot wrote:


[CVODE ERROR]  CVode tout too close to t0 to start integration.

That's an error message from SUNDIALS CVODE.
What the CVODE documentation says about it:


CV_TOO_CLOSE The initial time t0 and the output time tout are too close to each other and the user did not specify an initial step size.

marcelot wrote:


So, is there a way to pass additional arguments to CVODE solver at the moment we generate the FMU? For example, an argument for enabling the internal root finding method?

Currently not. It was planned to do that at some point but there is no one working on it at the moment.


By the way:

Code:

--fmiFlags=nls:hybrid

isn't doing anything. The documentation is not very good on that.
So

Code:

--fmiFlags=s:cvode

is enough.

Edited by: AnHeuermann - Mar-26-21 17:47:59

Re: Extra CVODE options

Thank you, AnHeuermann, for your prompt reply.

Would you have any further advice on how to circumvent the problem I am facing? I could not find much information in PyFMI documentation either.

Re: Extra CVODE options

Not really. You should open a ticket about it https://github.com/OpenModelica/OpenMod … new/choose and ask for it to be implemented. Add me (AnHeuermann) to the ticket. I'll probably be the one to implement it, but I can't promise to do it anytime soon.

There are ways to hack something into the FMU but I would not advise in doing that. It would be faster to update fmu_read_flags.c.inc to parse more simulation flags (e.g. initialStepSize in this case) anyway.
So the fastest solution would be to do it yourself (and create a pull request), but I know that's not very helpful.

Re: Extra CVODE options

I do really appreciate your help, AnHeuermann. I will open the ticket as you recommended.

There are 0 guests and 0 other users also viewing this topic