BELFEM
0.9.0
Berkeley Lab Finite Element Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
cl_IF_QUAD4.hpp
Go to the documentation of this file.
1
/*
2
* BELFEM -- The Berkeley Lab Finite Element Framework
3
* Copyright (c) 2026, The Regents of the University of California,
4
* through Lawrence Berkeley National Laboratory (subject to receipt of any required
5
* approvals from the U.S. Dept. of Energy). All rights reserved.
6
*
7
* Developers: Christian Messe, Gregory Giard
8
*
9
* See the top-level LICENSE file for the complete license and disclaimer.
10
*/
11
12
#ifndef BELFEM_CL_IF_QUAD4_HPP
13
#define BELFEM_CL_IF_QUAD4_HPP
14
15
#include "
cl_IF_InterpolationFunctionTemplate.hpp
"
16
17
namespace
belfem
18
{
19
namespace
fem
20
{
21
//------------------------------------------------------------------------------
22
23
template
<>
24
inline
InterpolationOrder
25
InterpolationFunctionTemplate
<
26
GeometryType::QUAD
,
InterpolationType::LAGRANGE
, 2, 4 >
27
::interpolation_order
()
const
28
{
29
return
InterpolationOrder::LINEAR
;
30
}
31
32
//------------------------------------------------------------------------------
33
34
template
<>
35
inline
ElementType
36
InterpolationFunctionTemplate
<
37
GeometryType::QUAD
,
InterpolationType::LAGRANGE
, 2, 4 >
38
::element_type
()
const
39
{
40
return
ElementType::QUAD4
;
41
}
42
43
//------------------------------------------------------------------------------
44
45
template
<>
46
inline
void
47
InterpolationFunctionTemplate
<
48
GeometryType::QUAD
,
InterpolationType::LAGRANGE
, 2, 4 >
49
::param_coords
(
Matrix< real >
& aXiHat )
const
50
{
51
aXiHat.
set_size
( 2, 4 );
52
53
aXiHat( 0, 0 ) = -1.000000;
54
aXiHat( 1, 0 ) = -1.000000;
55
56
aXiHat( 0, 1 ) = 1.000000;
57
aXiHat( 1, 1 ) = -1.000000;
58
59
aXiHat( 0, 2 ) = 1.000000;
60
aXiHat( 1, 2 ) = 1.000000;
61
62
aXiHat( 0, 3 ) = -1.000000;
63
aXiHat( 1, 3 ) = 1.000000;
64
}
65
66
//------------------------------------------------------------------------------
67
68
template
<>
69
inline
void
70
InterpolationFunctionTemplate
<
71
GeometryType::QUAD
,
InterpolationType::LAGRANGE
, 2, 4 >
::N
(
72
const
Vector< real >
& aXi,
73
Matrix< real >
& aN )
const
74
{
75
const
real
xi = aXi( 0 );
76
const
real
eta = aXi( 1 );
77
78
aN.
set_size
( 1, 4 );
79
80
aN( 0, 0 ) = ( ( 1.0 - xi ) * ( 1.0 - eta ) ) * 0.25;
81
aN( 0, 1 ) = ( ( 1.0 + xi ) * ( 1.0 - eta ) ) * 0.25;
82
aN( 0, 2 ) = ( ( 1.0 + xi ) * ( 1.0 + eta ) ) * 0.25;
83
aN( 0, 3 ) = ( ( 1.0 - xi ) * ( 1.0 + eta ) ) * 0.25;
84
}
85
86
//------------------------------------------------------------------------------
87
88
template
<>
89
inline
void
90
InterpolationFunctionTemplate
<
91
GeometryType::QUAD
,
InterpolationType::LAGRANGE
, 2, 4 >
::dNdXi
(
92
const
Vector< real >
& aXi,
93
Matrix< real >
& adNdXi )
const
94
{
95
const
real
xi = aXi( 0 );
96
const
real
eta = aXi( 1 );
97
98
adNdXi.
set_size
( 2, 4 );
99
100
adNdXi( 0, 0 ) = 0.25 * ( eta - 1.0 );
101
adNdXi( 1, 0 ) = 0.25 * ( xi - 1.0 );
102
103
adNdXi( 0, 1 ) = -0.25 * ( eta - 1.0 );
104
adNdXi( 1, 1 ) = -0.25 * ( xi + 1.0 );
105
106
adNdXi( 0, 2 ) = 0.25 * ( eta + 1.0 );
107
adNdXi( 1, 2 ) = 0.25 * ( xi + 1.0 );
108
109
adNdXi( 0, 3 ) = -0.25 * ( eta + 1.0 );
110
adNdXi( 1, 3 ) = -0.25 * ( xi - 1.0 );
111
}
112
113
//------------------------------------------------------------------------------
114
115
template
<>
116
inline
void
117
InterpolationFunctionTemplate
<
118
GeometryType::QUAD
,
InterpolationType::LAGRANGE
, 2, 4 >
::d2NdXi2
(
119
const
Vector< real >
& aXi,
120
Matrix< real >
& ad2NdXi2 )
const
121
{
122
ad2NdXi2.
set_size
( 3, 4 );
123
124
ad2NdXi2( 0, 0 ) = 0.0;
125
ad2NdXi2( 1, 0 ) = 0.0;
126
ad2NdXi2( 2, 0 ) = 0.25;
127
128
ad2NdXi2( 0, 1 ) = 0.0;
129
ad2NdXi2( 1, 1 ) = 0.0;
130
ad2NdXi2( 2, 1 ) = -0.25;
131
132
ad2NdXi2( 0, 2 ) = 0.0;
133
ad2NdXi2( 1, 2 ) = 0.0;
134
ad2NdXi2( 2, 2 ) = 0.25;
135
136
ad2NdXi2( 0, 3 ) = 0.0;
137
ad2NdXi2( 1, 3 ) = 0.0;
138
ad2NdXi2( 2, 3 ) = -0.25;
139
}
140
141
//------------------------------------------------------------------------------
142
}
143
}
144
145
#endif
//BELFEM_CL_IF_QUAD4_HPP
cl_IF_InterpolationFunctionTemplate.hpp
belfem::Matrix< real >
belfem::Matrix::set_size
void set_size(const size_t aNumRows, const size_t aNumCols)
Definition
cl_AR_Matrix.hpp:186
belfem::Vector< real >
belfem::fem::InterpolationFunctionTemplate
shape function templated class G : Geometry T : Type D : Dimension B : Number of Basis
Definition
cl_IF_InterpolationFunctionTemplate.hpp:25
belfem::fem::InterpolationFunctionTemplate::param_coords
void param_coords(Matrix< real > &aXiHat) const override
returns a matrix containing the parameter coordinates of the nodes < number of dimensions x number of...
Definition
cl_IF_InterpolationFunctionTemplate.hpp:49
belfem::fem::InterpolationFunctionTemplate::interpolation_order
InterpolationOrder interpolation_order() const override
returns the interpolation order
Definition
cl_IF_InterpolationFunctionTemplate.hpp:145
belfem::fem::InterpolationFunctionTemplate::d2NdXi2
void d2NdXi2(const Vector< real > &aXi, Matrix< real > &ad2NdXi2) const override
calculates the second derivative of the shape function in parameter space
Definition
cl_IF_InterpolationFunctionTemplate.hpp:110
belfem::fem::InterpolationFunctionTemplate::dNdXi
void dNdXi(const Vector< real > &aXi, Matrix< real > &adNdXi) const override
calculates the first derivative of the shape function in parameter space
Definition
cl_IF_InterpolationFunctionTemplate.hpp:89
belfem::fem::InterpolationFunctionTemplate::N
void N(const Vector< real > &aXi, Matrix< real > &aN) const override
evaluates the shape function at a given point
Definition
cl_IF_InterpolationFunctionTemplate.hpp:68
belfem::fem
Definition
cl_IFB_LINE3.hpp:21
belfem
USER GUIDES:
Definition
cl_Capacitor.cpp:16
belfem::InterpolationType::LAGRANGE
@ LAGRANGE
Definition
Mesh_Enums.hpp:100
belfem::element_type
ElementType element_type(const std::string &aStr)
Definition
Mesh_Enums.hpp:370
belfem::ElementType
ElementType
Element types.
Definition
Mesh_Enums.hpp:27
belfem::ElementType::QUAD4
@ QUAD4
Definition
Mesh_Enums.hpp:31
belfem::InterpolationOrder
InterpolationOrder
Definition
Mesh_Enums.hpp:85
belfem::InterpolationOrder::LINEAR
@ LINEAR
Definition
Mesh_Enums.hpp:87
belfem::real
double real
Definition
typedefs.hpp:36
belfem::GeometryType::QUAD
@ QUAD
Definition
Mesh_Enums.hpp:74
src
fem
interpolation
lagrange
cl_IF_QUAD4.hpp
Generated by
1.18.0