OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
q4axisymm.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 "fei2dquadquad.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 "connectivitytable.h"
52 #endif
53 
54 namespace oofem {
55 REGISTER_Element(Q4Axisymm);
56 
57 FEI2dQuadQuadAxi Q4Axisymm :: interp(1, 2);
58 
59 Q4Axisymm :: Q4Axisymm(int n, Domain *aDomain) :
61 {
62  numberOfDofMans = 8;
65 }
66 
67 
69 { }
70 
71 
74 {
75  return & interp;
76 }
77 
78 
79 
82 {
83  IRResultType result; // Required by IR_GIVE_FIELD macro
86  if ( result != IRRT_OK ) {
87  return result;
88  }
89 
93 
94  return result;
95 }
96 
97 
98 void
100 {
101  // Returns the [ 6 x (nno*2) ] strain-displacement matrix {B} of the receiver,
102  // evaluated at gp. Uses reduced integration
103  // (epsilon_x,epsilon_y,...,Gamma_xy) = B . r
104  // r = ( u1,v1,u2,v2,u3,v3,u4,v4)
105 
106  if ( numberOfFiAndShGaussPoints == 1 ) { // Reduced integration
108 
109  FloatArray N, NRed, redCoord = {0.0, 0.0}; // eval in centroid
110  interp->evalN( N, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
111  interp->evalN( NRed, redCoord, FEIElementGeometryWrapper(this) );
112 
113  // Evaluate radius at center
114  double r = 0.0;
115  for ( int i = 1; i <= this->giveNumberOfDofManagers(); i++ ) {
116  double x = this->giveNode(i)->giveCoordinate(1);
117  r += x * NRed.at(i);
118  }
119 
120  FloatMatrix dNdx, dNdxRed;
121  interp->evaldNdx( dNdx, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
122  interp->evaldNdx( dNdxRed, redCoord, FEIElementGeometryWrapper(this) );
123  answer.resize(6, dNdx.giveNumberOfRows() * 2);
124  answer.zero();
125 
126  for ( int i = 1; i <= dNdx.giveNumberOfRows(); i++ ) {
127  answer.at(1, i * 2 - 1) = dNdx.at(i, 1);
128  answer.at(2, i * 2 - 0) = dNdx.at(i, 2);
129  answer.at(3, i * 2 - 1) = NRed.at(i) / r;
130  answer.at(6, 2 * i - 1) = dNdxRed.at(i, 2);
131  answer.at(6, 2 * i - 0) = dNdxRed.at(i, 1);
132  }
133  }
134 }
135 
136 
137 
138 
139 
140 Interface *
142 {
143  if ( interface == ZZNodalRecoveryModelInterfaceType ) {
144  return static_cast< ZZNodalRecoveryModelInterface * >(this);
145  }
146 
147  return NULL;
148 }
149 
150 
151 #ifdef __OOFEG
152 
154 {
155  WCRec p [ 4 ];
156  GraphicObj *go;
157 
158  if ( !gc.testElementGraphicActivity(this) ) {
159  return;
160  }
161 
162  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
163  EASValsSetColor( gc.getElementColor() );
164  EASValsSetEdgeColor( gc.getElementEdgeColor() );
165  EASValsSetEdgeFlag(true);
166 
167  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
168  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
169  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
170  p [ 0 ].z = 0.;
171  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
172  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
173  p [ 1 ].z = 0.;
174  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
175  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
176  p [ 2 ].z = 0.;
177  p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveCoordinate(1);
178  p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveCoordinate(2);
179  p [ 3 ].z = 0.;
180 
181  go = CreateQuad3D(p);
182  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
183  EGAttachObject(go, ( EObjectP ) this);
184  EMAddGraphicsToModel(ESIModel(), go);
185 }
186 
187 
189 {
190  WCRec p [ 4 ];
191  GraphicObj *go;
192  double defScale = gc.getDefScale();
193 
194  if ( !gc.testElementGraphicActivity(this) ) {
195  return;
196  }
197 
198  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
199  EASValsSetColor( gc.getDeformedElementColor() );
200  EASValsSetEdgeColor( gc.getElementEdgeColor() );
201  EASValsSetEdgeFlag(true);
202  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
203  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
204  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
205  p [ 0 ].z = 0.;
206  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
207  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
208  p [ 1 ].z = 0.;
209  p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
210  p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
211  p [ 2 ].z = 0.;
212  p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
213  p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
214  p [ 3 ].z = 0.;
215 
216  go = CreateQuad3D(p);
217  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
218  EMAddGraphicsToModel(ESIModel(), go);
219 }
220 
221 #endif
222 } // end namespace oofem
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
virtual Interface * giveInterface(InterfaceType)
Interface requesting service.
Definition: q4axisymm.C:141
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
Definition: q4axisymm.C:188
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 void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: q4axisymm.C:153
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: q4axisymm.C:99
The element interface required by ZZNodalRecoveryModel.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
#define OOFEG_RAW_GEOMETRY_LAYER
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual double giveCoordinate(int i)
Definition: node.C:82
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
Q4Axisymm(int n, Domain *d)
Definition: q4axisymm.C:59
REGISTER_Element(LSpace)
#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
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
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
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
#define _IFT_Q4Axisymm_nipfish
Definition: q4axisymm.h:45
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
int numberOfFiAndShGaussPoints
Definition: q4axisymm.h:60
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:78
the oofem namespace is to define a context or scope in which all oofem names are defined.
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
static FEI2dQuadQuadAxi interp
Definition: q4axisymm.h:59
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: q4axisymm.C:81
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Class representing integration point in finite element program.
Definition: gausspoint.h:93
virtual FEInterpolation * giveInterpolation() const
Definition: q4axisymm.C:73
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...
virtual ~Q4Axisymm()
Definition: q4axisymm.C:68
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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011