BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
fn_create_fifth_order_beam_poly.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_FN_CREATE_FIFTH_ORDER_BEAM_POLY_HPP
13#define BELFEM_FN_CREATE_FIFTH_ORDER_BEAM_POLY_HPP
14
15#include "typedefs.hpp"
16#include "cl_Vector.hpp"
17#include "cl_Matrix.hpp"
19
20namespace belfem
21{
22 inline void
23 create_fifth_order_beam_poly( const real aX1, const real aF1, const real adF1dX, const real ad2F1dX,
24 const real aX2, const real aF2, const real adF2dX, const real ad2F2dX,
25 Vector <real> & aCoefficients, Matrix< real > & aWork, Vector< int_t > & aPivot )
26 {
27 BELFEM_ASSERT( aWork.n_rows() == 6 && aWork.n_cols() == 6, "Work Matrix must be 6x6" );
28 BELFEM_ASSERT( aPivot.length() >= 6, "Pivot Vector must be at least of length 6" );
29
30 // populate the matrix
31 aWork( 0, 0 ) = aX1 * aX1 * aX1 * aX1 * aX1;
32 aWork( 1, 0 ) = 5 * aX1 * aX1 * aX1 * aX1;
33 aWork( 2, 0 ) = 20 * aX1 * aX1 * aX1;
34 aWork( 3, 0 ) = aX2 * aX2 * aX2 * aX2 * aX2;
35 aWork( 4, 0 ) = 5 * aX2 * aX2 * aX2 * aX2;
36 aWork( 5, 0 ) = 20 * aX2 * aX2 * aX2;
37
38 aWork( 0, 1 ) = aX1 * aX1 * aX1 * aX1;
39 aWork( 1, 1 ) = 4 * aX1 * aX1 * aX1;
40 aWork( 2, 1 ) = 12 * aX1 * aX1;
41 aWork( 3, 1 ) = aX2 * aX2 * aX2 * aX2;
42 aWork( 4, 1 ) = 4 * aX2 * aX2 * aX2;
43 aWork( 5, 1 ) = 12 * aX2 * aX2;
44
45 aWork( 0, 2 ) = aX1 * aX1 * aX1;
46 aWork( 1, 2 ) = 3 * aX1 * aX1;
47 aWork( 2, 2 ) = 6 * aX1;
48 aWork( 3, 2 ) = aX2 * aX2 * aX2;
49 aWork( 4, 2 ) = 3 * aX2 * aX2;
50 aWork( 5, 2 ) = 6 * aX2;
51
52 aWork( 0, 3 ) = aX1 * aX1;
53 aWork( 1, 3 ) = 2 * aX1;
54 aWork( 2, 3 ) = 2.0;
55 aWork( 3, 3 ) = aX2 * aX2;
56 aWork( 4, 3 ) = 2 * aX2;
57 aWork( 5, 3 ) = 2.0;
58
59 aWork( 0, 4 ) = aX1;
60 aWork( 1, 4 ) = 1.0;
61 aWork( 2, 4 ) = 0;
62 aWork( 3, 4 ) = aX2;
63 aWork( 4, 4 ) = 1.0;
64 aWork( 5, 4 ) = 0.0;
65
66 aWork( 0, 5 ) = 1.0;
67 aWork( 1, 5 ) = 0.0;
68 aWork( 2, 5 ) = 0.0;
69 aWork( 3, 5 ) = 1.0;
70 aWork( 4, 5 ) = 0.0;
71 aWork( 5, 5 ) = 0.0;
72
73
74 // create the right hand side
75 aCoefficients.set_size( 6 );
76
77 aCoefficients( 0 ) = aF1;
78 aCoefficients( 1 ) = adF1dX;
79 aCoefficients( 2 ) = ad2F1dX;
80 aCoefficients( 3 ) = aF2;
81 aCoefficients( 4 ) = adF2dX;
82 aCoefficients( 5 ) = ad2F2dX;
83
84 // solve the system and return the coefficients
85 gesv( aWork, aCoefficients, aPivot );
86 }
87
88 inline void
89 create_fifth_order_beam_poly( const real aX1, const real aF1, const real adF1dX, const real ad2F1dX,
90 const real aX2, const real aF2, const real adF2dX, const real ad2F2dX,
91 Vector <real> & aCoefficients )
92 {
93 // create the vandermonde matrix
94 Matrix <real> tVandermonde( 6, 6 );
95
96 Vector< int_t > tPivot( 6 );
97
98 create_fifth_order_beam_poly( aX1, aF1, adF1dX, ad2F1dX, aX2, aF2, adF2dX, ad2F2dX, aCoefficients, tVandermonde, tPivot );
99 }
100
101}
102#endif //BELFEM_FN_CREATE_FIFTH_ORDER_BEAM_POLY_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
size_t n_rows() const
Definition cl_AR_Matrix.hpp:205
size_t n_cols() const
Definition cl_AR_Matrix.hpp:213
void set_size(const size_t aNumRows)
change the size of the vector
Definition cl_AR_Vector.hpp:237
size_t length() const
get the length of the vector
Definition cl_AR_Vector.hpp:257
Solves a square linear system by LU factorization (LAPACK ?gesv).
USER GUIDES:
Definition cl_Capacitor.cpp:16
int_t gesv(Matrix< T > &A, Vector< T > &B, Vector< int_t > &Pivot, const bool AbortOnError=true)
solve the square linear system A * x = b via LAPACK ?gesv ( LU factorization with partial pivoting )
Definition fn_gesv.hpp:222
void create_fifth_order_beam_poly(const real aX1, const real aF1, const real adF1dX, const real ad2F1dX, const real aX2, const real aF2, const real adF2dX, const real ad2F2dX, Vector< real > &aCoefficients, Matrix< real > &aWork, Vector< int_t > &aPivot)
Definition fn_create_fifth_order_beam_poly.hpp:23
double real
Definition typedefs.hpp:36