Hello,
I am trying to simulate the Incompressible Navier-Stokes equations in a cylinder, but after a couple of steps inside the loop, I am getting the following error:
** Error: Unable to solve linear system using PETSc Krylov solver.**
** Reason: Solution failed to converge in 0 iterations (PETSc reason DIVERGED_NANORINF, residual norm ||r|| = inf).
** Where: This error was encountered inside PETScKrylovSolver.cpp.**
** Process: unknown
** DOLFIN version: 1.4.0
** Git changeset: unknown
My code is practically the same as in the demo that FEniCS offers (demo_navier-stokes.py), the only thing I changed was the mesh and boundary conditions as follows:
class Around(SubDomain):
def inside(self, x, on_boundary):
return -1 <= x[2] <= 1 and on_boundary
class Outflow(SubDomain):
def inside(self, x, on_boundary):
return near(x[2], 1.0) and on_boundary
class Inflow(SubDomain):
def inside(self, x, on_boundary):
return near(x[2], -1.0) and on_boundary
#Mesh from FEniCS:
if not has_cgal():
print "DOLFIN must be compiled with CGAL to generate the mesh."
exit(0)
cyl = Cone(Point(0, 0, -1), Point(0, 0, 1), 0.5715, 0.5715) #Cylinder
g3d = cyl
mesh = Mesh(g3d, 32)
# Create mesh functions over the cell facets
sub_domains = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
# Mark all facets as sub domain 0
sub_domains.set_all(0)
# Mark Around as sub domain 1
around = Around()
around.mark(sub_domains, 1)
# Mark Inflow as sub domain 2
inflow = Inflow()
inflow.mark(sub_domains, 2)
# Mark Outflow as sub domain 3
outflow = Outflow()
outflow.mark(sub_domains, 3)
# Define pressure boundary conditions
p_in = Constant(10.0) #Inflow value of pressure
p_out=Constant(0.0) #Outflow value of pressure
# Define velocity boundary conditions
noslip = Constant((0, 0, 0)) # -1 < z < 1
u_in = Constant((0, 0, 1)) #Inflow value of velocity
# Define boundary conditions
bc1 = DirichletBC(V, noslip, sub_domains, 1)
bc2 = DirichletBC(V, u_in, sub_domains, 2)
bc3 = DirichletBC(Q, p_in, sub_domains, 2)
bc4 = DirichletBC(Q, p_out, sub_domains, 3)
bcu = [bc1, bc2]
bcp = [bc3, bc4]
Does anybody can help me in finding the error?
Thank you very much in advance!