- edited description
Assembling of Navier-Stokes gradient form segfaults
I came across this curious issue while playing with NavierStokes, and I can't explain it to myself.
The following code segfaults at the last instruction on my debian testing, dolfin 1.4.0 from repos
V = VectorElement("CG", triangle, 2)
Q = FiniteElement("CG", triangle, 1)
u = TrialFunction(V)
v = TestFunction(V)
p = TrialFunction(Q)
q = TestFunction(Q)
b = -q*div(u)*dx
g = -p*div(v)*dx
forms = [b,g]
#include <dolfin.h>
#ifdef USING_MSHR
#include <mshr.h>
#endif
#include "NavierStokesYosida.h"
using namespace dolfin;
int main(int argc, char *argv[])
{
int resolution = 50;
#ifndef USING_MSHR
/*
* create mesh legacy version
*/
Rectangle cavity(0,0,1,1);
Mesh mesh(cavity,resolution);
#else
/*
* create mesh mshr version
*/
mshr::Rectangle cavity(Point(0,0,0),Point(1,1,0));
Mesh mesh;
mshr::generate(mesh,cavity,resolution);
#endif
NavierStokesYosida::Form_g::TestSpace V(mesh);
NavierStokesYosida::Form_b::TestSpace Q(mesh);
NavierStokesYosida::Form_b b(V,Q);
NavierStokesYosida::Form_g g(Q,V);
PETScMatrix B;
PETScMatrix G;
assemble(B,b);
assemble(G,g);
}
What's most puzzling, it crashes when assembling G, but not B, which is very similar.
I attach main.cpp, ufl file and CMakeLists.txt. There's code for both meshing with mshr and legacy meshing.
Comments (9)
-
Account Deleted reporter -
Account Deleted reporter Also, it seems to work just fine in python
from dolfin import * mesh = UnitSquareMesh(32,32) V = VectorFunctionSpace(mesh,"Lagrange",2) Q = FunctionSpace(mesh,"Lagrange",1) u = TrialFunction(V) v = TestFunction(V) p = TrialFunction(Q) q = TestFunction(Q) assemble(-p*div(v)*dx) assemble(-q*div(u)*dx)
-
- changed milestone to 1.6
-
@massimiliano_leoni, what FFC command do you use? I can't reproduce it with
ffc -ldolfin -O NavierStokesYosida.ufl
on my build of FEniCS 1.4.0 and without
-DUSING_MSHR
-
Account Deleted reporter - attached backtrace
The very same! I just tried again and I can still reproduce it on my Debian testing, so can my other computer on Linux Mint [same repos as Ubuntu, I guess] and so can the computer of my department I have access to, which runs some old Red Hat Linux and where fenics is compiled by hand and made available through the module system.
I attach the full backtrace from my Debian testing,
-
@massimiliano_leoni does it work on fenics 1.5?
-
Account Deleted reporter @martinal I just tried it and it seems to be working on 1.5.0 with mshr. Apologies for forgetting to check and report!
-
- changed status to resolved
Works in 1.5.
-
- removed milestone
Removing milestone: 1.6 (automated comment)
- Log in to comment