## Re: [Libmesh-devel] non-Lagrange FEFamily for geometry

 Re: [Libmesh-devel] non-Lagrange FEFamily for geometry From: Roy Stogner - 2006-08-08 15:17:40 ```On Tue, 8 Aug 2006, Karl Tomlinson wrote: > Our meshes do try to be as topologically similar as possible to a > subset of a cartesian grid. There are places where this is not > the case but we don't have C1 continuity there - we don't require > C1 for our second order problems but it makes geometries look nice > and provides a dof-cheap high-order interpolation. Okay. If you don't need C1 geometry everywhere, then doing a pseudo-Hermite geometry on unstructured meshes starts to make a little more sense. I'm still not sure what the right thing to do at odd-valence nodes is, but now it's a "what's the best data structure" problem rather than a "how is this even possible" problem. Talking about a C1 geometry on an unstructured mesh was starting to confuse me. On an unstructured mesh you don't have one geometric mapping, you have an entirely different mapping for each finite element. Mapping continuity between elements usually isn't important at all; it's just that a couple of the exceptions (like combining Hermite mappings with Hermite solution spaces to handle more interesting geometries) are very interesting. >> I'm not convinced it's possible to get C1 continuous mapping functions >> with Hermite elements in this situation, regardless of how you code >> them. > > Yes I don't think it is possible in general. It can be C1 at the > node but only almost C1 away from the node. > > But the same issue applies to solution variables with Hermite > elements, doesn't it? Yes - in fact if you'll look at the fe_hermite_* code, you'll see that we just give up and error() if we discover that an element isn't a rectangle parallel to the coordinate axes. In theory you could get C1 solutions on any mesh where the xi/eta/zeta directions are consistent at element interfaces, but I only needed rectilinear domains and so I left the code simple. >> The Hermite elements get away with fewer degrees of freedom >> than you would expect a C1 quad or hex to need, because they take >> advantage of the fact that you're using meshes where the mixed >> derivatives (e.g. d^2/dxideta in 2D) are in the same "direction" on >> all neighboring elements. I don't see how that can happen unless you >> have four quads (or 8 hexes) meeting at every node. > > The Hermite elements normally share their derivatives with > adjacent elements but this need not be the case. The zeroth order > derivatives are always going to be consistent (and shared) between > elements, but, in the 3 quads at a point case, the first-order > derivatives could be expressed as linear combinations of one pair > of derivatives to ensure C1 continuity at the node (but not > necessarily on the edges). I don't know whether their is an > appropriate way to tie mixed derivatives to each other or whether > this would help with continuity at all (probably not). > > This can be difficult to implement. The way it has been done here > is by having a separate node for each of the three elements and > then tie the appropriate dofs together, but we have only done this > to provide the necessary C0 continuity. > > (It could also be done by having the derivatives as element > parameters so only the zeroth derivatives are automatically > shared, but this would mean that constraints would normally be > involved even for the standard 4 quads at a node case.) > > These are the issues that I was/am hoping Clouch-Tocher elements > might solve. This is all going to take some thought. If you want to maintain a C1 map between an unstructured 2D reference grid and a deformed grid, though, you're right that using the Clough-Tochers should make that pretty natural. > I think I'm seeing the issues here: > > It is inefficient to refine a geometry that doesn't change. By > providing a 2 step mapping, only the simplest mapping need be > refined. > > And there is no need for a high order representation of the > internal element boundaries in a homogeneous domain, when usually > representing the boundary is the only reason for the high order > representation. Exactly. > Much of our legacy code was designed for Lagrangian > finite-deformation (non-linear) solid mechanics. In this problem, > solution variables are the geometry variables. Similarly for > problems involving fitting meshes to boundary data points. And that makes perfect sense too - once you start perturbing the geometry it's very unlikely that you can still get away with a patch-based rather than an element-based description. I'd like to have an implementation that can handle both sorts of situation, if possible - but as a first draft it may make sense to implement mapping information on a per-element level but try to keep the API abstract enough to allow memory optimization in the future. >> Also, keep in mind that there's no Clough Tet elements in libMesh, >> either. C1 tets are ugly; you need something like p=11 to build them >> without macroelements, and the best macroelements suitable for any Tet >> mesh require p=5 polynomials and can't be restricted below p=3. My >> main motivation for writing the Hermite class in the first place was >> that I wanted to get some C1 3D results without spending a year or two >> bug hunting through a hundred macroelement terms. > > Sounds scary. It is, but only because I don't know enough about handling high polynomial degrees intelligently without getting swamped by floating point error. I've got libMesh's adaptive p refinement capped at around p=10 or p=11 for just that reason. > But I don't know what "restricted below p=3" means. Take a look at the quadratic "restricted Clough-Tocher" triangles for a 2D example: you can start with the cubic CT triangle, then constrain away the side flux degrees of freedom. The result has fewer degrees of freedom and p=2 accuracy like a normal quadratic element would, but it's still got some cubic terms so the quadrature rules don't get any cheaper. The tet situation is the same: you can start with a p=5 macroelement tet, then constrain away a bunch of the degrees of freedom to get something that has performance more like a cubic element. >> That would work, but I'd be worried about what Clough-Tocher mappings >> might do to your quadrature rules. Granted, any kind of non-affine >> map can mess up your nice exact Gaussian quadrature, but the >> Clough-Tocher basis functions have internal subelement boundaries >> which might be even worse. > > The quadrature rules should be applied over each of the > subelements individually (or through a macro-quadrature rule). > Isn't this also an issue when integrating solution variables or > their shape functions? Yes; how we do things now is to just copy a Gaussian rule over each subelement. I guess it's not a serious problem, but tripling the cost of FEM calculations isn't something to be happy about. Do you have any references to macroelement-specific quadrature rules in the literature? I'd been thinking about deriving something more efficient for the cubic CT, but I'd hate to reinvent the wheel. > If the solution variables need to C1 wrt xyz, then I think there > are some requirements for the geometry representation. It entirely depends on the finite element space - Clough-Tochers will build a C1 solution space on top of any geometry; Hermites need consistent local coordinate directions at nodes. --- Roy ```

 [Libmesh-devel] non-Lagrange FEFamily for geometry From: Karl Tomlinson - 2006-08-04 19:16:06 ```Hi. The Bioengineering Institute at the University of Auckland is looking to replace its current FEM modelling software. The main reasons are probably: * We want to develop open source code. * Although our existing software has OpenMP multi-threading for shared memory systems, we want software to run on clusters also, and we were intimidated by the idea of introducing message passing to legacy Fortran code full of common blocks and data structures that are accessed directly from everywhere. (See http://www.cmiss.org/ if you want more info.) We've been impressed by what we've seen of libMesh and it already implements many of the features that we are interested in. So, rather than rewrite everything again, we would like to use libMesh as the core finite element library for our projects (although there may still be some internal debates over whether we should be using Fortran...). Hopefully we will also be able to contribute additional functionality to libMesh. However, we have many existing meshes that use Hermite interpolation for the geometric variables (xyz). I see that the Hermite FEFamily has been added since 0.5.0, but AFAICT from FE< Dim, T >::init_shape_functions, libmesh always uses the Lagrange FEFamily for geometric variables (the map). FE< Dim, T >::reinit has the comment: "In the future we can specify different types of maps" Does this indicate that more general interpolations for the geometric variables were intended? Would it be reasonable to implement this? Any thoughts on how this might be done? I'm used to thinking of x,y,z as variables in themselves, like dependent (system) variables in libMesh, each with their own FEType. But I think it is reasonable that x,y,z should all have the same FEType (but not necessarily the same as that of each of the dependent variables). Should the shape functions for the map be tied more closely to an FE for the Mesh (or an Elem) rather than to the FEs for each of the dependent variables in each System on the Mesh? Thanks, Karl. ```
 Re: [Libmesh-devel] non-Lagrange FEFamily for geometry From: Roy Stogner - 2006-08-04 21:09:21 ```On Sat, 5 Aug 2006, Karl Tomlinson wrote: > So, rather than rewrite everything again, we would like to use > libMesh as the core finite element library for our projects > (although there may still be some internal debates over whether we > should be using Fortran...). Aren't there always internal debates about one language vs. another? The only reasons to prefer Fortran over C++ are performance and ease-of-learning. For a code like libMesh which has been developed as a learning and research tool rather than for production engineering, C++ was clearly better: any performance problems are better solved by throwing cheap hardware at a C++ code than by throwing expensive graduate student time at a Fortran code, and the original developers were already past the hard part of the C++ learning curve. > Hopefully we will also be able to contribute additional > functionality to libMesh. That's the open source idea! These things sort of snowball. I got involved when I realized it would be much easier to add Clough-Tocher elements and W^{2,p} calculations to libMesh than it would be to add AMR and parallelism to my own Matlab code. Neither Ben nor John had any need for Hermite elements, but now that I've been lured into writing them it might attract more developers? Good stuff. > However, we have many existing meshes that use Hermite > interpolation for the geometric variables (xyz). > > I see that the Hermite FEFamily has been added since 0.5.0, but > AFAICT from FE< Dim, T >::init_shape_functions, libmesh always > uses the Lagrange FEFamily for geometric variables (the map). This is true. > FE< Dim, T >::reinit has the comment: > > "In the future we can specify different types of maps" > > Does this indicate that more general interpolations for the > geometric variables were intended? There are all sorts of features that have always been intended, but some will be easier to implement than others... > Would it be reasonable to implement this? I suspect implementing other mappings to the point where you can run all the standard examples may be reasonable; no harder than adding AMR to non-Lagrange variables was, at least. The big problem will be getting all the odd combinations of features right. Right now adaptive p refinement works for most calculations, for example, but you can't write p refinement code capable of restarts because none of the Mesh I/O classes are aware of element p_level. A couple other users are now discovering that nobody ever updated the MeshFunction support classes to work with adaptive h refinement. It's hard to keep everything in sync. > Any thoughts on how this might be done? > > I'm used to thinking of x,y,z as variables in themselves, like > dependent (system) variables in libMesh, each with their own > FEType. But I think it is reasonable that x,y,z should all have > the same FEType (but not necessarily the same as that of each of > the dependent variables). This makes sense when the domain is transformed from a cartesian grid, but what do you do on more general unstructured meshes? Imagine you've got three Hermite quads meeting at one point, for example - what are the mapping variables at that node? If xi and eta are different between elements, derivatives with respect to xi and eta won't be uniquely defined on element interfaces. Also, it's easy to conceive of situations where the mapping variables take up a different amount of data than any solution variable. It might be nice to handle NURBS geometries via a two step map: a first order Lagrange mapping from master elements to a few unit boxes, then a few NURBS points to define a map from those into physical space. Per-element NURBS information could work but would waste RAM. I'll think about it some more, but no bright ideas are coming to mind at the moment. > Should the shape functions for the map be tied more closely to an > FE for the Mesh (or an Elem) rather than to the FEs for each of > the dependent variables in each System on the Mesh? I'd rather not have a mapping FE associated with each Elem unless we can think of a cunning data structure; I felt bad about just adding a byte for p_level until I realized most compilers would have turned that byte into alignment padding anyway. Adding a per-Elem pointer to a mapping FEType object would be a bit much. Even if we do something more memory efficient (separate per-FEType std::vectors in Mesh? A tree storing the first and last element ID number in each contiguous range with the same FEType?), mixing different mapping FETypes in the same mesh is a little weird. I guess more flexibility is better than less, but to simplify code elsewhere (the FE caching I just added to CVS, for instance) it would be nice if we could assume there was just one per-Mesh mapping FEType. --- Roy Stogner ```
 Re: [Libmesh-devel] non-Lagrange FEFamily for geometry From: Karl Tomlinson - 2006-08-07 06:36:54 ```Thanks, Roy, for your positive comments and thoughts. On Fri, 4 Aug 2006 16:09:16 -0500 (CDT), Roy Stogner wrote: > On Sat, 5 Aug 2006, Karl Tomlinson wrote: > >> However, we have many existing meshes that use Hermite >> interpolation for the geometric variables (xyz). [snip] >> Any thoughts on how this might be done? >> >> I'm used to thinking of x,y,z as variables in themselves, like >> dependent (system) variables in libMesh, each with their own >> FEType. But I think it is reasonable that x,y,z should all have >> the same FEType (but not necessarily the same as that of each of >> the dependent variables). > > This makes sense when the domain is transformed from a cartesian grid, > but what do you do on more general unstructured meshes? I now see that libMesh is storing xyz-based derivatives for the dofs in Hermite meshes, whereas I'm used to thinking of xi-based derivatives. When thinking in terms of xyz-derivatives, there needs to be some way of calculating the scale factors (dx/dxi) for the geometry. This can be done with edge-lengths or something similar but it may be iterative and may not be simple. When the dofs are xi-derivatives this step is not an issue. > Imagine you've got three Hermite quads meeting at one point, for > example - what are the mapping variables at that node? If xi and eta > are different between elements, derivatives with respect to xi and eta > won't be uniquely defined on element interfaces. This situation does make things more complicated for the xi-derivative implementation. Some linear constraints would be needed to require C1 continuity. (The scale factor matrix provides this in the xyz-derivative implementation.) A similar issue exists where an element is adjacent on one side to 2 elements of higher h-refinement level (with a hanging node). I'll have to look more at the libMesh (xyz) implementation. > Also, it's easy to conceive of situations where the mapping variables > take up a different amount of data than any solution variable. It > might be nice to handle NURBS geometries via a two step map: a first > order Lagrange mapping from master elements to a few unit boxes, then > a few NURBS points to define a map from those into physical space. > Per-element NURBS information could work but would waste RAM. I'm not familiar enough with NURBS to comment here. I was thinking that geometric variables should be as similar as possible to solution (or any other - e.g. material parameter) variables, but are you saying that geometric variables may be more complicated than solution variables? >> Should the shape functions for the map be tied more closely to an >> FE for the Mesh (or an Elem) rather than to the FEs for each of >> the dependent variables in each System on the Mesh? > > I'd rather not have a mapping FE associated with each Elem unless we > can think of a cunning data structure; I felt bad about just adding a > byte for p_level until I realized most compilers would have turned > that byte into alignment padding anyway. Adding a per-Elem pointer to > a mapping FEType object would be a bit much. > > Even if we do something more memory efficient (separate per-FEType > std::vectors in Mesh? A tree storing the first and last > element ID number in each contiguous range with the same FEType?), > mixing different mapping FETypes in the same mesh is a little weird. (As I understand it, p-refinement essentially changes the FEType through the order and so it is just having different FEFamilys that is the issue. Correct me if I'm wrong.) > I guess more flexibility is better than less, but to simplify code > elsewhere (the FE caching I just added to CVS, for instance) it would > be nice if we could assume there was just one per-Mesh mapping FEType. For the most part I'm happy with one per-Mesh mapping FEFamily. The possible exception is Clough-Tocher and Hermite FEFamilies. I'm not familiar with Clough-Tocher but they look pretty clever. Hermites don't provide TRI or TET ElemTypes so having some Clough-Toucher to provide this may be useful. Is this a feasible combination (with hanging node constraints perhaps)? Maybe using only Clough-Tocher elements might be solution here. Are Clough-Tocher and Hermite FEFamilys similar enough to be different ElemTypes of the same FEFamily? Karl. ```
 Re: [Libmesh-devel] non-Lagrange FEFamily for geometry From: Roy Stogner - 2006-08-07 20:05:20 ```On Mon, 7 Aug 2006, Karl Tomlinson wrote: > On Fri, 4 Aug 2006 16:09:16 -0500 (CDT), Roy Stogner wrote: > >> On Sat, 5 Aug 2006, Karl Tomlinson wrote: >> >>> I'm used to thinking of x,y,z as variables in themselves, like >>> dependent (system) variables in libMesh, each with their own >>> FEType. But I think it is reasonable that x,y,z should all have >>> the same FEType (but not necessarily the same as that of each of >>> the dependent variables). >> >> This makes sense when the domain is transformed from a cartesian grid, >> but what do you do on more general unstructured meshes? > > I now see that libMesh is storing xyz-based derivatives for the > dofs in Hermite meshes, whereas I'm used to thinking of xi-based > derivatives. That's right. Basically I wanted to make it easier to handle selectively refined (whether by libMesh's hierarchical AMR or by a priori mesh grading) meshes. Once you do that, d/dxi is no longer consistent between neighboring elements, but d/dx still is. > When thinking in terms of xyz-derivatives, there needs to be some > way of calculating the scale factors (dx/dxi) for the geometry. > This can be done with edge-lengths or something similar but it may be > iterative and may not be simple. > > When the dofs are xi-derivatives this step is not an issue. Well, if your mesh is topologically equivalent to a subset of a cartesian grid, there's no problem: your "master elements" can all be the same, and then making a distinction between d/dx and d/dxi (for mapping functions) doesn't make sense. Once you do a little hierarchic refinement, then there's a scaling factor that comes into play, but it's still simple. What I still can't wrap my head around is what you do for really unstructured meshes: >> Imagine you've got three Hermite quads meeting at one point, for >> example - what are the mapping variables at that node? If xi and eta >> are different between elements, derivatives with respect to xi and eta >> won't be uniquely defined on element interfaces. > > This situation does make things more complicated for the > xi-derivative implementation. Some linear constraints would be needed > to require C1 continuity. (The scale factor matrix provides this > in the xyz-derivative implementation.) I'm not convinced it's possible to get C1 continuous mapping functions with Hermite elements in this situation, regardless of how you code them. The Hermite elements get away with fewer degrees of freedom than you would expect a C1 quad or hex to need, because they take advantage of the fact that you're using meshes where the mixed derivatives (e.g. d^2/dxideta in 2D) are in the same "direction" on all neighboring elements. I don't see how that can happen unless you have four quads (or 8 hexes) meeting at every node. > A similar issue exists where an element is adjacent on one side to > 2 elements of higher h-refinement level (with a hanging node). This is much easier to handle by comparison; sure there's some scaling involved, but as long as the mapping is consistent (all the mapping values on the hanging node correspond to the correct linear combinations of the values on the neighboring vertices), the result should still be C1 and should still be straightforward to compute. >> Also, it's easy to conceive of situations where the mapping variables >> take up a different amount of data than any solution variable. It >> might be nice to handle NURBS geometries via a two step map: a first >> order Lagrange mapping from master elements to a few unit boxes, then >> a few NURBS points to define a map from those into physical space. >> Per-element NURBS information could work but would waste RAM. > > I'm not familiar enough with NURBS to comment here. Imagine a quadratic mapping, then. Say you want to discretize the domain from -1 I was thinking that geometric variables should be as similar as > possible to solution (or any other - e.g. material parameter) > variables, but are you saying that geometric variables may be more > complicated than solution variables? It's not so much that they're more or less complicated, it's that they're "differently" complicated. I think that for geometric variables you may often find that the most memory-efficient way to store the mapping is as a composition of many simple (perhaps linear Lagrange) mappings from master elements into "geometric patches" and a few complicated (perhaps NURBS) mappings from those patches into the physical domain. There's no analog to such a process among solution variables. >>> Should the shape functions for the map be tied more closely to an >>> FE for the Mesh (or an Elem) rather than to the FEs for each of >>> the dependent variables in each System on the Mesh? >> >> I'd rather not have a mapping FE associated with each Elem unless we >> can think of a cunning data structure; I felt bad about just adding a >> byte for p_level until I realized most compilers would have turned >> that byte into alignment padding anyway. Adding a per-Elem pointer to >> a mapping FEType object would be a bit much. I'm willing to reconsider this. Looking over elem.h, it's clear that we're going to have something like a dozen pointers per Elem on even 2D meshes; adding another one won't kill us. I'm still not sure what good it would be, though. Generally when we have finite elements that are compatible with each other, we put them in the same FEFamily, even though one is a quad and the other a triangle. I can't imagine situations where I'd want to mix and match mapping FEFamilies; it wouldn't be safe. > (As I understand it, p-refinement essentially changes the FEType > through the order and so it is just having different FEFamilys > that is the issue. Correct me if I'm wrong.) You're correct. Also we currently only support adaptive p refinement of hierarchic-type basis functions, which makes mixing different p levels in the same mesh a little easier. >> I guess more flexibility is better than less, but to simplify code >> elsewhere (the FE caching I just added to CVS, for instance) it would >> be nice if we could assume there was just one per-Mesh mapping FEType. > > For the most part I'm happy with one per-Mesh mapping FEFamily. > The possible exception is Clough-Tocher and Hermite FEFamilies. > > I'm not familiar with Clough-Tocher but they look pretty clever. > Hermites don't provide TRI or TET ElemTypes so having some > Clough-Toucher to provide this may be useful. Is this a feasible > combination (with hanging node constraints perhaps)? I had hoped it would be when I started coding them, but no, that doesn't work. To make the interface C1, you'd need to constrain the flux on the Hermite side to be quadratic instead of cubic - but there's no way to do that without the constraint "spilling over" into neighboring elements, and that can ruin the locality or even the approximation accuracy of your basis functions. There is a quad macroelement which is compatible with the Clough-Tochers and which is likely a little more efficient in a hybrid mesh than dissecting the quads and using CT alone, but I don't think the slight gain is worth the coding time. Also, keep in mind that there's no Clough Tet elements in libMesh, either. C1 tets are ugly; you need something like p=11 to build them without macroelements, and the best macroelements suitable for any Tet mesh require p=5 polynomials and can't be restricted below p=3. My main motivation for writing the Hermite class in the first place was that I wanted to get some C1 3D results without spending a year or two bug hunting through a hundred macroelement terms. > Maybe using only Clough-Tocher elements might be solution here. That would work, but I'd be worried about what Clough-Tocher mappings might do to your quadrature rules. Granted, any kind of non-affine map can mess up your nice exact Gaussian quadrature, but the Clough-Tocher basis functions have internal subelement boundaries which might be even worse. > Are Clough-Tocher and Hermite FEFamilys similar enough to be > different ElemTypes of the same FEFamily? No; even if the code worked, the resulting function space would only be C0 conforming. I guess having a space which was C1 almost everywhere might be good for some applications, but my fourth order problems would start producing bad results. --- Roy ```
 Re: [Libmesh-devel] non-Lagrange FEFamily for geometry From: Karl Tomlinson - 2006-08-08 03:24:01 ```Roy Stogner writes: > On Mon, 7 Aug 2006, Karl Tomlinson wrote: > >> On Fri, 4 Aug 2006 16:09:16 -0500 (CDT), Roy Stogner wrote: >> >>> On Sat, 5 Aug 2006, Karl Tomlinson wrote: >>> >>>> I'm used to thinking of x,y,z as variables in themselves, like >>>> dependent (system) variables in libMesh, each with their own >>>> FEType. But I think it is reasonable that x,y,z should all have >>>> the same FEType (but not necessarily the same as that of each of >>>> the dependent variables). >>> >>> This makes sense when the domain is transformed from a cartesian grid, >>> but what do you do on more general unstructured meshes? >> >> I now see that libMesh is storing xyz-based derivatives for the >> dofs in Hermite meshes, whereas I'm used to thinking of xi-based >> derivatives. > > That's right. Basically I wanted to make it easier to handle > selectively refined (whether by libMesh's hierarchical AMR or by a > priori mesh grading) meshes. Once you do that, d/dxi is no longer > consistent between neighboring elements, but d/dx still is. I can see advantages in this, but it might provide some challenges for Hermite geometries as the dx/dxi scale factors are not yet available. > >> When thinking in terms of xyz-derivatives, there needs to be some >> way of calculating the scale factors (dx/dxi) for the geometry. >> This can be done with edge-lengths or something similar but it may be >> iterative and may not be simple. >> >> When the dofs are xi-derivatives this step is not an issue. > > Well, if your mesh is topologically equivalent to a subset of a > cartesian grid, there's no problem: your "master elements" can all be > the same, and then making a distinction between d/dx and d/dxi (for > mapping functions) doesn't make sense. Once you do a little > hierarchic refinement, then there's a scaling factor that comes into > play, but it's still simple. Are you talking about p-refinement here (I haven't thought about these issues) or h-refinement (I can see use of scaling factors here)? > What I still can't wrap my head around > is what you do for really unstructured meshes: Our meshes do try to be as topologically similar as possible to a subset of a cartesian grid. There are places where this is not the case but we don't have C1 continuity there - we don't require C1 for our second order problems but it makes geometries look nice and provides a dof-cheap high-order interpolation. >>> Imagine you've got three Hermite quads meeting at one point, for >>> example - what are the mapping variables at that node? If xi and eta >>> are different between elements, derivatives with respect to xi and eta >>> won't be uniquely defined on element interfaces. >> >> This situation does make things more complicated for the >> xi-derivative implementation. Some linear constraints would be needed >> to require C1 continuity. (The scale factor matrix provides this >> in the xyz-derivative implementation.) > > I'm not convinced it's possible to get C1 continuous mapping functions > with Hermite elements in this situation, regardless of how you code > them. Yes I don't think it is possible in general. It can be C1 at the node but only almost C1 away from the node. But the same issue applies to solution variables with Hermite elements, doesn't it? > The Hermite elements get away with fewer degrees of freedom > than you would expect a C1 quad or hex to need, because they take > advantage of the fact that you're using meshes where the mixed > derivatives (e.g. d^2/dxideta in 2D) are in the same "direction" on > all neighboring elements. I don't see how that can happen unless you > have four quads (or 8 hexes) meeting at every node. The Hermite elements normally share their derivatives with adjacent elements but this need not be the case. The zeroth order derivatives are always going to be consistent (and shared) between elements, but, in the 3 quads at a point case, the first-order derivatives could be expressed as linear combinations of one pair of derivatives to ensure C1 continuity at the node (but not necessarily on the edges). I don't know whether their is an appropriate way to tie mixed derivatives to each other or whether this would help with continuity at all (probably not). This can be difficult to implement. The way it has been done here is by having a separate node for each of the three elements and then tie the appropriate dofs together, but we have only done this to provide the necessary C0 continuity. (It could also be done by having the derivatives as element parameters so only the zeroth derivatives are automatically shared, but this would mean that constraints would normally be involved even for the standard 4 quads at a node case.) These are the issues that I was/am hoping Clouch-Tocher elements might solve. > >> A similar issue exists where an element is adjacent on one side to >> 2 elements of higher h-refinement level (with a hanging node). > > This is much easier to handle by comparison; sure there's some scaling > involved, but as long as the mapping is consistent (all the mapping > values on the hanging node correspond to the correct linear > combinations of the values on the neighboring vertices), the result > should still be C1 and should still be straightforward to compute. Yes. The same could also apply for the derivative values at nodes that are shared (not hanging) if using d/dxi, but there may be issues in mapping nodal dofs to Hermite (element) dofs. > >>> Also, it's easy to conceive of situations where the mapping variables >>> take up a different amount of data than any solution variable. It >>> might be nice to handle NURBS geometries via a two step map: a first >>> order Lagrange mapping from master elements to a few unit boxes, then >>> a few NURBS points to define a map from those into physical space. >>> Per-element NURBS information could work but would waste RAM. >> >> I'm not familiar enough with NURBS to comment here. > > Imagine a quadratic mapping, then. Say you want to discretize the > domain from -1 that domain by using triangles which each have 6 nodes and a quadratic > map, but you could also do it by mapping a bunch of 3 node master > triangles onto a unit square, then using a single 9 node quadratic map > to transform the unit square onto the physical domain. In the former > case you end up using approximately 1 mapping node per 2 triangles, in > the latter you use approximately 3. > > This isn't a huge memory savings until you get up to high p mappings > or complicated NURBS, I know, but I don't want to preclude it unless > we have to. > >> I was thinking that geometric variables should be as similar as >> possible to solution (or any other - e.g. material parameter) >> variables, but are you saying that geometric variables may be more >> complicated than solution variables? > > It's not so much that they're more or less complicated, it's that > they're "differently" complicated. I think that for geometric > variables you may often find that the most memory-efficient way to > store the mapping is as a composition of many simple (perhaps linear > Lagrange) mappings from master elements into "geometric patches" and a > few complicated (perhaps NURBS) mappings from those patches into the > physical domain. There's no analog to such a process among solution > variables. I think I'm seeing the issues here: It is inefficient to refine a geometry that doesn't change. By providing a 2 step mapping, only the simplest mapping need be refined. And there is no need for a high order representation of the internal element boundaries in a homogeneous domain, when usually representing the boundary is the only reason for the high order representation. Much of our legacy code was designed for Lagrangian finite-deformation (non-linear) solid mechanics. In this problem, solution variables are the geometry variables. Similarly for problems involving fitting meshes to boundary data points. > >>>> Should the shape functions for the map be tied more closely to an >>>> FE for the Mesh (or an Elem) rather than to the FEs for each of >>>> the dependent variables in each System on the Mesh? >>> >>> I'd rather not have a mapping FE associated with each Elem unless we >>> can think of a cunning data structure; I felt bad about just adding a >>> byte for p_level until I realized most compilers would have turned >>> that byte into alignment padding anyway. Adding a per-Elem pointer to >>> a mapping FEType object would be a bit much. > > I'm willing to reconsider this. Looking over elem.h, it's clear that > we're going to have something like a dozen pointers per Elem on even > 2D meshes; adding another one won't kill us. I was wondering if this was the case, but if we use this argument too many times we'll soon be using lots of memory. > I'm still not sure what good it would be, though. Generally when we > have finite elements that are compatible with each other, we put them > in the same FEFamily, even though one is a quad and the other a > triangle. I can't imagine situations where I'd want to mix and match > mapping FEFamilies; it wouldn't be safe. I'm happy to leave this for now at least. Our meshes usually only have one FEFamily, and solution variables in libmesh only have one FEFamily. What I'm primarily interested in is providing similar flexibility to independent variables as what is already provided for dependent variables. > >> (As I understand it, p-refinement essentially changes the FEType >> through the order and so it is just having different FEFamilys >> that is the issue. Correct me if I'm wrong.) > > You're correct. Also we currently only support adaptive p refinement > of hierarchic-type basis functions, which makes mixing different p > levels in the same mesh a little easier. Sounds sensible. > >> >> I'm not familiar with Clough-Tocher but they look pretty clever. >> Hermites don't provide TRI or TET ElemTypes so having some >> Clough-Toucher to provide this may be useful. Is this a feasible >> combination (with hanging node constraints perhaps)? > > I had hoped it would be when I started coding them, but no, that > doesn't work. To make the interface C1, you'd need to constrain the > flux on the Hermite side to be quadratic instead of cubic - but > there's no way to do that without the constraint "spilling over" into > neighboring elements, and that can ruin the locality or even the > approximation accuracy of your basis functions. OK then. Thanks for your investigation. > > There is a quad macroelement which is compatible with the > Clough-Tochers and which is likely a little more efficient in a hybrid > mesh than dissecting the quads and using CT alone, but I don't think > the slight gain is worth the coding time. Sounds reasonable. > > Also, keep in mind that there's no Clough Tet elements in libMesh, > either. C1 tets are ugly; you need something like p=11 to build them > without macroelements, and the best macroelements suitable for any Tet > mesh require p=5 polynomials and can't be restricted below p=3. My > main motivation for writing the Hermite class in the first place was > that I wanted to get some C1 3D results without spending a year or two > bug hunting through a hundred macroelement terms. Sounds scary. But I don't know what "restricted below p=3" means. Is this something to do with restricting a fine mesh to a coarse mesh? Or is is something to do with the second order derivative parameters involved? > >> Maybe using only Clough-Tocher elements might be solution here. > > That would work, but I'd be worried about what Clough-Tocher mappings > might do to your quadrature rules. Granted, any kind of non-affine > map can mess up your nice exact Gaussian quadrature, but the > Clough-Tocher basis functions have internal subelement boundaries > which might be even worse. The quadrature rules should be applied over each of the subelements individually (or through a macro-quadrature rule). Isn't this also an issue when integrating solution variables or their shape functions? > ... I guess having a space which was C1 almost > everywhere might be good for some applications, but my fourth order > problems would start producing bad results. If the solution variables need to C1 wrt xyz, then I think there are some requirements for the geometry representation. du/dx = du/dxi * dxi/dx Scaling factors are chosen so that this quantity is continuous at the nodes, but, if dxi/dx is different in adjacent elements and varies within an element, then there may not be C1 continuity along the whole edge (or face). (IIRC a necessary condition for C1 continuity is that the ratios of scale factors in adjacent elements must be equal, which is not necessarily true of a Lagrange mesh.) The requirements are satisfied if a C1 representation is used for the geometry. ```
 Re: [Libmesh-devel] non-Lagrange FEFamily for geometry From: Roy Stogner - 2006-08-08 15:17:40 ```On Tue, 8 Aug 2006, Karl Tomlinson wrote: > Our meshes do try to be as topologically similar as possible to a > subset of a cartesian grid. There are places where this is not > the case but we don't have C1 continuity there - we don't require > C1 for our second order problems but it makes geometries look nice > and provides a dof-cheap high-order interpolation. Okay. If you don't need C1 geometry everywhere, then doing a pseudo-Hermite geometry on unstructured meshes starts to make a little more sense. I'm still not sure what the right thing to do at odd-valence nodes is, but now it's a "what's the best data structure" problem rather than a "how is this even possible" problem. Talking about a C1 geometry on an unstructured mesh was starting to confuse me. On an unstructured mesh you don't have one geometric mapping, you have an entirely different mapping for each finite element. Mapping continuity between elements usually isn't important at all; it's just that a couple of the exceptions (like combining Hermite mappings with Hermite solution spaces to handle more interesting geometries) are very interesting. >> I'm not convinced it's possible to get C1 continuous mapping functions >> with Hermite elements in this situation, regardless of how you code >> them. > > Yes I don't think it is possible in general. It can be C1 at the > node but only almost C1 away from the node. > > But the same issue applies to solution variables with Hermite > elements, doesn't it? Yes - in fact if you'll look at the fe_hermite_* code, you'll see that we just give up and error() if we discover that an element isn't a rectangle parallel to the coordinate axes. In theory you could get C1 solutions on any mesh where the xi/eta/zeta directions are consistent at element interfaces, but I only needed rectilinear domains and so I left the code simple. >> The Hermite elements get away with fewer degrees of freedom >> than you would expect a C1 quad or hex to need, because they take >> advantage of the fact that you're using meshes where the mixed >> derivatives (e.g. d^2/dxideta in 2D) are in the same "direction" on >> all neighboring elements. I don't see how that can happen unless you >> have four quads (or 8 hexes) meeting at every node. > > The Hermite elements normally share their derivatives with > adjacent elements but this need not be the case. The zeroth order > derivatives are always going to be consistent (and shared) between > elements, but, in the 3 quads at a point case, the first-order > derivatives could be expressed as linear combinations of one pair > of derivatives to ensure C1 continuity at the node (but not > necessarily on the edges). I don't know whether their is an > appropriate way to tie mixed derivatives to each other or whether > this would help with continuity at all (probably not). > > This can be difficult to implement. The way it has been done here > is by having a separate node for each of the three elements and > then tie the appropriate dofs together, but we have only done this > to provide the necessary C0 continuity. > > (It could also be done by having the derivatives as element > parameters so only the zeroth derivatives are automatically > shared, but this would mean that constraints would normally be > involved even for the standard 4 quads at a node case.) > > These are the issues that I was/am hoping Clouch-Tocher elements > might solve. This is all going to take some thought. If you want to maintain a C1 map between an unstructured 2D reference grid and a deformed grid, though, you're right that using the Clough-Tochers should make that pretty natural. > I think I'm seeing the issues here: > > It is inefficient to refine a geometry that doesn't change. By > providing a 2 step mapping, only the simplest mapping need be > refined. > > And there is no need for a high order representation of the > internal element boundaries in a homogeneous domain, when usually > representing the boundary is the only reason for the high order > representation. Exactly. > Much of our legacy code was designed for Lagrangian > finite-deformation (non-linear) solid mechanics. In this problem, > solution variables are the geometry variables. Similarly for > problems involving fitting meshes to boundary data points. And that makes perfect sense too - once you start perturbing the geometry it's very unlikely that you can still get away with a patch-based rather than an element-based description. I'd like to have an implementation that can handle both sorts of situation, if possible - but as a first draft it may make sense to implement mapping information on a per-element level but try to keep the API abstract enough to allow memory optimization in the future. >> Also, keep in mind that there's no Clough Tet elements in libMesh, >> either. C1 tets are ugly; you need something like p=11 to build them >> without macroelements, and the best macroelements suitable for any Tet >> mesh require p=5 polynomials and can't be restricted below p=3. My >> main motivation for writing the Hermite class in the first place was >> that I wanted to get some C1 3D results without spending a year or two >> bug hunting through a hundred macroelement terms. > > Sounds scary. It is, but only because I don't know enough about handling high polynomial degrees intelligently without getting swamped by floating point error. I've got libMesh's adaptive p refinement capped at around p=10 or p=11 for just that reason. > But I don't know what "restricted below p=3" means. Take a look at the quadratic "restricted Clough-Tocher" triangles for a 2D example: you can start with the cubic CT triangle, then constrain away the side flux degrees of freedom. The result has fewer degrees of freedom and p=2 accuracy like a normal quadratic element would, but it's still got some cubic terms so the quadrature rules don't get any cheaper. The tet situation is the same: you can start with a p=5 macroelement tet, then constrain away a bunch of the degrees of freedom to get something that has performance more like a cubic element. >> That would work, but I'd be worried about what Clough-Tocher mappings >> might do to your quadrature rules. Granted, any kind of non-affine >> map can mess up your nice exact Gaussian quadrature, but the >> Clough-Tocher basis functions have internal subelement boundaries >> which might be even worse. > > The quadrature rules should be applied over each of the > subelements individually (or through a macro-quadrature rule). > Isn't this also an issue when integrating solution variables or > their shape functions? Yes; how we do things now is to just copy a Gaussian rule over each subelement. I guess it's not a serious problem, but tripling the cost of FEM calculations isn't something to be happy about. Do you have any references to macroelement-specific quadrature rules in the literature? I'd been thinking about deriving something more efficient for the cubic CT, but I'd hate to reinvent the wheel. > If the solution variables need to C1 wrt xyz, then I think there > are some requirements for the geometry representation. It entirely depends on the finite element space - Clough-Tochers will build a C1 solution space on top of any geometry; Hermites need consistent local coordinate directions at nodes. --- Roy ```
 Re: [Libmesh-devel] non-Lagrange FEFamily for geometry From: Karl Tomlinson - 2006-08-09 09:46:03 ```Thanks for the explanations, Roy. I now have a better idea of some of the issues involved. I'll have to have a deeper look into solution and geometry implementations to work out how they can be made more similar and provide extra dofs for the geometry (while still keeping [or making] the API abstract enough to allow other representations in the future). Although, maybe I'll spend a bit more time getting used to libMesh as is, before diving into changing core functionality. Roy Stogner writes: > On Tue, 8 Aug 2006, Karl Tomlinson wrote: > >>> ... I'd be worried about what Clough-Tocher mappings >>> might do to your quadrature rules. Granted, any kind of non-affine >>> map can mess up your nice exact Gaussian quadrature, but the >>> Clough-Tocher basis functions have internal subelement boundaries >>> which might be even worse. >> >> The quadrature rules should be applied over each of the >> subelements individually (or through a macro-quadrature rule). >> Isn't this also an issue when integrating solution variables or >> their shape functions? > > Yes; how we do things now is to just copy a Gaussian rule over each > subelement. I guess it's not a serious problem, but tripling the cost > of FEM calculations isn't something to be happy about. That is what I thought was appropriate, with the weights and abscissae the same in each subelement (apart from a simple transformation from macroelement to subelement xi-space). > > Do you have any references to macroelement-specific quadrature rules > in the literature? I'd been thinking about deriving something more > efficient for the cubic CT, but I'd hate to reinvent the wheel. I was merely thinking that implementing the three Gaussian copies as a one set of weights and abscissae would keep loops over quadrature points simple. I haven't looked at libMesh's implementation. Maybe that is what you already do. ```
 Re: [Libmesh-devel] non-Lagrange FEFamily for geometry From: Roy Stogner - 2006-08-09 12:50:58 ```On Wed, 9 Aug 2006, Karl Tomlinson wrote: >> Do you have any references to macroelement-specific quadrature rules >> in the literature? I'd been thinking about deriving something more >> efficient for the cubic CT, but I'd hate to reinvent the wheel. > > I was merely thinking that implementing the three Gaussian copies > as a one set of weights and abscissae would keep loops over > quadrature points simple. I haven't looked at libMesh's > implementation. Maybe that is what you already do. No, we duplicate the weights and pre-transform the point locations - that only wastes a tiny bit of RAM, and it keeps the code simpler. What I was thinking when talking about macroelement-specific rules is that it's very unlikely that the duplicated-Gaussian is the most efficient quadrature rule on a macroelement. For example it seems like you could shave a few points off of the rule by coming up with something that would exactly integrate all of the pairs of Clough-Tocher functions (and/or their derivatives) but wouldn't necessarily give an exact answer on any product of piecewise cubic polynomials (or their derivatives), since most of the piecewise cubics aren't C1 and so aren't in the CT space. --- Roy ```
 Re: [Libmesh-devel] non-Lagrange FEFamily for geometry From: Karl Tomlinson - 2006-08-09 20:59:49 ```Roy Stogner writes: > On Wed, 9 Aug 2006, Karl Tomlinson wrote: > >>> Do you have any references to macroelement-specific quadrature rules >>> in the literature? I'd been thinking about deriving something more >>> efficient for the cubic CT, but I'd hate to reinvent the wheel. >> >> I was merely thinking that implementing the three Gaussian copies >> as a one set of weights and abscissae would keep loops over >> quadrature points simple. I haven't looked at libMesh's >> implementation. Maybe that is what you already do. > > No, we duplicate the weights and pre-transform the point locations - > that only wastes a tiny bit of RAM, and it keeps the code simpler. Sounds sensible. (I think we might be trying to describe the same thing.) > > What I was thinking when talking about macroelement-specific rules is > that it's very unlikely that the duplicated-Gaussian is the most > efficient quadrature rule on a macroelement. For example it seems > like you could shave a few points off of the rule by coming up with > something that would exactly integrate all of the pairs of > Clough-Tocher functions (and/or their derivatives) but wouldn't > necessarily give an exact answer on any product of piecewise cubic > polynomials (or their derivatives), since most of the piecewise cubics > aren't C1 and so aren't in the CT space. Sounds possible. I don't know if has been done before. Would be an interesting study. But if the Jacobian is not constant, or the integral is not just a product of shape functions/derivatives, it could mess things up a bit. I'd feel safer with something that at least handled the cubic(-squared)-order variations. If your goal is just to make the code faster, I can't help wondering if the same time could be spent making bigger gains elsewhere. ```