#5692 closed defect (invalid)
segfault after "Invalid root".
Reported by: | Owned by: | Lennart Ochel | |
---|---|---|---|
Priority: | high | Milestone: | 1.16.0 |
Component: | Run-time | Version: | v.1.15.0-dev |
Keywords: | Cc: |
Description
I have a simulation which fails due to an 'Invalid root' in one of my equations (specifically, trying to solve T(h) for the properties of an incompressible substance, through calls to omc_SolarTherm_Media_SolidParticles_CarboHSPutilities_Th).
The output I get from my test script is as follows. We've previously reported the warning messages about the floating-point constant, so that's a different issue. The issue here is something is causing the model executable to segfault here, when it should really just be exiting with an error code (or continuing, even).
Something is apparently causing the solver to segfault from the 'solveNewton' function in libSimulationRuntimeC.so. Surely that isn't intended?
The actually command-line being run here (after compilation of the model) is
./PhysicalParticleSystem -override startTime=0.0,stopTime=31536000.0,stepSize=300.0 -s dassl -lv -LOG_SUCCESS,-stdout -f PhysicalParticleSystem_init.xml -r PhysicalParticleSystem_res.mat -nls newton
The version is OpenModelica 1.15.0~dev-9-g34505da.
And here is the output, including some extra output from the compilation process, wrapper script, etc.:
<env>john@thunder:~/src/solartherm/tests$ python TestPhysicalParticleSystem.py Notification: Automatically loaded package Complex 3.2.2 due to uses annotation. Notification: Automatically loaded package ModelicaServices 3.2.2 due to uses annotation. [/usr/lib/omlibrary/Modelica 3.2.2/Blocks/Sources.mo:2346:7-2347:66:readonly] Warning: Unused input variable tableAvailable in function .Modelica.Blocks.Sources.CombiTimeTable$data$table.getDerTableValue. [/usr/lib/omlibrary/Modelica 3.2.2/Blocks/Sources.mo:2312:7-2313:66:readonly] Warning: Unused input variable tableAvailable in function .Modelica.Blocks.Sources.CombiTimeTable$data$table.getTableValue. [/usr/lib/omlibrary/Modelica 3.2.2/Blocks/Sources.mo:2358:7-2359:66:readonly] Warning: Unused input variable tableAvailable in function .Modelica.Blocks.Sources.CombiTimeTable$data$table.getTableTimeTmin. [/usr/lib/omlibrary/Modelica 3.2.2/Blocks/Sources.mo:2369:7-2370:66:readonly] Warning: Unused input variable tableAvailable in function .Modelica.Blocks.Sources.CombiTimeTable$data$table.getTableTimeTmax. PhysicalParticleSystem.c:850:98: warning: magnitude of floating-point constant too large for type 'double'; maximum is 1.7976931348623157E+308 [-Wliteral-range] tmp11 = Less(data->localData[0]->realVars[163] /* data.table.nextTimeEventScaled DISCRETE */,1.797693134862316e+308); ^ PhysicalParticleSystem.c:851:168: warning: magnitude of floating-point constant too large for type 'double'; maximum is 1.7976931348623157E+308 [-Wliteral-range] .../* data.table.nextTimeEvent DISCRETE */ = (tmp11?data->localData[0]->realVars[163] /* data.table.nextTimeEventScaled DISCRETE */:1.797693134862316e+308); ^ PhysicalParticleSystem_06inz.c:2121:96: warning: magnitude of floating-point constant too large for type 'double'; maximum is 1.7976931348623157E+308 [-Wliteral-range] tmp50 = Less(data->localData[0]->realVars[163] /* data.table.nextTimeEventScaled DISCRETE */,1.797693134862316e+308); ^ PhysicalParticleSystem_06inz.c:2122:166: warning: magnitude of floating-point constant too large for type 'double'; maximum is 1.7976931348623157E+308 [-Wliteral-range] .../* data.table.nextTimeEvent DISCRETE */ = (tmp50?data->localData[0]->realVars[163] /* data.table.nextTimeEventScaled DISCRETE */:1.797693134862316e+308); ^ 2 warnings generated. 2 warnings generated. /usr/bin/../lib/x86_64-linux-gnu/omc/libModelicaMatIO.a(ModelicaMatIO.o): In function `Mat_VarDelete': (.text+0x1e14): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp' assert | debug | PhysicalParticleSystem_functions.c:488: Invalid root: (-1991.1)^(0.763767) assert | debug | Solving non-linear system 977 failed at time=9040492.36941685. | | | | For more information please use -lv LOG_NLS. Limited backtrace at point of segmentation fault /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7ffbb01af390] /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(solveNewton+0xda)[0x7ffbb1617385] /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(solveNLS+0xb1)[0x7ffbb15f8b05] /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(solve_nonlinear_system+0x307)[0x7ffbb15f9057] ./PhysicalParticleSystem(PhysicalParticleSystem_eqFunction_977+0x7f)[0x41ade3] ./PhysicalParticleSystem(PhysicalParticleSystem_functionDAE+0x496)[0x41d676] /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(updateDiscreteSystem+0x83)[0x7ffbb1605d0b] ./PhysicalParticleSystem(PhysicalParticleSystem_performSimulation+0xcca)[0x41773a] /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(solver_main+0x302)[0x7ffbb160d669] /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(+0x86921)[0x7ffbb1632921] /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(startNonInteractiveSimulation+0x9f4)[0x7ffbb1631cec] /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(_main_SimulationRuntime+0x73)[0x7ffbb1634181] ./PhysicalParticleSystem(main+0x1ac)[0x41e613] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7ffbafdf4830] ./PhysicalParticleSystem(_start+0x29)[0x416999] E ====================================================================== ERROR: test_sched (__main__.TestPhysicalParticleSystem) ---------------------------------------------------------------------- Traceback (most recent call last): File "TestPhysicalParticleSystem.py", line 28, in test_sched sim.simulate(start=0, stop='1y', step='5m',solver='dassl', nls='newton') File "/home/john/.local/lib/python2.7/site-packages/solartherm/simulation.py", line 360, in simulate sp.check_call(['./'+self.model] + sim_args + args) File "/usr/lib/python2.7/subprocess.py", line 541, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '['./PhysicalParticleSystem', '-override', 'startTime=0.0,stopTime=31536000.0,stepSize=300.0', '-s', 'dassl', '-lv', '-LOG_SUCCESS,-stdout', '-f', 'PhysicalParticleSystem_init.xml', '-r', 'PhysicalParticleSystem_res.mat', '-nls', 'newton']' returned non-zero exit status -11 ---------------------------------------------------------------------- Ran 1 test in 5.896s FAILED (errors=1)
Change History (6)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
First comment, I would suggest you to upgrade the uses annotations of your library to MSL 3.2.3 and related libraries. There's lots of bugfixes there compared with 3.2.2, and it's expected to be fully backwards compatible without any conversion needed.
I'm not sure if that solves your problem.
comment:3 by , 5 years ago
It would also be good if you locate equation 977 with the declarative debugger (click on the blue bug icon), expand all the involved equations, and post a .png image of that. Than we can try better to figure out what could go wrong in the solution of that nonlinear system.
Also, are the values of receiver.h_out that we see before the crash reasonable or not?
comment:5 by , 5 years ago
Milestone: | Future → NeedsInput |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Closing this until there's enough to reproduce or figure out what goes wrong. I tried a small model to trigger the same root finding error, but it does not crash:
model M function f input Real r; input Real t; output Real o; algorithm o := 1*r; o := o*r; o := if t > 0.1 then (-2.1) ^ 0.76 else 0.5*o; end f; Real r; equation r = f(r, time); end M;
comment:6 by , 5 years ago
Milestone: | NeedsInput → 1.16.0 |
---|
Here is a little bit more output, when LOG_NLS is turned on, as suggested in the output: