Dear all,
with the aim to simulate a three-dimensional fully developed turbulent channel flow, I am starting with a simple laminar 2D case.
The computational domain is a Lx x Ly rectangle (Ly = 2H, Lx = 14H, where H is the channel half-width) that I am simulating with the "multigrid.h" library.
1) As a preliminary check, I set up a simulation with the following boundary conditions (BCs ):
/**
The top and bottom walls are no-slip. */
u.n[top] = dirichlet(0.);
u.t[top] = dirichlet(0.);
u.n[bottom] = dirichlet(0.);
u.t[bottom] = dirichlet(0.);
/**
Velocity inlet on left side*/
u.n[left] = y < my_Ly ? dirichlet(-my_U_0*sq(y-0.5*my_Ly)/sq(0.5*my_Ly)+my_U_0) : dirichlet(0);
u.t[left] = dirichlet(0.);
/**
Pressure outlet on right side*/
p[right]=dirichlet(0.);
u.n[right] = u.n[] > 0 ? neumann(0.): 0;
u.t[right] = neumann(0.);
RESULT:
Results of the simulation are attached as x-velocity component (u_inlet.mp4) and pressure (p_inlet.mp4) videos.
As I am assigning a Poiseuille velocity inflow as left BC, the simulation converges to the (exact?) Poiseuille laminar solution in the whole channel.
2) Now I want to assign periodic boundary conditions on the left side, and insert a constant pressure gradient as a source (acceleration) term in the momentum equation. Therefore, I assign:
/**
The top and bottom walls are no-slip. */
u.n[top] = dirichlet(0.);
u.t[top] = dirichlet(0.);
u.n[bottom] = dirichlet(0.);
u.t[bottom] = dirichlet(0.);
int main() {
dimensions (nx = 7);
periodic(left);
init_grid (1 << my_initlev);
size (my_Lx);
mu = muv;
TOLERANCE = 1e-4;
run();
}
/* The pressure gradient required to drive the flow is introduced as a
source term */
event acceleration (i++) {
face vector av = a;
foreach_face()
av.x[] += my_dpdx;
}
RESULT:
The simulation fails before the first iteration with the following error message attached (out_fail).
What I found strange is that, if I remove the acceleration event, the simulation runs fine and converges to the solution attached as u_periodic.mp4 and p_periodic.mp4. What happens in this case is that the mass flow rate goes to zero, I think because there is no pressure gradient able to sustain the flow and BCs are periodic.
Therefore, my question is: is there any "physical" and/or "numerical" incompatibility in assigning a constant acceleration along a spatial direction where period BCs are imposed?
I attach also two versions of my code:
1) working.c --> periodic BCs with no pressure gradient
2) not_working.c --> same as working.c but with a constant pressure gradient assigned.
Thank you in advance for your help.
Cheers,
Alessandro