From: Dmitry Karpeyev <karpeev@mc...>  20140719 22:32:33

Ata, Note that you can attach a NearNullSpace calculation routine or an equivalent callable object to your NonlinearSolver (currently supported only for PetscNonlinearSolver, I believe). The solver will detect the NearNullSpace calculator, evaluate it and attach the resulting NearNullSpace to the Jacobian. For the calling sequence see class NonlinearImplicitSystem::ComputeVectorSubspace::operator()(std::vector<NumericVector<Number>*>&sp, sys_type& s) Set NonlinearSolver::nearnullspace to a pointer to a function with the same calling sequence as the operator() above. The (pointers to the) vectors you want to put into sp above have the same structure as the solution vector to your NonlinearImplicitSystem. In the case of elasticity, for example, you can interpret the vector components as nodal displacements if using a Lagrangian basis. The easiest way to obtain these vectors is via System::add_vector(name,projections=false,parallel_type=GHOSTED). Hope this helps, Dmitry. On Sat, Jul 19, 2014 at 8:45 PM, Ataollah Mesgarnejad < amesga1@...> wrote: > Dear all, > > I was wondering if there is a way to create the coordinates vector for > MatNullSpaceCreateRigidBody? I tried traversing all the nodes in the mesh > by doing something like: > > coords>init (no_nodes*dim, no_local_nodes*dim, false, PARALLEL); > > coords>zero(); > > MeshBase::const_node_iterator n = mesh.nodes_begin(); > > const MeshBase::const_node_iterator end_n = mesh.nodes_end(); > > for (;n!=end_n;++n) > > { > > const Node* node = *n; > > const dof_id_type global_dof_u = nodedof_number(elasticity_system_no, > 0,0); > > const dof_id_type global_dof_v = nodedof_number(elasticity_system_no, > 1,0); > > const dof_id_type global_dof_w = nodedof_number(elasticity_system_no, > 2,0); > > > const Number x = (*node)(0); > > const Number y = (*node)(1); > > coords>set(global_dof_u,x); > > coords>set(global_dof_v,y); > > const Number z = (*node)(2); > > coords>set(global_dof_w,z); > > } > > > > with a first order elasticity system (I'm pretty sure the numbering for the > variables in elasticity corresponds to those of the PETSc coordinate vector > this way). > > But the Nullspace created by MatNullSpaceCreateRigidBody does not seem to > be working (KSP diverges when I set it through KSPSetNullSpace)!!?? > > As always thank you for the help, > Ata > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers > 