I used scipy's solve_ivp to integrate large differential equations.
Sometimes a message comes up: runtime warning overflow encountered....
But solve_ivp keeps on running.
Is there any way to stop solve_ivp as soon as this error comes up?
Thanks for any help!
Related
I have a transient model with Modelia.Fluid Valves and Dynamic Pipes that is running slowly. I am trying to find strategies and tools for identifying what is causing the slowness. By following the guidance in the Using the Profiler from OMEdit section of the Modelica Performance Analyzer documentation, I am able to see that the non-linear torn systems of equations are taking most of the CPU time which is helpful. However, I would like to learn more about what is causing the simulation to run slowly.
From reading Automatic tracking of stiff calculations in the models for improving simulation performance, it looks like Dymola has a "State variable logging => Which states that dominate error" option that appears to give insight to what part of the model is causing the integration step size to be reduced. I have read through the OpenModelica Compiler Flags and Simulation Flags documentation and have not found a similar option. Does OpenModelica have a similar option? Are there any tools or options within OpenModelica that will help me understand what parts of my model are causing my model to reduce the step size and run slowly or run slowly for other reasons?
If it matters, I am using the DASSL solver and OpenModelica 1.20.0.
Thanks,
Michael
My problem is that I am running a sweep study with some parameters. I change them in MATLAB and then run a simulation in MATLAB with the sim command. The simulation in SIMULINK contains an external software component from COMSOL with an FEM behind it. In some cases where the configuration is unfavorable (rapid changes in the feedback loop of the controlled system), the FEM tool is not able to converge in finite time, resulting in an error after a few simulation seconds/minutes/hours. The simulation command is inside a try-catch section to avoid that the program is stopped and the next study step starts to process the acquired data.
The problem is that in case the simulation has a convergence problem, the data generated up to this error is not sent to the workspace, but would be valid, and so I cannot find out from the data what was the reason for the convergence problem.
As additional information, I have been using the ToWorkspace block to send the data to my workspace where I do my post processing, and that works fine when the simulation is complete.
If any of you have any ideas on how to solve this problem, maybe you can help me.
Thank you in advance.
With the following setup in Dymola, the model in Modelica Standard Library (Modelica.Fluid.Examples.HeatingSystem) would cause a lot of errors about failing to solve nonlinear equations, even though in the end, nonlinear solver handles this issue successfully, but I don't understand this process.
My question is :
Is there some simple example that demonstrates this process with more details?
I think the key problem here is that Dymola prints Error although it can recover from the problem. That is confusing, and will be improved.
I build a model of solar power plant with the Rankine cycle in Dymola, even though the initialization works fine, but at the time of 2840s, there is a failure to solve the nonlinear equations which leads the simulation to stop.
As shown in the following screenshot, Dymola recommends giving better start values, but it doesn't make any sense, because the failure happens during the simulation instead of initialization. And with better start values, the situation doesn't improve at all.
My question is :
How should I deal with the failure to solve nonlinear equations during simulation?
The error message indicates that the solver was not able to find a solution to a nonlinear system of equations in your model. This could mean either that there is no solution to the system or just that the solver is not able to find it.
The first easy steps would be to try a lower tolerance in simulation settings. And to use another solver that might suit better for your problem. Dassl can handle nonlinear systems quite well. If these steps won't work it might be that there just isn't a solution to your problem and you made a wrong assumption or accidentially have a wrong parameter somewhere.
I have the circuit in this figure:
I get the following error: Initial conditions solve failed to converge. Nonlinear solver: Linear Algebra error. Failed to solve using iteration matrix. The model may not give enough information to make it possible to solve for values of some of its variables. Specific advice is given below.
all components and nodal across variables involved Tie variable x to a definite value, for example by connecting an appropriate domain reference block.
I have looked at the other questions on this on MATLAB answers (did not see any on here) and these solutions did not work:
Changing the S-PS block to filter input.
One question was missing ground but I have that.
Any idea what is wrong?
Hi I had the same problem and I managed to solve mine.
I have a Solve Configuration block in the model.
I was able to run my model initially but I ran into the LA convergence issue when I modified my model.
Once I increased the Nonlinear iterations count the solver managed to complete.