ComplexFourier vs. RealFourier

42 views
Skip to first unread message

Zach Williams

unread,
Jun 13, 2024, 5:06:23 PMJun 13
to Dedalus Users
Hello Dedalus Community!

A student of mine is doing some work studying convection, and we're using the d3 IVP RBC example script as a starting point. For our purposes, it would be advantageous to set up the domain as ComplexFourier rather than RealFourier for our x-direction (efficiency of the solver is not a concern here, relatively speaking). When we make this change (and change data type to np.complex128), leaving all else the same as the d3 example script, the simulation pretty quickly diverges, reporting max(Re) = nan after about 12 time units. To my (limited) understanding, either of these bases should be acceptable for the periodic direction, but that doesn't seem to be the case. I appreciate any input you can provide!

Thanks so much (and thanks for bearing with two posts in the same day, lots of great Dedalus work happening over here!).

Cheers,
Zach Williams

Keaton Burns

unread,
Jun 13, 2024, 5:27:40 PMJun 13
to dedalu...@googlegroups.com
Hi Zach,

Running Navier-Stokes with complex grid values can be tricky, since the nonlinear terms mix the real and imaginary parts in ways that can prevent the normal nonlinear saturation of linear instabilities. It should be ok, though, if you ensure that fields actually remain real.

In that example, the buoyancy field starts from random noise, which will include imaginary parts if you use complex types. If you set those to zero by doing b['g'].imag = 0  after the initial condition is set, it should be stable for longer. But it may also blow up after long times if noise causes an imaginary solution to creep in there, so you might have to regularly set the imaginary part of all problem variables to zero periodically in the main loop.

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 on the web visit https://groups.google.com/d/msgid/dedalus-users/c69a2b68-b7e4-45cf-8c7c-8db26a8e6d74n%40googlegroups.com.

Zach Williams

unread,
Jun 14, 2024, 9:15:27 AMJun 14
to Dedalus Users
Thanks so much for the quick and informative reply, Keaton! That did the trick.

For any future readers: following Keaton's advice and zeroing out the imaginary part of the initial condition, as well as the imaginary part of all system variables every ten iterations, produces nonlinear time traces that differ from the RealFourier case only in minor fluctuations during the nonlinear state.

Thanks again!
Reply all
Reply to author
Forward
0 new messages