TransWikia.com

NDSolve is finding a stiff system very quickly trying to solve a large set of differential equations

Mathematica Asked by Seth Price on March 19, 2021

I’m a physics PhD student solving lubrication equations (non-linear PDEs) related to the evaporation of binary droplets in a cylindrical pixel in order to simulate the shape evolution. So I split the system into N ODEs, each representing the height evolution (dh/dt) at point i, write as finite differences, and solve simultaneously using NDSolve. For single-liquid droplets this works perfectly, the droplet evaporates cleanly.

However for binary droplets I include N additional ODEs for the composition fraction evolution (dX/dt) at each point. This also adds a new term (marangoni stress) to the dh/dt equations. Immediately NDSolve says:

At t == 0.00029140763302667777`, step size is effectively zero;
singularity or stiff system suspected.

I plot the droplet height at this t-value and it shows a narrow spike at the origin (clearly exploding, hence the stiffness); plotting the composition shows a narrow plummet at the origin (also exploding, just negative. Also, the physics obviously shouldn’t permit the composition fraction to be below 0).

Finally, both sets of equations have terms depending on dX/dr, the composition gradient. If this is set to zero and I also set the evaporation interaction to zero (meaning the two liquids evaporate at the same rate and there can be no X gradient) there should be no change in X anywhere and it should reduce to the single liquid case (dX/dt = 0 and dh/dt no longer depends on X). However, the procedure is introducing some small gradient in X nonetheless, which explodes and causes the same numerical instability.

My question is this: is there anything about NDSolve that might be causing this? I’ve been over the equations and discretisation a hundred times and am sure it’s correct. I’ve also looked into the documentation of NDSolve, but didn’t find anything that helps me. Could it be introducing a small numerical error in the composition gradient?

I can post an MRE code below, but it’s pretty dense and obviously written in mathematica code (doesn’t transfer to the real world well…) so I don’t know how much it’d help. Anyway thank you for reading this!

Edit: Here is a link to a Google drive containing the MRE.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP