hpfem / hermes-legacy

hp-FEM library
http://hpfem.org/
68 stars 47 forks source link

Tutorial example 17 fails #210

Closed solin closed 13 years ago

solin commented 13 years ago

The error message is:

E Invalid element ID 0, current range: [0; 0]

solin commented 13 years ago

Sometimes, I also get this error (at random):

I ---- Adaptivity step 2: I Projecting previous fine mesh solution to obtain initial vector on new fine mesh. E Meshes not compatible in Traverse::begin().

solin commented 13 years ago

Also 22, 23 and 24 have a similar problem. There seems to be something wrong with Solution::copy(), see below.


     This application uses Hermes.
   Hermes is a C++ library for rapid 

development of adaptive FEM and hp-FEM solvers developed by the hp-FEM group at UNR and distributed under the GPL license.

For more details visit http://hpfem.org/.

I ndof = 49. I Projecting initial condition to obtain initial vector for the Newton's method. I Solving on coarse mesh: I ---- Newton iter 1, ndof 49, res. l2 norm 2.03959 I ---- Newton iter 2, ndof 49, res. l2 norm 0.00424856 I Time step 1, adaptivity step 1: I Projecting coarse mesh solution to obtain coefficient vector on new fine mesh. I Solving on fine mesh: I ---- Newton iter 1, ndof 529, res. l2 norm 0.646282 I ---- Newton iter 2, ndof 529, res. l2 norm 0.000874644 I Projecting reference solution on coarse mesh. I Calculating error estimate. I ndof: 49, ref_ndof: 529, err_est_rel: 45.6363% I Adapting the coarse mesh. I Projecting fine mesh solution on new coarse mesh. I Time step 1, adaptivity step 2: I Projecting previous fine mesh solution to obtain coefficient vector on new fine mesh. I Solving on fine mesh: I ---- Newton iter 1, ndof 769, res. l2 norm 0.0106566 I Projecting reference solution on coarse mesh. I Calculating error estimate. I ndof: 89, ref_ndof: 769, err_est_rel: 4.86199% I Projecting fine mesh solution on new coarse mesh. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

Abort caught. Printing stacktrace:

Traceback (most recent call last): File unknown, in _start() File unknown, in libc_start_main() File "/home/pavel/hermes/hermes2d/tutorial/24-newton-timedep-gp-adapt/main.cpp", line 362, in main() sln_prev_time.copy(&refsln); File "/home/pavel/hermes/hermes2d/src/solution.cpp", line 250, in Solution::copy(Solution const) mesh->copy(sln->mesh); File "/home/pavel/hermes/hermes2d/src/mesh.cpp", line 916, in Mesh::copy(Mesh const) HashTable::copy(mesh); File "/home/pavel/hermes/hermes2d/src/hash.cpp", line 62, in HashTable::copy(HashTable const) nodes.copy(ht->nodes); File "/home/pavel/hermes/hermes2d/src/array.h", line 62, in Array::copy(Array const&) pages = array.pages; File "/usr/include/c++/4.4/bits/vector.tcc", line 165, in std::vector<Node_, std::allocator<Node> >::operator=(std::vector<Node, std::allocator<Node> > const&) __x.end()); File "/usr/include/c++/4.4/bits/stl_vector.h", line 963, in Node* std::vector<Node, std::allocator<Node> >::_M_allocate_and_copy<gnu_cxx::normal_iterator<Node const, std::vector<Node, std::allocator<Node> > > >(unsigned int, __gnu_cxx::normal_iterator<Node const, std::vector<Node, std::allocator<Node> > >, gnu_cxx::__normal_iterator<Node const, std::vector<Node, std::allocator<Node> > >) pointer result = this->_M_allocate(n); File "/usr/include/c++/4.4/bits/stl_vector.h", line 140, in std::_Vector_base<Node, std::allocator<Node> >::_M_allocate(unsigned int) { return n != 0 ? _M_impl.allocate(n) : 0; } File "/usr/include/c++/4.4/ext/new_allocator.h", line 87, in gnu_cxx::newallocator<Node*>::allocate(unsigned int, void const) std::throw_bad_alloc(); File unknown, in std::throw_bad_alloc() File unknown, in cxa_throw() File unknown, in std::terminate() File unknown, in std::setunexpected(void ()()) File unknown, in __gnu_cxx::verbose_terminate_handler() File unknown, in abort() File unknown, in raise() File unknown, address: 0xffffffffffffe422 File unknown, address: 0xffffffffffffe400 File "/home/pavel/hermes/hermes_common/Teuchos_stacktrace.cpp", line 469, in (anonymous namespace)::loc_abort_callback_print_stack(int) Teuchos::show_stacktrace(); File "/home/pavel/hermes/hermes_common/Teuchos_stacktrace.cpp", line 502, in Teuchos::show_stacktrace() std::cout << Teuchos::get_stacktrace(); File "/home/pavel/hermes/hermes_common/Teuchos_stacktrace.cpp", line 487, in Teuchos::get_stacktrace() STACKTRACE_ARRAY_SIZE);

