OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
tr2shell7.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/Shells/tr2shell7.h"
36 #include "../sm/Materials/structuralms.h"
37 #include "node.h"
38 #include "load.h"
39 #include "mathfem.h"
40 #include "domain.h"
41 #include "gaussintegrationrule.h"
42 #include "gausspoint.h"
43 #include "fei3dtrquad.h"
44 #include "boundaryload.h"
45 #include "vtkxmlexportmodule.h"
46 #include "classfactory.h"
47 
48 namespace oofem {
49 REGISTER_Element(Tr2Shell7);
50 
51 FEI3dTrQuad Tr2Shell7 :: interpolation;
52 
53 IntArray Tr2Shell7 :: orderingDofTypes = {1, 2, 3, 8, 9, 10, 15, 16, 17, 22, 23, 24, 29, 30, 31, 36, 37, 38,
54  4, 5, 6, 11, 12, 13, 18, 19, 20, 25, 26, 27, 32, 33, 34, 39, 40, 41,
55  7, 14, 21, 28, 35, 42};
56 IntArray Tr2Shell7 :: orderingNodes = {1, 2, 3, 19, 20, 21, 37, 4, 5, 6, 22, 23, 24, 38, 7, 8, 9, 25, 26, 27, 39,
57  10, 11, 12, 28, 29, 30, 40, 13, 14, 15, 31, 32, 33, 41, 16, 17, 18,
58  34, 35, 36, 42};
59 IntArray Tr2Shell7 :: orderingEdgeNodes = {1, 2, 3, 10, 11, 12, 19, 4, 5, 6, 13, 14, 15, 20, 7, 8, 9, 16, 17, 18, 21};
60 
61 
62 Tr2Shell7 :: Tr2Shell7(int n, Domain *aDomain) : Shell7Base(n, aDomain)
63 {
64  this->numberOfDofMans = 6;
65  this->numInPlaneIP = 6;
66 }
67 
68 const IntArray &
70 {
71  return this->orderingDofTypes;
72 }
73 
74 const IntArray &
76 {
77  return this->orderingNodes;
78 }
79 const IntArray &
81 {
82  return this->orderingEdgeNodes;
83 }
84 
86 
87 
88 
89 void
91 {
92  if ( integrationRulesArray.size() == 0 ) {
93  int nPointsTri = 6; // points in the plane
94 
95  // Layered cross section for bulk integration
96  //@todo - must use a cast here since check consistency has not been called yet
98  if ( layeredCS == NULL ) {
99  OOFEM_ERROR("Tr2Shell7 only supports layered cross section");
100  }
101  this->numberOfGaussPoints = layeredCS->giveNumberOfLayers() * nPointsTri * layeredCS->giveNumIntegrationPointsInLayer();
102  layeredCS->setupLayeredIntegrationRule(integrationRulesArray, this, nPointsTri);
103 
104  }
105 }
106 
107 
108 void
109 Tr2Shell7 :: giveBoundaryLocationArray(IntArray &locationArray, const IntArray &bNodes, const UnknownNumberingScheme &s, IntArray *dofIdArray)
110 {
111  IntArray localloc;
112 
113  // not a nice solution here, trying to deduce if Boundary is egde or surface
114  if (bNodes.giveSize() == 3) { // should be edge
115  //detect edge number
116  if (bNodes.at(1)==1 && bNodes.at(2)==2 && bNodes.at(3)==4) {
117  // edge #1
118  giveEdgeDofMapping(localloc, 1);
119  } else if (bNodes.at(1)==2 && bNodes.at(2)==3 && bNodes.at(3)==5) {
120  // edge #2
121  giveEdgeDofMapping(localloc, 2);
122  } else if (bNodes.at(1)==3 && bNodes.at(2)==1 && bNodes.at(3)==6) {
123  // edge #3
124  giveEdgeDofMapping(localloc, 3);
125  } else {
126  OOFEM_ERROR ("wrong edge number detected");
127  }
128  } else if (bNodes.giveSize() == 6) { // should be surface
129  this->giveSurfaceDofMapping(localloc, 1);
130  } else {
131  OOFEM_ERROR ("boundary not supported/detected");
132  }
133  IntArray eloc, dofID;
134  this->giveLocationArray(eloc, s, &dofID);
135  locationArray.resize(localloc.giveSize());
136  dofIdArray->resize(localloc.giveSize());
137  for (int i=1; i<=localloc.giveSize(); i++) {
138  locationArray.at(i)=eloc.at(localloc.at(i));
139  dofIdArray->at(i) = dofID.at(localloc.at(i));
140  }
141 
142 }
143 
144 void
145 Tr2Shell7 :: giveEdgeDofMapping(IntArray &answer, int iEdge) const
146 {
147  /*
148  * provides dof mapping of local edge dofs (only nonzero are taken into account)
149  * to global element dofs
150  */
151 
152  if ( iEdge == 1 ) { // edge between nodes 1-4-2
153  answer = {1, 2, 3, 8, 9, 10, 22, 23, 24, 4, 5, 6, 11, 12, 13, 25, 26, 27, 7, 14, 28};
154  } else if ( iEdge == 2 ) { // edge between nodes 2-5-3
155  answer = { 8, 9, 10, 15, 16, 17, 29, 30, 31, 11, 12, 13, 18, 19, 20, 32, 33, 34, 14, 21, 35};
156  } else if ( iEdge == 3 ) { // edge between nodes 3-6-1
157  answer = { 15, 16, 17, 1, 2, 3, 36, 37, 38, 18, 19, 20, 4, 5, 6, 39, 40, 41, 21, 7, 42};
158  } else {
159  OOFEM_ERROR("wrong edge number");
160  }
161 }
162 
163 
164 void
166 {
167  answer.resize(42);
168  for ( int i = 1; i <= 42; i++ ) {
169  answer.at(i) = i;
170  }
171 }
172 
173 
174 double
176 {
177  FloatArray G1, G2, temp;
178  FloatMatrix Gcov;
179  FloatArray lcoords(3);
180  lcoords.at(1) = gp->giveNaturalCoordinate(1);
181  lcoords.at(2) = gp->giveNaturalCoordinate(2);
182  lcoords.at(3) = xi;
183  this->evalInitialCovarBaseVectorsAt(lcoords, Gcov);
184  G1.beColumnOf(Gcov, 1);
185  G2.beColumnOf(Gcov, 2);
186  temp.beVectorProductOf(G1, G2);
187  double detJ = temp.computeNorm();
188  return detJ *gp->giveWeight();
189 }
190 
191 
192 
193 double
195 {
196  double detJ;
197  FloatMatrix Gcov;
198  FloatArray lcoords;
199  lcoords = gp->giveNaturalCoordinates();
200  this->evalInitialCovarBaseVectorsAt(lcoords, Gcov);
201  detJ = Gcov.giveDeterminant() * 0.5 * this->layeredCS->giveLayerThickness(layer);
202  return detJ *gp->giveWeight();
203 }
204 
205 
206 void
207 Tr2Shell7 :: compareMatrices(const FloatMatrix &matrix1, const FloatMatrix &matrix2, FloatMatrix &answer)
208 {
209  int ndofs = 42;
210  answer.resize(ndofs, ndofs);
211  for ( int i = 1; i <= ndofs; i++ ) {
212  for ( int j = 1; j <= 18; j++ ) {
213  if ( fabs( matrix1.at(i, j) ) > 1.0e-12 ) {
214  double diff = ( matrix1.at(i, j) - matrix2.at(i, j) );
215  double relDiff = diff / matrix1.at(i, j);
216  if ( fabs(relDiff) < 1.0e-4 ) {
217  answer.at(i, j) = 0.0;
218  } else if ( fabs(diff) < 1.0e3 ) {
219  answer.at(i, j) = 0.0;
220  } else {
221  answer.at(i, j) = relDiff;
222  }
223  } else {
224  answer.at(i, j) = -1.0;
225  }
226  }
227  }
228 }
229 } // end namespace oofem
double giveDeterminant() const
Returns the trace (sum of diagonal components) of the receiver.
Definition: floatmatrix.C:1408
CrossSection * giveCrossSection()
Definition: element.C:495
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Computes vector product (or cross product) of vectors given as parameters, , and stores the result in...
Definition: floatarray.C:415
Class and object Domain.
Definition: domain.h:115
virtual double computeAreaAround(GaussPoint *gp, double xi)
Definition: tr2shell7.C:175
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual const IntArray & giveOrderingEdgeNodes() const
Definition: tr2shell7.C:80
LayeredCrossSection * layeredCS
Definition: shell7base.h:107
static IntArray orderingEdgeNodes
Definition: tr2shell7.h:71
virtual FEInterpolation * giveInterpolation() const
Definition: tr2shell7.C:85
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
This class implements a layered cross section in a finite element problem.
void beColumnOf(const FloatMatrix &mat, int col)
Reciever will be set to a given column in a matrix.
Definition: floatarray.C:1114
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
void evalInitialCovarBaseVectorsAt(const FloatArray &lCoords, FloatMatrix &Gcov)
Definition: shell7base.C:222
double giveNaturalCoordinate(int i) const
Returns i-th natural element coordinate of receiver.
Definition: gausspoint.h:136
virtual const IntArray & giveOrderingDofTypes() const
Definition: tr2shell7.C:69
void giveEdgeDofMapping(IntArray &answer, int iEdge) const
Assembles edge dof mapping mask, which provides mapping between edge local DOFs and "global" element ...
Definition: tr2shell7.C:145
#define OOFEM_ERROR(...)
Definition: error.h:61
REGISTER_Element(LSpace)
double giveLayerThickness(int layer)
void setupLayeredIntegrationRule(std::vector< std::unique_ptr< IntegrationRule > > &layerIntegrationRulesArray, Element *el, int numInPlanePoints)
virtual double giveWeight()
Returns integration weight of receiver.
Definition: gausspoint.h:181
void giveLocationArray(IntArray &locationArray, const UnknownNumberingScheme &s, IntArray *dofIds=NULL) const
Returns the location array (array of code numbers) of receiver for given numbering scheme...
Definition: element.C:390
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
virtual void giveBoundaryLocationArray(IntArray &locationArray, const IntArray &bNodes, const UnknownNumberingScheme &s, IntArray *dofIdArray)
Returns the location array for the boundary of the element.
Definition: tr2shell7.C:109
Tr2Shell7(int n, Domain *d)
Definition: tr2shell7.C:62
void giveSurfaceDofMapping(IntArray &answer, int iSurf) const
Assembles surface dof mapping mask, which provides mapping between surface local DOFs and "global" el...
Definition: tr2shell7.C:165
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
int numberOfGaussPoints
Number of integration points as specified by nip.
Definition: element.h:188
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
Definition: tr2shell7.C:90
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
void compareMatrices(const FloatMatrix &matrix1, const FloatMatrix &matrix2, FloatMatrix &answer)
Definition: tr2shell7.C:207
virtual const IntArray & giveOrderingNodes() const
Definition: tr2shell7.C:75
This class represent a 7 parameter shell element.
Definition: shell7base.h:68
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
static IntArray orderingNodes
Definition: tr2shell7.h:70
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
static IntArray orderingDofTypes
Definition: tr2shell7.h:69
int giveSize() const
Definition: intarray.h:203
the oofem namespace is to define a context or scope in which all oofem names are defined.
Class representing integration point in finite element program.
Definition: gausspoint.h:93
static FEI3dTrQuad interpolation
Definition: tr2shell7.h:68
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
virtual double computeVolumeAroundLayer(GaussPoint *mastergp, int layer)
Definition: tr2shell7.C:194
const FloatArray & giveNaturalCoordinates()
Returns coordinate array of receiver.
Definition: gausspoint.h:138

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