Problems with 1D hydrodynamic IVP

49 views
Skip to first unread message

Varsha Felsy

unread,
Aug 11, 2025, 7:19:48 AMAug 11
to Dedalus Users
Hi everyone, 

 I am running a 1D non-adiabatic HD simulation with periodic boundary conditions as an IVP to study thermal instability and formation of condensation in a uniform infinite coronal plasma. After some initial stability issues, I found a combination that lets the code run without crashing:- Timestepper: RK222, Initial timestep: 2e-5. I have tried different timesteps and timesteppers, but this is the one where I was able to run the code without crashing. This setup works for a while, but midway through the simulation, the system develops noise/scales, which then stayed through the rest of the run. To address this, I tried adding artificial diffusive terms following the Orszag-Tang vortex example from the website (https://github.com/DedalusProject/methods_paper_examples/tree/master/orszag_tang_vortex). Unfortunately, tweaking the coefficients didn’t help — the noise remains. 

Additionally, I noticed that the condensation structures continue to grow indefinitely, and I’m unsure if that’s expected behavior or a sign of a modeling error. I suspect it may be related to how I implemented the heating, cooling, and conduction terms, which depend on temperature. These are updated inside the main loop like this: 
kappa_T['g'] = kappa(T) 
Q_T['g'] = Q(T)

Lastly, I found that increasing the resolution (e.g. N > 2100) causes the simulation to crash, even with small timesteps. I am not entirely sure whether I have setup the problem right, the equations and initial conditions are correct but the way I am adding the heating terms might be the problem , is there any way to improve the code? Any suggestions or insights would be very much appreciated. I’ve attached the code and sample results for reference. 
Thanks in advance 

Best regards, 
Varsha
contourT_.png
non_ad_dif.py
simu_process.py
variables_ .mp4

Keaton Burns

unread,
Aug 11, 2025, 8:24:08 AMAug 11
to dedalu...@googlegroups.com
Hi Varsha,

This looks quite complicated, but two things that jump out to me are that:

  1. The videos show substantial grid-scale noise, which are likely triggered by some of the non-smooth terms in your equations (I see lots of “np.where” statements, for instance). For good performance in a spectral method, you likely either need to smooth every jump/switch, or increase the diffusion substantially.
  2. If you’re updating coefficients in the main loop, you will lose pretty much all the benefits of the high-order timestepping schemes, and things will basically revert to first-order, since these quantities are not being updated during the substages within each timestep. So sticking with RK222 or RK111 is probably best for equations like this.

Best,
-Keaton


--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dedalus-users/4e28b2da-51fa-48a9-9122-1175c7882d45n%40googlegroups.com.

Varsha Felsy

unread,
Aug 14, 2025, 1:52:09 PMAug 14
to Dedalus Users

Hi Keaton,

Thanks for the quick reply (and sorry for the delay).

I implemented a smooth transition for the temperature-dependent coefficients (replacing np.where with a tanh switch), and I also scanned diffusion up to 1e-2. Neither change reduced the grid-scale noise; in fact higher diffusion (1e-2, 1e-3) made the simulation crash earlier. I even tried Bayesian optimization over the dissipation parameters, and the only stable region was around 1e-4, which is what I started with. I’ve attached the updated code. I am really confused at this point. Hope you can help me.

Regards,
Varsha
non_ad_dif.py

Keaton Burns

unread,
Aug 18, 2025, 3:01:24 PMAug 18
to dedalu...@googlegroups.com
Hi Varsha,

I’d try simplifying the model as much as possible to get something that runs stably as expected, even if that means going all the way down to something like viscous burgers equation, and then slowly add back physics/complexity to see where things start to break.  Otherwise its pretty much impossible, especially for someone who didn’t write the model, to debug everything all at once and check for sign or other errors, etc.

Best,
-Keaton


Varsha Felsy

unread,
Aug 20, 2025, 4:57:45 AMAug 20
to dedalu...@googlegroups.com

Hi Keaton,

Thanks a lot for the suggestion. That sounds like a good plan, I’ll try simplifying the model. 

Really appreciate your help.

Regards,
Varsha


Reply all
Reply to author
Forward
0 new messages