This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Incompressible Navier-Stokes equations with OpenMP threads

+1 vote

Hi,

I can't solve "Incompressible Navier-Stokes equations" even with direct lu solver and PETSc linear algebra backend with OpenMP threads.

parameters["linear_algebra_backend"] = "PETSc"
parameters["num_threads"] = 2;
solve(A1, u1.vector(), b1, "lu")

Link to the code:
http://fenicsproject.org/documentation/dolfin/1.5.0/cpp/demo/documented/navier-stokes/cpp/documentation.html

If I set another linear algebra backend, like uBLAS, I solve the problem easily.

parameters["linear_algebra_backend"] = "uBLAS";

Also I easily solve the problem without OpenMP, that is:

 parameters["num_threads"] = 1;

or

 parameters["num_threads"] = 0;

But how about PETSc?
How to solve the problem with OpenMP threads?

Error log below

Elapsed time: 1.19209e-06 (Build mesh number mesh entities)
Elapsed time: 0.000154972 (compute entities dim = 1)
Elapsed time: 0.000236988 (Build mesh number mesh entities)
Elapsed time: 0.000385046 (Init dofmap from UFC dofmap)
Elapsed time: 5.00679e-05 (SCOTCH graph ordering)
Elapsed time: 0.000876904 (Init dofmap)
Elapsed time: 0 (Build mesh number mesh entities)
Elapsed time: 0.000184059 (Init dofmap from UFC dofmap)
Elapsed time: 2.28882e-05 (SCOTCH graph ordering)
Elapsed time: 0.000387907 (Init dofmap)
DEBUG: [at /usr/lib/python2.7/dist-packages/dolfin/functions/expression.py:808 in _auto_select_element_from_shape()]
DEBUG: Automatic selection of expression element: <CG? on a None>
Initializing PETSc (ignoring command-line arguments).
Elapsed time: 7.08103e-05 (Init PETSc)
Elapsed time: 1.5974e-05 (Apply (PETScVector))
Elapsed time: 0.000545025 (Init dof vector)
Elapsed time: 4.05312e-06 (Apply (PETScVector))
Elapsed time: 5.31673e-05 (Init dof vector)
Elapsed time: 4.05312e-06 (Apply (PETScVector))
Elapsed time: 8.70228e-05 (Init dof vector)
Matrix of size 1010 x 1010 has 21988 (2.15547%) nonzero entries.
Elapsed time: 0.00104809 (Build sparsity)
Elapsed time: 9.20296e-05 (Init tensor)
Elapsed time: 1.19209e-06 (Delete sparsity)
*** Warning: Form::coloring does not properly consider form type.
Coloring mesh.
Requesting connectivity 0 - 2.
Requesting connectivity 2 - 0.
Computing mesh connectivity 0 - 2 from transpose.
Elapsed time: 9.5129e-05 (compute connectivity 0 - 2)
Elapsed time: 6.91414e-06 (Boost graph coloring)
Elapsed time: 8.79765e-05 (Boost graph coloring (from dolfin::Graph))
Elapsed time: 0.00495791 (Assemble cells)
Elapsed time: 9.10759e-05 (Apply (PETScMatrix))
Matrix of size 137 x 137 has 873 (4.65129%) nonzero entries.
Elapsed time: 0.000127077 (Build sparsity)
Elapsed time: 8.39233e-05 (Init tensor)
Elapsed time: 9.53674e-07 (Delete sparsity)
*** Warning: Form::coloring does not properly consider form type.
DEBUG: [at /build/buildd/dolfin-1.4.0+dfsg/dolfin/mesh/Mesh.cpp:405 in color()]
DEBUG: Mesh has already been colored, not coloring again.
Elapsed time: 0.000242949 (Assemble cells)
Elapsed time: 1.00136e-05 (Apply (PETScMatrix))
Matrix of size 1010 x 1010 has 21988 (2.15547%) nonzero entries.
Elapsed time: 0.000795126 (Build sparsity)
Elapsed time: 0.000128984 (Init tensor)
Elapsed time: 0 (Delete sparsity)
*** Warning: Form::coloring does not properly consider form type.
DEBUG: [at /build/buildd/dolfin-1.4.0+dfsg/dolfin/mesh/Mesh.cpp:405 in color()]
DEBUG: Mesh has already been colored, not coloring again.
Elapsed time: 0.00190401 (Assemble cells)
Elapsed time: 4.48227e-05 (Apply (PETScMatrix))
Computing tentative velocity
  Elapsed time: 3.8147e-06 (Build sparsity)
  Elapsed time: 1.00136e-05 (Apply (PETScVector))
  Elapsed time: 0.000279903 (Init tensor)
  Elapsed time: 9.53674e-07 (Delete sparsity)
  Elapsed time: 3.29018e-05 (Apply (PETScVector))
  *** Warning: Form::coloring does not properly consider form type.
  DEBUG: [at /build/buildd/dolfin-1.4.0+dfsg/dolfin/mesh/Mesh.cpp:405 in color()]
  DEBUG: Mesh has already been colored, not coloring again.
  Elapsed time: 0.00114393 (Assemble cells)
  Elapsed time: 7.15256e-06 (Apply (PETScVector))
  Computing sub domain markers for sub domain 0.
  Requesting connectivity 1 - 2.
  Requesting connectivity 2 - 1.
  Computing mesh connectivity 1 - 2 from transpose.
  Elapsed time: 9.39369e-05 (compute connectivity 1 - 2)
  Elapsed time: 0.000261068 (DirichletBC init facets)
  Elapsed time: 0.000342131 (DirichletBC compute bc)
  Applying boundary conditions to linear system.
  Elapsed time: 5.96046e-06 (Apply (PETScVector))
  Elapsed time: 2.40803e-05 (Apply (PETScMatrix))
  Elapsed time: 0.000624895 (DirichletBC apply)
  Solving linear system of size 1010 x 1010 (PETSc LU solver, (null)).
  Elapsed time: 0.00447893 (PETSc LU solver)
  Elapsed time: 0.00462294 (LU solver)
  Elapsed time: 0.00477695 (Solving linear system)
Computing pressure correction
  Elapsed time: 5.00679e-06 (Build sparsity)
  Elapsed time: 9.05991e-06 (Apply (PETScVector))
  Elapsed time: 0.000113964 (Init tensor)
  Elapsed time: 9.53674e-07 (Delete sparsity)
  Elapsed time: 5.96046e-06 (Apply (PETScVector))
  *** Warning: Form::coloring does not properly consider form type.
  DEBUG: [at /build/buildd/dolfin-1.4.0+dfsg/dolfin/mesh/Mesh.cpp:405 in color()]
  DEBUG: Mesh has already been colored, not coloring again.
*** glibc detected *** python: double free or corruption (fasttop): 0x00000000027a4150 ***
[Finished in 0.4s with exit code -11]

Thanks in advance!

asked Jul 13, 2015 by Maks FEniCS User (2,430 points)
...