Inquiry on Setting Specific Boundary Conditions and Creating Sponge Layers in Dedalus

43 views
Skip to first unread message

Juntao Chu

unread,
Jun 24, 2024, 3:15:33 PMJun 24
to dedalu...@googlegroups.com

Dear Dedalus Team,

I am currently working on a simulation project using Dedalus based on Rayleigh-Benard convection and I've encountered a couple of issues where I could use your expert guidance:

  1. Boundary Condition Specification: I need to implement a boundary condition where the first component of a vector field u (u = (u,w)) is linearly related to the z coordinate at x=0. Specifically, I want to set problem.add_equation("u[1](x=0) = 0.25*z") . I am unsure how to properly implement this in Dedalus since my attempts have led to syntax and key errors. Could you guide me on the correct method to set this boundary condition? 

  2. Sponge Layer Implementation: Additionally, I am looking to create a sponge layer on the rightmost 20% of the domain to dampen outflow effects. Could you provide insights or examples on how to correctly implement a sponge layer in this part of the computational domain? I use the equation "problem.add_equation("dt(u) - nu*div(grad_u) + grad(p) - b*ez + lift(tau_u2)  = - u@grad(u) - S*(u-z_linear)")", where S is a piecewise function that varies depending on the spatial location. S['g'] = np.where(x > x_sponge_start, sponge_strength * ((x - x_sponge_start) / (Lx - x_sponge_start)), 0) .

Any examples, documentation references, or code snippets you could provide would be immensely helpful.

Thank you for your time and assistance. I have attached my code for your reference.

Best regards,
Juntao

Simulation_Code_Sponge copy.ipynb

eric.w....@gmail.com

unread,
Jun 25, 2024, 7:50:13 AMJun 25
to Dedalus Users
Hi Juntao,

Some suggestions:

1. Remove the boundary condition at x = 0. This is something you should instead approximate via a sponge layer. Explicit boundary conditions for Fourier bases are unwise.

2. Rewrite the sponge layer from "u-z_linear" to "u-z_linear*ex". The problem is that u is a vector field, and z_linear is a scalar field. The inhomogeneity should be applied to each component, which is achieved by multiplying by the unit horizontal vector field ex.

3. Ideally the boundary conditions at each side of the domain (left/right) will match up with each other, since this should be a periodic simulation.

4. You might also want to smooth the sponge layer field S somewhat. Discontinuous data in spectral codes like Dedalus leads to Gibbs phenomena and other undesirable properties. Putting in a tanh profile where there are several grid points in the transition layer will help. And make sure that the function is periodic too, since it's discretised using a Fourier series.

Hope that helps,
Eric
Reply all
Reply to author
Forward
0 new messages