OOFEM 3.0
Loading...
Searching...
No Matches
tr2shell7PhFi.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 "tr2shell7phfi.h"
36#include "node.h"
37#include "load.h"
38#include "structuralms.h"
39#include "mathfem.h"
40#include "domain.h"
41#include "equationid.h"
43#include "gausspoint.h"
44#include "fei3dtrquad.h"
45#include "boundaryload.h"
46#include "vtkxmlexportmodule.h"
47#include "classfactory.h"
48#include "tr2shell7.h"
49
50namespace oofem {
51REGISTER_Element(Tr2Shell7PhFi);
52
53FEI3dTrQuad Tr2Shell7PhFi :: interpolation;
54
55IntArray Tr2Shell7PhFi :: ordering_disp(42);
56IntArray Tr2Shell7PhFi :: ordering_disp_inv(42);
57IntArray Tr2Shell7PhFi :: ordering_base(42);
58IntArray Tr2Shell7PhFi :: ordering_base_inv(42);
59IntArray Tr2Shell7PhFi:: ordering_all(1);
60IntArray Tr2Shell7PhFi:: ordering_damage(1);
61IntArray Tr2Shell7PhFi :: ordering_gr(1);
62IntArray Tr2Shell7PhFi :: ordering_gr_edge(21);
63bool Tr2Shell7PhFi :: __initialized = Tr2Shell7PhFi :: initOrdering();
64
65
66Tr2Shell7PhFi:: Tr2Shell7PhFi(int n, Domain *aDomain) : Shell7BasePhFi(n, aDomain)
67{
68 this->numberOfDofMans = 6;
69
70 this->ordering_damage.resize(0);
71 this->ordering_gr.resize(0);
72 this->ordering_disp_inv.resize(0);
73
74 IntArray localDam, localDisp(7); // hard coded for 7 parameter shell!!
75
76 localDam.resize(0);
77 localDisp.setValues(7, 1, 2, 3, 19, 20, 21, 37);
78
79 for (int i = 1; i <= numberOfLayers; i++) {
80 //localDam.followedBy(i + this->giveNumberOfuDofs());
81 localDam.followedBy(7 + i);
82 }
83
84 int numDofsPerNode = 7 + numberOfLayers;
85
86 for (int i = 1; i <= this->numberOfDofMans; i++) {
87 this->ordering_damage.followedBy(localDam);
88 this->ordering_gr.followedBy(localDisp);
89 this->ordering_gr.followedBy(localDam);
90 this->ordering_disp_inv.followedBy(localDisp);
91
92 localDisp.at(1) += 3;
93 localDisp.at(2) += 3;
94 localDisp.at(3) += 3;
95 localDisp.at(4) += 3;
96 localDisp.at(5) += 3;
97 localDisp.at(6) += 3;
98 localDisp.at(7) += 1;
99
100 localDam.add(numberOfLayers);
101 }
102
103
104 this->ordering_all.resize(0);
105 this->ordering_all = this->ordering_disp;
106 this->ordering_all.followedBy(ordering_damage);
107
108 // JB - New
109
110 IntArray temp_x(0), temp_m(0), temp_dam(0), local_temp_x(0), local_temp_m(0), local_temp_gam(0), local_temp_dam(0);
111 temp_x.setValues(3, 1, 2, 3);
112 temp_m.setValues(3, 4, 5, 6);
113 int temp_gam = 7;
114
115 for (int i = 1; i <= numberOfLayers; i++) {
116 temp_dam.followedBy(7 + i);
117 }
118
119 for (int i = 1; i <= this->numberOfDofMans; i++) {
120 local_temp_x.followedBy(temp_x);
121 local_temp_m.followedBy(temp_m);
122 local_temp_gam.followedBy(temp_gam);
123 local_temp_dam.followedBy(temp_dam);
124 temp_x.add(numDofsPerNode);
125 temp_m.add(numDofsPerNode);
126 temp_gam +=numDofsPerNode;
127 temp_dam.add(numDofsPerNode);
128 }
129 //local_temp_x.printYourself();
130 //local_temp_m.printYourself();
131 //local_temp_gam.printYourself();
132 //local_temp_dam.printYourself();
133
134 // Construct the two orddering arrays
135 ordering_disp.resize(0);
136 ordering_damage.resize(0);
137 this->ordering_disp.followedBy(local_temp_x); // xbar field
138 this->ordering_disp.followedBy(local_temp_m); // director field
139 this->ordering_disp.followedBy(local_temp_gam); // gamma field
140 this->ordering_damage = local_temp_dam;
141
142 //ordering_disp.printYourself();
143 //ordering_damage.printYourself();
144}
145
146void
147Tr2Shell7PhFi :: giveDofManDofIDMask_u(IntArray &answer)
148{
149 Shell7BasePhFi :: giveDofManDofIDMask_u(answer);
150}
151
152void
153Tr2Shell7PhFi :: giveDofManDofIDMask_d(IntArray &answer)
154{
155 Shell7BasePhFi :: giveDofManDofIDMask_d(answer);
156}
157
158const IntArray &
159Tr2Shell7PhFi:: giveOrdering(SolutionField fieldType) const
160{
161 OOFEM_ERROR("Tr2Shell7PhFi :: giveOrdering not implemented: Use Tr2Shell7PhFi :: giveOrderingPhFi instead");
162 return 0;
163}
164
165
166const IntArray &
167Tr2Shell7PhFi:: giveOrderingPhFi(SolutionFieldPhFi fieldType) const
168{
169 if ( fieldType == All ) {
170 return this->ordering_all;
171 } else if ( fieldType == Displacement ) {
172 return this->ordering_disp;
173 } else if ( fieldType == Damage ) {
174 return this->ordering_damage;
175 } else if ( fieldType == AllInv ) {
176 return this->ordering_gr;
177 } else { /*if ( fieldType == EdgeInv )*/
178 OOFEM_ERROR("Tr2Shell7PhFi :: giveOrdering: the requested ordering is not implemented")
179 //return this->ordering_gr_edge;
180 }
181}
182
183const IntArray &
184Tr2Shell7PhFi :: giveOrdering_All() const
185{
186 return this->ordering_base; // When shell7base methods are called this is what is wanted
187}
188
189const IntArray &
190Tr2Shell7PhFi :: giveOrdering_AllInv() const
191{
192 // Same as in Shell7Base
193 return this->ordering_base_inv;
194}
195
196const IntArray &
197Tr2Shell7PhFi :: giveOrdering_Disp() const
198{
199 return this->ordering_disp;
200}
201
202const IntArray &
203Tr2Shell7PhFi :: giveOrdering_Damage() const
204{
205 return this->ordering_damage;
206}
207
208
209void
210Tr2Shell7PhFi:: giveLocalNodeCoords(FloatArray &nodeLocalXiCoords, FloatArray &nodeLocalEtaCoords)
211{
212 nodeLocalXiCoords.setValues(6, 1., 0., 0., .5, 0., .5); // corner nodes then midnodes, uncertain of node numbering
213 nodeLocalEtaCoords.setValues(6, 0., 1., 0., .5, .5, 0.);
214}
215
216
217FEInterpolation *Tr2Shell7PhFi:: giveInterpolation() const { return & interpolation; }
218
219
220void
221Tr2Shell7PhFi:: computeGaussPoints()
222{
223 if ( !integrationRulesArray ) {
224 int nPointsTri = 6; // points in the plane
225 int nPointsEdge = 2; // edge integration
226 specialIntegrationRulesArray = new IntegrationRule * [ 3 ];
227
228 // Midplane and thickness
229
230 // Midplane (Mass matrix integrated analytically through the thickness)
231 specialIntegrationRulesArray [ 1 ] = new GaussIntegrationRule(1, this);
232 specialIntegrationRulesArray [ 1 ]->SetUpPointsOnWedge(nPointsTri, 1, _3dMat); //@todo replce with triangle which has a xi3-coord
233
234
235 // Edge
236 specialIntegrationRulesArray [ 2 ] = new GaussIntegrationRule(1, this);
237 specialIntegrationRulesArray [ 2 ]->SetUpPointsOnLine(nPointsEdge, _3dMat);
238
239
240 // Layered cross section for bulk integration
241 //@todo - must use a cast here since check consistency has not been called yet
242 LayeredCrossSection *layeredCS = dynamic_cast< LayeredCrossSection * >( Tr2Shell7PhFi:: giveCrossSection() );
243 if ( layeredCS == NULL ) {
244 OOFEM_ERROR("Tr2Shell7PhFionly supports layered cross section");
245 }
246 this->numberOfIntegrationRules = layeredCS->giveNumberOfLayers();
247 this->numberOfGaussPoints = layeredCS->giveNumberOfLayers() * nPointsTri * layeredCS->giveNumIntegrationPointsInLayer();
248 layeredCS->setupLayeredIntegrationRule(integrationRulesArray, this, nPointsTri);
249
250
251 // Thickness integration for stress recovery
252 specialIntegrationRulesArray [ 0 ] = new GaussIntegrationRule(1, this);
253 specialIntegrationRulesArray [ 0 ]->SetUpPointsOnLine(layeredCS->giveNumIntegrationPointsInLayer(), _3dMat);
254 }
255}
256
257
258void
259Tr2Shell7PhFi:: giveEdgeDofMapping(IntArray &answer, int iEdge) const
260{
261 /*
262 * provides dof mapping of local edge dofs (only nonzero are taken into account)
263 * to global element dofs
264 */
265
266 if ( iEdge == 1 ) { // edge between nodes 1-4-2
267 //answer.setValues(21, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 22, 23, 24, 25, 26, 27, 28);
268 answer.setValues(21, 1, 2, 3, 8, 9, 10, 22, 23, 24, 4, 5, 6, 11, 12, 13, 25, 26, 27, 7, 14, 28);
269 } else if ( iEdge == 2 ) { // edge between nodes 2-5-3
270 //answer.setValues(21, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 29, 30, 31, 32, 33, 34, 35 );
271 answer.setValues(21, 8, 9, 10, 15, 16, 17, 29, 30, 31, 11, 12, 13, 18, 19, 20, 32, 33, 34, 14, 21, 35);
272 } else if ( iEdge == 3 ) { // edge between nodes 3-6-1
273 //answer.setValues(21, 15, 16, 17, 18, 19, 20, 21, 1, 2, 3, 4, 5, 6, 7, 36, 37, 38, 39, 40, 41, 42);
274 answer.setValues(21, 15, 16, 17, 1, 2, 3, 36, 37, 38, 18, 19, 20, 4, 5, 6, 39, 40, 41, 21, 7, 42);
275 } else {
276 _error("giveEdgeDofMapping: wrong edge number");
277 }
278}
279
280
281void
282Tr2Shell7PhFi::giveSurfaceDofMapping(IntArray &answer, int iSurf) const
283{
284 answer.resize(42);
285 for ( int i = 1; i <= 42; i++ ) {
286 answer.at(i) = i;
287 }
288}
289
290
291double
292Tr2Shell7PhFi::computeAreaAround(GaussPoint *gp, double xi)
293{
294 FloatArray G1, G2, temp;
295 FloatMatrix Gcov;
296 FloatArray lcoords(3);
297 lcoords.at(1) = gp->giveCoordinate(1);
298 lcoords.at(2) = gp->giveCoordinate(2);
299 lcoords.at(3) = xi;
300 this->evalInitialCovarBaseVectorsAt(lcoords, Gcov);
301 G1.beColumnOf(Gcov, 1);
302 G2.beColumnOf(Gcov, 2);
303 temp.beVectorProductOf(G1, G2);
304 double detJ = temp.computeNorm();
305 return detJ * gp->giveWeight();
306}
307
308
309double
310Tr2Shell7PhFi::computeVolumeAroundLayer(GaussPoint *gp, int layer)
311{
312 double detJ;
313 FloatMatrix Gcov;
314 FloatArray lcoords;
315 lcoords = * gp->giveCoordinates();
316 this->evalInitialCovarBaseVectorsAt(lcoords, Gcov);
317 detJ = Gcov.giveDeterminant() * 0.5 * this->layeredCS->giveLayerThickness(layer);
318 return detJ * gp->giveWeight();
319}
320
321
322void
323Tr2Shell7PhFi:: compareMatrices(const FloatMatrix &matrix1, const FloatMatrix &matrix2, FloatMatrix &answer)
324{
325 int ndofs = 42;
326 answer.resize(ndofs, ndofs);
327 for ( int i = 1; i <= ndofs; i++ ) {
328 for ( int j = 1; j <= 18; j++ ) {
329 if ( fabs( matrix1.at(i, j) ) > 1.0e-12 ) {
330 double diff = ( matrix1.at(i, j) - matrix2.at(i, j) );
331 double relDiff = diff / matrix1.at(i, j);
332 if ( fabs(relDiff) < 1.0e-4 ) {
333 answer.at(i, j) = 0.0;
334 } else if ( fabs(diff) < 1.0e3 ) {
335 answer.at(i, j) = 0.0;
336 } else {
337 answer.at(i, j) = relDiff;
338 }
339 } else {
340 answer.at(i, j) = -1.0;
341 }
342 }
343 }
344}
345
346} // end namespace oofem
#define REGISTER_Element(class)
void followedBy(const IntArray &b, int allocChunk=0)
Definition intarray.C:94
void add(int val)
Definition intarray.C:58
void resize(int n)
Definition intarray.C:73
#define OOFEM_ERROR(...)
Definition error.h:79

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