From: Roy Stogner <roystgnr@ic...>  20110110 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 isoparametricLagrangespecific code, but I guess with H2 problems it'd be just as easy to accidentally write cubicHermitespecific 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.mailarchive.com/libmeshdevel@.../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 