OOFEM 3.0
Loading...
Searching...
No Matches
lspace.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 "fei3dhexalin.h"
37#include "node.h"
38#include "gausspoint.h"
40#include "floatmatrix.h"
41#include "floatarray.h"
42#include "intarray.h"
43#include "domain.h"
44#include "mathfem.h"
45#include "crosssection.h"
46#include "classfactory.h"
47#include "parametermanager.h"
48#include "paramkey.h"
49
50#ifdef __OOFEG
51 #include "oofeggraphiccontext.h"
52 #include "oofegutils.h"
53 #include "sm/Materials/rcm2.h"
54#endif
55
56namespace oofem {
58
59FEI3dHexaLin LSpace :: interpolation;
61
62LSpace :: LSpace(int n, Domain *aDomain) : Structural3DElement(n, aDomain), ZZNodalRecoveryModelInterface(this),
65 // Constructor.
66{
70}
71
72
73FEInterpolation *LSpace :: giveInterpolation() const { return & interpolation; }
74
76LSpace :: giveInterface(InterfaceType interface)
77{
78 if ( interface == ZZNodalRecoveryModelInterfaceType ) {
79 return static_cast< ZZNodalRecoveryModelInterface * >(this);
80 } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
81 return static_cast< SPRNodalRecoveryModelInterface * >(this);
82 } else if ( interface == NodalAveragingRecoveryModelInterfaceType ) {
83 return static_cast< NodalAveragingRecoveryModelInterface * >(this);
84 } else if ( interface == SpatialLocalizerInterfaceType ) {
85 return static_cast< SpatialLocalizerInterface * >(this);
86 } else if ( interface == HuertaErrorEstimatorInterfaceType ) {
87 return static_cast< HuertaErrorEstimatorInterface * >(this);
88 }
89
90 return NULL;
91}
92
93
94void
95LSpace :: initializeFrom(InputRecord &ir, int priority)
96{
97 Structural3DElement :: initializeFrom(ir, priority);
98 ParameterManager &ppm = this->giveDomain()->elementPPM;
100}
101
102
103
104void
105LSpace :: computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int li, int ui)
106// Returns the [ 6 x (nno*3) ] strain-displacement matrix {B} of the receiver, eva-
107// luated at gp.
108// B matrix - 6 rows : epsilon-X, epsilon-Y, epsilon-Z, gamma-YZ, gamma-ZX, gamma-XY :
109{
110 FEInterpolation *interp = this->giveInterpolation();
111 FloatMatrix dNdx, dNdxShear;
112 interp->evaldNdx( dNdx, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
113 if ( this->reducedShearIntegration ) {
114 interp->evaldNdx( dNdxShear, { 0., 0., 0. }, FEIElementGeometryWrapper(this) );
115 } else {
116 dNdxShear = dNdx;
117 }
118
119 answer.resize(6, dNdx.giveNumberOfRows() * 3);
120 answer.zero();
121
122 for ( int i = 1; i <= dNdx.giveNumberOfRows(); i++ ) {
123 answer.at(1, 3 * i - 2) = dNdx.at(i, 1);
124 answer.at(2, 3 * i - 1) = dNdx.at(i, 2);
125 answer.at(3, 3 * i - 0) = dNdx.at(i, 3);
126
127 answer.at(5, 3 * i - 2) = answer.at(4, 3 * i - 1) = dNdxShear.at(i, 3);
128 answer.at(6, 3 * i - 2) = answer.at(4, 3 * i - 0) = dNdxShear.at(i, 2);
129 answer.at(6, 3 * i - 1) = answer.at(5, 3 * i - 0) = dNdxShear.at(i, 1);
130 }
131}
132
133
134
135
136void
137LSpace :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
138{
140 for ( int i = 1; i <= numberOfDofMans; i++ ) {
141 pap.at(i) = this->giveNode(i)->giveNumber();
142 }
143}
144
145
146void
147LSpace :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
148{
149 int found = 0;
150 answer.resize(1);
151
152 for ( int i = 1; i <= numberOfDofMans; i++ ) {
153 if ( this->giveNode(i)->giveNumber() == pap ) {
154 found = 1;
155 }
156 }
157
158 if ( found ) {
159 answer.at(1) = pap;
160 } else {
161 OOFEM_ERROR("unknown node number %d", pap);
162 }
163}
164
165
166int
167LSpace :: SPRNodalRecoveryMI_giveNumberOfIP()
168{
169 return this->giveDefaultIntegrationRulePtr()->giveNumberOfIntegrationPoints();
170}
171
172
174LSpace :: SPRNodalRecoveryMI_givePatchType()
175{
177}
178
179
180void
181LSpace :: NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node,
182 InternalStateType type, TimeStep *tStep)
183{
184 double x1 = 0.0, x2 = 0.0, x3 = 0.0, y = 0.0;
185 FloatMatrix A(4, 4);
186 FloatMatrix b, r;
187 FloatArray val;
188 double u, v, w;
189
190 int size = 0;
191
192 for ( GaussPoint *gp : *integrationRulesArray [ 0 ] ) {
193 giveIPValue(val, gp, type, tStep);
194 if ( size == 0 ) {
195 size = val.giveSize();
196 b.resize(4, size);
197 r.resize(4, size);
198 A.zero();
199 r.zero();
200 }
201
202 const FloatArray &coord = gp->giveNaturalCoordinates();
203 u = coord.at(1);
204 v = coord.at(2);
205 w = coord.at(3);
206
207 A.at(1, 1) += 1;
208 A.at(1, 2) += u;
209 A.at(1, 3) += v;
210 A.at(1, 4) += w;
211 A.at(2, 1) += u;
212 A.at(2, 2) += u * u;
213 A.at(2, 3) += u * v;
214 A.at(2, 4) += u * w;
215 A.at(3, 1) += v;
216 A.at(3, 2) += v * u;
217 A.at(3, 3) += v * v;
218 A.at(3, 4) += v * w;
219 A.at(4, 1) += w;
220 A.at(4, 2) += w * u;
221 A.at(4, 3) += w * v;
222 A.at(4, 4) += w * w;
223
224 for ( int j = 1; j <= size; j++ ) {
225 y = val.at(j);
226 r.at(1, j) += y;
227 r.at(2, j) += y * u;
228 r.at(3, j) += y * v;
229 r.at(4, j) += y * w;
230 }
231 }
232
233 A.solveForRhs(r, b);
234
235 switch ( node ) {
236 case 1:
237 x1 = 1.0;
238 x2 = 1.0;
239 x3 = 1.0;
240 break;
241 case 2:
242 x1 = -1.0;
243 x2 = 1.0;
244 x3 = 1.0;
245 break;
246 case 3:
247 x1 = -1.0;
248 x2 = -1.0;
249 x3 = 1.0;
250 break;
251 case 4:
252 x1 = 1.0;
253 x2 = -1.0;
254 x3 = 1.0;
255 break;
256 case 5:
257 x1 = 1.0;
258 x2 = 1.0;
259 x3 = -1.0;
260 break;
261 case 6:
262 x1 = -1.0;
263 x2 = 1.0;
264 x3 = -1.0;
265 break;
266 case 7:
267 x1 = -1.0;
268 x2 = -1.0;
269 x3 = -1.0;
270 break;
271 case 8:
272 x1 = 1.0;
273 x2 = -1.0;
274 x3 = -1.0;
275 break;
276 default:
277 OOFEM_ERROR("unsupported node");
278 }
279
280 answer.resize(size);
281 for ( int j = 1; j <= size; j++ ) {
282 answer.at(j) = b.at(1, j) + x1 *b.at(2, j) * x2 * b.at(3, j) * x3 * b.at(4, j);
283 }
284}
285
286
287void
288LSpace :: HuertaErrorEstimatorI_setupRefinedElementProblem(RefinedElement *refinedElement, int level, int nodeId,
289 IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
290 HuertaErrorEstimatorInterface :: SetupMode sMode, TimeStep *tStep,
291 int &localNodeId, int &localElemId, int &localBcId,
292 IntArray &controlNode, IntArray &controlDof,
293 HuertaErrorEstimator :: AnalysisMode aMode)
294{
295 double x = 0.0, y = 0.0, z = 0.0;
296 int nodes = 8, sides = 12, faces = 6;
297
298 static int sideNode [ 12 ] [ 2 ] = { { 1, 2 }, { 2, 3 }, { 3, 4 }, { 4, 1 }, // bottom
299 { 5, 6 }, { 6, 7 }, { 7, 8 }, { 8, 5 }, // top
300 { 1, 5 }, { 2, 6 }, { 3, 7 }, { 4, 8 } }; // vertical
301 static int faceNode [ 6 ] [ 4 ] = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, // bottom, top
302 { 1, 2, 6, 5 }, { 2, 3, 7, 6 }, { 3, 4, 8, 7 }, { 4, 1, 5, 8 } }; // side
303
304 /* ordering of side and face hexa nodes must be compatible with refinedElement connectivity ordering;
305 * generally the ordering is: corner side side face side face face center;
306 * however the concrete ordering is element dependent (see refineMeshGlobally source if in doubts) */
307
308 static int hexaSideNode [ 8 ] [ 3 ] = { { 1, 4, 9 }, { 2, 1, 10 }, { 3, 2, 11 }, { 4, 3, 12 },
309 { 8, 5, 9 }, { 5, 6, 10 }, { 6, 7, 11 }, { 7, 8, 12 } };
310 static int hexaFaceNode [ 8 ] [ 3 ] = { { 1, 3, 6 }, { 1, 4, 3 }, { 1, 5, 4 }, { 1, 6, 5 },
311 { 2, 6, 3 }, { 2, 3, 4 }, { 2, 4, 5 }, { 2, 5, 6 } };
312
313 FloatArray corner [ 8 ], midSide [ 12 ], midFace [ 6 ], midNode;
314 if ( sMode == HuertaErrorEstimatorInterface :: NodeMode ||
315 ( sMode == HuertaErrorEstimatorInterface :: BCMode && aMode == HuertaErrorEstimator :: HEE_linear ) ) {
316 for ( int inode = 0; inode < nodes; inode++ ) {
317 corner [ inode ] = this->giveNode(inode + 1)->giveCoordinates();
318
319 x += corner [ inode ].at(1);
320 y += corner [ inode ].at(2);
321 z += corner [ inode ].at(3);
322 }
323
324 for ( int iside = 0; iside < sides; iside++ ) {
325 midSide [ iside ].resize(3);
326
327 int nd1 = sideNode [ iside ] [ 0 ] - 1;
328 int nd2 = sideNode [ iside ] [ 1 ] - 1;
329
330 midSide [ iside ].at(1) = ( corner [ nd1 ].at(1) + corner [ nd2 ].at(1) ) / 2.0;
331 midSide [ iside ].at(2) = ( corner [ nd1 ].at(2) + corner [ nd2 ].at(2) ) / 2.0;
332 midSide [ iside ].at(3) = ( corner [ nd1 ].at(3) + corner [ nd2 ].at(3) ) / 2.0;
333 }
334
335 midNode.resize(3);
336
337 midNode.at(1) = x / nodes;
338 midNode.at(2) = y / nodes;
339 midNode.at(3) = z / nodes;
340
341 for ( int iface = 0; iface < faces; iface++ ) {
342 x = y = z = 0.0;
343 for ( int inode = 0; inode < 4; inode++ ) {
344 int nd = faceNode [ iface ] [ inode ] - 1;
345 x += corner [ nd ].at(1);
346 y += corner [ nd ].at(2);
347 z += corner [ nd ].at(3);
348 }
349
350 midFace [ iface ].resize(3);
351
352 midFace [ iface ].at(1) = x / 4;
353 midFace [ iface ].at(2) = y / 4;
354 midFace [ iface ].at(3) = z / 4;
355 }
356 }
357
358 this->setupRefinedElementProblem3D(this, refinedElement, level, nodeId, localNodeIdArray, globalNodeIdArray,
359 sMode, tStep, nodes, corner, midSide, midFace, midNode,
360 localNodeId, localElemId, localBcId, hexaSideNode, hexaFaceNode,
361 controlNode, controlDof, aMode, "LSpace");
362}
363
364
365void LSpace :: HuertaErrorEstimatorI_computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)
366{
368}
369
370
371#ifdef __OOFEG
372 #define TR_LENGHT_REDUCT 0.3333
373
374void LSpace :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
375{
376 WCRec p [ 8 ];
377 GraphicObj *go;
378
379 if ( !gc.testElementGraphicActivity(this) ) {
380 return;
381 }
382
383 EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
384 EASValsSetColor( gc.getElementColor() );
385 EASValsSetEdgeColor( gc.getElementEdgeColor() );
386 EASValsSetEdgeFlag(true);
387 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
388 EASValsSetFillStyle(FILL_SOLID);
389 for ( int i = 0; i < 8; i++ ) {
390 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
391 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
392 p [ i ].z = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(3);
393 }
394
395 go = CreateHexahedron(p);
396 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
397 EGAttachObject(go, ( EObjectP ) this);
398 EMAddGraphicsToModel(ESIModel(), go);
399
400 /*
401 * FloatArray c(3);
402 * c.at(1) = -1.0; c.at(2) = 0.0; c.at(3) = 0.0;
403 * this->drawTriad (c,4);
404 * c.at(1) = 1.0; c.at(2) = 0.0; c.at(3) = 0.0;
405 * this->drawTriad (c,6);
406 * c.at(1) = 0.0; c.at(2) = -1.0; c.at(3) = 0.0;
407 * this->drawTriad (c,5);
408 * c.at(1) = 0.0; c.at(2) = 1.0; c.at(3) = 0.0;
409 * this->drawTriad (c,3);
410 * c.at(1) = 0.0; c.at(2) = 0.0; c.at(3) = -1.0;
411 * this->drawTriad (c,2);
412 * c.at(1) = 0.0; c.at(2) = 0.0; c.at(3) = 1.0;
413 * this->drawTriad (c,1);
414 */
415}
416
417
418void LSpace :: drawTriad(FloatArray &coords, int isurf)
419{
420 FloatMatrix jm(3, 3);
421 FloatArray gc(3);
422 GraphicObj *go;
423
424 WCRec p [ 2 ]; // point
425 double coeff = 1.0;
426 int i, succ;
427 /*
428 * // version I
429 * this->interpolation.giveJacobianMatrixAt (jm, domain, nodeArray, coords);
430 * // determine origin
431 * this->interpolation.local2global (gc, domain, nodeArray, coords, 0.0);
432 * // draw triad
433 *
434 */
435
436 // version II
437 // determine surface center
438 //IntArray snodes(4);
439 FloatArray h1(3), h2(3), nn(3), n(3);
440 int j;
441 const char *colors[] = {
442 "red", "green", "blue"
443 };
444
445
446 IntArray snodes = this->interpolation.computeSurfaceMapping(dofManArray, isurf);
447 for ( i = 1; i <= 4; i++ ) {
448 gc.add( domain->giveNode( snodes.at(i) )->giveCoordinates() );
449 }
450
451 gc.times(1. / 4.);
452 // determine "average normal"
453 nn.zero();
454 for ( i = 1; i <= 4; i++ ) {
455 j = ( i ) % 4 + 1;
456 h1 = domain->giveNode( snodes.at(i) )->giveCoordinates();
457 h1.subtract(gc);
458 h2 = domain->giveNode( snodes.at(j) )->giveCoordinates();
459 h2.subtract(gc);
460 n.beVectorProductOf(h1, h2);
461 if ( n.dotProduct(n, 3) > 1.e-6 ) {
462 n.normalize();
463 }
464
465 nn.add(n);
466 }
467
468 nn.times(1. / 4.);
469 if ( nn.dotProduct(nn, 3) < 1.e-6 ) {
470 return;
471 }
472
473 nn.normalize();
474 for ( i = 1; i <= 3; i++ ) {
475 jm.at(i, 3) = nn.at(i);
476 }
477
478 // determine lcs of surface
479 // local x axis in xy plane
480 double test = fabs(fabs( nn.at(3) ) - 1.0);
481 if ( test < 1.e-5 ) {
482 h1.at(1) = jm.at(1, 1) = 1.0;
483 h1.at(2) = jm.at(2, 1) = 0.0;
484 } else {
485 h1.at(1) = jm.at(1, 1) = jm.at(2, 3);
486 h1.at(2) = jm.at(2, 1) = -jm.at(1, 3);
487 }
488
489 h1.at(3) = jm.at(3, 1) = 0.0;
490 // local y axis perpendicular to local x,z axes
491 h2.beVectorProductOf(nn, h1);
492 for ( i = 1; i <= 3; i++ ) {
493 jm.at(i, 2) = h2.at(i);
494 }
495
496
497 p [ 0 ].x = gc.at(1);
498 p [ 0 ].y = gc.at(2);
499 p [ 0 ].z = gc.at(3);
500 for ( i = 1; i <= 3; i++ ) {
501 p [ 1 ].x = p [ 0 ].x + coeff *jm.at(1, i);
502 p [ 1 ].y = p [ 0 ].y + coeff *jm.at(2, i);
503 p [ 1 ].z = p [ 0 ].z + coeff *jm.at(3, i);
504
505 EASValsSetColor( ColorGetPixelFromString(const_cast< char * >(colors [ i - 1 ]), & succ) );
506
507 go = CreateLine3D(p);
508 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
509 EMAddGraphicsToModel(ESIModel(), go);
510 }
511}
512
513
514void LSpace :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
515{
516 int i;
517 WCRec p [ 8 ];
518 GraphicObj *go;
519 double defScale = gc.getDefScale();
520
521 if ( !gc.testElementGraphicActivity(this) ) {
522 return;
523 }
524
525 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
526 EASValsSetColor( gc.getDeformedElementColor() );
527 EASValsSetEdgeColor( gc.getElementEdgeColor() );
528 EASValsSetEdgeFlag(true);
529 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
530 EASValsSetFillStyle(FILL_SOLID);
531 for ( i = 0; i < 8; i++ ) {
532 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
533 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
534 p [ i ].z = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(3, tStep, defScale);
535 }
536
537 go = CreateHexahedron(p);
538 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
539 EMAddGraphicsToModel(ESIModel(), go);
540}
541
542
543void LSpace :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
544{
545 int i, indx, result = 0;
546 WCRec p [ 8 ];
547 GraphicObj *tr;
548 FloatArray v [ 8 ];
549 double s [ 8 ], defScale = 0.0;
550
551 if ( !gc.testElementGraphicActivity(this) ) {
552 return;
553 }
554
555 if ( gc.giveIntVarMode() == ISM_recovered ) {
556 for ( i = 1; i <= 8; i++ ) {
557 result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
558 }
559
560 if ( result != 8 ) {
561 return;
562 }
563 } else if ( gc.giveIntVarMode() == ISM_local ) {
564 return;
565 }
566
567 indx = gc.giveIntVarIndx();
568
569 for ( i = 1; i <= 8; i++ ) {
570 s [ i - 1 ] = v [ i - 1 ].at(indx);
571 }
572
573 EASValsSetEdgeColor( gc.getElementEdgeColor() );
574 EASValsSetEdgeFlag(true);
575 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
576 if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
577 for ( i = 0; i < 8; i++ ) {
578 if ( gc.getInternalVarsDefGeoFlag() ) {
579 // use deformed geometry
580 defScale = gc.getDefScale();
581 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
582 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
583 p [ i ].z = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(3, tStep, defScale);
584 } else {
585 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
586 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
587 p [ i ].z = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(3);
588 }
589 }
590
591 gc.updateFringeTableMinMax(s, 8);
592 tr = CreateHexahedronWD(p, s);
593 EGWithMaskChangeAttributes(LAYER_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK, tr);
594 EMAddGraphicsToModel(ESIModel(), tr);
595 }
596}
597
598void
599LSpace :: drawSpecial(oofegGraphicContext &gc, TimeStep *tStep)
600{
601 int i, j, k;
602 WCRec q [ 4 ];
603 GraphicObj *tr;
604 FloatArray crackStatuses, cf;
605
606 if ( !gc.testElementGraphicActivity(this) ) {
607 return;
608 }
609
610 if ( gc.giveIntVarType() == IST_CrackState ) {
611 int crackStatus;
612 FloatArray gpc;
613 double length;
614 FloatArray crackDir;
615
616 for ( GaussPoint *gp : *this->giveDefaultIntegrationRulePtr() ) {
617 if ( this->giveIPValue(cf, gp, IST_CrackedFlag, tStep) == 0 ) {
618 return;
619 }
620
621 if ( ( int ) cf.at(1) == 0 ) {
622 return;
623 }
624
625 //
626 // obtain gp global coordinates
627 this->computeGlobalCoordinates( gpc, gp->giveNaturalCoordinates() );
628 length = 0.3333 * cbrt( this->computeVolumeAround(gp) );
629 if ( this->giveIPValue(crackDir, gp, IST_CrackDirs, tStep) ) {
630 this->giveIPValue(crackStatuses, gp, IST_CrackStatuses, tStep);
631
632
633 for ( i = 1; i <= 3; i++ ) {
634 crackStatus = ( int ) crackStatuses.at(i);
635 if ( ( crackStatus != pscm_NONE ) && ( crackStatus != pscm_CLOSED ) ) {
636 // draw a crack
637 // this element is 3d element
638
639 if ( i == 1 ) {
640 j = 2;
641 k = 3;
642 } else if ( i == 2 ) {
643 j = 3;
644 k = 1;
645 } else {
646 j = 1;
647 k = 2;
648 }
649
650 q [ 0 ].x = ( FPNum ) gpc.at(1) + 0.5 * crackDir.at(0 + j) * length + 0.5 * crackDir.at(0 + k) * length;
651 q [ 0 ].y = ( FPNum ) gpc.at(2) + 0.5 * crackDir.at(3 + j) * length + 0.5 * crackDir.at(3 + k) * length;
652 q [ 0 ].z = ( FPNum ) gpc.at(3) + 0.5 * crackDir.at(6 + j) * length + 0.5 * crackDir.at(6 + k) * length;
653 q [ 1 ].x = ( FPNum ) gpc.at(1) + 0.5 * crackDir.at(0 + j) * length - 0.5 * crackDir.at(0 + k) * length;
654 q [ 1 ].y = ( FPNum ) gpc.at(2) + 0.5 * crackDir.at(3 + j) * length - 0.5 * crackDir.at(3 + k) * length;
655 q [ 1 ].z = ( FPNum ) gpc.at(3) + 0.5 * crackDir.at(6 + j) * length - 0.5 * crackDir.at(6 + k) * length;
656 q [ 2 ].x = ( FPNum ) gpc.at(1) - 0.5 * crackDir.at(0 + j) * length - 0.5 * crackDir.at(0 + k) * length;
657 q [ 2 ].y = ( FPNum ) gpc.at(2) - 0.5 * crackDir.at(3 + j) * length - 0.5 * crackDir.at(3 + k) * length;
658 q [ 2 ].z = ( FPNum ) gpc.at(3) - 0.5 * crackDir.at(6 + j) * length - 0.5 * crackDir.at(6 + k) * length;
659 q [ 3 ].x = ( FPNum ) gpc.at(1) - 0.5 * crackDir.at(0 + j) * length + 0.5 * crackDir.at(0 + k) * length;
660 q [ 3 ].y = ( FPNum ) gpc.at(2) - 0.5 * crackDir.at(3 + j) * length + 0.5 * crackDir.at(3 + k) * length;
661 q [ 3 ].z = ( FPNum ) gpc.at(3) - 0.5 * crackDir.at(6 + j) * length + 0.5 * crackDir.at(6 + k) * length;
662
663 EASValsSetLayer(OOFEG_CRACK_PATTERN_LAYER);
664 EASValsSetLineWidth(OOFEG_CRACK_PATTERN_WIDTH);
665 if ( ( crackStatus == pscm_SOFTENING ) || ( crackStatus == pscm_OPEN ) ) {
666 EASValsSetColor( gc.getActiveCrackColor() );
667 } else {
668 EASValsSetColor( gc.getCrackPatternColor() );
669 }
670
671 // EASValsSetFillStyle (FILL_HOLLOW);
672 tr = CreateQuad3D(q);
673 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, tr);
674 EMAddGraphicsToModel(ESIModel(), tr);
675 }
676 }
677 }
678 } // end loop over gp
679 }
680}
681
682#endif
683
684
685int
686LSpace :: computeLoadLSToLRotationMatrix(FloatMatrix &answer, int isurf, GaussPoint *gp)
687{
688 // returns transformation matrix from
689 // surface local coordinate system
690 // to element local c.s
691 // (same as global c.s in this case)
692 //
693 // i.e. f(element local) = T * f(edge local)
694
695 // definition of local c.s on surface:
696 // local z axis - perpendicular to surface, pointing outwards from element
697 // local x axis - is in global xy plane (perpendicular to global z axis)
698 // local y axis - completes the righ hand side cs.
699
700 /*
701 * OOFEM_ERROR("surface local coordinate system not supported");
702 * return 1;
703 */
704 FloatArray gc(3);
705 FloatArray h1(3), h2(3), nn(3), n(3);
706
707 answer.resize(3, 3);
708
709 const auto &snodes = this->interpolation.computeSurfaceMapping(dofManArray, isurf);
710 for ( int i = 1; i <= 4; i++ ) {
711 gc.add( domain->giveNode( snodes.at(i) )->giveCoordinates() );
712 }
713
714 gc.times(1. / 4.);
715 // determine "average normal"
716 for ( int i = 1; i <= 4; i++ ) {
717 int j = ( i ) % 4 + 1;
718 h1 = domain->giveNode( snodes.at(i) )->giveCoordinates();
719 h1.subtract(gc);
720 h1.normalize();
721 h2 = domain->giveNode( snodes.at(j) )->giveCoordinates();
722 h2.subtract(gc);
723 h2.normalize();
724 n.beVectorProductOf(h1, h2);
725
726 nn.add(n);
727 }
728
729 nn.times(1. / 4.);
730 if ( nn.computeSquaredNorm() < 1.e-6 ) {
731 answer.zero();
732 return 1;
733 }
734
735 nn.normalize();
736 for ( int i = 1; i <= 3; i++ ) {
737 answer.at(i, 3) = nn.at(i);
738 }
739
740 // determine lcs of surface
741 // local x axis in xy plane
742 double test = fabs(fabs( nn.at(3) ) - 1.0);
743 if ( test < 1.e-5 ) {
744 h1.at(1) = answer.at(1, 1) = 1.0;
745 h1.at(2) = answer.at(2, 1) = 0.0;
746 } else {
747 h1.at(1) = answer.at(1, 1) = answer.at(2, 3);
748 h1.at(2) = answer.at(2, 1) = -answer.at(1, 3);
749 }
750
751 h1.at(3) = answer.at(3, 1) = 0.0;
752 // local y axis perpendicular to local x,z axes
753 h2.beVectorProductOf(nn, h1);
754 for ( int i = 1; i <= 3; i++ ) {
755 answer.at(i, 2) = h2.at(i);
756 }
757
758 return 1;
759}
760} // 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
IntArray dofManArray
Array containing dofmanager numbers.
Definition element.h:138
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Definition element.C:1225
int numberOfDofMans
Number of dofmanagers.
Definition element.h:136
std::vector< std ::unique_ptr< IntegrationRule > > integrationRulesArray
Definition element.h:157
int numberOfGaussPoints
Definition element.h:175
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Definition element.h:886
virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
Domain * giveDomain() const
Definition femcmpnn.h:97
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
int number
Component number.
Definition femcmpnn.h:77
int giveNumber() const
Definition femcmpnn.h:104
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
double dotProduct(const FloatArray &x) const
Definition floatarray.C:524
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Definition floatarray.C:476
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void zero()
Zeroes all coefficient of receiver.
int giveNumberOfRows() const
Returns number of rows of receiver.
double at(std::size_t i, std::size_t j) const
bool solveForRhs(const FloatArray &b, FloatArray &answer, bool transpose=false)
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 setupRefinedElementProblem3D(Element *element, RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface ::SetupMode mode, TimeStep *tStep, int nodes, FloatArray *corner, FloatArray *midSide, FloatArray *midFace, FloatArray &midNode, int &localNodeId, int &localElemId, int &localBcId, int hexaSideNode[1][3], int hexaFaceNode[1][3], IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator ::AnalysisMode aMode, const char *hexatype)
void resize(int n)
Definition intarray.C:73
int & at(std::size_t i)
Definition intarray.h:104
static ParamKey IPK_LSpace_reducedShearIntegration
[optional] Reduced shear integration flag.
Definition lspace.h:69
FEInterpolation * giveInterpolation() const override
Definition lspace.C:73
static FEI3dHexaLin interpolation
Definition lspace.h:67
bool reducedShearIntegration
Definition lspace.h:68
SpatialLocalizerInterface(Element *element)
Structural3DElement(int n, Domain *d)
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 cbrt(double x)
Returns the cubic root of x.
Definition mathfem.h:122
@ HuertaErrorEstimatorInterfaceType
@ SPRNodalRecoveryModelInterfaceType
@ ZZNodalRecoveryModelInterfaceType
@ SpatialLocalizerInterfaceType
@ NodalAveragingRecoveryModelInterfaceType
#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 PM_UPDATE_PARAMETER(_val, _pm, _ir, _componentnum, _paramkey, _prio)
#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