Hi all,
I'm using the FEniCS to simulate the flow past a cylinder in the 2-D channel. The geometry and the mesh are plotted in the following picture. The length is 800 and the height is 200.
The flow is driven by a constant pressure at the inlet, where the pressure = 1. The pressure at the outlet is zero. Furthermore, the non-slip boundary conditions are adopted with regards to the two parallel walls and cylinder surface.
My code is from the modification of the demo in https://fenicsproject.org/documentation/dolfin/2016.1.0/python/demo/documented/navier-stokes/python/documentation.html. Only two pieces of code are different.
Mesh generation:
from mshr import *
# Mesh generation
r = Rectangle(Point(0, 0), Point(length, height))
c = Circle(Point(0.2 * length, 0.5 * height), radius)
g = r - c
mesh = generate_mesh(g, 40)
Boundary definition:
# Define constant boundary condition
p_in = Constant(1)
p_out = Constant(0)
# Define boundary conditions
nonslip = DirichletBC(V, (0, 0), "on_boundary && \
(x[0] > 1 + DOLFIN_EPS && x[0] < 800 - DOLFIN_EPS)")
p_inflow = DirichletBC(Q, p_in, "x[0] <= 1 + DOLFIN_EPS")
outflow = DirichletBC(Q, p_out, "x[0] >= 800 - DOLFIN_EPS")
bcu = [nonslip]
bcp = [p_inflow, outflow]
It is expected to show the well-known vortex shedding flow. However, I only find the velocity goes larger and larger as the simulation goes on. Could someone give me some advises? Thank you in advance.
=======================================================================
October 31
Notice that the though the velocity is growing larger, it is actually very small (10^{-6}). Then I found that when I assigned an initial value for u_0, which is poiseuille and of magnitude 0.1, the velocity no longer kept growing larger. Then I added an inlet boundary condition on velocity and at the same time deleted the inlet pressure boundary condition. The result is quite unphysical---the pressure, in the domain except for the outlet, is negative.
So my new question is how to define the boundary condition and initial function properly? Are both the non-zero conditions on pressure and velocity necessary? Or is there any problems with my code?
Thank you so much.