Hi,
I am trying to setup a NonlinearVariationalSolver in c++
My code:
NonlinearVariationalProblem bl_problem(F, u, bcs, J);
NonlinearVariationalSolver solver(bl_problem);
solver.solve();
Unfortunatly i get a segfault when calling solver.solve().
If instead i use
solve( F == 0,u, bcs,J);
Everything works fine.
I am using dolfin 1.2.x from launchpad, compiled with gcc-4.8.
I don't believe this is a bug in dolfin, am I just missing something? (Spent last two days recompiling everything fenics-releated to make sure i used the same versions/compilers).
Thanks in advance for help!
Backtrace:
0x00007ffff7409950 in dolfin::DirichletBC::compute_bc_topological (this=this@entry=0x1138a10, boundary_values=..., data=...) at /home/ennio/projects/fenics/dolfin/src/build/dolfin/fem/DirichletBC.cpp:802
802 _g->restrict(&data.w[0], *_function_space->element(), cell, ufc_cell);
(gdb) bt
#0 0x00007ffff7409950 in dolfin::DirichletBC::compute_bc_topological (this=this@entry=0x1138a10, boundary_values=..., data=...) at /home/ennio/projects/fenics/dolfin/src/build/dolfin/fem/DirichletBC.cpp:802
#1 0x00007ffff740c1a9 in dolfin::DirichletBC::compute_bc (this=this@entry=0x1138a10, boundary_values=..., data=..., method="topological") at /home/ennio/projects/fenics/dolfin/src/build/dolfin/fem/DirichletBC.cpp:750
#2 0x00007ffff740d0cf in dolfin::DirichletBC::apply (this=0x1138a10, A=0x0, b=0x1124210, x=0x1139910) at /home/ennio/projects/fenics/dolfin/src/build/dolfin/fem/DirichletBC.cpp:498
#3 0x00007ffff744b931 in dolfin::NonlinearVariationalSolver::NonlinearDiscreteProblem::F (this=0x1d19830, b=..., x=...) at /home/ennio/projects/fenics/dolfin/src/build/dolfin/fem/NonlinearVariationalSolver.cpp:158
#4 0x00007ffff794a429 in dolfin::NewtonSolver::solve (this=0x1d1bdd0, nonlinear_problem=..., x=...) at /home/ennio/projects/fenics/dolfin/src/build/dolfin/nls/NewtonSolver.cpp:103
#5 0x00007ffff744d7d2 in dolfin::NonlinearVariationalSolver::solve (this=0x7fffffffccb0) at /home/ennio/projects/fenics/dolfin/src/build/dolfin/fem/NonlinearVariationalSolver.cpp:94
#6 0x0000000000419951 in main () at /home/ennio/projects/tesi/main.cpp:118
Valgrind says:
==3718== Invalid read of size 8
==3718== at 0x5336950: dolfin::DirichletBC::compute_bc_topological(boost::unordered::unordered_map<unsigned long, double, boost::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, double> > >&, dolfin::BoundaryCondition::LocalData&) const (DirichletBC.cpp:802)
==3718== by 0x53391A8: dolfin::DirichletBC::compute_bc(boost::unordered::unordered_map<unsigned long, double, boost::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, double> > >&, dolfin::BoundaryCondition::LocalData&, std::string) const (DirichletBC.cpp:750)
==3718== by 0x533A0CE: dolfin::DirichletBC::apply(dolfin::GenericMatrix*, dolfin::GenericVector*, dolfin::GenericVector const*) const (DirichletBC.cpp:498)
==3718== by 0x5378930: dolfin::NonlinearVariationalSolver::NonlinearDiscreteProblem::F(dolfin::GenericVector&, dolfin::GenericVector const&) (NonlinearVariationalSolver.cpp:158)
==3718== by 0x5877428: dolfin::NewtonSolver::solve(dolfin::NonlinearProblem&, dolfin::GenericVector&) (NewtonSolver.cpp:103)
==3718== by 0x537A7D1: dolfin::NonlinearVariationalSolver::solve() (NonlinearVariationalSolver.cpp:94)
==3718== by 0x418C00: main (main.cpp:120)
==3718== Address 0x38 is not stack'd, malloc'd or (recently) free'd
cmake optional packages used when building dolfin
-- The following optional packages were found:
-- -------------------------------------------
-- (OK) OPENMP
-- (OK) MPI
-- (OK) PETSC
-- (OK) TRILINOS
-- (OK) UMFPACK
-- (OK) CHOLMOD
-- (OK) SCOTCH
-- (OK) PARMETIS
-- (OK) CGAL
-- (OK) ZLIB
-- (OK) PYTHON
-- (OK) SPHINX
-- (OK) VTK
-- (OK) QT
--
-- The following optional packages were not be found:
-- --------------------------------------------------
-- (**) SLEPC
-- (**) PASTIX
-- (**) HDF5