Done. Aborted

solin commented 13 years ago

Example ns-timedep-adapt joints the list:

W None of the elements selected for refinement could be refined. Adaptivity step not successful, returning 'true'. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

Abort caught. Printing stacktrace:

Traceback (most recent call last): File unknown, in _start() File unknown, in libc_start_main() File "/home/pavel/hermes/hermes2d/examples/ns-timedep-adapt/main.cpp", line 370, in main() xvel_prev_time.copy(&xvel_refsln); File "/home/pavel/hermes/hermes2d/src/solution.cpp", line 250, in Solution::copy(Solution const) mesh->copy(sln->mesh); File "/home/pavel/hermes/hermes2d/src/mesh.cpp", line 916, in Mesh::copy(Mesh const) HashTable::copy(mesh); File "/home/pavel/hermes/hermes2d/src/hash.cpp", line 62, in HashTable::copy(HashTable const) nodes.copy(ht->nodes); File "/home/pavel/hermes/hermes2d/src/array.h", line 62, in Array::copy(Array const&) pages = array.pages; File "/usr/include/c++/4.4/bits/vector.tcc", line 165, in std::vector<Node_, std::allocator<Node> >::operator=(std::vector<Node, std::allocator<Node*> > const&) x.end()); File "/usr/include/c++/4.4/bits/stl_vector.h", line 963, in Node* std::vector<Node, std::allocator<Node> >::_M_allocate_and_copy<__gnu_cxx::__normal_iterator<Node const, std::vector<Node, std::allocator<Node> > > >(unsigned int, __gnu_cxx::__normal_iterator<Node const, std::vector<Node, std::allocator<Node> > >, __gnu_cxx::__normal_iterator<Node const, std::vector<Node, std::allocator<Node> > >) pointer result = this->_M_allocate(n); File "/usr/include/c++/4.4/bits/stl_vector.h", line 140, in std::_Vector_base<Node, std::allocator<Node> >::_M_allocate(unsigned int) { return n != 0 ? _M_impl.allocate(n) : 0; } File "/usr/include/c++/4.4/ext/new_allocator.h", line 87, in __gnu_cxx::new_allocator<Node>::allocate(unsigned int, void const_) std::throw_bad_alloc(); File unknown, in std::throw_bad_alloc() File unknown, in cxa_throw() File unknown, in std::terminate() File unknown, in std::setunexpected(void ()()) File unknown, in __gnu_cxx::verbose_terminate_handler() File unknown, in abort() File unknown, in raise() File unknown, address: 0xffffffffffffe422 File unknown, address: 0xffffffffffffe400 File "/home/pavel/hermes/hermes_common/Teuchos_stacktrace.cpp", line 469, in (anonymous namespace)::loc_abort_callback_print_stack(int) Teuchos::show_stacktrace(); File "/home/pavel/hermes/hermes_common/Teuchos_stacktrace.cpp", line 502, in Teuchos::show_stacktrace() std::cout << Teuchos::get_stacktrace(); File "/home/pavel/hermes/hermes_common/Teuchos_stacktrace.cpp", line 487, in Teuchos::get_stacktrace() STACKTRACE_ARRAY_SIZE);

