OOFEM 3.0
Loading...
Searching...
No Matches
quad1planestrain.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
36#include "fei2dquadlin.h"
37#include "node.h"
38#include "crosssection.h"
39#include "gausspoint.h"
41#include "floatmatrix.h"
42#include "floatarray.h"
43#include "intarray.h"
44#include "mathfem.h"
45#include "classfactory.h"
46
47#ifdef __OOFEG
48 #include "oofeggraphiccontext.h"
49 #include "oofegutils.h"
50 #include "sm/Materials/rcm2.h"
51#endif
52
53namespace oofem {
55
56FEI2dQuadLin Quad1PlaneStrain :: interp(1, 2);
57
58Quad1PlaneStrain :: Quad1PlaneStrain(int n, Domain *aDomain) :
62{
65}
66
67
68Quad1PlaneStrain :: ~Quad1PlaneStrain()
69{ }
70
71
72FEInterpolation *Quad1PlaneStrain :: giveInterpolation() const { return & interp; }
73
74
75void
76Quad1PlaneStrain :: computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int li, int ui)
77//
78// Returns the [4x8] strain-displacement matrix {B} of the receiver,
79// evaluated at gp.
80// (epsilon_x,epsilon_y,epsilon_z,gamma_xy) = B . r
81// r = ( u1,v1,u2,v2,u3,v3,u4,v4)
82{
83 FloatMatrix dN;
84
85 this->interp.evaldNdx( dN, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
86
87 // Reshape
88 answer.resize(4, 8);
89 answer.zero();
90
91#ifdef Quad1PlaneStrain_reducedVolumetricIntegration
92 FloatMatrix dN_red;
93 FloatArray lcoords_red(2);
94 lcoords_red.zero();
95 this->interp.evaldNdx( dN_red, lcoords_red, FEIElementGeometryWrapper(this) );
96
97 for ( int i = 1; i <= 4; i++ ) {
98 answer.at(1, 2 * i - 1) = ( dN.at(i, 1) + dN_red.at(i, 1) ) / 2.;
99 answer.at(1, 2 * i - 0) = (-dN.at(i, 2) + dN_red.at(i, 2) ) / 2.;
100 answer.at(2, 2 * i - 1) = (-dN.at(i, 1) + dN_red.at(i, 1) ) / 2.;
101 answer.at(2, 2 * i - 0) = ( dN.at(i, 2) + dN_red.at(i, 2) ) / 2.;
102 answer.at(4, 2 * i - 1) = dN.at(i, 2);
103 answer.at(4, 2 * i - 0) = dN.at(i, 1);
104 }
105#else
106#ifdef Quad1PlaneStrain_reducedShearIntegration
107 FloatMatrix dN_red;
108 FloatArray lcoords_red(2);
109 lcoords_red.zero();
110 this->interp.evaldNdx( dN_red, lcoords_red, FEIElementGeometryWrapper(this) );
111
112 for ( int i = 1; i <= 4; i++ ) {
113 answer.at(1, 2 * i - 1) = dN.at(i, 1);
114 answer.at(2, 2 * i - 0) = dN.at(i, 2);
115 answer.at(4, 2 * i - 1) = dN_red.at(i, 2);
116 answer.at(4, 2 * i - 0) = dN_red.at(i, 1);
117 }
118
119#else
120 for ( int i = 1; i <= 4; i++ ) {
121 answer.at(1, 2 * i - 1) = dN.at(i, 1);
122 answer.at(2, 2 * i - 0) = dN.at(i, 2);
123 answer.at(4, 2 * i - 1) = dN.at(i, 2);
124 answer.at(4, 2 * i - 0) = dN.at(i, 1);
125 }
126
127#endif
128#endif
129}
130
131void
132Quad1PlaneStrain :: computeBHmatrixAt(GaussPoint *gp, FloatMatrix &answer)
133// Returns the [5x8] displacement gradient matrix {BH} of the receiver,
134// evaluated at gp.
135{
136 FloatMatrix dnx;
137 this->interp.evaldNdx( dnx, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
138
139 answer.resize(5, 8);
140 answer.zero();
141 // 3rd row is zero -> dw/dz = 0
142 for ( int i = 1; i <= 4; i++ ) {
143 answer.at(1, 2 * i - 1) = dnx.at(i, 1); // du/dx -1
144 answer.at(2, 2 * i - 0) = dnx.at(i, 2); // dv/dy -2
145 answer.at(4, 2 * i - 1) = dnx.at(i, 2); // du/dy -6
146 answer.at(5, 2 * i - 0) = dnx.at(i, 1); // dv/dx -9
147 }
148}
149
150
151void
152Quad1PlaneStrain :: postInitialize()
153{
154 if ( !( ( numberOfGaussPoints == 4 ) ||
155 ( numberOfGaussPoints == 1 ) ||
156 ( numberOfGaussPoints == 9 ) ||
157 ( numberOfGaussPoints == 16 ) ) ) {
159 }
160 PlaneStrainElement :: postInitialize();
161}
162
163
164
165Interface *
166Quad1PlaneStrain :: giveInterface(InterfaceType interface)
167{
168 if ( interface == ZZNodalRecoveryModelInterfaceType ) {
169 return static_cast< ZZNodalRecoveryModelInterface * >(this);
170 } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
171 return static_cast< SPRNodalRecoveryModelInterface * >(this);
172 } else if ( interface == SpatialLocalizerInterfaceType ) {
173 return static_cast< SpatialLocalizerInterface * >(this);
174 } else if ( interface == HuertaErrorEstimatorInterfaceType ) {
175 return static_cast< HuertaErrorEstimatorInterface * >(this);
176 }
177
178 return NULL;
179}
180
181
182void
183Quad1PlaneStrain :: HuertaErrorEstimatorI_setupRefinedElementProblem(RefinedElement *refinedElement, int level, int nodeId,
184 IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
185 HuertaErrorEstimatorInterface :: SetupMode sMode, TimeStep *tStep,
186 int &localNodeId, int &localElemId, int &localBcId,
187 IntArray &controlNode, IntArray &controlDof,
188 HuertaErrorEstimator :: AnalysisMode aMode)
189{
190 int nodes = 4, sides = 4;
191 double x = 0.0, y = 0.0;
192
193 static int sideNode [ 4 ] [ 2 ] = { { 1, 2 }, { 2, 3 }, { 3, 4 }, { 4, 1 } };
194
195 FloatArray corner [ 4 ], midSide [ 4 ], midNode, cor [ 4 ];
196 if ( sMode == HuertaErrorEstimatorInterface :: NodeMode ||
197 ( sMode == HuertaErrorEstimatorInterface :: BCMode && aMode == HuertaErrorEstimator :: HEE_linear ) ) {
198 for ( int inode = 0; inode < nodes; inode++ ) {
199 corner [ inode ] = this->giveNode(inode + 1)->giveCoordinates();
200 if ( corner [ inode ].giveSize() != 3 ) {
201 cor [ inode ].resize(3);
202 cor [ inode ].at(1) = corner [ inode ].at(1);
203 cor [ inode ].at(2) = corner [ inode ].at(2);
204 cor [ inode ].at(3) = 0.0;
205
206 corner [ inode ] = cor [ inode ];
207 }
208
209 x += corner [ inode ].at(1);
210 y += corner [ inode ].at(2);
211 }
212
213 for ( int iside = 0; iside < sides; iside++ ) {
214 midSide [ iside ].resize(3);
215
216 int nd1 = sideNode [ iside ] [ 0 ] - 1;
217 int nd2 = sideNode [ iside ] [ 1 ] - 1;
218
219 midSide [ iside ].at(1) = ( corner [ nd1 ].at(1) + corner [ nd2 ].at(1) ) / 2.0;
220 midSide [ iside ].at(2) = ( corner [ nd1 ].at(2) + corner [ nd2 ].at(2) ) / 2.0;
221 midSide [ iside ].at(3) = 0.0;
222 }
223
224 midNode.resize(3);
225
226 midNode.at(1) = x / nodes;
227 midNode.at(2) = y / nodes;
228 midNode.at(3) = 0.0;
229 }
230
231 this->setupRefinedElementProblem2D(this, refinedElement, level, nodeId, localNodeIdArray, globalNodeIdArray,
232 sMode, tStep, nodes, corner, midSide, midNode,
233 localNodeId, localElemId, localBcId,
234 controlNode, controlDof, aMode, "Quad1PlaneStrain");
235}
236
237
238void Quad1PlaneStrain :: HuertaErrorEstimatorI_computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)
239{
241}
242
243
244
245#ifdef __OOFEG
246 #define TR_LENGHT_REDUCT 0.3333
247
248void Quad1PlaneStrain :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
249{
250 WCRec p [ 4 ];
251 GraphicObj *go;
252
253 if ( !gc.testElementGraphicActivity(this) ) {
254 return;
255 }
256
257 EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
258 EASValsSetColor( gc.getElementColor() );
259 EASValsSetEdgeColor( gc.getElementEdgeColor() );
260 EASValsSetEdgeFlag(true);
261 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
262 EASValsSetFillStyle(FILL_HOLLOW);
263 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
264 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
265 p [ 0 ].z = 0.;
266 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
267 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
268 p [ 1 ].z = 0.;
269 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
270 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
271 p [ 2 ].z = 0.;
272 p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveCoordinate(1);
273 p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveCoordinate(2);
274 p [ 3 ].z = 0.;
275
276 go = CreateQuad3D(p);
277 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
278 EGAttachObject(go, ( EObjectP ) this);
279 EMAddGraphicsToModel(ESIModel(), go);
280}
281
282
283void Quad1PlaneStrain :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
284{
285 WCRec p [ 4 ];
286 GraphicObj *go;
287 double defScale = gc.getDefScale();
288
289 if ( !gc.testElementGraphicActivity(this) ) {
290 return;
291 }
292
293 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
294 EASValsSetColor( gc.getDeformedElementColor() );
295 EASValsSetEdgeColor( gc.getElementEdgeColor() );
296 EASValsSetEdgeFlag(true);
297 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
298 EASValsSetFillStyle(FILL_HOLLOW);
299 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
300 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
301 p [ 0 ].z = 0.;
302 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
303 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
304 p [ 1 ].z = 0.;
305 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
306 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
307 p [ 2 ].z = 0.;
308 p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
309 p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
310 p [ 3 ].z = 0.;
311
312 go = CreateQuad3D(p);
313 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
314 EMAddGraphicsToModel(ESIModel(), go);
315}
316
317
318
319void Quad1PlaneStrain :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
320{
321 int i, indx, result = 0;
322 WCRec p [ 4 ];
323 GraphicObj *tr;
324 FloatArray v [ 4 ];
325 double s [ 4 ], defScale;
326
327 if ( !gc.testElementGraphicActivity(this) ) {
328 return;
329 }
330
331 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
332 if ( gc.giveIntVarMode() == ISM_recovered ) {
333 for ( i = 1; i <= 4; i++ ) {
334 result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
335 }
336
337 if ( result != 4 ) {
338 return;
339 }
340
341 indx = gc.giveIntVarIndx();
342
343 for ( i = 1; i <= 4; i++ ) {
344 s [ i - 1 ] = v [ i - 1 ].at(indx);
345 }
346
347 if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
348 for ( i = 0; i < 4; i++ ) {
349 if ( gc.getInternalVarsDefGeoFlag() ) {
350 // use deformed geometry
351 defScale = gc.getDefScale();
352 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
353 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
354 p [ i ].z = 0.;
355 } else {
356 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
357 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
358 p [ i ].z = 0.;
359 }
360 }
361
362 //EASValsSetColor(gc.getYieldPlotColor(ratio));
363 gc.updateFringeTableMinMax(s, 4);
364 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
365 EGWithMaskChangeAttributes(LAYER_MASK, tr);
366 EMAddGraphicsToModel(ESIModel(), tr);
367 } else if ( ( gc.getScalarAlgo() == SA_ZPROFILE ) || ( gc.getScalarAlgo() == SA_COLORZPROFILE ) ) {
368 double landScale = gc.getLandScale();
369
370 for ( i = 0; i < 4; i++ ) {
371 if ( gc.getInternalVarsDefGeoFlag() ) {
372 // use deformed geometry
373 defScale = gc.getDefScale();
374 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
375 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
376 p [ i ].z = s [ i ] * landScale;
377 } else {
378 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
379 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
380 p [ i ].z = s [ i ] * landScale;
381 }
382
383 // this fixes a bug in ELIXIR
384 if ( fabs(s [ i ]) < 1.0e-6 ) {
385 s [ i ] = 1.0e-6;
386 }
387 }
388
389 if ( gc.getScalarAlgo() == SA_ZPROFILE ) {
390 EASValsSetColor( gc.getDeformedElementColor() );
391 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
392 tr = CreateQuad3D(p);
393 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
394 } else {
395 gc.updateFringeTableMinMax(s, 4);
396 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
397 EGWithMaskChangeAttributes(LAYER_MASK, tr);
398 }
399
400 EMAddGraphicsToModel(ESIModel(), tr);
401 }
402 } else if ( gc.giveIntVarMode() == ISM_local ) {
403 if ( numberOfGaussPoints != 4 ) {
404 return;
405 }
406
407 IntArray ind(4);
408 WCRec pp [ 9 ];
409
410 for ( i = 0; i < 4; i++ ) {
411 if ( gc.getInternalVarsDefGeoFlag() ) {
412 // use deformed geometry
413 defScale = gc.getDefScale();
414 pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
415 pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
416 pp [ i ].z = 0.;
417 } else {
418 pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
419 pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
420 pp [ i ].z = 0.;
421 }
422 }
423
424 for ( i = 0; i < 3; i++ ) {
425 pp [ i + 4 ].x = 0.5 * ( pp [ i ].x + pp [ i + 1 ].x );
426 pp [ i + 4 ].y = 0.5 * ( pp [ i ].y + pp [ i + 1 ].y );
427 pp [ i + 4 ].z = 0.5 * ( pp [ i ].z + pp [ i + 1 ].z );
428 }
429
430 pp [ 7 ].x = 0.5 * ( pp [ 3 ].x + pp [ 0 ].x );
431 pp [ 7 ].y = 0.5 * ( pp [ 3 ].y + pp [ 0 ].y );
432 pp [ 7 ].z = 0.5 * ( pp [ 3 ].z + pp [ 0 ].z );
433
434 pp [ 8 ].x = 0.25 * ( pp [ 0 ].x + pp [ 1 ].x + pp [ 2 ].x + pp [ 3 ].x );
435 pp [ 8 ].y = 0.25 * ( pp [ 0 ].y + pp [ 1 ].y + pp [ 2 ].y + pp [ 3 ].y );
436 pp [ 8 ].z = 0.25 * ( pp [ 0 ].z + pp [ 1 ].z + pp [ 2 ].z + pp [ 3 ].z );
437
438 for ( GaussPoint *gp: *this->giveDefaultIntegrationRulePtr() ) {
439 const FloatArray& gpCoords = gp->giveNaturalCoordinates();
440 if ( ( gpCoords.at(1) > 0. ) && ( gpCoords.at(2) > 0. ) ) {
441 ind.at(1) = 0;
442 ind.at(2) = 4;
443 ind.at(3) = 8;
444 ind.at(4) = 7;
445 } else if ( ( gpCoords.at(1) < 0. ) && ( gpCoords.at(2) > 0. ) ) {
446 ind.at(1) = 4;
447 ind.at(2) = 1;
448 ind.at(3) = 5;
449 ind.at(4) = 8;
450 } else if ( ( gpCoords.at(1) < 0. ) && ( gpCoords.at(2) < 0. ) ) {
451 ind.at(1) = 5;
452 ind.at(2) = 2;
453 ind.at(3) = 6;
454 ind.at(4) = 8;
455 } else {
456 ind.at(1) = 6;
457 ind.at(2) = 3;
458 ind.at(3) = 7;
459 ind.at(4) = 8;
460 }
461
462 if ( giveIPValue(v [ 0 ], gp, gc.giveIntVarType(), tStep) == 0 ) {
463 return;
464 }
465
466 indx = gc.giveIntVarIndx();
467
468 for ( i = 1; i <= 4; i++ ) {
469 s [ i - 1 ] = v [ 0 ].at(indx);
470 }
471
472 for ( i = 0; i < 4; i++ ) {
473 p [ i ].x = pp [ ind.at(i + 1) ].x;
474 p [ i ].y = pp [ ind.at(i + 1) ].y;
475 p [ i ].z = pp [ ind.at(i + 1) ].z;
476 }
477
478 gc.updateFringeTableMinMax(s, 4);
479 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
480 EGWithMaskChangeAttributes(LAYER_MASK, tr);
481 EMAddGraphicsToModel(ESIModel(), tr);
482 }
483 }
484}
485
486
487void
488Quad1PlaneStrain :: drawSpecial(oofegGraphicContext &gc, TimeStep *tStep)
489{
490 int i;
491 WCRec l [ 2 ];
492 GraphicObj *tr;
493 double defScale = gc.getDefScale();
494 FloatArray crackStatuses, cf;
495
496 if ( !gc.testElementGraphicActivity(this) ) {
497 return;
498 }
499
500 if ( gc.giveIntVarType() == IST_CrackState ) {
501 // ask if any active crack exist
502 int crackStatus;
503 double ax, ay, bx, by, norm, xc, yc, length;
504 FloatArray crackDir;
505 FloatArray gpglobalcoords;
506
507 for ( GaussPoint *gp: *this->giveDefaultIntegrationRulePtr() ) {
508
509 if ( this->giveIPValue(cf, gp, IST_CrackedFlag, tStep) == 0 ) {
510 return;
511 }
512
513 if ( ( int ) cf.at(1) == 0 ) {
514 return;
515 }
516
517 if ( this->giveIPValue(crackDir, gp, IST_CrackDirs, tStep) ) {
518 this->giveIPValue(crackStatuses, gp, IST_CrackStatuses, tStep);
519 for ( i = 1; i <= 3; i++ ) {
520 crackStatus = ( int ) crackStatuses.at(i);
521 if ( ( crackStatus != pscm_NONE ) && ( crackStatus != pscm_CLOSED ) ) {
522 // draw a crack
523 // this element is 2d element in x-y plane
524 //
525 // compute perpendicular line to normal in xy plane
526 ax = crackDir.at(i);
527 ay = crackDir.at(3 + i);
528 if ( fabs(ax) > 1.e-6 ) {
529 by = 1.;
530 bx = -ay * by / ax;
531 norm = sqrt(bx * bx + by * by);
532 bx = bx / norm; // normalize to obtain unit vector
533 by = by / norm;
534 } else {
535 by = 0.0;
536 bx = 1.0;
537 }
538
539 // obtain gp global coordinates
540 if ( gc.getInternalVarsDefGeoFlag() ) {
541 double ksi, eta, n1, n2, n3, n4;
542 ksi = gp->giveNaturalCoordinate(1);
543 eta = gp->giveNaturalCoordinate(2);
544
545 n1 = ( 1. + ksi ) * ( 1. + eta ) * 0.25;
546 n2 = ( 1. - ksi ) * ( 1. + eta ) * 0.25;
547 n3 = ( 1. - ksi ) * ( 1. - eta ) * 0.25;
548 n4 = ( 1. + ksi ) * ( 1. - eta ) * 0.25;
549
550 gpglobalcoords.resize(2);
551
552 gpglobalcoords.at(1) = ( n1 * this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale) +
553 n2 * this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale) +
554 n3 * this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale) +
555 n4 * this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale) );
556 gpglobalcoords.at(2) = ( n1 * this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale) +
557 n2 * this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale) +
558 n3 * this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale) +
559 n4 * this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale) );
560 } else {
561 computeGlobalCoordinates( gpglobalcoords, gp->giveNaturalCoordinates() );
562 }
563
564 xc = gpglobalcoords.at(1);
565 yc = gpglobalcoords.at(2);
566 length = sqrt( computeVolumeAround(gp) / this->giveCrossSection()->give(CS_Thickness, gp) ) / 2.;
567 l [ 0 ].x = ( FPNum ) xc + bx * length;
568 l [ 0 ].y = ( FPNum ) yc + by * length;
569 l [ 0 ].z = 0.;
570 l [ 1 ].x = ( FPNum ) xc - bx * length;
571 l [ 1 ].y = ( FPNum ) yc - by * length;
572 l [ 1 ].z = 0.;
573 EASValsSetLayer(OOFEG_CRACK_PATTERN_LAYER);
574 EASValsSetLineWidth(OOFEG_CRACK_PATTERN_WIDTH);
575 if ( ( crackStatus == pscm_SOFTENING ) || ( crackStatus == pscm_OPEN ) ) {
576 EASValsSetColor( gc.getActiveCrackColor() );
577 } else {
578 EASValsSetColor( gc.getCrackPatternColor() );
579 }
580
581 tr = CreateLine3D(l);
582 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
583 EMAddGraphicsToModel(ESIModel(), tr);
584 }
585 }
586 }
587 }
588 }
589}
590
591#endif
592
593
594void
595Quad1PlaneStrain :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
596{
597 pap.resize(4);
598 for ( int i = 1; i < 5; i++ ) {
599 pap.at(i) = this->giveNode(i)->giveNumber();
600 }
601}
602
603
604void
605Quad1PlaneStrain :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
606{
607 int found = 0;
608 answer.resize(1);
609
610 for ( int i = 1; i < 5; i++ ) {
611 if ( pap == this->giveNode(i)->giveNumber() ) {
612 found = 1;
613 }
614 }
615
616 if ( found ) {
617 answer.at(1) = pap;
618 } else {
619 OOFEM_ERROR("node unknown");
620 }
621}
622
623
624int
625Quad1PlaneStrain :: SPRNodalRecoveryMI_giveNumberOfIP()
626{
627 return this->giveDefaultIntegrationRulePtr()->giveNumberOfIntegrationPoints();
628}
629
630
632Quad1PlaneStrain :: SPRNodalRecoveryMI_givePatchType()
633{
634 return SPRPatchType_2dxy;
635}
636
637} // end namespace oofem
double length(const Vector &a)
Definition CSG.h:88
#define REGISTER_Element(class)
Node * giveNode(int i) const
Definition element.h:629
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Definition element.C:1225
int numberOfDofMans
Number of dofmanagers.
Definition element.h:136
int numberOfGaussPoints
Definition element.h:175
CrossSection * giveCrossSection()
Definition element.C:534
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Definition element.h:886
int giveNumber() const
Definition femcmpnn.h:104
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
void zero()
Zeroes all coefficients of receiver.
Definition floatarray.C:683
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void zero()
Zeroes all coefficient of receiver.
double at(std::size_t i, std::size_t j) const
const FloatArray & giveNaturalCoordinates() const
Returns coordinate array of receiver.
Definition gausspoint.h:138
const FloatArray & giveSubPatchCoordinates() const
Returns local sub-patch coordinates of the receiver.
Definition gausspoint.h:142
void setupRefinedElementProblem2D(Element *element, RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface ::SetupMode mode, TimeStep *tStep, int nodes, FloatArray *corner, FloatArray *midSide, FloatArray &midNode, int &localNodeId, int &localElemId, int &localBcId, IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator ::AnalysisMode aMode, const char *quadtype)
void resize(int n)
Definition intarray.C:73
int & at(std::size_t i)
Definition intarray.h:104
PlaneStrainElement(int n, Domain *d)
static FEI2dQuadLin interp
SpatialLocalizerInterface(Element *element)
double computeVolumeAround(GaussPoint *gp) override
virtual void computeNmatrixAt(const FloatArray &iLocCoord, FloatMatrix &answer)
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
int giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode, int node, TimeStep *tStep) override
ZZNodalRecoveryModelInterface(Element *element)
Constructor.
#define OOFEM_ERROR(...)
Definition error.h:79
#define pscm_NONE
Definition fcm.h:56
#define pscm_CLOSED
Definition fcm.h:60
#define pscm_SOFTENING
Definition fcm.h:58
double norm(const FloatArray &x)
@ CS_Thickness
Thickness.
@ HuertaErrorEstimatorInterfaceType
@ SPRNodalRecoveryModelInterfaceType
@ ZZNodalRecoveryModelInterfaceType
@ SpatialLocalizerInterfaceType
#define OOFEG_CRACK_PATTERN_LAYER
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
#define OOFEG_VARPLOT_PATTERN_LAYER
#define OOFEG_DEFORMED_GEOMETRY_LAYER
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_LAYER
#define OOFEG_CRACK_PATTERN_WIDTH
#define pscm_OPEN
Definition rcm2.h:61

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