OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
fei3dtrlin.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 "fei3dtrlin.h"
36 
37 #include "mathfem.h"
38 #include "floatmatrix.h"
39 #include "floatarray.h"
40 #include "gaussintegrationrule.h"
41 
42 namespace oofem {
43 void
44 FEI3dTrLin :: evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
45 {
46  this->surfaceEvalN(answer, 1, lcoords, cellgeo);
47 }
48 
49 double
50 FEI3dTrLin :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
51 {
52  OOFEM_ERROR("FEI3dTrLin :: evaldNdx - Not supported");
53  return 0.;
54 }
55 
56 
57 void
58 FEI3dTrLin :: evaldNdxi(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
59 {
60  this->surfaceEvaldNdxi(answer, lcoords);
61 }
62 
63 
64 void
66 {
67  n.resize(3);
68  n.at(1) = 1.0;;
69  n.at(2) = 0.0;
70  n.at(3) = -1.0;
71 }
72 
73 void
75 {
76  n.resize(3);
77  n.at(1) = 0.0;;
78  n.at(2) = 1.0;
79  n.at(3) = -1.0;
80 }
81 
82 
83 void
84 FEI3dTrLin :: local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
85 {
86  FloatArray n;
87  this->evalN(n, lcoords, cellgeo);
88  answer.resize(0);
89  for ( int i = 1; i <= 3; ++i ) {
90  answer.add( n.at(i), * cellgeo.giveVertexCoordinates(i) );
91  }
92 }
93 
94 #define POINT_TOL 1.e-3
95 int
96 FEI3dTrLin :: global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo)
97 {
98  OOFEM_ERROR("FEI3dTrLin :: global2local - Not supported");
99  return -1;
100 
101 }
102 
103 
104 void
105 FEI3dTrLin :: giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
106 {
107  OOFEM_ERROR("FEI3dTrLin :: giveJacobianMatrixAt - Not supported");
108 }
109 
110 
111 void
112 FEI3dTrLin :: edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
113 {
114  double xi = lcoords.at(1);
115  answer.resize(2);
116  answer.at(1) = ( 1. - xi ) * 0.5;
117  answer.at(2) = ( 1. + xi ) * 0.5;
118 }
119 
120 
121 
122 void
124  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
125 {
126  OOFEM_ERROR("FEI3dTrLin :: edgeEvaldNdx - Not supported");
127 }
128 
129 void
130 FEI3dTrLin :: edgeEvaldNdxi(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
131 {
132  answer.resize(2);
133  answer(0) = -0.5;
134  answer(1) = 0.5;
135 }
136 
137 void
139  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
140 {
141  IntArray edgeNodes;
142  FloatArray N;
143  this->computeLocalEdgeMapping(edgeNodes, iedge);
144  this->edgeEvalN(N, iedge, lcoords, cellgeo);
145 
146  answer.resize(0);
147  for ( int i = 0; i < N.giveSize(); ++i ) {
148  answer.add( N(i), * cellgeo.giveVertexCoordinates( edgeNodes(i) ) );
149  }
150 }
151 
152 
153 double
155 {
156  IntArray edgeNodes;
157  this->computeLocalEdgeMapping(edgeNodes, iedge);
159  OOFEM_ERROR("FEI3dTrLin :: edgeGiveTransformationJacobian - Not supported");
160  return -1;
161 }
162 
163 
164 void
166 {
167 
168  if ( iedge == 1 ) { // edge between nodes 1 2
169  edgeNodes = { 1, 2 };
170 
171  } else if ( iedge == 2 ) { // edge between nodes 2 3
172  edgeNodes = { 2, 3 };
173 
174  } else if ( iedge == 3 ) { // edge between nodes 2 3
175  edgeNodes = { 3, 1 };
176 
177  } else {
178  OOFEM_ERROR("Wrong edge number (%d)", iedge);
179  }
180 
181 }
182 
183 double
185 {
187  OOFEM_ERROR("FEI3dTrLin :: edgeComputeLength - Not supported");
188  return -1;
189 }
190 
191 void
192 FEI3dTrLin :: surfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
193 {
194  answer.resize(3);
195  answer.at(1) = lcoords.at(1);
196  answer.at(2) = lcoords.at(2);
197  answer.at(3) = 1. - lcoords.at(1) - lcoords.at(2);
198 }
199 
200 void
202 {
203  // Returns matrix with derivatives wrt local coordinates
204  answer.resize(3, 2);
205  FloatArray dndxi(3), dndeta(3);
206 
207  this->giveDerivativeXi(dndxi, lcoords);
208  this->giveDerivativeEta(dndeta, lcoords);
209  for ( int i = 1; i <= 3; ++i ) {
210  answer.at(i, 1) = dndxi.at(i);
211  answer.at(i, 2) = dndeta.at(i);
212  }
213 }
214 
215 
216 
217 void
219  const FloatArray &lcoords, const FEICellGeometry &cellgeo)
220 {
221  //Note: This gives the coordinate in the reference system
222  FloatArray N;
223  this->surfaceEvalN(N, isurf, lcoords, cellgeo);
224 
225  answer.resize(0);
226  for ( int i = 0; i < N.giveSize(); ++i ) {
227  answer.add( N(i), * cellgeo.giveVertexCoordinates(i) );
228  }
229 }
230 
231 void
232 FEI3dTrLin :: surfaceEvaldNdx(FloatMatrix &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
233 {
235  OOFEM_ERROR("FEI3dTrLin :: surfaceEvaldNdx - Not supported");
236 }
237 
238 void
240 {
241  // Note: These are not normalized. Returns the two tangent vectors to the surface.
242  FloatMatrix dNdxi;
243  this->surfaceEvaldNdxi(dNdxi, lcoords);
244 
245  G1.resize(0);
246  G2.resize(0);
247  for ( int i = 0; i < 3; ++i ) {
248  G1.add( dNdxi(i, 1), * cellgeo.giveVertexCoordinates(i) );
249  G2.add( dNdxi(i, 2), * cellgeo.giveVertexCoordinates(i) );
250  }
251 }
252 
253 double
254 FEI3dTrLin :: surfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
255 {
256  FloatArray G1, G2; // local curvilinear base vectors
257  this->surfaceEvalBaseVectorsAt(G1, G2, lcoords, cellgeo);
258  answer.beVectorProductOf(G1, G2);
259  double J = answer.computeNorm();
260  answer.times(1 / J);
261  return J;
262 }
263 
264 void
265 FEI3dTrLin :: surfaceGiveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
266 {
267  // Jacobian matrix consists of the three curvilinear base vectors. The third is taken as the normal to the surface.
268  // Note! The base vectors are not normalized except the third (normal)
269  FloatArray G1, G2, G3;
270  this->surfaceEvalBaseVectorsAt(G1, G2, lcoords, cellgeo);
271  G3.beVectorProductOf(G1, G2);
272 
273  jacobianMatrix.resize(3, 3);
274  jacobianMatrix.at(1, 1) = G1.at(1);
275  jacobianMatrix.at(1, 2) = G2.at(1);
276  jacobianMatrix.at(1, 3) = G3.at(1);
277  jacobianMatrix.at(2, 1) = G1.at(2);
278  jacobianMatrix.at(2, 2) = G2.at(2);
279  jacobianMatrix.at(2, 3) = G3.at(2);
280  jacobianMatrix.at(3, 1) = G1.at(3);
281  jacobianMatrix.at(3, 2) = G2.at(3);
282  jacobianMatrix.at(3, 3) = G3.at(3);
283 }
284 
285 double
287 {
288  OOFEM_ERROR("FEI3dTrLin :: surfaceGiveTransformationJacobian - Not supported yet");
289  return 0;
290 }
291 
292 void
294 {
295  //surfNodes.setValues(3, 1, 2, 3);
296  computeLocalEdgeMapping(surfNodes, isurf);
297 
298 }
299 
302 {
303  IntegrationRule *iRule = new GaussIntegrationRule(1, NULL);
304  int points = iRule->getRequiredNumberOfIntegrationPoints(_Triangle, order);
305  iRule->SetUpPointsOnTriangle(points, _Unknown);
306  return iRule;
307 }
308 
311 {
313  OOFEM_ERROR("FEI3dTrLin :: giveBoundaryIntegrationRule - Not supported");
314  return NULL;
315 }
316 
317 
318 double
320 {
321  // A = 0.5 * |AB x AC|
322  FloatArray AB, AC;
323  AB = *cellgeo.giveVertexCoordinates(2) - *cellgeo.giveVertexCoordinates(1);
324  AC = *cellgeo.giveVertexCoordinates(3) - *cellgeo.giveVertexCoordinates(1);
325  FloatArray temp;
326  temp.beVectorProductOf(AB, AC);
327  return 0.5 * temp.computeNorm();
328 
329 }
330 } // end namespace oofem
virtual void evaldNdxi(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of interpolation functions (shape functions) at given point...
Definition: fei3dtrlin.C:58
virtual void surfaceEvaldNdx(FloatMatrix &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of edge interpolation functions (shape functions) at given point...
Definition: fei3dtrlin.C:232
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
double edgeComputeLength(IntArray &edgeNodes, const FEICellGeometry &cellgeo)
Definition: fei3dtrlin.C:184
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
virtual const FloatArray * giveVertexCoordinates(int i) const =0
virtual IntegrationRule * giveIntegrationRule(int order)
Sets up a suitable integration rule for numerical integrating over volume.
Definition: fei3dtrlin.C:301
Class representing a general abstraction for cell geometry.
Definition: feinterpol.h:62
virtual void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of edge interpolation functions (shape functions) at given point.
Definition: fei3dtrlin.C:112
Class implementing an array of integers.
Definition: intarray.h:61
virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates global coordinates from given local ones.
Definition: fei3dtrlin.C:84
Abstract base class representing integration rule.
virtual void edgeEvaldNdx(FloatMatrix &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of edge interpolation functions (shape functions) at given point...
Definition: fei3dtrlin.C:123
virtual double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the edge jacobian of transformation between local and global coordinates.
Definition: fei3dtrlin.C:154
void surfaceEvaldNdxi(FloatMatrix &answer, const FloatArray &lcoords)
Definition: fei3dtrlin.C:201
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of interpolation functions (shape functions) at given point.
Definition: fei3dtrlin.C:44
virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of interpolation functions (shape functions) at given point...
Definition: fei3dtrlin.C:50
virtual void computeLocalEdgeMapping(IntArray &edgeNodes, int iedge)
Definition: fei3dtrlin.C:165
void giveDerivativeXi(FloatArray &n, const FloatArray &lcoords)
Definition: fei3dtrlin.C:65
virtual void computeLocalSurfaceMapping(IntArray &edgeNodes, int iedge)
Definition: fei3dtrlin.C:293
#define N(p, q)
Definition: mdm.C:367
virtual double surfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the normal out of the surface at given point.
Definition: fei3dtrlin.C:254
virtual int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates local coordinates from given global ones.
Definition: fei3dtrlin.C:96
double giveArea(const FEICellGeometry &cellgeo) const
Definition: fei3dtrlin.C:319
double at(int i, int j) const
Coefficient access function.
Definition: floatmatrix.h:176
void surfaceEvalBaseVectorsAt(FloatArray &G1, FloatArray &G2, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Definition: fei3dtrlin.C:239
virtual void edgeEvaldNdxi(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the matrix of derivatives of edge interpolation functions (shape functions) at given point...
Definition: fei3dtrlin.C:130
virtual double surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the edge jacobian of transformation between local and global coordinates.
Definition: fei3dtrlin.C:286
virtual void surfaceLocal2global(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates edge global coordinates from given local ones.
Definition: fei3dtrlin.C:218
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
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 int getRequiredNumberOfIntegrationPoints(integrationDomain dType, int approxOrder)
Abstract service.
void times(double s)
Multiplies receiver with scalar.
Definition: floatarray.C:818
virtual int SetUpPointsOnTriangle(int, MaterialMode mode)
Sets up receiver&#39;s integration points on triangular (area coords) integration domain.
virtual void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates edge global coordinates from given local ones.
Definition: fei3dtrlin.C:138
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
virtual void surfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Evaluates the array of edge interpolation functions (shape functions) at given point.
Definition: fei3dtrlin.C:192
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual IntegrationRule * giveBoundaryIntegrationRule(int order, int boundary)
Sets up a suitable integration rule for integrating over the requested boundary.
Definition: fei3dtrlin.C:310
virtual void surfaceGiveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Definition: fei3dtrlin.C:265
virtual void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo)
Gives the jacobian matrix at the local coordinates.
Definition: fei3dtrlin.C:105
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
void giveDerivativeEta(FloatArray &n, const FloatArray &lcoords)
Definition: fei3dtrlin.C:74

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