Unable to put a condition on the ny==0 mode

11 views
Skip to first unread message

AKASH DUTTA

unread,
Sep 4, 2025, 10:31:25 PM (4 days ago) Sep 4
to Dedalus Users
Hi everyone,

I'm running a simple 2D Navier-Stokes model: an IVP with two variables, the streamfunction p and the vorticity q. One equation is for the advection of vorticity, and the other relates p and q as lap(p) + q = 0.

I need to put a condition on the vorticity inversion (the second equation) so that it doesn't apply to the (nx,ny)=(0,0) mode. However, when I try:

problem.add_equation("lap(p)+q=0", condition="(nx!=0) or (ny!=0)")
and 
problem.add_equation("p=0", condition="(nx==0) and (ny==0)")

I'm getting an error message claiming that ny is not defined.

I've seen the exact same syntax used for the exact same situation on previous exchanges on this group. Is this a new issue?

As a workaround, I was considering adding the equation "integ(p)=0", but I'm not sure how that's implemented in the back end. Is it going to do a long, unnecessary computation for all the other modes, or does Dedalus "know" that Fourier modes integrate out to 0, and compute this condition only for the constant mode? (Worth saying here that the spectral basis is Fourier x Fourier).

Do let me know!
Akash

Keaton Burns

unread,
Sep 5, 2025, 2:18:30 AM (4 days ago) Sep 5
to dedalu...@googlegroups.com
Hi Akash,

Please see the documentation here for information about imposing gauge constraints like this in v3. In short, you can either add integ(p) to the divergence constraint, so the mean mode only sets the pressure gauge, or you add a constant tau term / Lagrange multiplier to “remove” the mean mode of the equation and add the other constraint separately.

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/c4368154-a8aa-467d-8c7f-3208f7eb33d5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages