Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Ataollah Mesgarnejad <amesga1@ti...>  20140719 19:39:44

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 
From: Ataollah Mesgarnejad <amesga1@ti...>  20140719 19:39:44

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 
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 > 
From: Ataollah Mesgarnejad <amesga1@ti...>  20140720 00:10:46

Thank Dmitry, I've seen the implementation in the NonlinearImplicitSystem. I've also made my own copy of your implementation in PETScNonlinearSolver::build_mat_null_space inside my own code to do the same thing for LinearImplicitSystems. I suspect there is something wrong with the BlockSize since even when I compile libMesh with enableblockedstorage the block size for elasticity in 2D (even though I have 2 variables added) is 1 instead of 2!? The way I understood it was that if I compile with blocked storage the number of blocks would be equal to number of variables! Best, Ata On Sat, Jul 19, 2014 at 5:31 PM, Dmitry Karpeyev <karpeev@...> wrote: > 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 >> > >  A. Mesgarnejad PhD Student, Research Assistant Mechanical Engineering Department Louisiana State University 2203 Patrick F. Taylor Hall Baton Rouge, La 70803 http://www.mesgarnejad.com 
From: Ataollah Mesgarnejad <amesga1@ti...>  20140724 14:37:26

Just wanted to let everyone know that the snippet for getting the coordinates works just fine and can be used with a PetscVector coords to get the coordinates of all the nodes and then passed to MatNullSpaceCreateRigidBody to build the correct rigid body nullspace for a first order Lagrange basis. Thank you for all the help, Ata On Sat, Jul 19, 2014 at 7:10 PM, Ataollah Mesgarnejad < amesga1@...> wrote: > Thank Dmitry, > > I've seen the implementation in the NonlinearImplicitSystem. I've also > made my own copy of your implementation in > PETScNonlinearSolver::build_mat_null_space inside my own code to do the > same thing for LinearImplicitSystems. I suspect there is something wrong > with the BlockSize since even when I compile libMesh with > enableblockedstorage the block size for elasticity in 2D (even though I > have 2 variables added) is 1 instead of 2!? The way I understood it was > that if I compile with blocked storage the number of blocks would be equal > to number of variables! > > Best, > Ata > > > > On Sat, Jul 19, 2014 at 5:31 PM, Dmitry Karpeyev <karpeev@...> > wrote: > >> 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 >>> >> >> > > >  > A. Mesgarnejad > PhD Student, Research Assistant > Mechanical Engineering Department > Louisiana State University > 2203 Patrick F. Taylor Hall > Baton Rouge, La 70803 > http://www.mesgarnejad.com >  A. Mesgarnejad PhD Student, Research Assistant Mechanical Engineering Department Louisiana State University 2203 Patrick F. Taylor Hall Baton Rouge, La 70803 http://www.mesgarnejad.com 
Sign up for the SourceForge newsletter:
No, thanks