OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
intelline1.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/Interfaces/intelline1.h"
36 #include "../sm/CrossSections/structuralinterfacecrosssection.h"
37 #include "node.h"
38 #include "gausspoint.h"
39 #include "gaussintegrationrule.h"
40 #include "lobattoir.h"
41 #include "floatmatrix.h"
42 #include "floatarray.h"
43 #include "intarray.h"
44 #include "mathfem.h"
45 #include "fei2dlinelin.h"
46 #include "classfactory.h"
47 
48 #ifdef __OOFEG
49  #include "oofeggraphiccontext.h"
50  #include <Emarkwd3d.h>
51 #endif
52 
53 namespace oofem {
54 REGISTER_Element(IntElLine1);
55 
56 FEI2dLineLin IntElLine1 :: interp(1, 1);
57 
58 
59 IntElLine1 :: IntElLine1(int n, Domain *aDomain) :
60  StructuralInterfaceElement(n, aDomain)
61 {
62  numberOfDofMans = 4;
63  axisymmode = false;
64 
66 }
67 
68 
69 void
71 {
72  // Returns the modified N-matrix which multiplied with u give the spatial jump.
73 
74  FloatArray N;
76  interp->evalN( N, ip->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
77 
78  answer.resize(2, 8);
79  answer.zero();
80  answer.at(1, 1) = answer.at(2, 2) = -N.at(1);
81  answer.at(1, 3) = answer.at(2, 4) = -N.at(2);
82 
83  answer.at(1, 5) = answer.at(2, 6) = N.at(1);
84  answer.at(1, 7) = answer.at(2, 8) = N.at(2);
85 }
86 
87 
88 void
90 // Sets up the array of Gauss Points of the receiver.
91 {
92  if ( integrationRulesArray.size() == 0 ) {
93  integrationRulesArray.resize( 1 );
94 
95 // integrationRulesArray[ 0 ].reset( new LobattoIntegrationRule (1,this, 1, 2, false) );
96 // integrationRulesArray [ 0 ]->SetUpPointsOnLine(2, _2dInterface);
97 
98  integrationRulesArray [ 0 ].reset( new GaussIntegrationRule(1, this, 1, 2) );
99  integrationRulesArray [ 0 ]->SetUpPointsOnLine(this->numberOfGaussPoints, _2dInterface);
100  }
101 }
102 
103 void
105 {
106  FloatMatrix dNdxi;
108  interp->evaldNdxi( dNdxi, ip->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
109  G.resize(2);
110  G.zero();
111  int numNodes = this->giveNumberOfNodes();
112  for ( int i = 1; i <= dNdxi.giveNumberOfRows(); i++ ) {
113  double X1_i = 0.5 * ( this->giveNode(i)->giveCoordinate(1) + this->giveNode(i + numNodes / 2)->giveCoordinate(1) ); // (mean) point on the fictious mid surface
114  double X2_i = 0.5 * ( this->giveNode(i)->giveCoordinate(2) + this->giveNode(i + numNodes / 2)->giveCoordinate(2) );
115  G.at(1) += dNdxi.at(i, 1) * X1_i;
116  G.at(2) += dNdxi.at(i, 1) * X2_i;
117  }
118 }
119 
120 double
122 {
123  FloatArray G;
124  this->computeCovarBaseVectorAt(ip, G);
125 
126  double weight = ip->giveWeight();
127  double ds = sqrt( G.dotProduct(G) ) * weight;
128  if ( this->axisymmode ) {
129  int numNodes = this->giveNumberOfNodes();
130  FloatArray N;
132  // interpolate radius
133  double r = 0.0;
134  for ( int i = 1; i <= N.giveSize(); i++ ) {
135  double X_i = 0.5 * ( this->giveNode(i)->giveCoordinate(1) + this->giveNode(i + numNodes / 2)->giveCoordinate(1) ); // X-coord of the fictious mid surface
136  r += N.at(i) * X_i;
137  }
138  return ds * r;
139 
140  } else { // regular 2d
141  double thickness = this->giveCrossSection()->give(CS_Thickness, ip);
142  return ds * thickness;
143  }
144 }
145 
146 
149 {
150  this->axisymmode = false;
153 
154 
155 
156  // Check if node numbering is ok
157  int nodeInd1 = this->giveDofManagerNumber(1);
158  int arrayInd1 = domain->giveDofManPlaceInArray(nodeInd1);
159  DofManager *node1 = domain->giveDofManager(arrayInd1);
160  const FloatArray &x1 = *(node1->giveCoordinates());
161 
162 // DofManager *node2 = this->giveDofManager(2);
163  int nodeInd2 = this->giveDofManagerNumber(2);
164  int arrayInd2 = domain->giveDofManPlaceInArray(nodeInd2);
165  DofManager *node2 = domain->giveDofManager(arrayInd2);
166  const FloatArray &x2 = *(node2->giveCoordinates());
167 
168 // DofManager *node3 = this->giveDofManager(3);
169  int nodeInd3 = this->giveDofManagerNumber(3);
170  int arrayInd3 = domain->giveDofManPlaceInArray(nodeInd3);
171  DofManager *node3 = domain->giveDofManager(arrayInd3);
172  const FloatArray &x3 = *(node3->giveCoordinates());
173 
174 
175  double L2 = x1.distance_square(x2);
176  double L3 = x1.distance_square(x3);
177 
178 
179  if(L2 < L3) {
180  printf("Renumbering element %d\n.\n", this->giveNumber());
181  IntArray dofManArrayTmp = {dofManArray.at(3), dofManArray.at(1), dofManArray.at(4), dofManArray.at(2)};
182  dofManArray = std::move(dofManArrayTmp);
183  }
184 
185 
186  return result;
187 }
188 
189 
190 void
192 {
193  answer = {D_u, D_v};
194 }
195 
196 void
198 {
199  // Transformation matrix to the local coordinate system
200  // xy plane
201  FloatArray G;
202  this->computeCovarBaseVectorAt(gp, G);
203  G.normalize();
204 
205  answer.resize(2, 2);
206 // answer.at(1, 1) = G.at(1);//tangent vector
207 // answer.at(2, 1) = -G.at(2);
208 // answer.at(1, 2) = G.at(2);
209 // answer.at(2, 2) = G.at(1);
210  //normal is -G.at(2), G.at(1), perpendicular to nodes 1 2
211  answer.at(1, 1) = -G.at(2);//normal vector
212  answer.at(2, 1) = G.at(1);
213  answer.at(1, 2) = G.at(1);
214  answer.at(2, 2) = G.at(2);
215 }
216 
219 {
220  return & interp;
221 }
222 
223 
224 #ifdef __OOFEG
226 {
227  GraphicObj *go;
228  // if (!go) { // create new one
229  WCRec p [ 2 ]; /* poin */
230  if ( !gc.testElementGraphicActivity(this) ) {
231  return;
232  }
233 
234  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
235  EASValsSetColor( gc.getElementColor() );
236  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
237  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
238  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
239  p [ 0 ].z = 0.0;
240  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
241  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
242  p [ 1 ].z = 0.0;
243  go = CreateLine3D(p);
244  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
245  EGAttachObject(go, ( EObjectP ) this);
246  EMAddGraphicsToModel(ESIModel(), go);
247 }
248 
249 
251 {
252  GraphicObj *go;
253  // if (!go) { // create new one
254  WCRec p [ 2 ]; /* poin */
255  if ( !gc.testElementGraphicActivity(this) ) {
256  return;
257  }
258 
259  double defScale = gc.getDefScale();
260 
261  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
262  EASValsSetColor( gc.getDeformedElementColor() );
263  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER + 1);
264  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
265  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
266  p [ 0 ].z = 0.0;
267  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
268  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
269  p [ 1 ].z = 0.0;
270  go = CreateLine3D(p);
271  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
272  EMAddGraphicsToModel(ESIModel(), go);
273 
274  p [ 0 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
275  p [ 0 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
276  p [ 0 ].z = 0.0;
277  p [ 1 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
278  p [ 1 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
279  p [ 1 ].z = 0.0;
280  go = CreateLine3D(p);
281  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
282  EMAddGraphicsToModel(ESIModel(), go);
283 }
284 
285 
287 {
288  int indx, result = 0;
290  FloatArray gcoord(3), v1;
291  WCRec p [ 1 ];
292  GraphicObj *go;
293  double val [ 1 ];
294 
295  if ( !gc.testElementGraphicActivity(this) ) {
296  return;
297  }
298 
299  if ( gc.giveIntVarMode() == ISM_recovered ) {
300  return;
301  }
302 
303  for ( GaussPoint *gp: *iRule ) {
304  result = 0;
305  result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
306  if ( result != 1 ) {
307  continue;
308  }
309 
310  indx = gc.giveIntVarIndx();
311 
312  result += this->computeGlobalCoordinates( gcoord, gp->giveNaturalCoordinates() );
313 
314  p [ 0 ].x = ( FPNum ) gcoord.at(1);
315  p [ 0 ].y = ( FPNum ) gcoord.at(2);
316  p [ 0 ].z = 0.;
317 
318  val [ 0 ] = v1.at(indx);
319  gc.updateFringeTableMinMax(val, 1);
320  //if (val[0] > 0.) {
321 
322  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
323  EASValsSetMType(FILLED_CIRCLE_MARKER);
324  go = CreateMarkerWD3D(p, val [ 0 ]);
325  EGWithMaskChangeAttributes(LAYER_MASK | FILL_MASK | MTYPE_MASK, go);
326  EMAddGraphicsToModel(ESIModel(), go);
327  //}
328  }
329 }
330 
331 #endif
332 
333 } // end namespace oofem
CrossSection * giveCrossSection()
Definition: element.C:495
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
IntArray dofManArray
Array containing dofmanager numbers.
Definition: element.h:151
virtual void evaldNdxi(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of interpolation functions (shape functions) at given point...
Definition: feinterpol.h:193
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
int giveDofManagerNumber(int i) const
Translates local to global indices for dof managers.
Definition: element.h:590
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Definition: intelline1.C:286
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
bool axisymmode
Flag controlling axisymmetric mode (integration over unit circumferential angle)
Definition: intelline1.h:60
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
#define OOFEG_RAW_GEOMETRY_LAYER
virtual void computeTransformationMatrixAt(GaussPoint *gp, FloatMatrix &answer)
Definition: intelline1.C:197
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of interpolation functions (shape functions) at given point.
Definition: fei2dlinelin.C:42
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual FloatArray * giveCoordinates()
Definition: dofmanager.h:382
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
virtual void computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)
Computes modified interpolation matrix (N) for the element which multiplied with the unknowns vector ...
Definition: intelline1.C:70
static FEI2dLineLin interp
Definition: intelline1.h:58
Base class for dof managers.
Definition: dofmanager.h:113
virtual double giveCoordinate(int i)
Definition: node.C:82
IntElLine1(int n, Domain *d)
Definition: intelline1.C:59
virtual double computeAreaAround(GaussPoint *gp)
Definition: intelline1.C:121
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
Abstract base class representing integration rule.
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Computes the global coordinates from given element&#39;s local coordinates.
virtual int giveNumberOfNodes() const
Returns number of nodes of receiver.
Definition: element.h:662
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
Definition: intelline1.C:89
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
InternalStateType giveIntVarType()
virtual FEInterpolation * giveInterpolation() const
Definition: intelline1.C:218
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
REGISTER_Element(LSpace)
#define OOFEG_RAW_GEOMETRY_WIDTH
virtual double giveWeight()
Returns integration weight of receiver.
Definition: gausspoint.h:181
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 computeCovarBaseVectorAt(GaussPoint *gp, FloatArray &G)
Definition: intelline1.C:104
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
double distance_square(const FloatArray &iP1, const FloatArray &iP2, double &oXi, double &oXiUnbounded) const
Definition: floatarray.C:499
#define _IFT_IntElLine1_axisymmode
Definition: intelline1.h:41
int giveDofManPlaceInArray(int iGlobalDofManNum) const
Returns the array index of the dofman with global number iGlobalDofManNum, so that it can be fetched ...
Definition: domain.C:196
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
InternalStateMode giveIntVarMode()
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
virtual double give(CrossSectionProperty a, GaussPoint *gp)
Returns the value of cross section property at given point.
Definition: crosssection.C:151
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
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
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 void giveDofManDofIDMask(int inode, IntArray &answer) const
Returns dofmanager dof mask for node.
Definition: intelline1.C:191
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
void updateFringeTableMinMax(double *s, int size)
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: intelline1.C:148
Abstract base class for all structural interface elements.
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
int giveNumber() const
Definition: femcmpnn.h:107
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
Definition: domain.C:314
double normalize()
Normalizes receiver.
Definition: floatarray.C:828
Node * giveNode(int i) const
Returns reference to the i-th node of element.
Definition: element.h:610
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType)
Definition: intelline1.C:250
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 void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
Definition: intelline1.C:225
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Definition: gausspoint.h:138
Class representing Gaussian-quadrature integration rule.
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:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011