OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
celnode2node.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 "Contact/celnode2node.h"
36 #include "floatmatrix.h"
37 #include "masterdof.h"
38 #include "unknownnumberingscheme.h"
39 #include "gaussintegrationrule.h"
40 
41 namespace oofem {
42 
44 {
45  this->masterNode = master;
46  this->slaveNode = slave;
47  this->area = 1.0; // should be optional parameter
48  this->epsN = 1.0e6; // penalty - should be given by 'contactmaterial'
49 }
50 
51 
52 int
54 {
55  // compute normal as direction vector from master node to slave node
56  FloatArray xs, xm, _normal;
57  xs = *this->slaveNode->giveCoordinates();
58  xm = *this->masterNode->giveCoordinates();
59 
60  _normal = xs-xm;
61  double norm = _normal.computeNorm();
62  if ( norm < 1.0e-8 ) {
63  OOFEM_ERROR("Couldn't compute normal between master node (num %d) and slave node (num %d), nodes are too close to each other.",
65  } else {
66  normal = _normal*(1.0/norm);
67  }
68  return 1;
69 }
70 
71 
72 void
74 {
75  FloatArray xs, xm, uS, uM;
76  xs = *this->slaveNode->giveCoordinates();
77  xm = *this->masterNode->giveCoordinates();
78  this->slaveNode->giveUnknownVector(uS, {D_u, D_v, D_w}, VM_Total, tStep, true);
79  this->masterNode->giveUnknownVector(uM, {D_u, D_v, D_w}, VM_Total, tStep, true);
80  xs.add(uS);
81  xm.add(uM);
82  FloatArray dx = xs-xm;
83 
84  FloatArray normal = this->giveNormal();
85  answer = {dx.dotProduct(normal), 0.0, 0.0};
86 
87  //printf("normal gap = %e \n", answer.at(1));
88  // store in gp?
89  this->inContact = answer.at(1) < 0.0;
90 }
91 
92 
93 void
95 {
96  // The normal is not updated for node2node which is for small deformations only
97  // C = {n -n}
98  FloatArray normal = this->giveNormal();
99  answer = { normal.at(1), normal.at(2), normal.at(3),
100  -normal.at(1), -normal.at(2), -normal.at(3) };
101 }
102 
103 
104 void
106 {
107  // should be replaced with a call to constitutive model
108  // gap should be in a local system
109  if ( gap.at(1) < 0.0 ) {
110  t = this->epsN * gap;
111  } else {
112  t = {0.0, 0.0, 0.0};
113  }
114 }
115 
116 
117 void
119  const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms)
120 {
121  answer.clear();
122  FloatArray gap, C;
123 
124  this->computeGap(gap, tStep);
125  if ( gap.at(1) < 0.0 ) {
127  FloatArray t;
128  this->computeContactTractionAt(gp, t ,gap, tStep);
129 
130  this->computeCmatrixAt(gp, C, tStep);
131 
132  // compute load vector
133  // fc = C^T * traction * A, Area - should be optional par
134  answer = t.at(1) * this->area * C;
135 
136  }
137 }
138 
139 
140 void
142 {
143  // Need to set up an integration rule
144  GaussPoint *gp = NULL;
145  FloatArray gap;
146 
147  this->computeGap(gap, tStep);
148 
149  FloatArray C;
150  this->computeCmatrixAt(gp, C, tStep);
151  answer.beDyadicProductOf(C,C);
152  // this is the interface stiffness and should be obtained from that model
153  answer.times( this->epsN * this->area );
154  answer.negated();
155 
156  if( gap.at(1) > 0.0 ) {
157  answer.zero();
158  }
159 }
160 
161 
162 void
164 {
165  // should return location array for the master and the slave node
166  // TODO this whole thing should be rewritten
167 
168  answer.resize(6);
169  answer.zero();
170  //TODO should use a proper unknownnumberingscheme
171  IntArray dofIdArray = {D_u, D_v, D_w};
172 
173  // master node
174  for ( int i = 1; i <= dofIdArray.giveSize(); i++ ) {
175  if ( this->masterNode->hasDofID( (DofIDItem)dofIdArray.at(i) ) ) { // add corresponding number
176  Dof *dof= this->masterNode->giveDofWithID( (DofIDItem)dofIdArray.at(i) );
177  answer.at(i) = s.giveDofEquationNumber( dof );
178  }
179  }
180 
181  // slave node
182  for ( int i = 1; i <= dofIdArray.giveSize(); i++ ) {
183  if ( this->slaveNode->hasDofID( (DofIDItem)dofIdArray.at(i) ) ) { // add corresponding number
184  Dof *dof= this->slaveNode->giveDofWithID( (DofIDItem)dofIdArray.at(i) );
185  answer.at(3 + i) = s.giveDofEquationNumber( dof );
186  }
187  }
188 }
189 
190 
191 void
193 {
194  // Sets up the integration rule array which contains all the necessary integration points
195  if ( this->integrationRule == NULL ) {
196  //TODO sets a null pointer for the element in the iRule
197  this->integrationRule = new GaussIntegrationRule(1, NULL) ;
198  this->integrationRule->SetUpPoint(_Unknown);
199  }
200 }
201 
202 // node 2 node Lagrange
203 
205 {
206  this->masterNode = master;
207  this->slaveNode = slave;
208  this->area = 1.0;
209 }
210 
211 
212 void
214 {
216 
217  // Add one lagrange dof
218  if ( this->masterNode->hasDofID( (DofIDItem)this->giveDofIdArray().at(1) ) ) {
219  Dof *dof= this->masterNode->giveDofWithID( (DofIDItem)this->giveDofIdArray().at(1) );
220  answer.followedBy( s.giveDofEquationNumber(dof) );
221  }
222 }
223 
224 
225 void
227  const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms)
228 {
229  //Loop through all the master objects and let them do their thing
230  FloatArray gap, C;
231  this->computeGap(gap, tStep);
232 
234  FloatArray t;
235  this->computeContactTractionAt(gp, t ,gap, tStep);
236  this->computeCmatrixAt(gp, C, tStep);
237 
238  // compute load vector
239  // for Lagrange: fc = traction * C^T * A (traction = lambda)
240  FloatArray temp = t.at(1) *this->area * C;
241 
242  answer.resize( C.giveSize() + 1);
243  answer.zero();
244  if( gap.at(1) < 0.0 ) {
245  answer.addSubVector(temp,1);
246  answer.at( C.giveSize() + 1 ) = -gap.at(1);
247  }
248 }
249 
250 
251 void
253 {
254  answer.resize(7,7);
255  answer.zero();
256 
257  FloatArray gap;
258  this->computeGap(gap, tStep);
259 
260  if ( gap.at(1) < 0.0 ) {
261 
263 
264  FloatArray C;
265  this->computeCmatrixAt(gp, C, tStep);
266  int sz = C.giveSize();
267  C.times(this->area);
268 
269  answer.addSubVectorCol(C, 1, sz + 1);
270  answer.addSubVectorRow(C, sz + 1, 1);
271  }
272 
273  //TODO need to add a small number for the solver
274  for ( int i = 1; i <= 7; i++ ) {
275  answer.at(i,i) += 1.0e-8;
276  }
277 }
278 
279 
280 void
282 {
283  // should be replaced with a call to constitutive model
284  // gap should be in a local system
285  if ( gap.at(1) < 0.0 ) {
286  auto dof = masterNode->giveDofWithID( this->giveDofIdArray().at(1) );
287  double lambda = dof->giveUnknown(VM_Total, tStep);
288  t = {lambda, 0.0, 0.0};
289  //printf("lambda %e \n\n", lambda);
290  } else {
291  t = {0.0, 0.0, 0.0};
292  }
293 }
294 
295 
296 void
298 {
299  answer = {this->masterNode->giveNumber()};
300 }
301 
302 
303 }
virtual void giveLocationArray(IntArray &answer, const UnknownNumberingScheme &s)
Definition: celnode2node.C:163
int SetUpPoint(MaterialMode mode)
Trivial implementation, only creates a single point.
Class and object Domain.
Definition: domain.h:115
int giveGlobalNumber() const
Definition: dofmanager.h:501
virtual void computeContactTractionAt(GaussPoint *gp, FloatArray &t, FloatArray &gap, TimeStep *tStep)
Definition: celnode2node.C:281
void zero()
Sets all component to zero.
Definition: intarray.C:52
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
void clear()
Clears receiver (zero size).
Definition: floatarray.h:206
virtual FloatArray * giveCoordinates()
Definition: dofmanager.h:382
virtual double giveUnknown(ValueModeType mode, TimeStep *tStep)=0
The key method of class Dof.
virtual IntArray & giveDofIdArray()
virtual int instanciateYourself(DataReader &dr)
Definition: celnode2node.C:53
Base class for dof managers.
Definition: dofmanager.h:113
virtual void computeContactTangent(FloatMatrix &answer, TimeStep *tStep)
Definition: celnode2node.C:141
void negated()
Changes sign of receiver values.
Definition: floatmatrix.C:1605
Class representing the abstraction for input data source.
Definition: datareader.h:50
virtual void computeCmatrixAt(GaussPoint *gp, FloatArray &answer, TimeStep *TimeStep)
Definition: celnode2node.C:94
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
virtual void giveDofManagersToAppendTo(IntArray &answer)
Definition: celnode2node.C:297
virtual int giveDofEquationNumber(Dof *dof) const =0
Returns the equation number for corresponding DOF.
Node2NodeContactL(DofManager *master, DofManager *slave)
Constructor.
Definition: celnode2node.C:204
FloatArray & giveNormal()
Definition: celnode2node.h:85
void giveUnknownVector(FloatArray &answer, const IntArray &dofMask, ValueModeType mode, TimeStep *tStep, bool padding=false)
Assembles the vector of unknowns in global c.s for given dofs of receiver.
Definition: dofmanager.C:685
DofManager * slaveNode
Definition: celnode2node.h:66
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
Definition: floatarray.C:463
#define OOFEM_ERROR(...)
Definition: error.h:61
DofIDItem
Type representing particular dof type.
Definition: dofiditem.h:86
Node2NodeContact(DofManager *master, DofManager *slave)
Constructor.
Definition: celnode2node.C:43
void times(double f)
Multiplies receiver by factor f.
Definition: floatmatrix.C:1594
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
void addSubVector(const FloatArray &src, int si)
Adds the given vector as sub-vector to receiver.
Definition: floatarray.C:399
DofManager * masterNode
Definition: celnode2node.h:65
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
virtual void giveLocationArray(IntArray &answer, const UnknownNumberingScheme &s)
Definition: celnode2node.C:213
virtual void computeGap(FloatArray &answer, TimeStep *tStep)
Definition: celnode2node.C:73
virtual void setupIntegrationPoints()
Definition: celnode2node.C:192
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
GaussPoint * getIntegrationPoint(int n)
Access particular integration point of receiver.
void addSubVectorCol(const FloatArray &src, int sr, int sc)
Adds given vector to receiver starting at given position.
Definition: floatmatrix.C:627
double norm(const FloatArray &x)
Definition: floatarray.C:985
double computeNorm() const
Computes the norm (or length) of the vector.
Definition: floatarray.C:840
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
virtual void computeContactTangent(FloatMatrix &answer, TimeStep *tStep)
Definition: celnode2node.C:252
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
Definition: dofmanager.C:119
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 beDyadicProductOf(const FloatArray &vec1, const FloatArray &vec2)
Assigns to the receiver the dyadic product .
Definition: floatmatrix.C:492
IntegrationRule * integrationRule
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
int giveSize() const
Definition: intarray.h:203
virtual void computeContactForces(FloatArray &answer, TimeStep *tStep, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms)
Definition: celnode2node.C:226
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.
Abstract class Dof represents Degree Of Freedom in finite element mesh.
Definition: dof.h:93
virtual void computeContactForces(FloatArray &answer, TimeStep *tStep, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms)
Definition: celnode2node.C:118
int giveNumber() const
Definition: femcmpnn.h:107
void addSubVectorRow(const FloatArray &src, int sr, int sc)
Adds given vector to receiver starting at given position.
Definition: floatmatrix.C:607
Class representing integration point in finite element program.
Definition: gausspoint.h:93
virtual void computeContactTractionAt(GaussPoint *gp, FloatArray &t, FloatArray &gap, TimeStep *tStep)
Definition: celnode2node.C:105
Class representing solution step.
Definition: timestep.h:80
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
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:27 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011