OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
structuralinterfaceelementphf.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/structuralinterfaceelementphf.h"
38 
40 #include "feinterpol.h"
41 #include "domain.h"
42 #include "material.h"
43 #include "gausspoint.h"
44 #include "gaussintegrationrule.h"
45 #include "intarray.h"
46 #include "floatarray.h"
47 #include "floatmatrix.h"
48 #include "mathfem.h"
49 #include "dof.h"
50 
51 
52 namespace oofem {
54  interpolation(NULL),
55  nlGeometry(0)
56 {
57  this->internalLength = 1.0e-1;
58 }
59 
60 
62 { }
63 
64 
65 // remove later
66 void
68 {
69  IntArray dofIdArray;
70  this->giveDofManDofIDMask_u(dofIdArray);
71  this->computeVectorOf(dofIdArray, valueMode, tStep, answer);
72 }
73 void
74 
76 {
77  IntArray dofIdArray;
78  this->giveDofManDofIDMask_d(dofIdArray);
79  this->computeVectorOf(dofIdArray, valueMode, tStep, answer);
80 }
81 
82 
83 
84 
85 
86 
87 void
89 {
90  // Routine to compute the local ordering array an element given a dofid array.
91  answer.resize( 0 );
92  int k = 0;
93  for(int i = 1; i <= this->giveNumberOfDofManagers(); i++) {
94  DofManager *dMan = this->giveDofManager( i );
95  for(int j = 1; j <= dofIdArray.giveSize( ); j++) {
96 
97  if(dMan->hasDofID( (DofIDItem) dofIdArray.at( j ) )) {
98  // hack
99 
100  answer.followedBy( k + j );
101  }
102  }
103  k += dMan->giveNumberOfDofs( );
104  }
105 }
106 
107 
108 
109 void
111 {
112  // Computes the internal forces corresponding to the two fields u & d
113  IntArray IdMask_u, IdMask_d;
114  this->giveDofManDofIDMask_u( IdMask_u );
115  this->giveDofManDofIDMask_d( IdMask_d );
116  this->getLocationArray_u(loc_u);
117  this->getLocationArray_d(loc_d);
118  int ndofs = this->computeNumberOfDofs();
119  answer.resize( ndofs);
120  answer.zero();
121  FloatArray answer_u(0);
122  FloatArray answer_d(0);
123  this->giveInternalForcesVector_u(answer_u, tStep, useUpdatedGpRecord);
124  this->giveInternalForcesVector_d(answer_d, tStep, useUpdatedGpRecord);
125  answer.assemble(answer_u, loc_u);
126  answer.assemble(answer_d, loc_d);
127 
128 }
129 
130 
131 
132 void
134 {
135 
136 
137  FloatMatrix N;
138  FloatArray u, traction, jump;
139 
140  IntArray dofIdArray;
141  this->giveDofManDofIDMask_u(dofIdArray);
142  this->computeVectorOf(dofIdArray, VM_Total, tStep, u);
143 
144  // subtract initial displacements, if defined
145  if ( initialDisplacements.giveSize() ) {
147  }
148 
149  // zero answer will resize accordingly when adding first contribution
150  answer.clear();
151 
152  for ( auto &ip: *this->giveDefaultIntegrationRulePtr() ) {
153 
154  this->computeNmatrixAt(ip, N);
155 
156  jump.beProductOf(N, u);
157  this->computeTraction(traction, ip, jump, tStep);
158  //traction.resize(2);
159 
160  // compute internal cohesive forces as f = N^T*traction dA
161  double dA = this->computeAreaAround(ip);
162  answer.plusProduct(N, traction, dA);
163  }
164 
165 }
166 
167 void
169 {
170 
171  // computes int_A ( N^t * ( d + l*f ) + B^t * l^2 * gradd(d) )* dA
172  FloatArray BStress, Nd, BS, a_d, grad_d;
173  FloatMatrix B;
174  answer.clear();
175  this->computeDamageUnknowns( a_d, VM_Total, tStep );
176 
177  double l = this->giveInternalLength();
178 
179  for ( auto &ip: *this->giveDefaultIntegrationRulePtr() ) {
180 
181  // Part 1
183 
184  double d = computeDamageAt( ip, VM_Total, tStep );
185  double facN = d + l * mat->giveDrivingForce(ip);
186 
187  this->giveInterpolation()->evalN(Nd, ip->giveNaturalCoordinates(), FEIElementGeometryWrapper(this));
188 
189  double dA = this->computeAreaAround(ip);
190  answer.add(facN*dA, Nd);
191 
192  // Part 2
193  this->computeBd_matrixAt(ip, B );
194  grad_d.beProductOf(B, { a_d.at(1), a_d.at(2) });
195  BStress = grad_d * l * l;
196  BS.beTProductOf(B, BStress);
197  answer.add(dA, BS);
198  }
199 
200  FloatArray temp;
201  temp = answer;
202  answer.resize(4);
203  answer.zero();
204  answer.assemble(temp,{1,2});
205  answer.assemble(temp,{3,4});
206 
207 }
208 
209 
210 
211 double
213 {
214  // d = N_d * a_d
215  FloatArray dVec;
216  computeDamageUnknowns(dVec, valueMode, stepN);
217  FloatArray Nvec;
219  //return Nvec.dotProduct(dVec);
220  return Nvec.dotProduct( {dVec.at(1), dVec.at(2) });
221 }
222 
223 
224 
225 
226 void
228 {
229  FloatArray Nvec;
230  this->giveInterpolation( )->evalN( Nvec, lCoords, FEIElementGeometryWrapper( this ) );
231  //N.resize(1, Nvec.giveSize());
232  N.beNMatrixOf(Nvec,1);
233 }
234 
235 void
237 {
238 
239  FloatMatrix dNdxi;
240 
241  FloatMatrix G;
242  this->computeCovarBaseVectorsAt(gp, G);
243 
245  answer.beProductTOf(G,dNdxi);
246  //answer.beTranspositionOf( dNdx );
247 
248 
249 }
250 
251 
252 
253 
254 int
256 {
257  //NLStructuralElement *el = static_cast< NLStructuralElement* >(this->giveElement( ) );
258  int nDofs = 0;
259  for( int i = 1; i <= this->giveNumberOfDofManagers(); i++)
260  {
261  nDofs += this->giveDofManager( i )->giveNumberOfDofs();
262  }
263  return nDofs;
264 }
265 
266 
267 
268 
269 void
271 {
272  //set displacement and nonlocal location array
274  //IntArray IdMask_u, IdMask_d;
275  //this->giveDofManDofIDMask_u( IdMask_u );
276  //this->giveDofManDofIDMask_d( IdMask_d );
277 
278  this->getLocationArray_u(loc_u);
279  this->getLocationArray_d(loc_d);
280 
281  int nDofs = this->computeNumberOfDofs();
282  answer.resize( nDofs, nDofs );
283  answer.zero();
284 
285  FloatMatrix answer1, answer2, answer3, answer4;
286 
287  this->computeStiffnessMatrix_uu(answer1, rMode, tStep);
288  //StructuralInterfaceElement :: computeStiffnessMatrix(answer1, rMode, tStep);
289 
290 
291  //this->computeStiffnessMatrix_ud(answer2, rMode, tStep);
292  //this->computeStiffnessMatrix_du(answer3, rMode, tStep); //symmetric
293  //answer3.beTranspositionOf( answer2 );
294 
295  this->computeStiffnessMatrix_dd(answer4, rMode, tStep);
296 
297  answer.assemble( answer1, loc_u, loc_u );
298  //answer.assemble( answer2, loc_u, loc_d );
299  //answer.assemble( answer3, loc_d, loc_u );
300  answer.assemble( answer4, loc_d, loc_d );
301 
302 }
303 
304 
305 
306 void
308 {
309 
310 
311  // This is the regular stiffness matrix times G
312 
313  // Computes the stiffness matrix of the receiver K_cohesive = int_A ( N^t * D * N ) dA
314  // with the stiffness D = dT/dj
315  FloatMatrix N, D, DN;
316  bool matStiffSymmFlag = this->giveCrossSection()->isCharacteristicMtrxSymmetric(rMode);
317  answer.clear();
318 
319  FloatMatrix rotationMatGtoL;
320  for ( auto &ip: *this->giveDefaultIntegrationRulePtr() ) {
321 
322  this->giveStiffnessMatrix_Eng(D, rMode, ip, tStep);
323 
324  this->computeTransformationMatrixAt(ip, rotationMatGtoL);
325  D.rotatedWith(rotationMatGtoL, 't'); // transform stiffness to global coord system
326 
327  this->computeNmatrixAt(ip, N);
328  DN.beProductOf(D, N);
329  double dA = this->computeAreaAround(ip);
330  if ( matStiffSymmFlag ) {
331  answer.plusProductSymmUpper(N, DN, dA);
332  } else {
333  answer.plusProductUnsym(N, DN, dA);
334  }
335  }
336 
337 
338  if ( matStiffSymmFlag ) {
339  answer.symmetrized();
340  }
341 }
342 
343 
344 
345 
346 
347 
348 
349 void
351 {
352  FloatMatrix B, DB, N_d, DN, S(3,1);
353  FloatArray stress;
354 #if 1
355 
356  answer.resize(0,0);
357 
358  for ( auto &ip: *this->giveDefaultIntegrationRulePtr() ) {
359 
360  double dA = this->computeAreaAround(ip);
361 
362  // compute int_V ( B^t * D_B * B )dV
363  this->computeNd_matrixAt(ip->giveNaturalCoordinates(), N_d);
364  // stress
365 
366  FloatMatrix B_u, N;
367  this->computeNmatrixAt(ip, N);
368  //stress = matStat->giveTempStressVector();
369  //stress.times( this->computeGPrim( ip, VM_Total, tStep ) );
370  S.setColumn(stress,1);
371  DN.beProductOf(S, N_d);
372  answer.plusProductUnsym(N, DN, dA);
373  }
374 #endif
375 }
376 
377 
378 
379 
380 void
382 {
383 
384  double l = this->giveInternalLength();
385 
386  FloatMatrix B_d, N_d;
387  answer.clear();
388 
389  FloatMatrix rotationMatGtoL;
390  for ( auto &ip: *this->giveDefaultIntegrationRulePtr() ) {
392 
393  this->computeNd_matrixAt(ip->giveNaturalCoordinates(), N_d);
394  this->computeBd_matrixAt(ip, B_d);
395 
396  // K_dd1 = ( 1 + l*f' ) * N^t*N;
397  // K_dd2 = ( l*l ) * B^t*B;
398  double dA = this->computeAreaAround(ip);
399 
400  double fPrime = mat->giveDrivingForcePrime(ip);
401  double factorN = 1.0 + l* fPrime;
402  double factorB = l*l;
403 
404  answer.plusProductUnsym(N_d, N_d, factorN * dA);
405  answer.plusProductUnsym(B_d, B_d, factorB * dA);
406 
407  }
408 
409  FloatMatrix temp;
410  temp =answer;
411  answer.resize(4,4);
412  answer.zero();
413  answer.assemble(temp,{1,2},{1,2});
414  answer.assemble(temp,{3,4},{3,4});
415 
416 }
417 
418 
419 void
421 {
422  // Returns the traction in global coordinate system
423  FloatMatrix rotationMatGtoL, F;
424  this->computeTransformationMatrixAt(ip, rotationMatGtoL);
425  jump.rotatedWith(rotationMatGtoL, 'n'); // transform jump to local coord system
426 
427  double damage = this->computeDamageAt(ip, VM_Total, tStep);
428 
429  this->giveEngTraction(traction, ip, jump, damage, tStep);
430 
431 
432  traction.rotatedWith(rotationMatGtoL, 't'); // transform traction to global coord system
433 }
434 
435 
436 
437 
438 
439 void
441 {
443 
444  // record initial displacement if element not active
445  if ( activityTimeFunction && !isActivated(tStep) ) {
446  this->computeVectorOf(VM_Total, tStep, initialDisplacements);
447  }
448 }
449 
450 
451 void
453 {
454  // Updates the receiver at end of step.
455  FloatArray tractionG, jumpL;
456 
457  // force updating strains & stresses
458  for ( auto &iRule: integrationRulesArray ) {
459  for ( GaussPoint *gp: *iRule ) {
460  this->computeSpatialJump(jumpL, gp, tStep);
461  this->computeTraction(tractionG, gp, jumpL, tStep);
462  }
463  }
464 }
465 
466 
467 
468 
469 
470 
471 } // end namespace oofem
472 
CrossSection * giveCrossSection()
Definition: element.C:495
virtual bool isActivated(TimeStep *tStep)
Definition: element.C:793
virtual void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord=0)
Returns equivalent nodal forces vectors.
StructuralInterfaceMaterial * giveInterfaceMaterial()
void subtract(const FloatArray &src)
Subtracts array src to receiver.
Definition: floatarray.C:258
virtual void giveEngTraction(FloatArray &answer, GaussPoint *gp, const FloatArray &jump, const double damage, TimeStep *tStep)
virtual void computeTransformationMatrixAt(GaussPoint *gp, FloatMatrix &answer)=0
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.
virtual void getLocationArray_u(IntArray &answer)=0
Class and object Domain.
Definition: domain.h:115
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Returns local vector of unknowns.
Definition: element.C:86
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
Definition: element.h:822
virtual double computeDamageAt(GaussPoint *gp, ValueModeType valueMode, TimeStep *stepN)
virtual void computeNd_matrixAt(const FloatArray &lCoords, FloatMatrix &N)
virtual void computeTraction(FloatArray &traction, IntegrationPoint *ip, FloatArray &jump, TimeStep *tStep)
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
virtual void computeCovarBaseVectorsAt(GaussPoint *gp, FloatMatrix &G)=0
void clear()
Clears receiver (zero size).
Definition: floatarray.h:206
void giveInternalForcesVector_u(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord=0)
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
Definition: element.C:779
StructuralInterfaceElementPhF(int n, Domain *d)
Constructor.
Base class for dof managers.
Definition: dofmanager.h:113
virtual double computeAreaAround(GaussPoint *gp)=0
#define S(p)
Definition: mdm.C:481
virtual void computeBd_matrixAt(GaussPoint *, FloatMatrix &)
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
MatResponseMode
Describes the character of characteristic material matrix.
void computeDamageUnknowns(FloatArray &answer, ValueModeType valueMode, TimeStep *stepN)
virtual int giveNumberOfDofManagers() const
Definition: element.h:656
void rotatedWith(FloatMatrix &r, char mode)
Returns the receiver a rotated according the change-of-base matrix r.
Definition: floatarray.C:799
virtual void computeLocationArrayOfDofIDs(const IntArray &dofIdArray, IntArray &answer)
virtual FEInterpolation * giveInterpolation() const
int computeNumberOfDofs()
Computes or simply returns total number of element&#39;s local DOFs.
void plusProductUnsym(const FloatMatrix &a, const FloatMatrix &b, double dV)
Adds to the receiver the product .
Definition: floatmatrix.C:780
virtual void getLocationArray_d(IntArray &answer)=0
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
int activityTimeFunction
Element activity time function. If defined, nonzero value indicates active receiver, zero value inactive element.
Definition: element.h:176
virtual void computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)=0
Computes modified interpolation matrix (N) for the element which multiplied with the unknowns vector ...
int giveNumberOfDofs() const
Definition: dofmanager.C:279
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
virtual void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
Computes the stiffness/tangent matrix of receiver.
FloatArray initialDisplacements
Initial displacement vector, describes the initial nodal displacements when element has been casted...
void rotatedWith(const FloatMatrix &r, char mode= 'n')
Returns the receiver &#39;a&#39; transformed using give transformation matrix r.
Definition: floatmatrix.C:1557
Wrapper around element definition to provide FEICellGeometry interface.
Definition: feinterpol.h:95
virtual bool isCharacteristicMtrxSymmetric(MatResponseMode rMode)
Check for symmetry of stiffness matrix.
Definition: crosssection.h:172
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
Definition: floatarray.C:676
#define N(p, q)
Definition: mdm.C:367
void computeStiffnessMatrix_uu(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
void plusProductSymmUpper(const FloatMatrix &a, const FloatMatrix &b, double dV)
Adds to the receiver the product .
Definition: floatmatrix.C:698
virtual void updateInternalState(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix^T and anArray.
Definition: floatarray.C:708
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
void computeDisplacementUnknowns(FloatArray &answer, ValueModeType valueMode, TimeStep *stepN)
void computeStiffnessMatrix_ud(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
void computeStiffnessMatrix_dd(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
void beNMatrixOf(const FloatArray &n, int nsd)
Assigns the receiver to be a repeated diagonal matrix.
Definition: floatmatrix.C:505
virtual void giveStiffnessMatrix_Eng(FloatMatrix &answer, MatResponseMode rMode, IntegrationPoint *ip, TimeStep *tStep)
Class representing vector of real numbers.
Definition: floatarray.h:82
bool hasDofID(DofIDItem id) const
Checks if receiver contains dof with given ID.
Definition: dofmanager.C:166
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
void assemble(const FloatArray &fe, const IntArray &loc)
Assembles the array fe (typically, the load vector of a finite element) into the receiver, using loc as location array.
Definition: floatarray.C:551
virtual void giveDofManDofIDMask_d(IntArray &answer)=0
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
Definition: intarray.C:145
void zero()
Zeroes all coefficients of receiver.
Definition: floatarray.C:658
void setColumn(const FloatArray &src, int c)
Sets the values of the matrix in specified column.
Definition: floatmatrix.C:648
virtual void computeSpatialJump(FloatArray &answer, GaussPoint *gp, 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
void beProductTOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
Definition: floatmatrix.C:397
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
virtual double giveDrivingForcePrime(GaussPoint *gp)
Abstract base class for all structural interface elements.
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
Assigns to the receiver product of .
Definition: floatmatrix.C:337
int giveSize() const
Definition: intarray.h:203
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.
DofManager * giveDofManager(int i) const
Definition: element.C:514
void assemble(const FloatMatrix &src, const IntArray &loc)
Assembles the contribution using localization array into receiver.
Definition: floatmatrix.C:251
void clear()
Sets size of receiver to be an empty matrix. It will have zero rows and zero columns size...
Definition: floatmatrix.h:516
void symmetrized()
Initializes the lower half of the receiver according to the upper half.
Definition: floatmatrix.C:1576
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
virtual void giveDofManDofIDMask_u(IntArray &answer)=0
void giveInternalForcesVector_d(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord=0)
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Definition: gausspoint.h:138
StructuralInterfaceCrossSection * giveInterfaceCrossSection()
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631
void plusProduct(const FloatMatrix &b, const FloatArray &s, double dV)
Adds the product .
Definition: floatarray.C:226

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