Done. Aborted

solin commented 13 years ago

Example richards-seepage-adapt also fails, with a bit different stacktrace:


     This application uses Hermes.
   Hermes is a C++ library for rapid 

development of adaptive FEM and hp-FEM solvers developed by the hp-FEM group at UNR and distributed under the GPL license.

For more details visit http://hpfem.org/.

I ndof = 33. I Mesh adaptivity to an exact function: I Step 1, ndof 33, proj_error 1.9602e-12% I Projecting initial condition to obtain coefficient vector for Newton on coarse mesh. I ---- Time step 1: I ---- Time step 1, adaptivity step 1: I Projecting coarse mesh solution to obtain initial vector on new fine mesh. I Solving nonlinear problem: I ---- Newton iter 1, ndof 420, res. l2 norm 0.102447 I ---- Newton iter 2, ndof 420, res. l2 norm 0.000714751 I ---- Newton iter 3, ndof 420, res. l2 norm 3.43189e-08 I Projecting fine mesh solution on coarse mesh for error calculation. I Calculating error estimate. I ndof_coarse: 33, ndof_fine: 420, space_err_est_rel: 2.12241% I Adapting coarse mesh. I ---- Time step 1, adaptivity step 2: I Projecting previous fine mesh solution to obtain initial vector on new fine mesh.

Segfault caught. Printing stacktrace:

Traceback (most recent call last): File unknown, in _start() File unknown, in libc_start_main() File "/home/pavel/hermes/hermes2d/examples/richards-seepage-adapt/main.cpp", line 339, in main() OGProjection::project_global(ref_space, &ref_sln, coeff_vec, matrix_solver); File "/home/pavel/hermes/hermes2d/src/ogprojection.cpp", line 95, in OGProjection::projectglobal(Tuple<Space>, Tuple<MeshFunction>, double, MatrixSolverType, Tuple) project_internal(spaces, proj_wf, target_vec, matrix_solver); File "/home/pavel/hermes/hermes2d/src/ogprojection.cpp", line 24, in OGProjection::projectinternal(Tuple<Space>, WeakForm, double, MatrixSolverType) dp->assemble(matrix, rhs, false); File "/home/pavel/hermes/hermes2d/src/discreteproblem.cpp", line 305, in DiscreteProblem::assemble(SparseMatrix, Vector_, bool) assemble(NULL, mat, rhs, rhsonly); File "/home/pavel/hermes/hermes2d/src/discreteproblem.cpp", line 384, in DiscreteProblem::assemble(double, SparseMatrix, Vector, bool) trav.begin(s->meshes.size(), &(s->meshes.front()), &(s->fns.front())); File "/home/pavel/hermes/hermes2d/src/traverse.cpp", line 535, in Traverse::begin(int, Mesh, Transformable_*) if (fabs(areas[counter] - e->get_area()) > tolerance) { File "/home/pavel/hermes/hermes2d/src/mesh.cpp", line 85, in Element::get_area() const ax = vn[1]->x - vn[0]->x; File unknown, address: 0xffffffffffffe400 File "/home/pavel/hermes/hermes_common/Teuchos_stacktrace.cpp", line 458, in (anonymous namespace)::loc_segfault_callback_print_stack(int) Teuchos::show_stacktrace(); File "/home/pavel/hermes/hermes_common/Teuchos_stacktrace.cpp", line 502, in Teuchos::show_stacktrace() std::cout << Teuchos::get_stacktrace(); File "/home/pavel/hermes/hermes_common/Teuchos_stacktrace.cpp", line 487, in Teuchos::get_stacktrace() STACKTRACE_ARRAY_SIZE);

Done. Exiting the program. Aborted

solin commented 13 years ago

Example richards-tracy-adapt fails with

E Meshes not compatible in Traverse::begin().

l-korous commented 13 years ago

Yes, I already fixed everything described here.

solin commented 13 years ago

Thanks. I tried to close this issue but I only see a "Comment" button, not "Comment and Close".

l-korous commented 13 years ago

I closed it I think.