Thanks for the suggestion ¡ª increasing rtol? is truly helpful.
This model seems to struggle when dH/dt is near zero, causing oscillations in all conditional terms. Sometimes it converges, sometimes it doesn't.
Three ways to improve it:
-
Increase delay time (tau): Helps stability, but too large tau introduces more phase shift between B and H,which increases B-H loop area. At an input frequency of f = 50 Hz, using tau?= 300 ns still gives acceptable results, but if the frequency increases, tau must be reduced accordingly.
-
Reduce max timestep: Slower simulation, but improves convergence near dH/dt ¡Ö 0. Dropping it from 1e-6 to 1e-7 helped. It seems that better numerical resolution earlier in the simulation helps the solver predict the behavior more accurately at those critical points.
-
Increase rtol: Improves convergence but may distort waveforms. But combining this with a smaller timestep can balance accuracy. rtol = 0.005 worked better than the default rtol=0.001.
At this point, I haven¡¯t found a way to eliminate the oscillations, but I can improve both convergence and accuracy by balancing the three strategies above. I¡¯ll continue experimenting to see whether it's possible to reduce the oscillation by improving the inverse Jiles-Atherton algorithm itself.