OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 2013 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 "../sm/Elements/Axisymmetry/l4axisymm.h"
36 #include "fei2dquadlin.h"
37 #include "node.h"
38 #include "gausspoint.h"
39 #include "gaussintegrationrule.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 
55 namespace oofem {
56 REGISTER_Element(L4Axisymm);
57 
58 FEI2dQuadLinAxi L4Axisymm :: interpolation(1, 2);
59 
60 L4Axisymm :: L4Axisymm(int n, Domain *aDomain) :
62 {
63  numberOfDofMans = 4;
66 }
67 
68 
70 { }
71 
72 
75 
76 
77 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 
94 {
97  if ( result != IRRT_OK ) {
98  return result;
99  }
100 
101 
102  if ( !( ( numberOfGaussPoints == 1 ) ||
103  ( numberOfGaussPoints == 4 ) ||
104  ( numberOfGaussPoints == 9 ) ||
105  ( numberOfGaussPoints == 16 ) ) ) {
107  }
108 
110 
111  return IRRT_OK;
112 }
113 
114 
115 
116 void
118 {
119  // Returns the [ 6 x (nno*2) ] strain-displacement matrix {B} of the receiver,
120  // evaluated at gp. Uses reduced integration.
121  // (epsilon_x,epsilon_y,...,Gamma_xy) = B . r
122  // r = ( u1,v1,u2,v2,u3,v3,u4,v4)
123 
124  FloatArray N, NRed, redCoord;
125  if ( numberOfFiAndShGaussPoints == 1 ) { // Reduced integration
126  redCoord = {0.0, 0.0}; // eval in centroid
127  } else {
128  redCoord = gp->giveNaturalCoordinates();
129  }
130 
131 
132  FEInterpolation *interp = this->giveInterpolation();
133 
134 
135  interp->evalN( N, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
136  interp->evalN( NRed, redCoord, FEIElementGeometryWrapper(this) );
137 
138  // Evaluate radius at center
139  double r = 0.0;
140  for ( int i = 1; i <= this->giveNumberOfDofManagers(); i++ ) {
141  double x = this->giveNode(i)->giveCoordinate(1);
142  r += x * NRed.at(i);
143  }
144 
145  FloatMatrix dNdx, dNdxRed;
146  interp->evaldNdx( dNdx, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
147  interp->evaldNdx( dNdxRed, redCoord, FEIElementGeometryWrapper(this) );
148  answer.resize(6, dNdx.giveNumberOfRows() * 2);
149  answer.zero();
150 
151  for ( int i = 1; i <= dNdx.giveNumberOfRows(); i++ ) {
152  answer.at(1, i * 2 - 1) = dNdx.at(i, 1);
153  answer.at(2, i * 2 - 0) = dNdx.at(i, 2);
154  answer.at(3, i * 2 - 1) = NRed.at(i) / r;
155  answer.at(6, 2 * i - 1) = dNdxRed.at(i, 2);
156  answer.at(6, 2 * i - 0) = dNdxRed.at(i, 1);
157  }
158 }
159 
160 void
162 {
163  pap.resize(4);
164  for ( int i = 1; i < 5; i++ ) {
165  pap.at(i) = this->giveNode(i)->giveNumber();
166  }
167 }
168 
169 void
171 {
172  int found = 0;
173  answer.resize(1);
174 
175  for ( int i = 1; i < 5; i++ ) {
176  if ( pap == this->giveNode(i)->giveNumber() ) {
177  found = 1;
178  }
179  }
180 
181  if ( found ) {
182  answer.at(1) = pap;
183  } else {
184  OOFEM_ERROR("node unknown");
185  }
186 }
187 
188 int
190 {
192 }
193 
194 
197 {
198  return SPRPatchType_2dxy;
199 }
200 
201 
202 
203 #ifdef __OOFEG
204  #define TR_LENGHT_REDUCT 0.3333
205 
207 {
208  WCRec p [ 4 ];
209  GraphicObj *go;
210 
211  if ( !gc.testElementGraphicActivity(this) ) {
212  return;
213  }
214 
215  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
216  EASValsSetColor( gc.getElementColor() );
217  EASValsSetEdgeColor( gc.getElementEdgeColor() );
218  EASValsSetEdgeFlag(true);
219  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
220  EASValsSetFillStyle(FILL_HOLLOW);
221  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
222  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
223  p [ 0 ].z = 0.;
224  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
225  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
226  p [ 1 ].z = 0.;
227  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
228  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
229  p [ 2 ].z = 0.;
230  p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveCoordinate(1);
231  p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveCoordinate(2);
232  p [ 3 ].z = 0.;
233 
234  go = CreateQuad3D(p);
235  EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
236  EGAttachObject(go, ( EObjectP ) this);
237  EMAddGraphicsToModel(ESIModel(), go);
238 }
239 
240 
242 {
243  WCRec p [ 4 ];
244  GraphicObj *go;
245  double defScale = gc.getDefScale();
246 
247  if ( !gc.testElementGraphicActivity(this) ) {
248  return;
249  }
250 
251  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
252  EASValsSetColor( gc.getDeformedElementColor() );
253  EASValsSetEdgeColor( gc.getElementEdgeColor() );
254  EASValsSetEdgeFlag(true);
255  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
256  EASValsSetFillStyle(FILL_HOLLOW);
257  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
258  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
259  p [ 0 ].z = 0.;
260  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
261  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
262  p [ 1 ].z = 0.;
263  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
264  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
265  p [ 2 ].z = 0.;
266  p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
267  p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
268  p [ 3 ].z = 0.;
269 
270  go = CreateQuad3D(p);
271  EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
272  EMAddGraphicsToModel(ESIModel(), go);
273 }
274 
275 
276 
278 {
279  int i, indx, result = 0;
280  WCRec p [ 4 ];
281  GraphicObj *tr;
282  FloatArray v [ 4 ];
283  double s [ 4 ], defScale;
284 
285  if ( !gc.testElementGraphicActivity(this) ) {
286  return;
287  }
288 
289  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
290  if ( gc.giveIntVarMode() == ISM_recovered ) {
291  for ( i = 1; i <= 4; i++ ) {
292  result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
293  }
294 
295  if ( result != 4 ) {
296  return;
297  }
298 
299  indx = gc.giveIntVarIndx();
300 
301  for ( i = 1; i <= 4; i++ ) {
302  s [ i - 1 ] = v [ i - 1 ].at(indx);
303  }
304 
305  if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
306  for ( i = 0; i < 4; i++ ) {
307  if ( gc.getInternalVarsDefGeoFlag() ) {
308  // use deformed geometry
309  defScale = gc.getDefScale();
310  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
311  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
312  p [ i ].z = 0.;
313  } else {
314  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
315  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
316  p [ i ].z = 0.;
317  }
318  }
319 
320  //EASValsSetColor(gc.getYieldPlotColor(ratio));
321  gc.updateFringeTableMinMax(s, 4);
322  tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
323  EGWithMaskChangeAttributes(LAYER_MASK, tr);
324  EMAddGraphicsToModel(ESIModel(), tr);
325 
326  /*
327  * } else if (gc.getScalarAlgo() == SA_ISO_LINE) {
328  *
329  * EASValsSetColor(context.getActiveCrackColor());
330  * EASValsSetLineWidth(OOFEG_ISO_LINE_WIDTH);
331  *
332  * for (i=0; i< 4; i++) {
333  * if (gc.getInternalVarsDefGeoFlag()) {
334  * // use deformed geometry
335  * defScale = gc.getDefScale();
336  * p[i].x = (FPNum) this->giveNode(i+1)->giveUpdatedCoordinate(1,tStep,defScale);
337  * p[i].y = (FPNum) this->giveNode(i+1)->giveUpdatedCoordinate(2,tStep,defScale);
338  * p[i].z = 0.;
339  *
340  * } else {
341  * p[i].x = (FPNum) this->giveNode(i+1)->giveCoordinate(1);
342  * p[i].y = (FPNum) this->giveNode(i+1)->giveCoordinate(2);
343  * p[i].z = 0.;
344  * }
345  * }
346  *
347  * // isoline implementation
348  * oofeg_drawIsoLinesOnQuad (p, s);
349  *
350  */
351  }
352  } else if ( gc.giveIntVarMode() == ISM_local ) {
353  if ( numberOfGaussPoints != 4 ) {
354  return;
355  }
356 
357  IntArray ind(4);
358  WCRec pp [ 9 ];
359 
360  for ( i = 0; i < 4; i++ ) {
361  if ( gc.getInternalVarsDefGeoFlag() ) {
362  // use deformed geometry
363  defScale = gc.getDefScale();
364  pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
365  pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
366  pp [ i ].z = 0.;
367  } else {
368  pp [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
369  pp [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
370  pp [ i ].z = 0.;
371  }
372  }
373 
374  for ( i = 0; i < 3; i++ ) {
375  pp [ i + 4 ].x = 0.5 * ( pp [ i ].x + pp [ i + 1 ].x );
376  pp [ i + 4 ].y = 0.5 * ( pp [ i ].y + pp [ i + 1 ].y );
377  pp [ i + 4 ].z = 0.5 * ( pp [ i ].z + pp [ i + 1 ].z );
378  }
379 
380  pp [ 7 ].x = 0.5 * ( pp [ 3 ].x + pp [ 0 ].x );
381  pp [ 7 ].y = 0.5 * ( pp [ 3 ].y + pp [ 0 ].y );
382  pp [ 7 ].z = 0.5 * ( pp [ 3 ].z + pp [ 0 ].z );
383 
384  pp [ 8 ].x = 0.25 * ( pp [ 0 ].x + pp [ 1 ].x + pp [ 2 ].x + pp [ 3 ].x );
385  pp [ 8 ].y = 0.25 * ( pp [ 0 ].y + pp [ 1 ].y + pp [ 2 ].y + pp [ 3 ].y );
386  pp [ 8 ].z = 0.25 * ( pp [ 0 ].z + pp [ 1 ].z + pp [ 2 ].z + pp [ 3 ].z );
387 
388  for ( GaussPoint *gp: *this->giveDefaultIntegrationRulePtr() ) {
389  const FloatArray &gpCoords = gp->giveNaturalCoordinates();
390  if ( ( gpCoords.at(1) > 0. ) && ( gpCoords.at(2) > 0. ) ) {
391  ind.at(1) = 0;
392  ind.at(2) = 4;
393  ind.at(3) = 8;
394  ind.at(4) = 7;
395  } else if ( ( gpCoords.at(1) < 0. ) && ( gpCoords.at(2) > 0. ) ) {
396  ind.at(1) = 4;
397  ind.at(2) = 1;
398  ind.at(3) = 5;
399  ind.at(4) = 8;
400  } else if ( ( gpCoords.at(1) < 0. ) && ( gpCoords.at(2) < 0. ) ) {
401  ind.at(1) = 5;
402  ind.at(2) = 2;
403  ind.at(3) = 6;
404  ind.at(4) = 8;
405  } else {
406  ind.at(1) = 6;
407  ind.at(2) = 3;
408  ind.at(3) = 7;
409  ind.at(4) = 8;
410  }
411 
412  if ( giveIPValue(v [ 0 ], gp, gc.giveIntVarType(), tStep) == 0 ) {
413  return;
414  }
415 
416  indx = gc.giveIntVarIndx();
417 
418  for ( i = 1; i <= 4; i++ ) {
419  s [ i - 1 ] = v [ 0 ].at(indx);
420  }
421 
422  for ( i = 0; i < 4; i++ ) {
423  p [ i ].x = pp [ ind.at(i + 1) ].x;
424  p [ i ].y = pp [ ind.at(i + 1) ].y;
425  p [ i ].z = pp [ ind.at(i + 1) ].z;
426  }
427 
428  gc.updateFringeTableMinMax(s, 4);
429  tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
430  EGWithMaskChangeAttributes(LAYER_MASK, tr);
431  EMAddGraphicsToModel(ESIModel(), tr);
432  }
433  }
434 }
435 
436 
437 #endif
438 } // end namespace oofem
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
virtual ~L4Axisymm()
Definition: l4axisymm.C:69
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Definition: l4axisymm.C:277
The element interface required by ZZNodalRecoveryModel.
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the array of interpolation functions (shape functions) at given point.
Class and object Domain.
Definition: domain.h:115
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
Definition: element.h:822
ScalarAlgorithmType getScalarAlgo()
The element interface required by ZZNodalRecoveryModel.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual int giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode, int node, TimeStep *tStep)
Returns internal state variable (like stress,strain) at node of element in Reduced form...
#define OOFEG_RAW_GEOMETRY_LAYER
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
Definition: l4axisymm.C:161
virtual double giveCoordinate(int i)
Definition: node.C:82
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
virtual SPRPatchType SPRNodalRecoveryMI_givePatchType()
Definition: l4axisymm.C:196
virtual int giveNumberOfDofManagers() const
Definition: element.h:656
#define OOFEG_DEFORMED_GEOMETRY_LAYER
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
virtual FEInterpolation * giveInterpolation() const
Definition: l4axisymm.C:74
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: l4axisymm.C:206
InternalStateType giveIntVarType()
L4Axisymm(int n, Domain *d)
Definition: l4axisymm.C:60
#define OOFEM_ERROR(...)
Definition: error.h:61
REGISTER_Element(LSpace)
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: l4axisymm.C:93
#define OOFEG_RAW_GEOMETRY_WIDTH
UnknownType
Type representing particular unknown (its physical meaning).
Definition: unknowntype.h:55
Wrapper around element definition to provide FEICellGeometry interface.
Definition: feinterpol.h:95
virtual double giveUpdatedCoordinate(int ic, TimeStep *tStep, double scale=1.)
Returns updated ic-th coordinate of receiver.
Definition: node.C:245
#define N(p, q)
Definition: mdm.C:367
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
Definition: l4axisymm.C:241
virtual void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
Definition: l4axisymm.C:170
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
virtual Interface * giveInterface(InterfaceType it)
Interface requesting service.
Definition: l4axisymm.C:78
virtual void computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int lowerIndx=1, int upperIndx=ALL_STRAINS)
Computes the geometrical matrix of receiver in given integration point.
Definition: l4axisymm.C:117
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
InternalStateMode giveIntVarMode()
int numberOfFiAndShGaussPoints
Definition: l4axisymm.h:57
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
Class representing the general Input Record.
Definition: inputrecord.h:101
Class Interface.
Definition: interface.h:82
int giveNumberOfIntegrationPoints() const
Returns number of integration points of receiver.
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
virtual int SPRNodalRecoveryMI_giveNumberOfIP()
Definition: l4axisymm.C:189
The spatial localizer element interface associated to spatial localizer.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
static FEI2dQuadLinAxi interpolation
Definition: l4axisymm.h:56
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
void updateFringeTableMinMax(double *s, int size)
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumber() const
Definition: femcmpnn.h:107
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
int giveNumberOfRows() const
Returns number of rows of receiver.
Definition: floatmatrix.h:156
#define OOFEG_VARPLOT_PATTERN_LAYER
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the matrix of derivatives of interpolation functions (shape functions) at given point...
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Definition: gausspoint.h:138

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011