OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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 "fei2dtrlin.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#endif
51
52namespace oofem {
54
55FEI2dTrLin TrPlaneStrain :: interp(1, 2);
56
57TrPlaneStrain :: TrPlaneStrain(int n, Domain *aDomain) :
62 // Constructor.
63{
65 area = -1;
67}
68
69
70FEInterpolation *TrPlaneStrain :: giveInterpolation() const { return & interp; }
71
72
74TrPlaneStrain :: giveInterface(InterfaceType 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
93void
94TrPlaneStrain :: postInitialize()
95{
97 PlaneStrainElement :: postInitialize();
98}
99
100
101
102void
103TrPlaneStrain :: NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node,
104 InternalStateType type, TimeStep *tStep)
105{
106 GaussPoint *gp;
107 gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);
108 this->giveIPValue(answer, gp, type, tStep);
109}
110
111
112void
113TrPlaneStrain :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
114{
115 pap.resize(3);
116 pap.at(1) = this->giveNode(1)->giveNumber();
117 pap.at(2) = this->giveNode(2)->giveNumber();
118 pap.at(3) = this->giveNode(3)->giveNumber();
119}
120
121
122void
123TrPlaneStrain :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
124{
125 answer.resize(1);
126 if ( ( pap == this->giveNode(1)->giveNumber() ) ||
127 ( pap == this->giveNode(2)->giveNumber() ) ||
128 ( pap == this->giveNode(3)->giveNumber() ) ) {
129 answer.at(1) = pap;
130 } else {
131 OOFEM_ERROR("node unknown");
132 }
133}
134
135
136int
137TrPlaneStrain :: SPRNodalRecoveryMI_giveNumberOfIP()
138{
139 return 1;
140}
141
142
144TrPlaneStrain :: SPRNodalRecoveryMI_givePatchType()
145{
146 return SPRPatchType_2dxy;
147}
148
149
150void
151TrPlaneStrain :: HuertaErrorEstimatorI_setupRefinedElementProblem(RefinedElement *refinedElement, int level, int nodeId,
152 IntArray &localNodeIdArray, IntArray &globalNodeIdArray,
153 HuertaErrorEstimatorInterface :: SetupMode sMode, TimeStep *tStep,
154 int &localNodeId, int &localElemId, int &localBcId,
155 IntArray &controlNode, IntArray &controlDof,
156 HuertaErrorEstimator :: AnalysisMode aMode)
157{
158 int nodes = 3, sides = 3;
159 FloatArray corner [ 3 ], midSide [ 3 ], midNode, cor [ 3 ];
160 double x = 0.0, y = 0.0;
161
162 static int sideNode [ 3 ] [ 2 ] = { { 1, 2 }, { 2, 3 }, { 3, 1 } };
163
164 if ( sMode == HuertaErrorEstimatorInterface :: NodeMode ||
165 ( sMode == HuertaErrorEstimatorInterface :: BCMode && aMode == HuertaErrorEstimator :: HEE_linear ) ) {
166 for ( int inode = 0; inode < nodes; inode++ ) {
167 corner [ inode ] = this->giveNode(inode + 1)->giveCoordinates();
168 if ( corner [ inode ].giveSize() != 3 ) {
169 cor [ inode ].resize(3);
170 cor [ inode ].at(1) = corner [ inode ].at(1);
171 cor [ inode ].at(2) = corner [ inode ].at(2);
172 cor [ inode ].at(3) = 0.0;
173
174 corner [ inode ] = cor [ inode ];
175 }
176
177 x += corner [ inode ].at(1);
178 y += corner [ inode ].at(2);
179 }
180
181 for ( int iside = 0; iside < sides; iside++ ) {
182 midSide [ iside ].resize(3);
183
184 int nd1 = sideNode [ iside ] [ 0 ] - 1;
185 int nd2 = sideNode [ iside ] [ 1 ] - 1;
186
187 midSide [ iside ].at(1) = ( corner [ nd1 ].at(1) + corner [ nd2 ].at(1) ) / 2.0;
188 midSide [ iside ].at(2) = ( corner [ nd1 ].at(2) + corner [ nd2 ].at(2) ) / 2.0;
189 midSide [ iside ].at(3) = 0.0;
190 }
191
192 midNode.resize(3);
193
194 midNode.at(1) = x / nodes;
195 midNode.at(2) = y / nodes;
196 midNode.at(3) = 0.0;
197 }
198
199 this->setupRefinedElementProblem2D(this, refinedElement, level, nodeId, localNodeIdArray, globalNodeIdArray,
200 sMode, tStep, nodes, corner, midSide, midNode,
201 localNodeId, localElemId, localBcId,
202 controlNode, controlDof, aMode, "Quad1PlaneStrain");
203}
204
205
206void TrPlaneStrain :: HuertaErrorEstimatorI_computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)
207{
209}
210
211
212
213#ifdef __OOFEG
214 #define TR_LENGHT_REDUCT 0.3333
215
216void TrPlaneStrain :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
217{
218 WCRec p [ 3 ];
219 GraphicObj *go;
220
221 if ( !gc.testElementGraphicActivity(this) ) {
222 return;
223 }
224
225 EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
226 EASValsSetColor( gc.getElementColor() );
227 EASValsSetEdgeColor( gc.getElementEdgeColor() );
228 EASValsSetEdgeFlag(true);
229 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
230 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
231 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
232 p [ 0 ].z = 0.;
233 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
234 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
235 p [ 1 ].z = 0.;
236 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
237 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
238 p [ 2 ].z = 0.;
239
240 go = CreateTriangle3D(p);
241 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
242 EGAttachObject(go, ( EObjectP ) this);
243 EMAddGraphicsToModel(ESIModel(), go);
244}
245
246
247void TrPlaneStrain :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
248{
249 WCRec p [ 3 ];
250 GraphicObj *go;
251 double defScale = gc.getDefScale();
252
253 if ( !gc.testElementGraphicActivity(this) ) {
254 return;
255 }
256
257 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
258 EASValsSetColor( gc.getDeformedElementColor() );
259 EASValsSetEdgeColor( gc.getElementEdgeColor() );
260 EASValsSetEdgeFlag(true);
261 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
262 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
263 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
264 p [ 0 ].z = 0.;
265 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
266 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
267 p [ 1 ].z = 0.;
268 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
269 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
270 p [ 2 ].z = 0.;
271
272 go = CreateTriangle3D(p);
273 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
274 EMAddGraphicsToModel(ESIModel(), go);
275}
276
277
278void TrPlaneStrain :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
279{
280 int i, indx, result = 0;
281 WCRec p [ 3 ];
282 GraphicObj *tr;
283 FloatArray v1, v2, v3;
284 double s [ 3 ], defScale;
285
286 if ( !gc.testElementGraphicActivity(this) ) {
287 return;
288 }
289
290 if ( gc.giveIntVarMode() == ISM_recovered ) {
291 result += this->giveInternalStateAtNode(v1, gc.giveIntVarType(), gc.giveIntVarMode(), 1, tStep);
292 result += this->giveInternalStateAtNode(v2, gc.giveIntVarType(), gc.giveIntVarMode(), 2, tStep);
293 result += this->giveInternalStateAtNode(v3, gc.giveIntVarType(), gc.giveIntVarMode(), 3, tStep);
294 } else if ( gc.giveIntVarMode() == ISM_local ) {
295 GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);
296 result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
297 v2 = v1;
298 v3 = v1;
299 result *= 3;
300 }
301
302 if ( result != 3 ) {
303 return;
304 }
305
306 indx = gc.giveIntVarIndx();
307
308 s [ 0 ] = v1.at(indx);
309 s [ 1 ] = v2.at(indx);
310 s [ 2 ] = v3.at(indx);
311
312 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
313
314 if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
315 for ( i = 0; i < 3; i++ ) {
316 if ( gc.getInternalVarsDefGeoFlag() ) {
317 // use deformed geometry
318 defScale = gc.getDefScale();
319 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
320 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
321 p [ i ].z = 0.;
322 } else {
323 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
324 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
325 p [ i ].z = 0.;
326 }
327 }
328
329 //EASValsSetColor(gc.getYieldPlotColor(ratio));
330 gc.updateFringeTableMinMax(s, 3);
331 tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
332 EGWithMaskChangeAttributes(LAYER_MASK, tr);
333 EMAddGraphicsToModel(ESIModel(), tr);
334 } else if ( ( gc.getScalarAlgo() == SA_ZPROFILE ) || ( gc.getScalarAlgo() == SA_COLORZPROFILE ) ) {
335 double landScale = gc.getLandScale();
336
337 for ( i = 0; i < 3; i++ ) {
338 if ( gc.getInternalVarsDefGeoFlag() ) {
339 // use deformed geometry
340 defScale = gc.getDefScale();
341 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(1, tStep, defScale);
342 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveUpdatedCoordinate(2, tStep, defScale);
343 p [ i ].z = s [ i ] * landScale;
344 } else {
345 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
346 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
347 p [ i ].z = s [ i ] * landScale;
348 }
349 }
350
351 if ( gc.getScalarAlgo() == SA_ZPROFILE ) {
352 EASValsSetColor( gc.getDeformedElementColor() );
353 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
354 EASValsSetFillStyle(FILL_SOLID);
355 tr = CreateTriangle3D(p);
356 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | FILL_MASK | LAYER_MASK, tr);
357 } else {
358 gc.updateFringeTableMinMax(s, 3);
359 EASValsSetFillStyle(FILL_SOLID);
360 tr = CreateTriangleWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ]);
361 EGWithMaskChangeAttributes(FILL_MASK | LAYER_MASK, tr);
362 }
363
364 EMAddGraphicsToModel(ESIModel(), tr);
365 }
366}
367
368#endif
369} // end namespace oofem
#define REGISTER_Element(class)
Node * giveNode(int i) const
Definition element.h:629
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
int giveNumber() const
Definition femcmpnn.h:104
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
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)
SpatialLocalizerInterface(Element *element)
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
static FEI2dTrLin interp
ZZErrorEstimatorInterface(Element *element)
Constructor.
ZZNodalRecoveryModelInterface(Element *element)
Constructor.
#define OOFEM_ERROR(...)
Definition error.h:79
@ HuertaErrorEstimatorInterfaceType
@ SPRNodalRecoveryModelInterfaceType
@ ZZNodalRecoveryModelInterfaceType
@ ZZErrorEstimatorInterfaceType
@ SpatialLocalizerInterfaceType
@ NodalAveragingRecoveryModelInterfaceType
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