OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
q27space.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 "Elements/3D/q27space.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 "domain.h"
43 #include "mathfem.h"
44 #include "crosssection.h"
45 #include "classfactory.h"
46 #include "fei3dhexatriquad.h"
47 
48 namespace oofem {
49 REGISTER_Element(Q27Space);
50 
51 FEI3dHexaTriQuad Q27Space :: interpolation;
52 
54 {
55  return & interpolation;
56 }
57 
59 {
60  numberOfDofMans = 27;
61 }
62 
63 
66 {
69 }
70 
71 
72 // ******************************
73 // *** Surface load support ***
74 // ******************************
75 
78 {
79  IntegrationRule *iRule = new GaussIntegrationRule(1, this, 1, 1);
80  int npoints = iRule->getRequiredNumberOfIntegrationPoints(_Square, approxOrder);
81  iRule->SetUpPointsOnSquare(npoints, _Unknown);
82  return iRule;
83 }
84 
85 
86 
87 int
89 {
90  // returns transformation matrix from
91  // surface local coordinate system
92  // to element local c.s
93  // (same as global c.s in this case)
94  //
95  // i.e. f(element local) = T * f(edge local)
96 
97  // definition of local c.s on surface:
98  // local z axis - perpendicular to surface, pointing outwards from element
99  // local x axis - is in global xy plane (perpendicular to global z axis)
100  // local y axis - completes the righ hand side cs.
101 
102  /*
103  * OOFEM_ERROR("surface local coordinate system not supported");
104  * return 1;
105  */
106  FloatArray gc(3);
107  FloatArray h1(3), h2(3), nn(3), n(3);
108  IntArray snodes(4);
109 
110  answer.resize(3, 3);
111  answer.zero();
112 
113  this->interpolation.computeSurfaceMapping(snodes, dofManArray, iSurf);
114  for ( int i = 1; i <= 4; i++ ) {
115  gc.add( * domain->giveNode( snodes.at(i) )->giveCoordinates() );
116  }
117 
118  gc.times(1. / 4.);
119  // determine "average normal"
120  for ( int i = 1; i <= 4; i++ ) {
121  int j = ( i ) % 4 + 1;
122  h1.beDifferenceOf(* domain->giveNode( snodes.at(i) )->giveCoordinates(), gc);
123  h2.beDifferenceOf(* domain->giveNode( snodes.at(j) )->giveCoordinates(), gc);
124  n.beVectorProductOf(h1, h2);
125  if ( n.computeSquaredNorm() > 1.e-6 ) {
126  n.normalize();
127  }
128 
129  nn.add(n);
130  }
131 
132  nn.times(1. / 4.);
133  if ( nn.computeSquaredNorm() < 1.e-6 ) {
134  answer.zero();
135  }
136 
137  nn.normalize();
138  for ( int i = 1; i <= 3; i++ ) {
139  answer.at(i, 3) = nn.at(i);
140  }
141 
142  // determine lcs of surface
143  // local x axis in xy plane
144  double test = fabs(fabs( nn.at(3) ) - 1.0);
145  if ( test < 1.e-5 ) {
146  h1.at(1) = answer.at(1, 1) = 1.0;
147  h1.at(2) = answer.at(2, 1) = 0.0;
148  } else {
149  h1.at(1) = answer.at(1, 1) = answer.at(2, 3);
150  h1.at(2) = answer.at(2, 1) = -answer.at(1, 3);
151  }
152 
153  h1.at(3) = answer.at(3, 1) = 0.0;
154  // local y axis perpendicular to local x,z axes
155  h2.beVectorProductOf(nn, h1);
156  for ( int i = 1; i <= 3; i++ ) {
157  answer.at(i, 2) = h2.at(i);
158  }
159 
160  return 1;
161 }
162 
163 Interface *
165 {
166  if ( interface == ZZNodalRecoveryModelInterfaceType ) {
167  return static_cast< ZZNodalRecoveryModelInterface * >(this);
168  } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
169  return static_cast< SPRNodalRecoveryModelInterface * >(this);
170  } else if ( interface == NodalAveragingRecoveryModelInterfaceType ) {
171  return static_cast< NodalAveragingRecoveryModelInterface * >(this);
172  }
173 
174  OOFEM_LOG_INFO("Interface on Qspace element not supported");
175  return NULL;
176 }
177 
178 void
180 {
181  pap.resize(27);
182  for ( int i = 1; i <= 27; i++ ) {
183  pap.at(i) = this->giveNode(i)->giveNumber();
184  }
185 }
186 
187 void
189 {
190  int found = 0;
191  answer.resize(1);
192 
193  for ( int i = 1; i <= 27; i++ ) {
194  if ( this->giveNode(i)->giveNumber() == pap ) {
195  found = 1;
196  }
197  }
198 
199  if ( found ) {
200  answer.at(1) = pap;
201  } else {
202  OOFEM_ERROR("unknown node number %d", pap);
203  }
204 }
205 
206 int
208 {
209  return numberOfGaussPoints;
210 }
211 
212 
215 {
217 }
218 
219 
220 void
222 {
223  answer.clear();
224  OOFEM_WARNING("IP values will not be transferred to nodes. Use ZZNodalRecovery instead (parameter stype 1)");
225 }
226 
227 } // end namespace oofem
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
The element interface required by NodalAvergagingRecoveryModel.
IntArray dofManArray
Array containing dofmanager numbers.
Definition: element.h:151
The element interface required by ZZNodalRecoveryModel.
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
Q27Space(int n, Domain *d)
Definition: q27space.C:58
Class and object Domain.
Definition: domain.h:115
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition: femcmpnn.h:82
virtual FEInterpolation * giveInterpolation() const
Definition: q27space.C:53
The element interface required by ZZNodalRecoveryModel.
void computeSurfaceMapping(IntArray &surfNodes, IntArray &elemNodes, int isurf)
Definition: feinterpol3d.C:103
void clear()
Clears receiver (zero size).
Definition: floatarray.h:206
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
Definition: q27space.C:179
virtual IntegrationRule * GetSurfaceIntegrationRule(int)
Definition: q27space.C:77
virtual int SetUpPointsOnSquare(int, MaterialMode mode)
Sets up receiver&#39;s integration points on unit square integration domain.
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
Abstract base class representing integration rule.
virtual void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep)
Computes the element value in given node.
Definition: q27space.C:221
virtual Interface * giveInterface(InterfaceType)
Interface requesting service.
Definition: q27space.C:164
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
#define OOFEM_LOG_INFO(...)
Definition: logger.h:127
virtual int SPRNodalRecoveryMI_giveNumberOfIP()
Definition: q27space.C:207
#define OOFEM_ERROR(...)
Definition: error.h:61
REGISTER_Element(LSpace)
double computeSquaredNorm() const
Computes the square of the norm.
Definition: floatarray.C:846
virtual SPRPatchType SPRNodalRecoveryMI_givePatchType()
Definition: q27space.C:214
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
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 IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: q27space.C:65
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
virtual int getRequiredNumberOfIntegrationPoints(integrationDomain dType, int approxOrder)
Abstract service.
Class Interface.
Definition: interface.h:82
Base class 3D elements.
static FEI3dHexaTriQuad interpolation
Definition: q27space.h:56
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
virtual int computeLoadLSToLRotationMatrix(FloatMatrix &answer, int, GaussPoint *gp)
Returns transformation matrix from local surface c.s to element local coordinate system of load vecto...
Definition: q27space.C:88
void zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
Node * giveNode(int n)
Service for accessing particular domain node.
Definition: domain.h:371
the oofem namespace is to define a context or scope in which all oofem names are defined.
int giveNumber() const
Definition: femcmpnn.h:107
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 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
#define OOFEM_WARNING(...)
Definition: error.h:62
Class representing solution step.
Definition: timestep.h:80
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
virtual void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
Definition: q27space.C:188
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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011