Periodic boundary conditions and conditional terms

248 views
Skip to first unread message

Sihe Chen

unread,
Nov 7, 2023, 9:56:16 AM11/7/23
to Dedalus Users
I am trying to setup a 2D square computational domain that is doubly periodic. Do I have to impose the tau method in this case? I could not find a similar case in the tutorial.
Also, I want to put in a conditional term in the equation. By conditional term I mean the term that takes effect in some conditions only, e.g. only some distance from the boundaries.
Many thanks in advance for the help :)

Guangpu Zhu

unread,
Nov 7, 2023, 10:02:23 AM11/7/23
to dedalu...@googlegroups.com
Hi, Sihe,

     You don't need to impose the tau method. 

Best,





--
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/71b29ea2-ceff-4957-bd0f-31f23adc6e52n%40googlegroups.com.

Sihe Chen

unread,
Nov 7, 2023, 11:55:07 AM11/7/23
to Dedalus Users
Thanks Guangpu. Any suggestions on the conditional terms? Is there something functions like Heaviside step function? I could not find it in the documentation...

Guangpu Zhu

unread,
Nov 7, 2023, 8:23:20 PM11/7/23
to dedalu...@googlegroups.com
Hi, Shihe,

   I suggest you read the tutorial carefully, you will find the answer.





MANISH KUMAR

unread,
Dec 5, 2023, 1:56:14 PM12/5/23
to Dedalus Users
Hello Dedalus Users, 
 I am trying to implement double periodic boundary conditions in Dedalus v3 using Fourier modes in both the x and y directions for a 2D flow. The following is the portion of the code:

~~~~~~~~~

problem = d3.LBVP([u, p, tau_p], namespace=locals())

problem.add_equation("-grad(p) + lap(u) = f", condition = "(nx != 0) or (ny != 0)")

problem.add_equation("u = 0", condition = "(nx == 0) and (ny == 0)")

problem.add_equation("div(u) + tau_p = 0")

problem.add_equation("integ(p) = 0") # Pressure gauge

~~~~~~~~~~

Without any condition on the momentum equation, it gives the error, "RuntimeError: Factor is exactly singular".

When I apply the condition shown in the code, it gives the error, "NameError: name 'ny' is not defined. Did you mean: 'nx'?".

I wonder if anyone has faced a similar problem.

Thanks in advance for any help.

Best regards,

Manish Kumar


Calum Skene

unread,
Dec 5, 2023, 2:48:42 PM12/5/23
to Dedalus Users
Hi Manish,
You can avoid using condition altogether by introducing another tau term, tau_u created in the same way as tau_p. Something like

problem = d3.LBVP([u, p, tau_p, tau_u], namespace=locals())

problem.add_equation("-grad(p) + lap(u) + tau_u = f")

problem.add_equation(integ(u) = 0")

problem.add_equation("div(u) + tau_p = 0")

problem.add_equation("integ(p) = 0") # Pressure gauge

should work. The tau_u term absorbs the nx=ny=0 average, and introduces another degree of freedom which allows you to specify integ(u)=0.

Best,
Calum

MANISH KUMAR

unread,
Dec 5, 2023, 3:23:57 PM12/5/23
to Dedalus Users
Thanks, Calum. Yes, It works.

Best regards
Manish Kumar

Reply all
Reply to author
Forward
0 new messages