Hi, I have rebuilt libmesh with PETSc. Here is an simple example that to obtain the nodal values. However, when I run it in parallel (mpiexec -n 2 ./out), there is always error that:
[1]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [1]PETSC ERROR: Signal received [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [1]PETSC ERROR: Petsc Release Version 3.7.2, Jun, 05, 2016 [1]PETSC ERROR: ./parallel on a arch-darwin-c-debug named xxx by xxx Wed Jun 22 14:19:19 2016 [1]PETSC ERROR: Configure options --prefix=/opt/petsc-3.7.2 --with-mpi-dir=/usr/local --download-fblaslapack [1]PETSC ERROR: #1 User provided function() line 0 in unknown file Was the PETSc not correctly installed or not well built with libmesh together? Below is the code: int main(int argc, char** argv) { LibMeshInit init(argc, argv); UnstructuredMesh *mesh; ExodusII_IO *exio; EquationSystems *eqsys; System *asys; unsigned int Ax_var, Ay_var, Az_var; mesh = new Mesh(init.comm()); exio = new ExodusII_IO(*mesh); exio->read("triangle_mesh_linear.e"); mesh->allow_renumbering(false); mesh->prepare_for_use(); /// equation systems eqsys = new EquationSystems(*mesh); asys = &(eqsys->add_system<System>("Velocity")); Ax_var = asys->add_variable("Vx", FIRST, LAGRANGE); Ay_var = asys->add_variable("Vy", FIRST, LAGRANGE); Az_var = asys->add_variable("Vz", FIRST, LAGRANGEJ); eqsys->init(); exio->copy_nodal_solution(*asys, "Vx", "velocityX"); exio->copy_nodal_solution(*asys, "Vy", "velocityY"); exio->copy_nodal_solution(*asys, "Vz", "velocityZ"); libMesh::UniquePtr<libMesh::NumericVector<libMesh::Number> > _as = asys->solution->clone(); MeshBase::const_element_iterator it = mesh->local_elements_begin(); const MeshBase::const_element_iterator end = mesh->local_elements_end(); for (; it != end; it ++) { Elem *elem = *it; elem->print_info(); const NumericVector<Number> &as = *_as; std::vector<NodeIdType> nodes; for (int i=0; i<elem->n_nodes(); i++) { const Node& node = mesh->node(elem->node(i)); nodes.push_back(elem->node(i)); float A[3]; A[0] = as( node.dof_number(asys->number(), Ax_var, 0) ); // it seems that here as() (NumericVector) has problems. A[1] = as( node.dof_number(asys->number(), Ay_var, 0) ); A[2] = as( node.dof_number(asys->number(), Az_var, 0) ); } } return 0; } best regards, > On Jun 21, 2016, at 4:07 PM, Cody Permann <codyperm...@gmail.com> wrote: > > No you may run serial if you wish. > > On Tue, Jun 21, 2016 at 12:40 PM 张江 <zhangjiang.d...@gmail.com > <mailto:zhangjiang.d...@gmail.com>> wrote: > Thanks. So I have to build libmesh with PETSc? > > > On Jun 21, 2016, at 1:35 PM, John Peterson <jwpeter...@gmail.com > > <mailto:jwpeter...@gmail.com>> wrote: > > > > > > > > On Tue, Jun 21, 2016 at 12:28 PM, 张江 <zhangjiang.d...@gmail.com > > <mailto:zhangjiang.d...@gmail.com> <mailto:zhangjiang.d...@gmail.com > > <mailto:zhangjiang.d...@gmail.com>>> wrote: > > Hi, > > > > I am using parallel environment to read an unstructured grid data so that > > each process is assigned one part of data. > > But there is an error when running the program (mpiexec -n 2 ./out) at the > > following codes: > > > > eqsys = new EquationSystems(*mesh); > > > > asys = &(eqsys->add_system<System>("Velocity")); > > Ax_var = asys->add_variable("Vx", FIRST, LAGRANGE); > > Ay_var = asys->add_variable("Vy", FIRST, LAGRANGE); > > Az_var = asys->add_variable("Vz", FIRST, LAGRANGE); > > > > eqsys->init(); > > > > > > The error is: > > > > Error: EigenError: EigenSparseVectors can onSparseVectors can only be usely > > be used in serial!d in serial! > > > > [1[0] ./inclu] > > ./include/libmesh/de/libmesh/eigen_spareigen_sparse_vector.h, line > > se_vector.h, line 506, compiled Jun 11 2016 at 16:06:07 > > 506, compiled Jun 11 2016 at 16:06:07 > > application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0 > > application called MPI_Abort(MPI_COMM_WORLD, 1) - process 1 > > > > It seems that the error occurs at eqsys->init(). Is there any wrong > > operation here? Thanks. > > > > You are attempting to run in parallel, but don't have a parallel > > SolverPackage (like PETSc) available for the NumericVector classes. > > > > -- > > John > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape <http://sdm.link/attshape> > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@lists.sourceforge.net > <mailto:Libmesh-users@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/libmesh-users > <https://lists.sourceforge.net/lists/listinfo/libmesh-users> ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users