simple compressible flow

265 views
Skip to first unread message

Michael Jolly

unread,
Mar 15, 2022, 9:21:05 AM3/15/22
to Dedalus Users

 I tried modifying the 2D Rayleigh-Benard example to solve 2D compressible flow (replacing temperature equation with one for density, basically).   The BCs I want are and periodic in x, and no-slip for velocity in z, Neumann for density in z, so the standard RB seemed like it would be close.  Pressure as a function of density is p=rho^gam.  The problem statement
 
problem.add_equation("dt(rho) = -(dx(rho*u) + dz(rho*w))")
problem.add_equation("dt(u) - visc*(dx(dx(u)) + dz(uz)) = -gam*rho**(gam-2)*dx(rho)-(u*dx(u) + w*uz)")
problem.add_equation("dt(w) - visc*(dx(dx(w)) + dz(wz)) = -gam*rho**(gam-2)*rhoz   -(u*dx(w) + w*wz)")
problem.add_equation("rhoz - dz(rho) = 0")
problem.add_equation("uz - dz(u) = 0")
problem.add_equation("wz - dz(w) = 0")
problem.add_bc("left(rhoz) = 0")
problem.add_bc("left(u) = 0")
problem.add_bc("left(w) = 0")
problem.add_bc("right(rhoz) = 0")
problem.add_bc("right(u) = 0")
problem.add_bc("right(w) = 0")
 
gives the error:
 
ValueError: Pencil (0,) has 6 constant equations for 0 constant variables plus 5 differential equations / tau terms.
 
I am guessing there is something missing like these lines from the RB code:
problem.add_bc("right(w) = 0", condition="(nx != 0)")
problem.add_bc("right(p) = 0", condition="(nx == 0)")

Any pointers to resolving this would be appreciated. 

Thanks,

Mike

Keaton Burns

unread,
Mar 15, 2022, 9:28:59 AM3/15/22
to dedalu...@googlegroups.com
Hi Mike,

To impose density boundary conditions, I think you’ll need add density diffusion to the LHS of the first equation.  Otherwise the system is just 4th order (only contains two linear z derivatives of u and w), so should only have 4 boundary conditions (2 each on u and w). Dedalus is reporting 5 because of the “rhoz - dz(rho) = 0” equation, but this should be removed if you don’t include density diffusion.

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/11c181b0-e11a-4b93-b20d-e75c4de30469n%40googlegroups.com.

Daniel Lecoanet

unread,
Mar 15, 2022, 10:24:44 PM3/15/22
to Dedalus Users
Hi,

 Just to add to Keaton’s comment… The mass flux for your equations is equal to the density at the boundary times the normal velocity. But if your BC is zero normal velocity, then the mass flux through your domain is zero, independent of the density at the boundary. Thus, you can determine the density without specifying its value at the boundary.

When I’ve simulated compressible flow in the past, I’ve use the perturbation to the log density and the temperature perturbation as my thermodynamic variables. This allows you to implicitly timestep over sound waves.

Daniel

Reply all
Reply to author
Forward
0 new messages