BELFEM
0.9.0
Berkeley Lab Finite Element Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
cl_IF_LINE5.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_LINE5_HPP
13
#define BELFEM_CL_IF_LINE5_HPP
14
15
16
#include "
cl_IF_InterpolationFunctionTemplate.hpp
"
17
18
namespace
belfem
19
{
20
namespace
fem
21
{
22
//------------------------------------------------------------------------------
23
24
template
<>
25
InterpolationOrder
26
InterpolationFunctionTemplate
<
27
GeometryType::LINE
,
InterpolationType::LAGRANGE
, 1, 5 >
28
::interpolation_order
()
const
29
{
30
return
InterpolationOrder::QUARTIC
;
31
}
32
33
//------------------------------------------------------------------------------
34
35
template
<>
36
ElementType
37
InterpolationFunctionTemplate
<
38
GeometryType::LINE
,
InterpolationType::LAGRANGE
, 1, 5 >
39
::element_type
()
const
40
{
41
return
ElementType::LINE5
;
42
}
43
44
//------------------------------------------------------------------------------
45
46
template
<>
47
void
48
InterpolationFunctionTemplate
<
49
GeometryType::LINE
,
InterpolationType::LAGRANGE
, 1, 5 >
50
::param_coords
(
Matrix< real >
& aXiHat )
const
51
{
52
aXiHat.
set_size
( 1, 5 );
53
54
aXiHat( 0, 0 ) = -1.0 ;
55
aXiHat( 0, 1 ) = 1.0 ;
56
aXiHat( 0, 2 ) = -0.5 ;
57
aXiHat( 0, 3 ) = 0.0 ;
58
aXiHat( 0, 4 ) = 0.5 ;
59
}
60
61
//------------------------------------------------------------------------------
62
63
template
<>
64
void
65
InterpolationFunctionTemplate
<
66
GeometryType::LINE
,
InterpolationType::LAGRANGE
, 1, 5 >
::N
(
67
const
Vector< real >
& aXi,
68
Matrix< real >
& aN )
const
69
{
70
const
real
xi = aXi( 0 );
71
72
aN.
set_size
( 1, 5 );
73
74
aN( 0, 0 ) = xi*(1.-xi*(1.+xi*(4.-4.*xi)));
75
aN( 0, 1 ) = xi*((4.*(xi+1.)*xi-1.)*xi-1.);
76
aN( 0, 2 ) = xi*(((8.-16.*xi)*xi+16.)*xi-8.);
77
aN( 0, 3 ) = (24.*xi*xi - 30.)*xi*xi + 6.;
78
aN( 0, 4 ) = xi*(8.+xi*(16.-xi*(8.+16.*xi)));
79
80
aN /= 6.0 ;
81
}
82
83
//------------------------------------------------------------------------------
84
85
template
<>
86
void
87
InterpolationFunctionTemplate
<
88
GeometryType::LINE
,
InterpolationType::LAGRANGE
, 1, 5 >
::dNdXi
(
89
const
Vector< real >
& aXi,
90
Matrix< real >
& adNdXi )
const
91
{
92
const
real
xi = aXi( 0 );
93
94
adNdXi.
set_size
( 1, 5 );
95
96
adNdXi( 0, 0 ) = xi*((16.*xi-12.)*xi-2.)+1.;
97
adNdXi( 0, 1 ) = xi*((16.*xi+12.)*xi-2.)-1.;
98
adNdXi( 0, 2 ) = 8.*xi*(4.+(3.-8.*xi)*xi)-8.;
99
adNdXi( 0, 3 ) = xi*(96.*xi*xi-60.);
100
adNdXi( 0, 4 ) = 8.+ xi*(32.-xi*(64.*xi+24.));
101
102
adNdXi /= 6.0 ;
103
104
}
105
106
//------------------------------------------------------------------------------
107
108
template
<>
109
void
110
InterpolationFunctionTemplate
<
111
GeometryType::LINE
,
InterpolationType::LAGRANGE
, 1, 5 >
::d2NdXi2
(
112
const
Vector< real >
& aXi,
113
Matrix< real >
& ad2NdXi2 )
const
114
{
115
ad2NdXi2.
set_size
( 1, 5 );
116
117
const
real
xi = aXi( 0 );
118
119
ad2NdXi2( 0, 0 ) = xi*(48.*xi-24.)-2.;
120
ad2NdXi2( 0, 1 ) = xi*(48.*xi+24.)-2.;
121
ad2NdXi2( 0, 2 ) = 32.+xi*(48.-192.*xi);
122
ad2NdXi2( 0, 3 ) = 288.*xi*xi-60;
123
ad2NdXi2( 0, 4 ) = 32.- xi*(192.*xi+48);
124
125
ad2NdXi2 /= 6.0 ;
126
127
}
128
129
//------------------------------------------------------------------------------
130
}
131
}
132
133
#endif
//BELFEM_CL_IF_LINE5_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::LINE5
@ LINE5
Definition
Mesh_Enums.hpp:52
belfem::InterpolationOrder
InterpolationOrder
Definition
Mesh_Enums.hpp:85
belfem::InterpolationOrder::QUARTIC
@ QUARTIC
Definition
Mesh_Enums.hpp:91
belfem::real
double real
Definition
typedefs.hpp:36
belfem::GeometryType::LINE
@ LINE
Definition
Mesh_Enums.hpp:72
src
fem
interpolation
lagrange
cl_IF_LINE5.hpp
Generated by
1.18.0