OOFEM 3.0
Loading...
Searching...
No Matches
fei2dquadbiquad.C
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35#include "fei2dquadbiquad.h"
36#include "floatmatrix.h"
37#include "floatarray.h"
38#include "floatarrayf.h"
39#include "floatmatrixf.h"
41
42namespace oofem {
43
45FEI2dQuadBiQuad :: evalN(const FloatArrayF<2> &lcoords)
46{
47 double u = lcoords[0];
48 double v = lcoords[1];
49
50 std::array<double, 3> a = {0.5 * ( u - 1.0 ) * u, 1.0 - u * u, 0.5 * ( u + 1.0 ) * u};
51 std::array<double, 3> b = {0.5 * ( v - 1.0 ) * v, 1.0 - v * v, 0.5 * ( v + 1.0 ) * v};
52
53 return {
54 a [ 0 ] * b [ 0 ],
55 a [ 2 ] * b [ 0 ],
56 a [ 2 ] * b [ 2 ],
57 a [ 0 ] * b [ 2 ],
58 a [ 1 ] * b [ 0 ],
59 a [ 2 ] * b [ 1 ],
60 a [ 1 ] * b [ 2 ],
61 a [ 0 ] * b [ 1 ],
62 a [ 1 ] * b [ 1 ],
63 };
64}
65
66void
67FEI2dQuadBiQuad :: evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const
68{
69 double u, v;
70
71 u = lcoords.at(1);
72 v = lcoords.at(2);
73
74 std::array<double, 3> a = {0.5 * ( u - 1.0 ) * u, 1.0 - u * u, 0.5 * ( u + 1.0 ) * u};
75 std::array<double, 3> b = {0.5 * ( v - 1.0 ) * v, 1.0 - v * v, 0.5 * ( v + 1.0 ) * v};
76
77 answer.resize(9);
78 answer.at(1) = a [ 0 ] * b [ 0 ];
79 answer.at(5) = a [ 1 ] * b [ 0 ];
80 answer.at(2) = a [ 2 ] * b [ 0 ];
81
82 answer.at(8) = a [ 0 ] * b [ 1 ];
83 answer.at(9) = a [ 1 ] * b [ 1 ];
84 answer.at(6) = a [ 2 ] * b [ 1 ];
85
86 answer.at(4) = a [ 0 ] * b [ 2 ];
87 answer.at(7) = a [ 1 ] * b [ 2 ];
88 answer.at(3) = a [ 2 ] * b [ 2 ];
89}
90
91
93FEI2dQuadBiQuad :: evaldNdxi(const FloatArrayF<2> &lc)
94{
95 double u = lc[0];
96 double v = lc[1];
97
98 std::array<double, 3> a = {0.5 * ( u - 1.0 ) * u, 1.0 - u * u, 0.5 * ( u + 1.0 ) * u};
99 std::array<double, 3> b = {0.5 * ( v - 1.0 ) * v, 1.0 - v * v, 0.5 * ( v + 1.0 ) * v};
100
101 std::array<double, 3> da = {u - 0.5, -2.0 * u, u + 0.5};
102 std::array<double, 3> db = {v - 0.5, -2.0 * v, v + 0.5};
103
104 return {
105 da [ 0 ] * b [ 0 ],
106 a [ 0 ] * db [ 0 ],
107 da [ 2 ] * b [ 0 ],
108 a [ 2 ] * db [ 0 ],
109 da [ 2 ] * b [ 2 ],
110 a [ 2 ] * db [ 2 ],
111 da [ 0 ] * b [ 2 ],
112 a [ 0 ] * db [ 2 ],
113 da [ 1 ] * b [ 0 ],
114 a [ 1 ] * db [ 0 ],
115 da [ 2 ] * b [ 1 ],
116 a [ 2 ] * db [ 1 ],
117 da [ 1 ] * b [ 2 ],
118 a [ 1 ] * db [ 2 ],
119 da [ 0 ] * b [ 1 ],
120 a [ 0 ] * db [ 1 ],
121 da [ 1 ] * b [ 1 ],
122 a [ 1 ] * db [ 1 ],
123 };
124}
125
126
127void
128FEI2dQuadBiQuad :: evaldNdxi(FloatMatrix &dN, const FloatArray &lc, const FEICellGeometry &cellgeo) const
129{
130 double u = lc.at(1);
131 double v = lc.at(2);
132
133 double a[] = {
134 0.5 * ( u - 1.0 ) * u, 1.0 - u * u, 0.5 * ( u + 1.0 ) * u
135 };
136 double b[] = {
137 0.5 * ( v - 1.0 ) * v, 1.0 - v * v, 0.5 * ( v + 1.0 ) * v
138 };
139
140 double da[] = {
141 u - 0.5, -2.0 * u, u + 0.5
142 };
143 double db[] = {
144 v - 0.5, -2.0 * v, v + 0.5
145 };
146
147 dN.resize(9, 2);
148
149 dN.at(1, 1) = da [ 0 ] * b [ 0 ];
150 dN.at(5, 1) = da [ 1 ] * b [ 0 ];
151 dN.at(2, 1) = da [ 2 ] * b [ 0 ];
152 dN.at(8, 1) = da [ 0 ] * b [ 1 ];
153 dN.at(9, 1) = da [ 1 ] * b [ 1 ];
154 dN.at(6, 1) = da [ 2 ] * b [ 1 ];
155 dN.at(4, 1) = da [ 0 ] * b [ 2 ];
156 dN.at(7, 1) = da [ 1 ] * b [ 2 ];
157 dN.at(3, 1) = da [ 2 ] * b [ 2 ];
158
159 dN.at(1, 2) = a [ 0 ] * db [ 0 ];
160 dN.at(5, 2) = a [ 1 ] * db [ 0 ];
161 dN.at(2, 2) = a [ 2 ] * db [ 0 ];
162 dN.at(8, 2) = a [ 0 ] * db [ 1 ];
163 dN.at(9, 2) = a [ 1 ] * db [ 1 ];
164 dN.at(6, 2) = a [ 2 ] * db [ 1 ];
165 dN.at(4, 2) = a [ 0 ] * db [ 2 ];
166 dN.at(7, 2) = a [ 1 ] * db [ 2 ];
167 dN.at(3, 2) = a [ 2 ] * db [ 2 ];
168}
169
170
171std::pair<double, FloatMatrixF<2,9>>
172FEI2dQuadBiQuad :: _evaldNdx(const FloatArrayF<2> &lcoords, const FEICellGeometry &cellgeo) const
173{
174 auto dn = evaldNdxi(lcoords);
176 for ( std::size_t i = 1; i <= dn.cols(); i++ ) {
177 const auto &c = cellgeo.giveVertexCoordinates(i);
178 double x = c.at(xind);
179 double y = c.at(yind);
180
182 jacT(0, 0) += dn.at(1, i) * x;
183 jacT(0, 1) += dn.at(1, i) * y;
184 jacT(1, 0) += dn.at(2, i) * x;
185 jacT(1, 1) += dn.at(2, i) * y;
186 }
187
188 return {det(jacT), dot(inv(jacT), dn)};
189}
190
191
192std::unique_ptr<IntegrationRule> FEI2dQuadBiQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const
193{
194 auto iRule = std::make_unique<GaussIntegrationRule>(1, nullptr);
195 int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 6);
196 iRule->SetUpPointsOnSquare(points, _Unknown);
197 return std::move(iRule);
198}
199} // end namespace oofem
static FloatMatrixF< 2, 9 > evaldNdxi(const FloatArrayF< 2 > &lcoords)
virtual const FloatArray giveVertexCoordinates(int i) const =0
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
double at(std::size_t i, std::size_t j) const
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
double at(std::size_t i, std::size_t j) const
double det(const FloatMatrixF< 2, 2 > &mat)
Computes the determinant.
double dot(const FloatArray &x, const FloatArray &y)
FloatMatrixF< N, N > inv(const FloatMatrixF< N, N > &mat, double zeropiv=1e-24)
Computes the inverse.

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011