PyKROME: wrong solver exit status

39 views
Skip to first unread message

Siddhant Deshmukh

unread,
Jul 25, 2021, 10:57:19 AM7/25/21
to KROMEusers
Hello,
I am running PyKROME for each cell in a density-temperature grid, and I am consistently getting a "ERROR: wrong solver exit status" with the max iter count being exceeded. I believe the solver is unable to converge to a solution within the default number of iterations; is there a way to increase this for the pykrome binding? I have tried the -forceRWORK=3000 flag, but I still get the error. I also tried the -ierr and -useIERR flags, but the program still crashes. I would like to know if I can a) increase the max iterations in the solver and b) if I can 'suppress' the error to be a warning that does not interrupt the program flow (so I can catch and handle it).

Thanks,
Siddhant

Jon Ramsey

unread,
Aug 3, 2021, 9:20:26 AM8/3/21
to Siddhant Deshmukh, KROMEusers
Hi Siddhant,

In my own experience, when KROME doesn't converge because it hits the maximum number of iterations, increasing the number of iterations doesn't fix the problem, it only postpones the error until later. :P

I would suggest that you take a look at your network and the combinations of density/temperature where KROME is failing to converge.
In particular, if there's a discontinuity in the rate of an important reaction at a particular temperature (e.g. because you are switching between two reaction rate expressions at a given temperature and the two expressions don't match up), this is one of things that can prevent KROME from converging (at least in my experience).

That said, more pragmatically, you can include the `-useIERR` flag when you run ./krome, and then the calling signature for pyKROME becomes:
```ierr = ctypes.c_int(0)
   dtl = ctypes.c_double(dt)
   pyk.lib.krome(x, ctypes.byref(Tgas), dtl, ctypes.byref(ierr))
```
Testing on `ierr.value != 0` will then allow you to catch if KROME had some problem (a value other than zero means there was a problem) and handle it how you like.
Invoking `-useIERR` also prevents KROME/pyKROME from crashing in the event of non-convergence.

Hope that helps.

Cheers,
Jon Ramsey


--
You received this message because you are subscribed to the Google Groups "KROMEusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kromeusers+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kromeusers/cfda3d9c-aca1-4941-bddd-f4915f9df704n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages