OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
trplanestrain.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 
36 #include "fei2dtrlin.h"
37 #include "node.h"
38 #include "crosssection.h"
39 #include "gausspoint.h"
40 #include "gaussintegrationrule.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 #endif
51 
52 namespace oofem {
53 REGISTER_Element(TrPlaneStrain);
54 
55 FEI2dTrLin TrPlaneStrain :: interp(1, 2);
56 
62  // Constructor.
63 {
64  numberOfDofMans = 3;
65  area = -1;
67 }
68 
69 
71 
72 
73 Interface *
75 {
76  if ( interface == ZZNodalRecoveryModelInterfaceType ) {
77  return static_cast< ZZNodalRecoveryModelInterface * >(this);
78  } else if ( interface == NodalAveragingRecoveryModelInterfaceType ) {
79  return static_cast< NodalAveragingRecoveryModelInterface * >(this);
80  } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
81  return static_cast< SPRNodalRecoveryModelInterface * >(this);
82  } else if ( interface == SpatialLocalizerInterfaceType ) {
83  return static_cast< SpatialLocalizerInterface * >(this);
84  } else if ( interface == ZZErrorEstimatorInterfaceType ) {
85  return static_cast< ZZErrorEstimatorInterface * >(this);
86  } else if ( interface == HuertaErrorEstimatorInterfaceType ) {
87  return static_cast< HuertaErrorEstimatorInterface * >(this);
88  }
89 
90  return NULL;
91 }
92 
93 
96 {
99  if ( result != IRRT_OK ) {
100  return result;
101  }
102 
103  if ( numberOfGaussPoints != 1 ) {
105  }
106 
107  return IRRT_OK;
108 }
109 
110 
111 
112 void
114  InternalStateType type, TimeStep *tStep)
115 {
116  GaussPoint *gp;
117  gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);
118  this->giveIPValue(answer, gp, type, tStep);
119 }
120 
121 
122 void
124 {
125  pap.resize(3);
126  pap.at(1) = this->giveNode(1)->giveNumber();
127  pap.at(2) = this->giveNode(2)->giveNumber();
128  pap.at(3) = this->giveNode(3)->giveNumber();
129 }
130 
131 
132 void
134 {
135  answer.resize(1);
136  if ( ( pap == this->giveNode(1)->giveNumber() ) ||
137  ( pap == this->giveNode(2)->giveNumber() ) ||
138  ( pap == this->giveNode(3)->giveNumber() ) ) {
139  answer.at(1) = pap;
140  } else {
141  OOFEM_ERROR("node unknown");
142  }
143 }
144 
145 
146 int
148 {
149  return 1;
150 }
151 
152 
155 {
156  return SPRPatchType_2dxy;
157 }
158 
159 
160 void
162  IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
164  int &localNodeId, int &localElemId, int &localBcId,
165  IntArray &controlNode, IntArray &controlDof,
167 {
168  int inode, nodes = 3, iside, sides = 3, nd1, nd2;
169  FloatArray *corner [ 3 ], midSide [ 3 ], midNode, cor [ 3 ];
170  double x = 0.0, y = 0.0;
171 
172  static int sideNode [ 3 ] [ 2 ] = { { 1, 2 }, { 2, 3 }, { 3, 1 } };
173 
176  for ( inode = 0; inode < nodes; inode++ ) {
177  corner [ inode ] = this->giveNode(inode + 1)->giveCoordinates();
178  if ( corner [ inode ]->giveSize() != 3 ) {
179  cor [ inode ].resize(3);
180  cor [ inode ].at(1) = corner [ inode ]->at(1);
181  cor [ inode ].at(2) = corner [ inode ]->at(2);
182  cor [ inode ].at(3) = 0.0;
183 
184  corner [ inode ] = & ( cor [ inode ] );
185  }
186 
187  x += corner [ inode ]->at(1);
188  y += corner [ inode ]->at(2);
189  }
190 
191  for ( iside = 0; iside < sides; iside++ ) {
192  midSide [ iside ].resize(3);
193 
194  nd1 = sideNode [ iside ] [ 0 ] - 1;
195  nd2 = sideNode [ iside ] [ 1 ] - 1;
196 
197  midSide [ iside ].at(1) = ( corner [ nd1 ]->at(1) + corner [ nd2 ]->at(1) ) / 2.0;
198  midSide [ iside ].at(2) = ( corner [ nd1 ]->at(2) + corner [ nd2 ]->at(2) ) / 2.0;
199  midSide [ iside ].at(3) = 0.0;
200  }
201 
202  midNode.resize(3);
203 
204  midNode.at(1) = x / nodes;
205  midNode.at(2) = y / nodes;
206  midNode.at(3) = 0.0;
207  }
208 
209  this->setupRefinedElementProblem2D(this, refinedElement, level, nodeId, localNodeIdArray, globalNodeIdArray,
210  sMode, tStep, nodes, corner, midSide, midNode,
211  localNodeId, localElemId, localBcId,
212  controlNode, controlDof, aMode, "Quad1PlaneStrain");
213 }
214 
215 
217 {
219 }
220 
221 
222 
223 #ifdef __OOFEG
224  #define TR_LENGHT_REDUCT 0.3333
225 
227 {
228  WCRec p [ 3 ];
229  GraphicObj *go;
230 
231  if ( !gc.testElementGraphicActivity(this) ) {
232  return;
233  }
234 
235  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
236  EASValsSetColor( gc.getElementColor() );
237  EASValsSetEdgeColor( gc.getElementEdgeColor() );
238  EASValsSetEdgeFlag(true);
239  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
240  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
241  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
242  p [ 0 ].z = 0.;
243  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
244  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
245  p [ 1 ].z = 0.;
246  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
247  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
248  p [ 2 ].z = 0.;
249 
250  go = CreateTriangle3D(p);
251  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
252  EGAttachObject(go, ( EObjectP ) this);
253  EMAddGraphicsToModel(ESIModel(), go);
254 }
255 
256 
258 {
259  WCRec p [ 3 ];
260  GraphicObj *go;
261  double defScale = gc.getDefScale();
262 
263  if ( !gc.testElementGraphicActivity(this) ) {
264  return;
265  }
266 
267  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
268  EASValsSetColor( gc.getDeformedElementColor() );
269  EASValsSetEdgeColor( gc.getElementEdgeColor() );
270  EASValsSetEdgeFlag(true);
271  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
272  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
273  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
274  p [ 0 ].z = 0.;
275  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
276  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
277  p [ 1 ].z = 0.;
278  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
279  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
280  p [ 2 ].z = 0.;
281 
282  go = CreateTriangle3D(p);
283  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
284  EMAddGraphicsToModel(ESIModel(), go);
285 }
286 
287 
289 {
290  int i, indx, result = 0;
291  WCRec p [ 3 ];
292  GraphicObj *tr;
293  FloatArray v1, v2, v3;
294  double s [ 3 ], defScale;
295 
296  if ( !gc.testElementGraphicActivity(this) ) {
297  return;
298  }
299 
300  if ( gc.giveIntVarMode() == ISM_recovered ) {
301  result += this->giveInternalStateAtNode(v1, gc.giveIntVarType(), gc.giveIntVarMode(), 1, tStep);
302  result += this->giveInternalStateAtNode(v2, gc.giveIntVarType(), gc.giveIntVarMode(), 2, tStep);
303  result += this->giveInternalStateAtNode(v3, gc.giveIntVarType(), gc.giveIntVarMode(), 3, tStep);
304  } else if ( gc.giveIntVarMode() == ISM_local ) {
305  GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);
306  result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
307  v2 = v1;
308  v3 = v1;
309  result *= 3;
310  }
311 
312  if ( result != 3 ) {
313  return;
314  }
315 
316  indx = gc.giveIntVarIndx();
317 
318  s [ 0 ] = v1.at(indx);
319  s [ 1 ] = v2.at(indx);
320  s [ 2 ] = v3.at(indx);
321 
322  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
323 
324  if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
325  for ( i = 0; i < 3; i++ ) {
326  if ( gc.getInternalVarsDefGeoFlag() ) {
327  // use deformed geometry
328  defScale = gc.getDefScale();
329  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
330  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
331  p [ i ].z = 0.;
332  } else {
333  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
334  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
335  p [ i ].z = 0.;
336  }
337  }
338 
339  //EASValsSetColor(gc.getYieldPlotColor(ratio));
340  gc.updateFringeTableMinMax(s, 3);
341  tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
342  EGWithMaskChangeAttributes(LAYER_MASK, tr);
343  EMAddGraphicsToModel(ESIModel(), tr);
344  } else if ( ( gc.getScalarAlgo() == SA_ZPROFILE ) || ( gc.getScalarAlgo() == SA_COLORZPROFILE ) ) {
345  double landScale = gc.getLandScale();
346 
347  for ( i = 0; i < 3; i++ ) {
348  if ( gc.getInternalVarsDefGeoFlag() ) {
349  // use deformed geometry
350  defScale = gc.getDefScale();
351  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
352  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
353  p [ i ].z = s [ i ] * landScale;
354  } else {
355  p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
356  p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
357  p [ i ].z = s [ i ] * landScale;
358  }
359  }
360 
361  if ( gc.getScalarAlgo() == SA_ZPROFILE ) {
362  EASValsSetColor( gc.getDeformedElementColor() );
363  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
364  EASValsSetFillStyle(FILL_SOLID);
365  tr = CreateTriangle3D(p);
366  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | FILL_MASK | LAYER_MASK, tr);
367  } else {
368  gc.updateFringeTableMinMax(s, 3);
369  EASValsSetFillStyle(FILL_SOLID);
370  tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
371  EGWithMaskChangeAttributes(FILL_MASK | LAYER_MASK, tr);
372  }
373 
374  EMAddGraphicsToModel(ESIModel(), tr);
375  }
376 }
377 
378 #endif
379 } // end namespace oofem
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
The element interface required by NodalAvergagingRecoveryModel.
virtual SPRPatchType SPRNodalRecoveryMI_givePatchType()
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.
Class and object Domain.
Definition: domain.h:115
ScalarAlgorithmType getScalarAlgo()
The element interface required by ZZNodalRecoveryModel.
const FloatArray & giveSubPatchCoordinates()
Returns local sub-patch coordinates of the receiver.
Definition: gausspoint.h:144
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
virtual int SPRNodalRecoveryMI_giveNumberOfIP()
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
virtual double giveCoordinate(int i)
Definition: node.C:82
virtual void computeNmatrixAt(const FloatArray &iLocCoord, FloatMatrix &answer)
Computes interpolation matrix for element unknowns.
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
#define OOFEG_DEFORMED_GEOMETRY_LAYER
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType)
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
InternalStateType giveIntVarType()
The element interface corresponding to ZZErrorEstimator.
The element interface corresponding to HuertaErrorEstimator.
virtual void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
#define OOFEM_ERROR(...)
Definition: error.h:61
REGISTER_Element(LSpace)
#define OOFEG_RAW_GEOMETRY_WIDTH
UnknownType
Type representing particular unknown (its physical meaning).
Definition: unknowntype.h:55
virtual double giveUpdatedCoordinate(int ic, TimeStep *tStep, double scale=1.)
Returns updated ic-th coordinate of receiver.
Definition: node.C:245
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
virtual FEInterpolation * giveInterpolation() const
Definition: trplanestrain.C:70
static FEI2dTrLin interp
Definition: trplanestrain.h:64
virtual void HuertaErrorEstimatorI_setupRefinedElementProblem(RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface::SetupMode sMode, TimeStep *tStep, int &localNodeId, int &localElemId, int &localBcId, IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator::AnalysisMode aMode)
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
InternalStateMode giveIntVarMode()
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: trplanestrain.C:95
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 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)
Class representing the general Input Record.
Definition: inputrecord.h:101
Class Interface.
Definition: interface.h:82
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
The spatial localizer element interface associated to spatial localizer.
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
std::vector< std::unique_ptr< IntegrationRule > > integrationRulesArray
List of integration rules of receiver (each integration rule contains associated integration points a...
Definition: element.h:170
virtual FloatArray * giveCoordinates()
Definition: node.h:114
virtual void HuertaErrorEstimatorI_computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)
virtual Interface * giveInterface(InterfaceType it)
Interface requesting service.
Definition: trplanestrain.C:74
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
void updateFringeTableMinMax(double *s, int size)
virtual void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep)
Computes the element value in given node.
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
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
TrPlaneStrain(int n, Domain *d)
Definition: trplanestrain.C:57
#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
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

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:32 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011