MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
fe_h1.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_FE_H1
13#define MFEM_FE_H1
14
15#include "fe_base.hpp"
16#include "fe_pyramid.hpp"
17
18namespace mfem
19{
20
21/// Arbitrary order H1 elements in 1D
23{
24private:
25#ifndef MFEM_THREAD_SAFE
26 mutable Vector shape_x, dshape_x, d2shape_x;
27#endif
28
29public:
30 /// Construct the H1_SegmentElement of order @a p and BasisType @a btype
31 H1_SegmentElement(const int p, const int btype = BasisType::GaussLobatto);
32 void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
33 void CalcDShape(const IntegrationPoint &ip,
34 DenseMatrix &dshape) const override;
35 void CalcHessian(const IntegrationPoint &ip,
36 DenseMatrix &Hessian) const override;
37 void ProjectDelta(int vertex, Vector &dofs) const override;
38};
39
40
41/// Arbitrary order H1 elements in 2D on a square
43{
44private:
45#ifndef MFEM_THREAD_SAFE
46 mutable Vector shape_x, shape_y, dshape_x, dshape_y, d2shape_x, d2shape_y;
47#endif
48
49public:
50 /// Construct the H1_QuadrilateralElement of order @a p and BasisType @a btype
51 H1_QuadrilateralElement(const int p,
52 const int btype = BasisType::GaussLobatto);
53 void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
54 void CalcDShape(const IntegrationPoint &ip,
55 DenseMatrix &dshape) const override;
56 void CalcHessian(const IntegrationPoint &ip,
57 DenseMatrix &Hessian) const override;
58 void ProjectDelta(int vertex, Vector &dofs) const override;
59};
60
61
62/// Arbitrary order H1 elements in 3D on a cube
64{
65private:
66#ifndef MFEM_THREAD_SAFE
67 mutable Vector shape_x, shape_y, shape_z, dshape_x, dshape_y, dshape_z,
68 d2shape_x, d2shape_y, d2shape_z;
69#endif
70
71public:
72 /// Construct the H1_HexahedronElement of order @a p and BasisType @a btype
73 H1_HexahedronElement(const int p, const int btype = BasisType::GaussLobatto);
74 void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
75 void CalcDShape(const IntegrationPoint &ip,
76 DenseMatrix &dshape) const override;
77 void CalcHessian(const IntegrationPoint &ip,
78 DenseMatrix &Hessian) const override;
79 void ProjectDelta(int vertex, Vector &dofs) const override;
80};
81
82
83/// Arbitrary order H1 elements in 2D on a triangle
85{
86private:
87#ifndef MFEM_THREAD_SAFE
88 mutable Vector shape_x, shape_y, shape_l, dshape_x, dshape_y, dshape_l, u;
89 mutable Vector ddshape_x, ddshape_y, ddshape_l;
90 mutable DenseMatrix du, ddu;
91#endif
93
94public:
95 /// Construct the H1_TriangleElement of order @a p and BasisType @a btype
96 H1_TriangleElement(const int p, const int btype = BasisType::GaussLobatto);
97 void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
98 void CalcDShape(const IntegrationPoint &ip,
99 DenseMatrix &dshape) const override;
100 void CalcHessian(const IntegrationPoint &ip,
101 DenseMatrix &ddshape) const override;
102};
103
104
105/// Arbitrary order H1 elements in 3D on a tetrahedron
107{
108private:
109#ifndef MFEM_THREAD_SAFE
110 mutable Vector shape_x, shape_y, shape_z, shape_l;
111 mutable Vector dshape_x, dshape_y, dshape_z, dshape_l, u;
112 mutable Vector ddshape_x, ddshape_y, ddshape_z, ddshape_l;
113 mutable DenseMatrix du, ddu;
114#endif
116
117public:
118 /// Construct the H1_TetrahedronElement of order @a p and BasisType @a btype
119 H1_TetrahedronElement(const int p,
120 const int btype = BasisType::GaussLobatto);
121 void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
122 void CalcDShape(const IntegrationPoint &ip,
123 DenseMatrix &dshape) const override;
124 void CalcHessian(const IntegrationPoint &ip,
125 DenseMatrix &ddshape) const override;
126};
127
128
129
130/// Arbitrary order H1 elements in 3D on a wedge
132{
133private:
134#ifndef MFEM_THREAD_SAFE
135 mutable Vector t_shape, s_shape;
136 mutable DenseMatrix t_dshape, s_dshape;
137#endif
138 Array<int> t_dof, s_dof;
139
140 H1_TriangleElement TriangleFE;
141 H1_SegmentElement SegmentFE;
142
143public:
144 /// Construct the H1_WedgeElement of order @a p and BasisType @a btype
145 H1_WedgeElement(const int p,
146 const int btype = BasisType::GaussLobatto);
147 void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
148 void CalcDShape(const IntegrationPoint &ip,
149 DenseMatrix &dshape) const override;
150};
151
152/** Arbitrary order H1 basis functions defined on pyramid-shaped elements
153
154 This implementation is closely based on the finite elements
155 described in section 9.1 of the paper "Orientation embedded high
156 order shape functions for the exact sequence elements of all shapes"
157 by Federico Fuentes, Brendan Keith, Leszek Demkowicz, and Sriram
158 Nagaraj, see https://doi.org/10.1016/j.camwa.2015.04.027.
159 */
161 : public NodalFiniteElement, public FuentesPyramid
162{
163private:
164 mutable real_t zmax;
165
166#ifndef MFEM_THREAD_SAFE
167 mutable Vector tmp_i, tmp_u;
168 mutable DenseMatrix tmp1_ij, tmp2_ij, tmp_du;
169 mutable DenseTensor tmp_ijk;
170#endif
172
173 void calcBasis(const int p, const IntegrationPoint &ip,
174 Vector &phi_i, DenseMatrix &phi_ij, Vector &u) const;
175 void calcGradBasis(const int p, const IntegrationPoint &ip,
176 Vector &phi_i, DenseMatrix &dphi_i,
177 DenseMatrix &phi_ij, DenseTensor &dphi_ij,
178 DenseMatrix &du) const;
179
180public:
181 H1_FuentesPyramidElement(const int p,
182 const int btype = BasisType::GaussLobatto);
183 virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
184 virtual void CalcDShape(const IntegrationPoint &ip,
185 DenseMatrix &dshape) const;
186 void CalcRawShape(const IntegrationPoint &ip, Vector &shape) const;
187 void CalcRawDShape(const IntegrationPoint &ip,
188 DenseMatrix &dshape) const;
189
190 real_t GetZetaMax() const { return zmax; }
191};
192
193/** Arbitrary order H1 basis functions defined on pyramid-shaped elements
194
195 This implementation is based on the finite elements described in the
196 2010 paper "Higher-Order Finite Elements for Hybrid Meshes Using New
197 Nodal Pyramidal Elements" by Morgane Bergot, Gary Cohen, and Marc
198 Durufle, see https://hal.archives-ouvertes.fr/hal-00454261.
199 */
201{
202private:
203#ifndef MFEM_THREAD_SAFE
204 mutable Vector shape_x, shape_y, shape_z;
205 mutable Vector dshape_x, dshape_y, dshape_z, dshape_z_dt, u;
206 mutable Vector ddshape_x, ddshape_y, ddshape_z;
207 mutable DenseMatrix du, ddu;
208#endif
210
211public:
212 H1_BergotPyramidElement(const int p,
213 const int btype = BasisType::GaussLobatto);
214 virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
215 virtual void CalcDShape(const IntegrationPoint &ip,
216 DenseMatrix &dshape) const;
217};
218
219} // namespace mfem
220
221#endif
@ GaussLobatto
Closed type.
Definition fe_base.hpp:36
Data type dense matrix using column-major storage.
Definition densemat.hpp:24
Rank 3 tensor (array of matrices)
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition fe_h1.cpp:1784
H1_BergotPyramidElement(const int p, const int btype=BasisType::GaussLobatto)
Definition fe_h1.cpp:1628
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition fe_h1.cpp:1818
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition fe_h1.cpp:1170
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition fe_h1.cpp:1186
void CalcRawShape(const IntegrationPoint &ip, Vector &shape) const
Definition fe_h1.cpp:1203
H1_FuentesPyramidElement(const int p, const int btype=BasisType::GaussLobatto)
Definition fe_h1.cpp:1043
void CalcRawDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Definition fe_h1.cpp:1216
Arbitrary order H1 elements in 3D on a cube.
Definition fe_h1.hpp:64
H1_HexahedronElement(const int p, const int btype=BasisType::GaussLobatto)
Construct the H1_HexahedronElement of order p and BasisType btype.
Definition fe_h1.cpp:265
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition fe_h1.cpp:293
void ProjectDelta(int vertex, Vector &dofs) const override
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition fe_h1.cpp:367
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &Hessian) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition fe_h1.cpp:338
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition fe_h1.cpp:314
Arbitrary order H1 elements in 2D on a square.
Definition fe_h1.hpp:43
void ProjectDelta(int vertex, Vector &dofs) const override
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition fe_h1.cpp:216
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition fe_h1.cpp:151
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition fe_h1.cpp:170
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &Hessian) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition fe_h1.cpp:192
H1_QuadrilateralElement(const int p, const int btype=BasisType::GaussLobatto)
Construct the H1_QuadrilateralElement of order p and BasisType btype.
Definition fe_h1.cpp:125
Arbitrary order H1 elements in 1D.
Definition fe_h1.hpp:23
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition fe_h1.cpp:40
H1_SegmentElement(const int p, const int btype=BasisType::GaussLobatto)
Construct the H1_SegmentElement of order p and BasisType btype.
Definition fe_h1.cpp:21
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &Hessian) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition fe_h1.cpp:78
void ProjectDelta(int vertex, Vector &dofs) const override
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition fe_h1.cpp:97
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition fe_h1.cpp:59
Arbitrary order H1 elements in 3D on a tetrahedron.
Definition fe_h1.hpp:107
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &ddshape) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition fe_h1.cpp:816
H1_TetrahedronElement(const int p, const int btype=BasisType::GaussLobatto)
Construct the H1_TetrahedronElement of order p and BasisType btype.
Definition fe_h1.cpp:617
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition fe_h1.cpp:758
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition fe_h1.cpp:783
Arbitrary order H1 elements in 2D on a triangle.
Definition fe_h1.hpp:85
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition fe_h1.cpp:555
void CalcHessian(const IntegrationPoint &ip, DenseMatrix &ddshape) const override
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition fe_h1.cpp:584
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition fe_h1.cpp:533
H1_TriangleElement(const int p, const int btype=BasisType::GaussLobatto)
Construct the H1_TriangleElement of order p and BasisType btype.
Definition fe_h1.cpp:451
Arbitrary order H1 elements in 3D on a wedge.
Definition fe_h1.hpp:132
void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const override
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition fe_h1.cpp:1018
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition fe_h1.cpp:999
H1_WedgeElement(const int p, const int btype=BasisType::GaussLobatto)
Construct the H1_WedgeElement of order p and BasisType btype.
Definition fe_h1.cpp:863
Class for integration point with weight.
Definition intrules.hpp:35
Class for standard nodal finite elements.
Definition fe_base.hpp:721
Vector data type.
Definition vector.hpp:82
real_t u(const Vector &xvec)
Definition lor_mms.hpp:22
float real_t
Definition config.hpp:43
real_t p(const Vector &x, real_t t)