OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
interfaceelem2dquad.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 "interfaceelem2dquad.h"
36 #include "node.h"
37 #include "gausspoint.h"
38 #include "gaussintegrationrule.h"
39 #include "floatmatrix.h"
40 #include "floatarray.h"
41 #include "intarray.h"
42 #include "mathfem.h"
43 #include "fei2dlinequad.h"
44 #include "../sm/CrossSections/structuralinterfacecrosssection.h"
45 #include "classfactory.h"
46 
47 #ifdef __OOFEG
48  #include "oofeggraphiccontext.h"
49  #include <Emarkwd3d.h>
50 #endif
51 
52 namespace oofem {
53 REGISTER_Element(InterfaceElem2dQuad);
54 
55 FEI2dLineQuad InterfaceElem2dQuad :: interp(1, 2);
56 
57 
59  StructuralElement(n, aDomain)
60 {
61  numberOfDofMans = 6;
62  axisymmode = false;
63 }
64 
65 
66 void
68 //
69 // Returns linear part of geometrical equations of the receiver at gp.
70 // Returns the linear part of the B matrix
71 //
72 {
74  double ksi, n1, n2, n3;
75 
76  ksi = gp->giveNaturalCoordinate(1);
77  n3 = 1. - ksi * ksi;
78  n1 = ( 1. - ksi ) * 0.5 - 0.5 * n3;
79  n2 = ( 1. + ksi ) * 0.5 - 0.5 * n3;
80  answer.resize(2, 12);
81  answer.zero();
82 
83  answer.at(1, 2) = answer.at(2, 1) = -n1;
84  answer.at(1, 4) = answer.at(2, 3) = -n2;
85  answer.at(1, 6) = answer.at(2, 5) = -n3;
86 
87  answer.at(1, 8) = answer.at(2, 7) = n1;
88  answer.at(1, 10) = answer.at(2, 9) = n2;
89  answer.at(1, 12) = answer.at(2, 11) = n3;
90 }
91 
92 
93 void
95 // Sets up the array of Gauss Points of the receiver.
96 {
97  if ( integrationRulesArray.size() == 0 ) {
98  integrationRulesArray.resize( 1 );
99  //integrationRulesArray[0].reset( new LobattoIntegrationRule (1,domain, 1, 2) );
100  integrationRulesArray [ 0 ].reset( new GaussIntegrationRule(1, this, 1, 2) );
101  integrationRulesArray [ 0 ]->SetUpPointsOnLine(4, _2dInterface);
102  }
103 }
104 
105 
106 double
108 // Returns the length of the receiver. This method is valid only if 1
109 // Gauss point is used.
110 {
111  double weight = gp->giveWeight();
112  double ksi = gp->giveNaturalCoordinate(1);
113  double dn1 = ksi - 0.5;
114  double dn2 = ksi + 0.5;
115  double dn3 = -2.0 * ksi;
116 
117  double x1 = this->giveNode(1)->giveCoordinate(1);
118  double x2 = this->giveNode(2)->giveCoordinate(1);
119  double x3 = this->giveNode(3)->giveCoordinate(1);
120 
121  double y1 = this->giveNode(1)->giveCoordinate(2);
122  double y2 = this->giveNode(2)->giveCoordinate(2);
123  double y3 = this->giveNode(3)->giveCoordinate(2);
124 
125  double dx = ( dn1 * x1 ) + ( dn2 * x2 ) + ( dn3 * x3 );
126  double dy = ( dn1 * y1 ) + ( dn2 * y2 ) + ( dn3 * y3 );
127  double thickness = this->giveCrossSection()->give(CS_Thickness, gp);
128 
129  double r = 1.0;
130  if (this->axisymmode) {
131  double n3 = 1. - ksi * ksi;
132  double n1 = ( 1. - ksi ) * 0.5 - 0.5 * n3;
133  double n2 = ( 1. + ksi ) * 0.5 - 0.5 * n3;
134  r = n1*this->giveNode(1)->giveCoordinate(1) + n2*this->giveNode(2)->giveCoordinate(1)+ n3*this->giveNode(3)->giveCoordinate(1);
135  }
136 
137  return sqrt(dx * dx + dy * dy) * weight * thickness * r;
138 }
139 
140 
141 void
143 {
144  static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->giveEngTraction_2d(answer, gp, strain, tStep);
145 }
146 
147 
148 void
150 {
151  static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->give2dStiffnessMatrix_Eng(answer, rMode, gp, tStep);
152 }
153 
154 
157 {
160 }
161 
162 
163 void
165 {
166  answer = {D_u, D_v};
167 }
168 
169 
170 bool
172 {
173  FloatArray grad(2);
174 
175  //double ksi = gp -> giveCoordinate(1) ;
176  double ksi = 0.0; // compute tangent in the middle
177  double dn1 = ksi - 0.5;
178  double dn2 = ksi + 0.5;
179  double dn3 = -2.0 * ksi;
180 
181  // tangent
182  grad.at(1) = dn1 * this->giveNode(1)->giveCoordinate(1) + dn2 *this->giveNode(2)->giveCoordinate(1) + dn3 *this->giveNode(3)->giveCoordinate(1);
183  grad.at(2) = dn1 * this->giveNode(1)->giveCoordinate(2) + dn2 *this->giveNode(2)->giveCoordinate(2) + dn3 *this->giveNode(3)->giveCoordinate(2);
184  grad.normalize();
185 
186  answer.resize(12, 12);
187  for ( int i = 0; i < 6; i++ ) {
188  answer.at(i * 2 + 1, i * 2 + 1) = grad.at(1);
189  answer.at(i * 2 + 1, i * 2 + 2) = grad.at(2);
190  answer.at(i * 2 + 2, i * 2 + 1) = -grad.at(2);
191  answer.at(i * 2 + 2, i * 2 + 2) = grad.at(1);
192  }
193 
194  return 1;
195 }
196 
197 
200 {
201  return & interp;
202 }
203 
205 /*
206  * void
207  * InterfaceElem2dQuad :: computeStiffnessMatrix (FloatMatrix& answer, MatResponseMode rMode,
208  * TimeStep* tStep)
209  * // Computes numerically the stiffness matrix of the receiver.
210  * {
211  * double dV ;
212  * FloatMatrix d, bj, bjl, dbj, t;
213  * GaussPoint *gp ;
214  * IntegrationRule* iRule;
215  * bool matStiffSymmFlag = this->giveCrossSection()->isCharacteristicMtrxSymmetric(rMode, this->material);
216  *
217  * answer.resize (computeNumberOfDofs(),computeNumberOfDofs());
218  * answer.zero();
219  *
220  * iRule = integrationRulesArray[giveDefaultIntegrationRule()];
221  *
222  * for ( GaussPoint *gp: *iRule ) {
223  * this -> computeBmatrixAt(gp, bjl) ;
224  * this -> computeConstitutiveMatrixAt(d, rMode, gp, tStep);
225  * this -> computeGtoLRotationMatrix(t, gp);
226  * bj.beProductOf(bjl,t);
227  * dbj.beProductOf (d, bj) ;
228  * dV = this->computeVolumeAround (gp);
229  * if (matStiffSymmFlag) answer.plusProductSymmUpper (bj,dbj,dV); else answer.plusProductUnsym (bj,dbj,dV);
230  *
231  * }
232  * }
233  */
234 
235 
236 #ifdef __OOFEG
238 {
239  GraphicObj *go;
240  // if (!go) { // create new one
241  WCRec p [ 2 ]; /* poin */
242  if ( !gc.testElementGraphicActivity(this) ) {
243  return;
244  }
245 
246  EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
247  EASValsSetColor( gc.getElementColor() );
248  EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
249  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
250  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
251  p [ 0 ].z = 0.0;
252  p [ 1 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
253  p [ 1 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
254  p [ 1 ].z = 0.0;
255  go = CreateLine3D(p);
256  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
257  EGAttachObject(go, ( EObjectP ) this);
258  EMAddGraphicsToModel(ESIModel(), go);
259  p [ 0 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
260  p [ 0 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
261  p [ 0 ].z = 0.0;
262  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
263  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
264  p [ 1 ].z = 0.0;
265  go = CreateLine3D(p);
266  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
267  EGAttachObject(go, ( EObjectP ) this);
268  EMAddGraphicsToModel(ESIModel(), go);
269 }
270 
271 
273 {
274  GraphicObj *go;
275  // if (!go) { // create new one
276  WCRec p [ 2 ]; /* poin */
277  if ( !gc.testElementGraphicActivity(this) ) {
278  return;
279  }
280 
281  double defScale = gc.getDefScale();
282 
283  EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
284  EASValsSetColor( gc.getDeformedElementColor() );
285  EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER + 1);
286  p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
287  p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
288  p [ 0 ].z = 0.0;
289  p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
290  p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
291  p [ 1 ].z = 0.0;
292  go = CreateLine3D(p);
293  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
294  EMAddGraphicsToModel(ESIModel(), go);
295 
296  p [ 0 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
297  p [ 0 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
298  p [ 0 ].z = 0.0;
299  p [ 1 ].x = ( FPNum ) this->giveNode(5)->giveUpdatedCoordinate(1, tStep, defScale);
300  p [ 1 ].y = ( FPNum ) this->giveNode(5)->giveUpdatedCoordinate(2, tStep, defScale);
301  p [ 1 ].z = 0.0;
302  go = CreateLine3D(p);
303  EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
304  EMAddGraphicsToModel(ESIModel(), go);
305 }
306 
307 
309 {
310  int indx, result = 0;
311  FloatArray gcoord(3), v1;
312  WCRec p [ 1 ];
313  GraphicObj *go;
314  double val [ 1 ];
315 
316  if ( !gc.testElementGraphicActivity(this) ) {
317  return;
318  }
319 
320  if ( gc.giveIntVarMode() == ISM_recovered ) {
321  return;
322  }
323 
324  for ( GaussPoint *gp: *this->giveDefaultIntegrationRulePtr() ) {
325  result = 0;
326  result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
327  if ( result != 1 ) {
328  continue;
329  }
330 
331  indx = gc.giveIntVarIndx();
332 
333  result += this->computeGlobalCoordinates( gcoord, gp->giveNaturalCoordinates() );
334 
335  p [ 0 ].x = ( FPNum ) gcoord.at(1);
336  p [ 0 ].y = ( FPNum ) gcoord.at(2);
337  p [ 0 ].z = 0.;
338 
339  val [ 0 ] = v1.at(indx);
340  gc.updateFringeTableMinMax(val, 1);
341  //if (val[0] > 0.) {
342 
343  EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
344  EASValsSetMType(FILLED_CIRCLE_MARKER);
345  go = CreateMarkerWD3D(p, val [ 0 ]);
346  EGWithMaskChangeAttributes(LAYER_MASK | FILL_MASK | MTYPE_MASK, go);
347  EMAddGraphicsToModel(ESIModel(), go);
348  //}
349  }
350 }
351 
352 #endif
353 } // 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...
virtual FEInterpolation * giveInterpolation() const
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
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
Definition: element.h:822
virtual void computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int=1, int=ALL_STRAINS)
Computes the geometrical matrix of receiver in given integration point.
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
#define OOFEG_RAW_GEOMETRY_LAYER
virtual double computeVolumeAround(GaussPoint *gp)
Returns volume related to given integration point.
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual bool hasField(InputFieldType id)=0
Returns true if record contains field identified by idString keyword.
InterfaceElem2dQuad(int n, Domain *d)
virtual double giveCoordinate(int i)
Definition: node.C:82
virtual void drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType)
Class implementing an array of integers.
Definition: intarray.h:61
MatResponseMode
Describes the character of characteristic material matrix.
#define OOFEG_DEFORMED_GEOMETRY_LAYER
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
InternalStateType giveIntVarType()
Abstract base class for all "structural" finite elements.
double giveNaturalCoordinate(int i) const
Returns i-th natural element coordinate of receiver.
Definition: gausspoint.h:136
#define _IFT_InterfaceElem2dQuad_axisymmode
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
virtual void giveDofManDofIDMask(int inode, IntArray &answer) const
Returns dofmanager dof mask for node.
bool axisymmode
Flag controlling axisymmetric mode (integration over unit circumferential angle)
virtual double giveUpdatedCoordinate(int ic, TimeStep *tStep, double scale=1.)
Returns updated ic-th coordinate of receiver.
Definition: node.C:245
Base class for all structural interface cross section models.
virtual void computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep)
Computes the stress vector of receiver at given integration point, at time step tStep.
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
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
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
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
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
virtual bool computeGtoLRotationMatrix(FloatMatrix &answer)
Returns transformation matrix from global c.s.
void updateFringeTableMinMax(double *s, int size)
the oofem namespace is to define a context or scope in which all oofem names are defined.
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 computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep)
Computes constitutive matrix of receiver.
static FEI2dLineQuad interp
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
#define OOFEG_VARPLOT_PATTERN_LAYER
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
Class representing solution step.
Definition: timestep.h:80
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Computes the global coordinates from given element&#39;s local coordinates.
Definition: element.C:1207
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
Class representing Gaussian-quadrature integration rule.

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