OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
tr2shell7PhFi.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 "tr2shell7phfi.h"
36 #include "node.h"
37 #include "load.h"
38 #include "structuralms.h"
39 #include "mathfem.h"
40 #include "domain.h"
41 #include "equationid.h"
42 #include "gaussintegrationrule.h"
43 #include "gausspoint.h"
44 #include "fei3dtrquad.h"
45 #include "boundaryload.h"
46 #include "vtkxmlexportmodule.h"
47 #include "classfactory.h"
48 #include "tr2shell7.h"
49 
50 namespace oofem {
51 REGISTER_Element(Tr2Shell7PhFi);
52 
53 FEI3dTrQuad Tr2Shell7PhFi :: interpolation;
54 
55 IntArray Tr2Shell7PhFi :: ordering_disp(42);
56 IntArray Tr2Shell7PhFi :: ordering_disp_inv(42);
57 IntArray Tr2Shell7PhFi :: ordering_base(42);
58 IntArray Tr2Shell7PhFi :: ordering_base_inv(42);
59 IntArray Tr2Shell7PhFi:: ordering_all(1);
60 IntArray Tr2Shell7PhFi:: ordering_damage(1);
61 IntArray Tr2Shell7PhFi :: ordering_gr(1);
62 IntArray Tr2Shell7PhFi :: ordering_gr_edge(21);
63 bool Tr2Shell7PhFi :: __initialized = Tr2Shell7PhFi :: initOrdering();
64 
65 
66 
67 Tr2Shell7PhFi:: Tr2Shell7PhFi(int n, Domain *aDomain) : Shell7BasePhFi(n, aDomain)
68 {
69  this->numberOfDofMans = 6;
70 
71  this->ordering_damage.resize(0);
72  this->ordering_gr.resize(0);
73  this->ordering_disp_inv.resize(0);
74 
75  IntArray localDam, localDisp(7); // hard coded for 7 parameter shell!!
76 
77  localDam.resize(0);
78  localDisp.setValues(7, 1, 2, 3, 19, 20, 21, 37);
79 
80  for (int i = 1; i <= numberOfLayers; i++)
81  {
82  //localDam.followedBy(i + this->giveNumberOfuDofs());
83  localDam.followedBy(7 + i);
84  }
85 
86  int numDofsPerNode = 7 + numberOfLayers;
87 
88  for (int i = 1; i <= this->numberOfDofMans; i++)
89  {
90  this->ordering_damage.followedBy(localDam);
91  this->ordering_gr.followedBy(localDisp);
92  this->ordering_gr.followedBy(localDam);
93  this->ordering_disp_inv.followedBy(localDisp);
94 
95  localDisp.at(1) += 3;
96  localDisp.at(2) += 3;
97  localDisp.at(3) += 3;
98  localDisp.at(4) += 3;
99  localDisp.at(5) += 3;
100  localDisp.at(6) += 3;
101  localDisp.at(7) += 1;
102 
103  localDam.add(numberOfLayers);
104 
105  }
106 
107 
108  this->ordering_all.resize(0);
109  this->ordering_all = this->ordering_disp;
110  this->ordering_all.followedBy(ordering_damage);
111 
112 
113  // JB - New
114 
115  IntArray temp_x(0), temp_m(0), temp_dam(0), local_temp_x(0), local_temp_m(0), local_temp_gam(0), local_temp_dam(0);
116  temp_x.setValues(3, 1, 2, 3);
117  temp_m.setValues(3, 4, 5, 6);
118  int temp_gam = 7;
119 
120  for (int i = 1; i <= numberOfLayers; i++) {
121  temp_dam.followedBy(7 + i);
122  }
123 
124  for (int i = 1; i <= this->numberOfDofMans; i++)
125  {
126  local_temp_x.followedBy(temp_x);
127  local_temp_m.followedBy(temp_m);
128  local_temp_gam.followedBy(temp_gam);
129  local_temp_dam.followedBy(temp_dam);
130  temp_x.add(numDofsPerNode);
131  temp_m.add(numDofsPerNode);
132  temp_gam +=numDofsPerNode;
133  temp_dam.add(numDofsPerNode);
134  }
135  //local_temp_x.printYourself();
136  //local_temp_m.printYourself();
137  //local_temp_gam.printYourself();
138  //local_temp_dam.printYourself();
139 
140  // Construct the two orddering arrays
141  ordering_disp.resize(0);
142  ordering_damage.resize(0);
143  this->ordering_disp.followedBy(local_temp_x); // xbar field
144  this->ordering_disp.followedBy(local_temp_m); // director field
145  this->ordering_disp.followedBy(local_temp_gam); // gamma field
146  this->ordering_damage = local_temp_dam;
147 
148  //ordering_disp.printYourself();
149  //ordering_damage.printYourself();
150 }
151 
152 void
153 Tr2Shell7PhFi :: giveDofManDofIDMask_u(IntArray &answer)
154 {
155  Shell7BasePhFi :: giveDofManDofIDMask_u(answer);
156 }
157 
158 void
159 Tr2Shell7PhFi :: giveDofManDofIDMask_d(IntArray &answer)
160 {
161  Shell7BasePhFi :: giveDofManDofIDMask_d(answer);
162 }
163 
164 const IntArray &
165 Tr2Shell7PhFi:: giveOrdering(SolutionField fieldType) const
166 {
167  OOFEM_ERROR("Tr2Shell7PhFi :: giveOrdering not implemented: Use Tr2Shell7PhFi :: giveOrderingPhFi instead");
168  return 0;
169 
170 }
171 
172 
173 const IntArray &
174 Tr2Shell7PhFi:: giveOrderingPhFi(SolutionFieldPhFi fieldType) const
175 {
176  if ( fieldType == All ) {
177  return this->ordering_all;
178  } else if ( fieldType == Displacement ) {
179  return this->ordering_disp;
180  } else if ( fieldType == Damage ) {
181  return this->ordering_damage;
182  } else if ( fieldType == AllInv ) {
183  return this->ordering_gr;
184  } else { /*if ( fieldType == EdgeInv )*/
185  OOFEM_ERROR("Tr2Shell7PhFi :: giveOrdering: the requested ordering is not implemented")
186  //return this->ordering_gr_edge;
187  }
188 }
189 
190 const IntArray &
191 Tr2Shell7PhFi :: giveOrdering_All() const
192 {
193  return this->ordering_base; // When shell7base methods are called this is what is wanted
194 }
195 
196 const IntArray &
197 Tr2Shell7PhFi :: giveOrdering_AllInv() const
198 {
199  // Same as in Shell7Base
200  return this->ordering_base_inv;
201 }
202 
203 const IntArray &
204 Tr2Shell7PhFi :: giveOrdering_Disp() const
205 {
206  return this->ordering_disp;
207 }
208 
209 const IntArray &
210 Tr2Shell7PhFi :: giveOrdering_Damage() const
211 {
212  return this->ordering_damage;
213 }
214 
215 
216 void
217 Tr2Shell7PhFi:: giveLocalNodeCoords(FloatArray &nodeLocalXiCoords, FloatArray &nodeLocalEtaCoords)
218 {
219  nodeLocalXiCoords.setValues(6, 1., 0., 0., .5, 0., .5); // corner nodes then midnodes, uncertain of node numbering
220  nodeLocalEtaCoords.setValues(6, 0., 1., 0., .5, .5, 0.);
221 }
222 
223 
224 FEInterpolation *Tr2Shell7PhFi:: giveInterpolation() const { return & interpolation; }
225 
226 
227 
228 void
229 Tr2Shell7PhFi:: computeGaussPoints()
230 {
231  if ( !integrationRulesArray ) {
232  int nPointsTri = 6; // points in the plane
233  int nPointsEdge = 2; // edge integration
234  specialIntegrationRulesArray = new IntegrationRule * [ 3 ];
235 
236  // Midplane and thickness
237 
238  // Midplane (Mass matrix integrated analytically through the thickness)
239  specialIntegrationRulesArray [ 1 ] = new GaussIntegrationRule(1, this);
240  specialIntegrationRulesArray [ 1 ]->SetUpPointsOnWedge(nPointsTri, 1, _3dMat); //@todo replce with triangle which has a xi3-coord
241 
242 
243  // Edge
244  specialIntegrationRulesArray [ 2 ] = new GaussIntegrationRule(1, this);
245  specialIntegrationRulesArray [ 2 ]->SetUpPointsOnLine(nPointsEdge, _3dMat);
246 
247 
248  // Layered cross section for bulk integration
249  //@todo - must use a cast here since check consistency has not been called yet
250  LayeredCrossSection *layeredCS = dynamic_cast< LayeredCrossSection * >( Tr2Shell7PhFi:: giveCrossSection() );
251  if ( layeredCS == NULL ) {
252  OOFEM_ERROR("Tr2Shell7PhFionly supports layered cross section");
253  }
254  this->numberOfIntegrationRules = layeredCS->giveNumberOfLayers();
255  this->numberOfGaussPoints = layeredCS->giveNumberOfLayers() * nPointsTri * layeredCS->giveNumIntegrationPointsInLayer();
256  layeredCS->setupLayeredIntegrationRule(integrationRulesArray, this, nPointsTri);
257 
258 
259  // Thickness integration for stress recovery
260  specialIntegrationRulesArray [ 0 ] = new GaussIntegrationRule(1, this);
261  specialIntegrationRulesArray [ 0 ]->SetUpPointsOnLine(layeredCS->giveNumIntegrationPointsInLayer(), _3dMat);
262  }
263 }
264 
265 
266 
267 
268 void
269 Tr2Shell7PhFi:: giveEdgeDofMapping(IntArray &answer, int iEdge) const
270 {
271  /*
272  * provides dof mapping of local edge dofs (only nonzero are taken into account)
273  * to global element dofs
274  */
275 
276  if ( iEdge == 1 ) { // edge between nodes 1-4-2
277  //answer.setValues(21, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 22, 23, 24, 25, 26, 27, 28);
278  answer.setValues(21, 1, 2, 3, 8, 9, 10, 22, 23, 24, 4, 5, 6, 11, 12, 13, 25, 26, 27, 7, 14, 28);
279  } else if ( iEdge == 2 ) { // edge between nodes 2-5-3
280  //answer.setValues(21, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 29, 30, 31, 32, 33, 34, 35 );
281  answer.setValues(21, 8, 9, 10, 15, 16, 17, 29, 30, 31, 11, 12, 13, 18, 19, 20, 32, 33, 34, 14, 21, 35);
282  } else if ( iEdge == 3 ) { // edge between nodes 3-6-1
283  //answer.setValues(21, 15, 16, 17, 18, 19, 20, 21, 1, 2, 3, 4, 5, 6, 7, 36, 37, 38, 39, 40, 41, 42);
284  answer.setValues(21, 15, 16, 17, 1, 2, 3, 36, 37, 38, 18, 19, 20, 4, 5, 6, 39, 40, 41, 21, 7, 42);
285  } else {
286  _error("giveEdgeDofMapping: wrong edge number");
287  }
288 }
289 
290 
291 void
292 Tr2Shell7PhFi:: giveSurfaceDofMapping(IntArray &answer, int iSurf) const
293 {
294  answer.resize(42);
295  for ( int i = 1; i <= 42; i++ ) {
296  answer.at(i) = i;
297  }
298 }
299 
300 
301 double
302 Tr2Shell7PhFi:: computeAreaAround(GaussPoint *gp, double xi)
303 {
304  FloatArray G1, G2, temp;
305  FloatMatrix Gcov;
306  FloatArray lcoords(3);
307  lcoords.at(1) = gp->giveCoordinate(1);
308  lcoords.at(2) = gp->giveCoordinate(2);
309  lcoords.at(3) = xi;
310  this->evalInitialCovarBaseVectorsAt(lcoords, Gcov);
311  G1.beColumnOf(Gcov, 1);
312  G2.beColumnOf(Gcov, 2);
313  temp.beVectorProductOf(G1, G2);
314  double detJ = temp.computeNorm();
315  return detJ * gp->giveWeight();
316 }
317 
318 
319 
320 double
321 Tr2Shell7PhFi:: computeVolumeAroundLayer(GaussPoint *gp, int layer)
322 {
323  double detJ;
324  FloatMatrix Gcov;
325  FloatArray lcoords;
326  lcoords = * gp->giveCoordinates();
327  this->evalInitialCovarBaseVectorsAt(lcoords, Gcov);
328  detJ = Gcov.giveDeterminant() * 0.5 * this->layeredCS->giveLayerThickness(layer);
329  return detJ * gp->giveWeight();
330 }
331 
332 
333 void
334 Tr2Shell7PhFi:: compareMatrices(const FloatMatrix &matrix1, const FloatMatrix &matrix2, FloatMatrix &answer)
335 {
336  int ndofs = 42;
337  answer.resize(ndofs, ndofs);
338  for ( int i = 1; i <= ndofs; i++ ) {
339  for ( int j = 1; j <= 18; j++ ) {
340  if ( fabs( matrix1.at(i, j) ) > 1.0e-12 ) {
341  double diff = ( matrix1.at(i, j) - matrix2.at(i, j) );
342  double relDiff = diff / matrix1.at(i, j);
343  if ( fabs(relDiff) < 1.0e-4 ) {
344  answer.at(i, j) = 0.0;
345  } else if ( fabs(diff) < 1.0e3 ) {
346  answer.at(i, j) = 0.0;
347  } else {
348  answer.at(i, j) = relDiff;
349  }
350  } else {
351  answer.at(i, j) = -1.0;
352  }
353  }
354  }
355 }
356 } // end namespace oofem
LayeredCrossSection * layeredCS
Definition: shell7base.h:107
void evalInitialCovarBaseVectorsAt(const FloatArray &lCoords, FloatMatrix &Gcov)
Definition: shell7base.C:222
#define OOFEM_ERROR(...)
Definition: error.h:61
REGISTER_Element(LSpace)
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
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
the oofem namespace is to define a context or scope in which all oofem names are defined.
static FEI3dTrQuad interpolation
Definition: tr2shell7.h:68
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149

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