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