## Re: [Libmesh-users] Distinguising different dofs for Hermite elements

 Re: [Libmesh-users] Distinguising different dofs for Hermite elements From: Roy Stogner - 2011-01-10 20:57:03 ```On Tue, 14 Dec 2010, Vetter Roman wrote: > I'm using a 1D mesh with (cubic) Hermite shape functions to > implement a beam. Each element comes with four dof_indices per > variable, namely the nodal value and its derivative for each of the > two nodes. > In beam theory, when using Hermite shape fcts, the derivative dofs > are treated differently than the normal ones in that their stiffness > matrix entries are different. Thus, when building the stiffness > matrix, I need to now which entries of the dof_indices vector > corresponds to which type of dof. > > To be a bit more specific: Currently, I'm iterating over all > active_local_elements. For each of these, I determine the > dof_indices vector, which, for 3 variables, has a size of 12. For > each entry in dof_indices, I would like to know three things: > a) the variable number it belongs to, > b) the node it belongs to, > c) "normal" dof or derivative dof, > so I can build the 12x12 element stiffness matrix correspondingly. > > I'm looking for the "intended" way to do it, i.e. such that my code > would still be correct after doing AMR or even using different shape > functions, both of which I'm planning to do. If you want to be as flexibly correct as possible, the way to do it is to write your formulation in such a way as to avoid needing to know anything about the DoFs "types", just about their shape functions and shape function derivatives. Usually this bites people when they write themselves into a corner with isoparametric-Lagrange-specific code, but I guess with H2 problems it'd be just as easy to accidentally write cubic-Hermite-specific code instead. I.e. if you're solving (EI w'')'' = q, then you'd just weight that by a test function and integrate by parts twice, and evaluating the resulting weak formulation should give you a good approximation of w on any C1 function space. > I reckon that the two components per variable (n_comp(s,vn) == 2) > precisely represent the value and the derivative, for each node, > right? (source: > http://www.mail-archive.com/libmesh-devel@.../msg00844.html) Yes. > Is the ordering always guaranteed to be this way? In general, NO. As soon as you bump up to p=4, for example, you'll end up with a new node on which the DoF doesn't correspond to either a value or a derivative. But if you stick to our cubic hermites you should be safe, even with adaptive h refinement. --- Roy ```

 [Libmesh-users] Distinguising different dofs for Hermite elements From: Vetter Roman - 2010-12-14 10:35:36 ```Hello there. I'm using a 1D mesh with (cubic) Hermite shape functions to implement a beam. Each element comes with four dof_indices per variable, namely the nodal value and its derivative for each of the two nodes. In beam theory, when using Hermite shape fcts, the derivative dofs are treated differently than the normal ones in that their stiffness matrix entries are different. Thus, when building the stiffness matrix, I need to now which entries of the dof_indices vector corresponds to which type of dof. To be a bit more specific: Currently, I'm iterating over all active_local_elements. For each of these, I determine the dof_indices vector, which, for 3 variables, has a size of 12. For each entry in dof_indices, I would like to know three things: a) the variable number it belongs to, b) the node it belongs to, c) "normal" dof or derivative dof, so I can build the 12x12 element stiffness matrix correspondingly. I'm looking for the "intended" way to do it, i.e. such that my code would still be correct after doing AMR or even using different shape functions, both of which I'm planning to do. I reckon that the two components per variable (n_comp(s,vn) == 2) precisely represent the value and the derivative, for each node, right? (source: http://www.mail-archive.com/libmesh-devel@.../msg00844.html) Is the ordering always guaranteed to be this way? Thanks for helping me with this. Roman ```
 Re: [Libmesh-users] Distinguising different dofs for Hermite elements From: Roy Stogner - 2011-01-10 20:57:03 ```On Tue, 14 Dec 2010, Vetter Roman wrote: > I'm using a 1D mesh with (cubic) Hermite shape functions to > implement a beam. Each element comes with four dof_indices per > variable, namely the nodal value and its derivative for each of the > two nodes. > In beam theory, when using Hermite shape fcts, the derivative dofs > are treated differently than the normal ones in that their stiffness > matrix entries are different. Thus, when building the stiffness > matrix, I need to now which entries of the dof_indices vector > corresponds to which type of dof. > > To be a bit more specific: Currently, I'm iterating over all > active_local_elements. For each of these, I determine the > dof_indices vector, which, for 3 variables, has a size of 12. For > each entry in dof_indices, I would like to know three things: > a) the variable number it belongs to, > b) the node it belongs to, > c) "normal" dof or derivative dof, > so I can build the 12x12 element stiffness matrix correspondingly. > > I'm looking for the "intended" way to do it, i.e. such that my code > would still be correct after doing AMR or even using different shape > functions, both of which I'm planning to do. If you want to be as flexibly correct as possible, the way to do it is to write your formulation in such a way as to avoid needing to know anything about the DoFs "types", just about their shape functions and shape function derivatives. Usually this bites people when they write themselves into a corner with isoparametric-Lagrange-specific code, but I guess with H2 problems it'd be just as easy to accidentally write cubic-Hermite-specific code instead. I.e. if you're solving (EI w'')'' = q, then you'd just weight that by a test function and integrate by parts twice, and evaluating the resulting weak formulation should give you a good approximation of w on any C1 function space. > I reckon that the two components per variable (n_comp(s,vn) == 2) > precisely represent the value and the derivative, for each node, > right? (source: > http://www.mail-archive.com/libmesh-devel@.../msg00844.html) Yes. > Is the ordering always guaranteed to be this way? In general, NO. As soon as you bump up to p=4, for example, you'll end up with a new node on which the DoF doesn't correspond to either a value or a derivative. But if you stick to our cubic hermites you should be safe, even with adaptive h refinement. --- Roy ```