OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
qspace.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/qspace.h"
37 #include "fei3dhexaquad.h"
38 #include "node.h"
39 #include "gausspoint.h"
40 #include "gaussintegrationrule.h"
41 #include "floatmatrix.h"
42 #include "floatarray.h"
43 #include "intarray.h"
44 #include "domain.h"
45 #include "mathfem.h"
46 #include "classfactory.h"
47 
48 namespace oofem {
49 REGISTER_Element(QSpace);
50 
51 FEI3dHexaQuad QSpace :: interpolation;
52 
54 {
55  numberOfDofMans = 20;
56 }
57 
58 
61 {
63 
65 }
66 
67 
69 
70 // ******************************
71 // *** Surface load support ***
72 // ******************************
73 
76 {
77  IntegrationRule *iRule = new GaussIntegrationRule(1, this, 1, 1);
78  int npoints = iRule->getRequiredNumberOfIntegrationPoints(_Square, approxOrder);
79  iRule->SetUpPointsOnSquare(npoints, _Unknown);
80  return iRule;
81 }
82 
83 
84 int
86 {
87  // returns transformation matrix from
88  // surface local coordinate system
89  // to element local c.s
90  // (same as global c.s in this case)
91  //
92  // i.e. f(element local) = T * f(edge local)
93 
94  // definition of local c.s on surface:
95  // local z axis - perpendicular to surface, pointing outwards from element
96  // local x axis - is in global xy plane (perpendicular to global z axis)
97  // local y axis - completes the righ hand side cs.
98 
99  /*
100  * OOFEM_ERROR("surface local coordinate system not supported");
101  * return 1;
102  */
103  FloatArray gc(3);
104  FloatArray h1(3), h2(3), nn(3), n(3);
105  IntArray snodes(4);
106 
107  answer.resize(3, 3);
108  answer.zero();
109 
110  this->interpolation.computeSurfaceMapping(snodes, dofManArray, iSurf);
111  for ( int i = 1; i <= 4; i++ ) {
112  gc.add( * domain->giveNode( snodes.at(i) )->giveCoordinates() );
113  }
114 
115  gc.times(1. / 4.);
116  // determine "average normal"
117  for ( int i = 1; i <= 4; i++ ) {
118  int j = ( i ) % 4 + 1;
119  h1.beDifferenceOf(* domain->giveNode( snodes.at(i) )->giveCoordinates(), gc);
120  h2.beDifferenceOf(* domain->giveNode( snodes.at(j) )->giveCoordinates(), gc);
121  n.beVectorProductOf(h1, h2);
122  if ( n.computeSquaredNorm() > 1.e-6 ) {
123  n.normalize();
124  }
125 
126  nn.add(n);
127  }
128 
129  nn.times(1. / 4.);
130  if ( nn.computeSquaredNorm() < 1.e-6 ) {
131  answer.zero();
132  }
133 
134  nn.normalize();
135  for ( int i = 1; i <= 3; i++ ) {
136  answer.at(i, 3) = nn.at(i);
137  }
138 
139  // determine lcs of surface
140  // local x axis in xy plane
141  double test = fabs(fabs( nn.at(3) ) - 1.0);
142  if ( test < 1.e-5 ) {
143  h1.at(1) = answer.at(1, 1) = 1.0;
144  h1.at(2) = answer.at(2, 1) = 0.0;
145  } else {
146  h1.at(1) = answer.at(1, 1) = answer.at(2, 3);
147  h1.at(2) = answer.at(2, 1) = -answer.at(1, 3);
148  }
149 
150  h1.at(3) = answer.at(3, 1) = 0.0;
151  // local y axis perpendicular to local x,z axes
152  h2.beVectorProductOf(nn, h1);
153  for ( int i = 1; i <= 3; i++ ) {
154  answer.at(i, 2) = h2.at(i);
155  }
156 
157  return 1;
158 }
159 
160 Interface *
162 {
163  if ( interface == ZZNodalRecoveryModelInterfaceType ) {
164  return static_cast< ZZNodalRecoveryModelInterface * >(this);
165  } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
166  return static_cast< SPRNodalRecoveryModelInterface * >(this);
167  } else if ( interface == NodalAveragingRecoveryModelInterfaceType ) {
168  return static_cast< NodalAveragingRecoveryModelInterface * >(this);
169  }
170 
171  OOFEM_LOG_INFO("Interface on Qspace element not supported");
172  return NULL;
173 }
174 
175 void
177 {
178  pap.resize(20);
179  for ( int i = 1; i <= 20; i++ ) {
180  pap.at(i) = this->giveNode(i)->giveNumber();
181  }
182 }
183 
184 void
186 {
187  int found = 0;
188  answer.resize(1);
189 
190  for ( int i = 1; i <= 20; i++ ) {
191  if ( this->giveNode(i)->giveNumber() == pap ) {
192  found = 1;
193  }
194  }
195 
196  if ( found ) {
197  answer.at(1) = pap;
198  } else {
199  OOFEM_ERROR("unknown node number %d", pap);
200  }
201 }
202 
203 int
205 {
206  return this->integrationRulesArray [ 0 ]->giveNumberOfIntegrationPoints();
207 }
208 
209 
212 {
214 }
215 
216 
217 void
219 {
220  answer.clear();
221  OOFEM_WARNING("IP values will not be transferred to nodes. Use ZZNodalRecovery instead (parameter stype 1)");
222 }
223 
224 } // 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
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
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 SPRPatchType SPRNodalRecoveryMI_givePatchType()
Definition: qspace.C:211
virtual void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep)
Computes the element value in given node.
Definition: qspace.C:218
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
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: qspace.C:60
Abstract base class representing integration rule.
virtual int SPRNodalRecoveryMI_giveNumberOfIP()
Definition: qspace.C:204
Class representing a general abstraction for finite element interpolation class.
Definition: feinterpol.h:132
#define OOFEM_LOG_INFO(...)
Definition: logger.h:127
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual IntegrationRule * GetSurfaceIntegrationRule(int)
Definition: qspace.C:75
REGISTER_Element(LSpace)
double computeSquaredNorm() const
Computes the square of the norm.
Definition: floatarray.C:846
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: qspace.C:85
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 SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
Definition: qspace.C:185
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
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.
virtual Interface * giveInterface(InterfaceType)
Interface requesting service.
Definition: qspace.C:161
static FEI3dHexaQuad interpolation
Definition: qspace.h:58
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
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 zero()
Zeroes all coefficient of receiver.
Definition: floatmatrix.C:1326
virtual void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
Definition: qspace.C:176
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
virtual FEInterpolation * giveInterpolation() const
Definition: qspace.C:68
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
QSpace(int n, Domain *d)
Definition: qspace.C:53
int numberOfDofMans
Number of dofmanagers.
Definition: element.h:149
void add(const FloatArray &src)
Adds array src to receiver.
Definition: floatarray.C:156
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