OOFEM 3.0
Loading...
Searching...
No Matches
l4axisymm.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 "gausspoint.h"
40#include "floatmatrix.h"
41#include "floatarray.h"
42#include "intarray.h"
43#include "domain.h"
44#include "engngm.h"
45#include "mathfem.h"
46#include "crosssection.h"
47#include "classfactory.h"
48
49#ifdef __OOFEG
50 #include "oofeggraphiccontext.h"
51 #include "oofegutils.h"
52 #include "connectivitytable.h"
53#endif
54
55namespace oofem {
57
58FEI2dQuadLinAxi L4Axisymm :: interpolation(1, 2);
59
60L4Axisymm :: L4Axisymm(int n, Domain *aDomain) :
62{
66}
67
68
69L4Axisymm :: ~L4Axisymm()
70{ }
71
72
74L4Axisymm :: giveInterpolation() const { return & interpolation; }
75
76
78L4Axisymm :: giveInterface(InterfaceType interface)
79{
80 if ( interface == ZZNodalRecoveryModelInterfaceType ) {
81 return static_cast< ZZNodalRecoveryModelInterface * >(this);
82 } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
83 return static_cast< SPRNodalRecoveryModelInterface * >(this);
84 } else if ( interface == SpatialLocalizerInterfaceType ) {
85 return static_cast< SpatialLocalizerInterface * >(this);
86 }
87
88 return NULL;
89}
90
91
92void
93L4Axisymm :: initializeFrom(InputRecord &ir, int priority)
94{
95 NLStructuralElement :: initializeFrom(ir, priority);
96}
97
98void
99L4Axisymm :: postInitialize()
100{
101 if ( !( ( numberOfGaussPoints == 1 ) ||
102 ( numberOfGaussPoints == 4 ) ||
103 ( numberOfGaussPoints == 9 ) ||
104 ( numberOfGaussPoints == 16 ) ) ) {
106 }
107
109
110 NLStructuralElement :: postInitialize();
111}
112
113void
114L4Axisymm :: computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int li, int ui)
115{
116 // Returns the [ 6 x (nno*2) ] strain-displacement matrix {B} of the receiver,
117 // evaluated at gp. Uses reduced integration.
118 // (epsilon_x,epsilon_y,...,Gamma_xy) = B . r
119 // r = ( u1,v1,u2,v2,u3,v3,u4,v4)
120
121 FloatArray N, NRed, redCoord;
122 if ( numberOfFiAndShGaussPoints == 1 ) { // Reduced integration
123 redCoord = Vec2(0.0, 0.0); // eval in centroid
124 } else {
125 redCoord = gp->giveNaturalCoordinates();
126 }
127
128
129 FEInterpolation *interp = this->giveInterpolation();
130
131
133 interp->evalN( NRed, redCoord, FEIElementGeometryWrapper(this) );
134
135 // Evaluate radius at center
136 double r = 0.0;
137 for ( int i = 1; i <= this->giveNumberOfDofManagers(); i++ ) {
138 double x = this->giveNode(i)->giveCoordinate(1);
139 r += x * NRed.at(i);
140 }
141
142 FloatMatrix dNdx, dNdxRed;
143 interp->evaldNdx( dNdx, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
144 interp->evaldNdx( dNdxRed, redCoord, FEIElementGeometryWrapper(this) );
145 answer.resize(6, dNdx.giveNumberOfRows() * 2);
146 answer.zero();
147
148 for ( int i = 1; i <= dNdx.giveNumberOfRows(); i++ ) {
149 answer.at(1, i * 2 - 1) = dNdx.at(i, 1);
150 answer.at(2, i * 2 - 0) = dNdx.at(i, 2);
151 answer.at(3, i * 2 - 1) = NRed.at(i) / r;
152 answer.at(6, 2 * i - 1) = dNdxRed.at(i, 2);
153 answer.at(6, 2 * i - 0) = dNdxRed.at(i, 1);
154 }
155}
156
157void
158L4Axisymm :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
159{
160 pap.resize(4);
161 for ( int i = 1; i < 5; i++ ) {
162 pap.at(i) = this->giveNode(i)->giveNumber();
163 }
164}
165
166void
167L4Axisymm :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
168{
169 int found = 0;
170 answer.resize(1);
171
172 for ( int i = 1; i < 5; i++ ) {
173 if ( pap == this->giveNode(i)->giveNumber() ) {
174 found = 1;
175 }
176 }
177
178 if ( found ) {
179 answer.at(1) = pap;
180 } else {
181 OOFEM_ERROR("node unknown");
182 }
183}
184
185int
186L4Axisymm :: SPRNodalRecoveryMI_giveNumberOfIP()
187{
188 return this->giveDefaultIntegrationRulePtr()->giveNumberOfIntegrationPoints();
189}
190
191
193L4Axisymm :: SPRNodalRecoveryMI_givePatchType()
194{
195 return SPRPatchType_2dxy;
196}
197
198
199
200#ifdef __OOFEG
201 #define TR_LENGHT_REDUCT 0.3333
202
203void L4Axisymm :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
204{
205 WCRec p [ 4 ];
206 GraphicObj *go;
207
208 if ( !gc.testElementGraphicActivity(this) ) {
209 return;
210 }
211
212 EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
213 EASValsSetColor( gc.getElementColor() );
214 EASValsSetEdgeColor( gc.getElementEdgeColor() );
215 EASValsSetEdgeFlag(true);
216 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
217 EASValsSetFillStyle(FILL_HOLLOW);
218 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
219 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
220 p [ 0 ].z = 0.;
221 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
222 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
223 p [ 1 ].z = 0.;
224 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
225 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
226 p [ 2 ].z = 0.;
227 p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveCoordinate(1);
228 p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveCoordinate(2);
229 p [ 3 ].z = 0.;
230
231 go = CreateQuad3D(p);
232 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
233 EGAttachObject(go, ( EObjectP ) this);
234 EMAddGraphicsToModel(ESIModel(), go);
235}
236
237
238void L4Axisymm :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
239{
240 WCRec p [ 4 ];
241 GraphicObj *go;
242 double defScale = gc.getDefScale();
243
244 if ( !gc.testElementGraphicActivity(this) ) {
245 return;
246 }
247
248 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
249 EASValsSetColor( gc.getDeformedElementColor() );
250 EASValsSetEdgeColor( gc.getElementEdgeColor() );
251 EASValsSetEdgeFlag(true);
252 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
253 EASValsSetFillStyle(FILL_HOLLOW);
254 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
255 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
256 p [ 0 ].z = 0.;
257 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
258 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
259 p [ 1 ].z = 0.;
260 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
261 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
262 p [ 2 ].z = 0.;
263 p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
264 p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
265 p [ 3 ].z = 0.;
266
267 go = CreateQuad3D(p);
268 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
269 EMAddGraphicsToModel(ESIModel(), go);
270}
271
272
273
274void L4Axisymm :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
275{
276 int i, indx, result = 0;
277 WCRec p [ 4 ];
278 GraphicObj *tr;
279 FloatArray v [ 4 ];
280 double s [ 4 ], defScale;
281
282 if ( !gc.testElementGraphicActivity(this) ) {
283 return;
284 }
285
286 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
287 if ( gc.giveIntVarMode() == ISM_recovered ) {
288 for ( i = 1; i <= 4; i++ ) {
289 result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
290 }
291
292 if ( result != 4 ) {
293 return;
294 }
295
296 indx = gc.giveIntVarIndx();
297
298 for ( i = 1; i <= 4; i++ ) {
299 s [ i - 1 ] = v [ i - 1 ].at(indx);
300 }
301
302 if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
303 for ( i = 0; i < 4; i++ ) {
304 if ( gc.getInternalVarsDefGeoFlag() ) {
305 // use deformed geometry
306 defScale = gc.getDefScale();
307 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
308 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
309 p [ i ].z = 0.;
310 } else {
311 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
312 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
313 p [ i ].z = 0.;
314 }
315 }
316
317 //EASValsSetColor(gc.getYieldPlotColor(ratio));
318 gc.updateFringeTableMinMax(s, 4);
319 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
320 EGWithMaskChangeAttributes(LAYER_MASK, tr);
321 EMAddGraphicsToModel(ESIModel(), tr);
322
323 /*
324 * } else if (gc.getScalarAlgo() == SA_ISO_LINE) {
325 *
326 * EASValsSetColor(context.getActiveCrackColor());
327 * EASValsSetLineWidth(OOFEG_ISO_LINE_WIDTH);
328 *
329 * for (i=0; i< 4; i++) {
330 * if (gc.getInternalVarsDefGeoFlag()) {
331 * // use deformed geometry
332 * defScale = gc.getDefScale();
333 * p[i].x = (FPNum) this->giveNode(i+1)->giveUpdatedCoordinate(1,tStep,defScale);
334 * p[i].y = (FPNum) this->giveNode(i+1)->giveUpdatedCoordinate(2,tStep,defScale);
335 * p[i].z = 0.;
336 *
337 * } else {
338 * p[i].x = (FPNum) this->giveNode(i+1)->giveCoordinate(1);
339 * p[i].y = (FPNum) this->giveNode(i+1)->giveCoordinate(2);
340 * p[i].z = 0.;
341 * }
342 * }
343 *
344 * // isoline implementation
345 * oofeg_drawIsoLinesOnQuad (p, s);
346 *
347 */
348 }
349 } else if ( gc.giveIntVarMode() == ISM_local ) {
350 if ( numberOfGaussPoints != 4 ) {
351 return;
352 }
353
354 IntArray ind(4);
355 WCRec pp [ 9 ];
356
357 for ( i = 0; i < 4; i++ ) {
358 if ( gc.getInternalVarsDefGeoFlag() ) {
359 // use deformed geometry
360 defScale = gc.getDefScale();
361 pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
362 pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
363 pp [ i ].z = 0.;
364 } else {
365 pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
366 pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
367 pp [ i ].z = 0.;
368 }
369 }
370
371 for ( i = 0; i < 3; i++ ) {
372 pp [ i + 4 ].x = 0.5 * ( pp [ i ].x + pp [ i + 1 ].x );
373 pp [ i + 4 ].y = 0.5 * ( pp [ i ].y + pp [ i + 1 ].y );
374 pp [ i + 4 ].z = 0.5 * ( pp [ i ].z + pp [ i + 1 ].z );
375 }
376
377 pp [ 7 ].x = 0.5 * ( pp [ 3 ].x + pp [ 0 ].x );
378 pp [ 7 ].y = 0.5 * ( pp [ 3 ].y + pp [ 0 ].y );
379 pp [ 7 ].z = 0.5 * ( pp [ 3 ].z + pp [ 0 ].z );
380
381 pp [ 8 ].x = 0.25 * ( pp [ 0 ].x + pp [ 1 ].x + pp [ 2 ].x + pp [ 3 ].x );
382 pp [ 8 ].y = 0.25 * ( pp [ 0 ].y + pp [ 1 ].y + pp [ 2 ].y + pp [ 3 ].y );
383 pp [ 8 ].z = 0.25 * ( pp [ 0 ].z + pp [ 1 ].z + pp [ 2 ].z + pp [ 3 ].z );
384
385 for ( GaussPoint *gp: *this->giveDefaultIntegrationRulePtr() ) {
386 const FloatArray &gpCoords = gp->giveNaturalCoordinates();
387 if ( ( gpCoords.at(1) > 0. ) && ( gpCoords.at(2) > 0. ) ) {
388 ind.at(1) = 0;
389 ind.at(2) = 4;
390 ind.at(3) = 8;
391 ind.at(4) = 7;
392 } else if ( ( gpCoords.at(1) < 0. ) && ( gpCoords.at(2) > 0. ) ) {
393 ind.at(1) = 4;
394 ind.at(2) = 1;
395 ind.at(3) = 5;
396 ind.at(4) = 8;
397 } else if ( ( gpCoords.at(1) < 0. ) && ( gpCoords.at(2) < 0. ) ) {
398 ind.at(1) = 5;
399 ind.at(2) = 2;
400 ind.at(3) = 6;
401 ind.at(4) = 8;
402 } else {
403 ind.at(1) = 6;
404 ind.at(2) = 3;
405 ind.at(3) = 7;
406 ind.at(4) = 8;
407 }
408
409 if ( giveIPValue(v [ 0 ], gp, gc.giveIntVarType(), tStep) == 0 ) {
410 return;
411 }
412
413 indx = gc.giveIntVarIndx();
414
415 for ( i = 1; i <= 4; i++ ) {
416 s [ i - 1 ] = v [ 0 ].at(indx);
417 }
418
419 for ( i = 0; i < 4; i++ ) {
420 p [ i ].x = pp [ ind.at(i + 1) ].x;
421 p [ i ].y = pp [ ind.at(i + 1) ].y;
422 p [ i ].z = pp [ ind.at(i + 1) ].z;
423 }
424
425 gc.updateFringeTableMinMax(s, 4);
426 tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
427 EGWithMaskChangeAttributes(LAYER_MASK, tr);
428 EMAddGraphicsToModel(ESIModel(), tr);
429 }
430 }
431}
432
433
434#endif
435} // end namespace oofem
#define N(a, b)
#define REGISTER_Element(class)
AxisymElement(int n, Domain *d)
Node * giveNode(int i) const
Definition element.h:629
int numberOfDofMans
Number of dofmanagers.
Definition element.h:136
int numberOfGaussPoints
Definition element.h:175
virtual int giveNumberOfDofManagers() const
Definition element.h:695
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Definition element.h:886
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
int giveNumber() const
Definition femcmpnn.h:104
double & at(Index i)
Definition floatarray.h:202
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
const FloatArray & giveNaturalCoordinates() const
Returns coordinate array of receiver.
Definition gausspoint.h:138
void resize(int n)
Definition intarray.C:73
int & at(std::size_t i)
Definition intarray.h:104
static FEI2dQuadLinAxi interpolation
Definition l4axisymm.h:56
FEInterpolation * giveInterpolation() const override
Definition l4axisymm.C:74
int numberOfFiAndShGaussPoints
Definition l4axisymm.h:57
SpatialLocalizerInterface(Element *element)
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
static FloatArray Vec2(const double &a, const double &b)
Definition floatarray.h:606
@ SPRNodalRecoveryModelInterfaceType
@ ZZNodalRecoveryModelInterfaceType
@ SpatialLocalizerInterfaceType
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

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