## Re: [Libmesh-users] Questions about shape function and element

 Re: [Libmesh-users] Questions about shape function and element From: Roy Stogner - 2006-03-01 20:25:33 ```On Wed, 1 Mar 2006, David Xu wrote: > I'd like to know when you expect to have a working 3D hermite > polynomial in place? Well, the bug hunting hasn't been high on my priority list since the 3D version of my method has a couple harder obstacles to overcome first. I can give it more attention if I know there's other people waiting to use the code, but it won't be fixed any time in the next week. > I'm trying to model 3D time-independent schrodinger equation and > some references tell me using hermite polynomial with C1 continuity > has clear advantage over Lagrange polynomial. I'm not sure the advantages will be clear unless your weak formulation depends on integrals on a W^{2,p} space. C1 elements can give you similar accuracy with fewer DoFs (I think ~8 per element instead of ~27 when comparing C0 and C1 cubic hexes), I suppose. > What's the highest order of Lagrange polynomial supported? Only linears and quadratics are supported with a Lagrange basis on most elements, and AFAIK only pseudo-linears are supported on pyramid elements. We've also got a set of hierarchic elements you might be interesed in. They're not very complete, but they do include cubic 3D hexes, without any rectilinear mesh restrictions. >> No. The higher order elements give you the chance to use higher order >> mapping functions, and give libMesh more places to put degrees of >> freedom (because edge and face DoFs are usually necessary for higher >> order shape functions), but if you just convert a QUAD4 mesh into a >> QUAD9 mesh while specifying bilinear shape functions it shouldn't >> change your results beyond whatever different floating-point errors >> do to the mapping functions. > > So, is the number of nodes in an element unrelated to the order of > Lagrange polynomial in libmesh? Not unrelated - if you want quadratic Lagrange elements, then you need second order geometric elements like QUAD9. However, if you want linear elements, then you can still use second order geometric elements (to better resolve a curved boundary, for instance). > How do I sepcify the order of gauss quadrature? When you construct a QGauss object, one of the parameters is the degree of polynomials you want to exactly integrate. You can also call FEType::default_quadrature_rule() if you have an FEType corresponding to an element of order p and you want a quadrature rule that exactly integrates polynomials of degree 2p+1. That's the safest way to go if you want compatibility with future more exotic elements, too. Macroelement basis functions require Gaussian rules on each of their subelements for exact integration, for example. --- Roy ```

 [Libmesh-users] Questions about shape function and element From: David Xu - 2006-03-01 18:54:28 ```Hi everyone, My questions are: 1. Does libmesh support Hermite polynomial shape function? If so, how do I specify it in the my code? I didn't find any indication in the examples. I assume they all use Lagrange polynomial as default? 2. How do I specify the polynomial order (p) in the code? 3. In this line equation_systems("Poisson").add_variable("u", SECOND); Is "SECOND" the order of polynomial shape function or the order of gauss quadrature? 4. Do the element types (QUAD4, QUAD9, etc.) already include polynomial order information implicitly? Thanks for your time, David ```
 Re: [Libmesh-users] Questions about shape function and element From: Roy Stogner - 2006-03-01 19:17:39 ```On Wed, 1 Mar 2006, David Xu wrote: > 1. Does libmesh support Hermite polynomial shape function? Yes, but as far as I know only the 2D case (the Bogner-Fox-Schmidt rectangle) is well tested. I just caught a bug in the 3D Hermite a little while ago, and I think there's still a bug remaining. I haven't tested the 1D case at all except insofar as the 1D code gets used by the 2D element. > If so, how do I specify it in the my code? By overwriting the default argument to ::add_variable(), like so: system.add_variable("u", THIRD, HERMITE); Note that only cubics (THIRD) are supported by the Hermite elements, and your mesh had better be rectilinear if you want them to work correctly. > I didn't find any indication in the examples. That's my fault. I don't want to commit an updated example 15 until I'm certain the 3D case is working correctly. > I assume they all use Lagrange polynomial as default? Yes. > 2. How do I specify the polynomial order (p) in the code? In the second argument to add_variable(). > 3. In this line equation_systems("Poisson").add_variable("u", SECOND); > Is "SECOND" the order of polynomial shape function or the order of > gauss quadrature? The polynomial order. > 4. Do the element types (QUAD4, QUAD9, etc.) already include > polynomial order information implicitly? No. The higher order elements give you the chance to use higher order mapping functions, and give libMesh more places to put degrees of freedom (because edge and face DoFs are usually necessary for higher order shape functions), but if you just convert a QUAD4 mesh into a QUAD9 mesh while specifying bilinear shape functions it shouldn't change your results beyond whatever different floating-point errors do to the mapping functions. --- Roy Stogner ```
 Re: [Libmesh-users] Questions about shape function and element From: David Xu - 2006-03-01 19:57:15 ```Roy, Thanks for your quick and thorough answers. I have some follow-up questions= : > > > 1. Does libmesh support Hermite polynomial shape function? > > Yes, but as far as I know only the 2D case (the Bogner-Fox-Schmidt > rectangle) is well tested. I just caught a bug in the 3D Hermite a > little while ago, and I think there's still a bug remaining. I > haven't tested the 1D case at all except insofar as the 1D code gets > used by the 2D element. > > > If so, how do I specify it in the my code? > > By overwriting the default argument to ::add_variable(), like so: > > system.add_variable("u", THIRD, HERMITE); > > Note that only cubics (THIRD) are supported by the Hermite elements, > and your mesh had better be rectilinear if you want them to work > correctly. I'd like to know when you expect to have a working 3D hermite polynomial in place? I'm trying to model 3D time-independent schrodinger equation and some references tell me using hermite polynomial with C1 continuity has clear advantage over Lagrange polynomial. What's the highest order of Lagrange polynomial supported? > > I didn't find any indication in the examples. > > That's my fault. I don't want to commit an updated example 15 until > I'm certain the 3D case is working correctly. > > > I assume they all use Lagrange polynomial as default? > > Yes. > > 2. How do I specify the polynomial order (p) in the code? > > In the second argument to add_variable(). > > > 3. In this line equation_systems("Poisson").add_variable("u", SECOND); > > Is "SECOND" the order of polynomial shape function or the order of > > gauss quadrature? > > The polynomial order. > > > 4. Do the element types (QUAD4, QUAD9, etc.) already include > > polynomial order information implicitly? > > No. The higher order elements give you the chance to use higher order > mapping functions, and give libMesh more places to put degrees of > freedom (because edge and face DoFs are usually necessary for higher > order shape functions), but if you just convert a QUAD4 mesh into a > QUAD9 mesh while specifying bilinear shape functions it shouldn't > change your results beyond whatever different floating-point errors > do to the mapping functions. So, is the number of nodes in an element unrelated to the order of Lagrange polynomial in libmesh? How do I sepcify the order of gauss quadrature? Thanks, David ```
 Re: [Libmesh-users] Questions about shape function and element From: Roy Stogner - 2006-03-01 20:25:33 ```On Wed, 1 Mar 2006, David Xu wrote: > I'd like to know when you expect to have a working 3D hermite > polynomial in place? Well, the bug hunting hasn't been high on my priority list since the 3D version of my method has a couple harder obstacles to overcome first. I can give it more attention if I know there's other people waiting to use the code, but it won't be fixed any time in the next week. > I'm trying to model 3D time-independent schrodinger equation and > some references tell me using hermite polynomial with C1 continuity > has clear advantage over Lagrange polynomial. I'm not sure the advantages will be clear unless your weak formulation depends on integrals on a W^{2,p} space. C1 elements can give you similar accuracy with fewer DoFs (I think ~8 per element instead of ~27 when comparing C0 and C1 cubic hexes), I suppose. > What's the highest order of Lagrange polynomial supported? Only linears and quadratics are supported with a Lagrange basis on most elements, and AFAIK only pseudo-linears are supported on pyramid elements. We've also got a set of hierarchic elements you might be interesed in. They're not very complete, but they do include cubic 3D hexes, without any rectilinear mesh restrictions. >> No. The higher order elements give you the chance to use higher order >> mapping functions, and give libMesh more places to put degrees of >> freedom (because edge and face DoFs are usually necessary for higher >> order shape functions), but if you just convert a QUAD4 mesh into a >> QUAD9 mesh while specifying bilinear shape functions it shouldn't >> change your results beyond whatever different floating-point errors >> do to the mapping functions. > > So, is the number of nodes in an element unrelated to the order of > Lagrange polynomial in libmesh? Not unrelated - if you want quadratic Lagrange elements, then you need second order geometric elements like QUAD9. However, if you want linear elements, then you can still use second order geometric elements (to better resolve a curved boundary, for instance). > How do I sepcify the order of gauss quadrature? When you construct a QGauss object, one of the parameters is the degree of polynomials you want to exactly integrate. You can also call FEType::default_quadrature_rule() if you have an FEType corresponding to an element of order p and you want a quadrature rule that exactly integrates polynomials of degree 2p+1. That's the safest way to go if you want compatibility with future more exotic elements, too. Macroelement basis functions require Gaussian rules on each of their subelements for exact integration, for example. --- Roy ```
 Re: [Libmesh-users] Questions about shape function and element From: David Xu - 2006-03-06 01:23:39 ```Roy, > > So, is the number of nodes in an element unrelated to the order of > > Lagrange polynomial in libmesh? > > Not unrelated - if you want quadratic Lagrange elements, then you need > second order geometric elements like QUAD9. However, if you want > linear elements, then you can still use second order geometric > elements (to better resolve a curved boundary, for instance). I'm still not clear about how to match the a geometric element type to the polynomial type and order that can be applied to this geometric element. Say, if I want to use EDGE4 for a 1D problem. What are my choices in terms of the order of Lagrange, Hierarchic, Hermite and CLOUGH polynomials? Thanks, David ```
 Re: [Libmesh-users] Questions about shape function and element From: Roy Stogner - 2006-03-06 06:11:21 ```On Sun, 5 Mar 2006, David Xu wrote: >>> So, is the number of nodes in an element unrelated to the order of >>> Lagrange polynomial in libmesh? >> >> Not unrelated - if you want quadratic Lagrange elements, then you need >> second order geometric elements like QUAD9. However, if you want >> linear elements, then you can still use second order geometric >> elements (to better resolve a curved boundary, for instance). > > I'm still not clear about how to match the a geometric element type to > the polynomial type and order that can be applied to this geometric > element. Hmm... I'm actually not sure if there is a clear way other than "look through the src/fe/ code" or "try instantiating the element and see if your program aborts". Ben? If you know something about your finite element's shape functions, then the simplest rule is that your geometric element has to have geometric nodes with the same connectivity. A quadratic element has degrees of freedom on element edges, for example, so will only work on elements with edge nodes. A C1 Hermite cube has degrees of freedom only on its corners, so will work on first order geometric elements. > Say, if I want to use EDGE4 for a 1D problem. What are my > choices in terms of the order of Lagrange, Hierarchic, Hermite and > CLOUGH polynomials? I think EDGE4 was specifically intended to give cubic Lagrange functions in 1D. It looks like the monomials (and the "xyz" basis: monomials in global coordinates) also support it... but I confess, the way I found this out was "grep EDGE4 src/fe/*.C" --- Roy Stogner ```