That was the problem. I changed my mesh file cantilever.xda to follow the syntax in H_channel_quads.xda in adjoint_ex3 and that made it work. I remember reading a pdf document about xda files in libmesh, can't find it now. Could anybody explain me why my original mesh file wasn't working?
Thanks Miguel On Nov 18, 2015 16:40, "Miguel Angel Salazar de Troya" < salazardetr...@gmail.com> wrote: > I think my problem must be in my original mesh format. This simple code > has the same problem: > > int main (int argc, char** argv) > > > > { > > // Initialize libraries. > > LibMeshInit init (argc, argv); > > > > // Skip adaptive examples on a non-adaptive libMesh build > > #ifndef LIBMESH_ENABLE_AMR > > libmesh_example_requires(false, "--enable-amr"); > > #endif > > // Skip this default-2D example if libMesh was compiled as 1D-only. > > libmesh_example_requires(2 <= LIBMESH_DIM, "2D support"); > > libMesh::out<< "Reading in and building the mesh" << std::endl; > > const unsigned int dim = 2; > > // Create a mesh, with dimension to be overridden later, on the > > // default MPI communicator. > > Mesh mesh(init.comm(),dim); > > // Read in the mesh > > mesh.read("cantilever.xda"); > > // Create a mesh refinement object to do the initial uniform > refinements > > // on the coarse grid read in from lshaped.xda > > MeshRefinement initial_uniform_refinements(mesh); > > initial_uniform_refinements.uniformly_refine(1); > > mesh.write("save.xda"); > > return 0; > > } > > My mesh cantilever.xda is > > DEAL 003:003 > 2 # Num. Elements > 6 # Num. Nodes > 8 # Length of connectivity vector (Num elements * Num Nodes) > > 2 # Num. Boundary Conds. > 65536 # String Size (ignore) > 1 # Num. Element Types. We just have quads, no triangles > > 5 # Element types in each block. 5 Corresponds to QUAD4 in the > libMeshEnums::ElemType namespace > 2 # Num. of elements in each block. > Id String > Title String > 0 1 4 5 > 1 2 3 4 > 0. 0. 0. > 50. 0. 0. > 100. 0. 0. > 100. 50. 0. > 50. 50. 0. > 0. 50. 0. > 0 3 0 > 1 2 1 > On Nov 18, 2015 15:35, "Miguel Angel Salazar de Troya" < > salazardetr...@gmail.com> wrote: > >> I realized that my nodes id's are not continuous. Having 15 nodes in my >> mesh, their id's are 0,1,2,3,4,5,6,8,10,12,14,16,18,20,22, hence why I get >> that assertion error, which assumes that the nodes' id are within the >> limits of the number of nodes I think. I'm going to try to get an example >> that I can send and that reproduces the error. >> >> Miguel >> On Nov 18, 2015 12:15, "Roy Stogner" <royst...@ices.utexas.edu> wrote: >> >>> >>> On Wed, 18 Nov 2015, Miguel Angel Salazar de Troya wrote: >>> >>> I'm trying to output my mesh into a file with Mesh::write ("mesh.xda"). >>>> Because my mesh is parallel I call Mesh::allgather () first. Then I call >>>> Mesh::write("mesh.xda") which doesn't give me problems if I don't make >>>> any >>>> uniform refinement, however if I do, I obtain this assertion >>>> >>>> Assertion `(3*local_idx+2) < coords.size()' failed. >>>> >>>> (3*local_idx+2) = 38 >>>> >>>> coords.size() = 33 >>>> >>>> At the moment of the assertion, my mesh consists of eight elements in a >>>> 4x2 >>>> grid, coming from a 2x1 mesh before one single uniform refinement. Any >>>> idea? >>>> >>> >>> Not a clue. Can you boil this down into an example you can share? >>> >>> I tried to follow adjoint_ex3 and added >>>> mesh.renumber_nodes_and_elements () before calling the write, but it >>>> didn't >>>> make a difference. >>>> >>> >>> I'm not sure why adjoints_ex3 is doing that, but it shouldn't be >>> necessary. >>> --- >>> Roy >>> >> ------------------------------------------------------------------------------ _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users