danieljprice / phantom

Phantom Smoothed Particle Hydrodynamics and Magnetohydrodynamics code
https://phantomsph.github.io
Other
110 stars 246 forks source link

Velocity not converged fatal error #590

Open teogeo1996 opened 2 months ago

teogeo1996 commented 2 months ago

Whilst using global time steps to try and examine an issue arising from individual tilmestep simulations that caused the tilmestep to reduce and caused Fatal errors, I discovered something. In mid simulations, as the density increases in colliding flows, the velocity does not converge which throws two errors. Error 1: fatal error velocities not converged. Error 2 dtc:0 Since tilmestep goes to zero, since err-> +00. I can see that in both cases, the iterations of velocity cause the error to grow until errmax=infinity. I have tried reducing the Courant and force parameters to limit maximum tilmestep allowed (as well as dtmax) and increase tree accuracy (from 0.5 -> 0.1). This sometimes works but still a lot of my simulations throw this error. Is there a work around this? I think that this is what causes individual tilmestep simulations to crush as well and this is an issue located primarily at MHD simulations.

danieljprice commented 2 months ago

a simple fix here is to switch off the velocity iterations. If you set the tolv > 1e2 then it just won't try to do these at all.

The code does try to adjust the timestep when tolv causes iterations, because taking a velocity iteration is as expensive as taking a smaller timestep, so one might as well take a smaller timestep to avoid doing iterations. But this timestep adjustment could definitely send dt to zero if things were going wrong

Often this kind of thing is a symptom of something else being wrong, like div B being out of control?

teogeo1996 commented 2 months ago

That is indeed true. This happens at a very small very high density region of a collision front that is going to form a sink. The divB there is large, no matter what over clean factor you choose to use. I have deactivated the tolv and it works, but I just wanted to double check that there is no underlying bad behaviour at the code at this part. Thank you for your response.