Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## libmesh-users

 [Libmesh-users] Question about node's function dof_number(s, var, comb) From: Shengli Xu - 2006-06-07 20:04:16 Attachments: Message as HTML ```Dear buddies, In 2D stokes problem, Quad8 is used. Periodic boundary condition of velocity is applied on the model. dof_number(s,var,comb) is used during searching the couple of nodes which satisfy the periodic b.c. The result is correct. But in 2D, Hex20 is used. The function of dof_number(s,var,comb) becomes very strange. It can do well with some nodes but can't do with other nodes. I don't know why. The variables is velocities (U, V, W) and pressure (P ). I have done a test with only one Hex20 element in the mesh. Generate mode mesh: //=====code======= MeshTools::Generation::build_cube(mesh,1,1,1,0,1,0,1,0,1,HEX20); It generates 27 nodes. The following codes is used to extract the nodes attaching to the only one element. //=====code======= typedef std::vector evec; evec TNode; // get the node attach to element MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); for( ; el != end_el; ++el){ const Elem* elem = *el; unsigned int TotalNum = elem->n_nodes(); for(unsigned int i=0; i< TotalNum; i++){ TNode.push_back(elem->get_node(i)); } } for(evec::iterator it = TNode.begin(); it != TNode.end(); ++it){ std::cout<<"Node Num: "<<(*it)->id()<<", " <<(*it)->dof_number(0,0,0)<<", "<<(*it)->dof_number(0,1,0)<<", " <<(*it)->dof_number(0,2,0)<<", "<<(*it)->dof_number(0,3,0) <n_comp(s,var)' failed. Program received signal SIGABRT, Aborted. Oxffffe410 in __kernal_vsyscall() The nodes 0,2,8,6,18,20,26,24 are the corner nodes. It just like that the eight corner nodes are correct. -- Best regards, Yours sincerely ShengliXu Department of Engineering Mechanics State Key Laboratory of Structural Analysis for Industrial Equipment Dalian University of Technology Dalian, 116023, P. R. China Email:shengli@... shengli.xu.xu@... ========================== ```
 Re: [Libmesh-users] Question about node's function dof_number(s, var, comb) From: Roy Stogner - 2006-06-07 20:51:21 ```On Wed, 7 Jun 2006, Shengli Xu wrote: > In 2D stokes problem, Quad8 is used. Periodic boundary condition of velocity > is applied on the model. dof_number(s,var,comb) is used during searching the > couple of nodes which satisfy the periodic b.c. The result is correct. > But in 2D, Hex20 is used. What types of finite element are you using for each variable? (e.g. second order Lagrange, first order Hierarchic, etc.) > The function of dof_number(s,var,comb) becomes > very strange. It can do well with some nodes but can't do with other nodes. > I don't know why. The variables is velocities (U, V, W) and pressure (P ). > I have done a test with only one Hex20 element in the mesh. > Generate mode mesh: > //=====code======= > MeshTools::Generation::build_cube(mesh,1,1,1,0,1,0,1,0,1,HEX20); > > It generates 27 nodes. This sounds like a bug, in my opinion. Having nodes laying around unattached to elements shouldn't cause any problems for robust code, but it's inefficient and unexpected, so it's just asking for trouble. > The following codes is used to extract the nodes > attaching to the only one element. > //=====code======= > typedef std::vector evec; > evec TNode; > // get the node attach to element > MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); > const MeshBase::const_element_iterator end_el = > mesh.active_local_elements_end(); > for( ; el != end_el; ++el){ > const Elem* elem = *el; > unsigned int TotalNum = elem->n_nodes(); > for(unsigned int i=0; i< TotalNum; i++){ > TNode.push_back(elem->get_node(i)); > } > } > for(evec::iterator it = TNode.begin(); it != TNode.end(); ++it){ > std::cout<<"Node Num: "<<(*it)->id()<<", " > <<(*it)->dof_number(0,0,0)<<", "<<(*it)->dof_number(0,1,0)<<", " > <<(*it)->dof_number(0,2,0)<<", "<<(*it)->dof_number(0,3,0) > < } > > The output result is : > Node Num: 0, 0, 20, 40, 60 > Node Num: 2, 1, 21, 41, 61 > Node Num: 8, 2, 22, 42, 62 > Node Num: 6, 3, 23, 43, 63 > Node Num: 18, 4, 24, 44, 64 > Node Num: 20, 5, 25, 45, 65 > Node Num: 26, 6, 26, 46, 66 > Node Num: 24, 7, 27, 47, 67 > homo_stokes: /home/shengli/usr/libmesh-0.5.0/inlcude/base/dof_object.h:718: > unsigned int DofObject::dof_number(unsigned int, unsigned int, unsigned int) > const: Assertion 'comp < this->n_comp(s,var)' failed. > Program received signal SIGABRT, Aborted. > Oxffffe410 in __kernal_vsyscall() > > The nodes 0,2,8,6,18,20,26,24 are the corner nodes. It just like that the > eight corner nodes are correct. The call to (*it)->dof_number(0,3,0) only makes sense if you actually have a degree of freedom on node (*it) in system 0, variable 3. Assuming variable 3 is your pressure, do you expect to have any pressure degrees of freedom at non-corner nodes? Unless you're using a second order approximation, the answer is no. --- Roy Stogner ```