Hi,
I am new to Dedalus and I think that it is a great tool! I wanted to ask the list since I am trying a very basic flow configuration, but I have a few questions about my implementation:
I am trying to simulate a 2D plane channel flow in primitive variables. It is possible to have Poiseuille flow (and equally pipe flow) considering a fixed mass flux (or bulk velocity). In most codes such as NEK5000, (
https://github.com/Nek5000/Nek5000) this condition is enforced in a correction.
Since in Dedalus the equations are introduced in symbolic form. The way I have implemented this can be found below. The configuration works and the mass flux is indeed kept constant, but I feel that it does not really fit the way Dedalus works.
In particular regarding the variable 'Fdp', the additional eq.
problem.add_equation("Fdp = (integ(u,'y')*0.5-cmflux)/timestep")
mixes the symbolic formulation in Dedalus with the numerical considerations of the body force.
Are you aware of any way of implementing this better? I have tested adding a constraint of the form
problem.add_equation("(integ(u,'y')*0.5-cmflux)=0")
but I get problems regarding the amount of equations/bc.
Any help is appreciated,
Best,
Miguel
# ----------------- SET UP ------------------
# Parameters
Lx, Ly = (2.0*np.pi, 2.0)
nx, ny = (128, 128)
Re = 6000.0
timestep = 0.01
# Constant mass flux
cmflux = 2/3
# Create bases and domain
start_init_time = time.time()
# Basis
x_basis = de.Fourier('x', nx, interval=(0, Lx), dealias=3/2)
y_basis = de.Chebyshev('y', ny, interval=(-Ly/2, Ly/2), dealias=3/2)
domain = de.Domain([x_basis, y_basis], grid_dtype=np.float64)
problem = de.IVP(domain, variables=['p','u','v','uy','vy','Fdp'], time='t')
problem.parameters['Re'] = Re
problem.parameters['cmflux'] = cmflux
problem.parameters['timestep'] = timestep
problem.add_equation('dt(u) + dx(p) - 1/Re * Lap(u, uy) + Fdp = - Adv(u, uy)
problem.add_equation('dt(v) + dy(p) - 1/Re * Lap(v, vy) = - Adv(v, vy)
problem.add_equation("Fdp = (integ(u,'y')*0.5-cmflux)/timestep")
problem.add_bc('dx(u) + vy = 0')
problem.add_equation('uy - dy(u) = 0')
problem.add_equation('vy - dy(v) = 0')
problem.add_bc('left(u) = 0')
problem.add_bc('right(u) = 0')
problem.add_bc('left(v) = 0')
problem.add_bc('right(v) = 0', condition='(nx != 0)')
problem.add_bc('left(p) = 0', condition='(nx == 0)')
solver = problem.build_solver(de.timesteppers.RK443)
solver.stop_wall_time = np.inf
solver.stop_iteration = np.inf
solver.stop_sim_time = 100.0
initial_dt = 0.01
logger.info('Solver built')