OOFEM 3.0
Loading...
Searching...
No Matches
linquad3d_planestress.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 - 2025 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
36#include "classfactory.h"
39#include "gausspoint.h"
40
41#ifdef __OOFEG
42 #include "oofeggraphiccontext.h"
43 #include "oofegutils.h"
44 #include "connectivitytable.h"
45 #include "sm/Materials/rcm2.h"
46#endif
47
48namespace oofem {
50
51LinQuad3DPlaneStress :: LinQuad3DPlaneStress(int n, Domain *aDomain) :
52 PlaneStress2d(n, aDomain)
53 // Constructor.
54{
55 this->GtoLRotationMatrix = NULL;
56}
57
58LinQuad3DPlaneStress :: ~LinQuad3DPlaneStress()
59// Destructor
60{
61 delete this->GtoLRotationMatrix;
62}
63
65LinQuad3DPlaneStress :: giveInterface(InterfaceType interface)
66{
67 if ( interface == ZZNodalRecoveryModelInterfaceType ) {
68 return static_cast< ZZNodalRecoveryModelInterface * >(this);
69 } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
70 return static_cast< SPRNodalRecoveryModelInterface * >(this);
71 } else if ( interface == SpatialLocalizerInterfaceType ) {
72 return static_cast< SpatialLocalizerInterface * >(this);
73 }
74
75 return NULL;
76}
77
78
89
90
91void
92LinQuad3DPlaneStress :: computeLocalNodalCoordinates(std::vector< FloatArray > &lxy)
93// Returns global coordinates given in global vector
94// transformed into local coordinate system of the
95// receiver
96{
97 // test if previously computed
98 if ( GtoLRotationMatrix == NULL ) {
100 }
101
102
103 lxy.resize(4);
104 for ( int i = 0; i < 4; i++ ) {
105 const auto &nc = this->giveNode(i + 1)->giveCoordinates();
106 lxy[i].beProductOf(* GtoLRotationMatrix, nc);
107 }
108}
109
110void
111LinQuad3DPlaneStress :: giveDofManDofIDMask(int inode, IntArray &answer) const
112{
113 answer = {D_u, D_v, D_w};
114}
115
116
117
118
119const FloatMatrix *
120LinQuad3DPlaneStress :: computeGtoLRotationMatrix()
121// Returns the rotation matrix of the receiver of the size [3,3]
122// coords(local) = T * coords(global)
123//
124// local coordinate (described by vector triplet e1',e2',e3') is defined as follows:
125//
126// e1' : [N2-N1] Ni - means i - th node
127// help : [N3-N1]
128// e3' : e1' x help
129// e2' : e3' x e1'
130{
131 if ( GtoLRotationMatrix == NULL ) {
132 FloatArray e1, e2, e3, help;
133
134 // compute e1' = [N2-N1] and help = [N3-N1]
135 e1.beDifferenceOf( this->giveNode(2)->giveCoordinates(), this->giveNode(1)->giveCoordinates() );
136 help.beDifferenceOf( this->giveNode(3)->giveCoordinates(), this->giveNode(1)->giveCoordinates() );
137
138 // let us normalize e1'
139 e1.normalize();
140
141 // compute e3' : vector product of e1' x help
142 e3.beVectorProductOf(e1, help);
143 // let us normalize
144 e3.normalize();
145
146 // now from e3' x e1' compute e2'
147 e2.beVectorProductOf(e3, e1);
148
149 //
151
152 for ( int i = 1; i <= 3; i++ ) {
153 GtoLRotationMatrix->at(1, i) = e1.at(i);
154 GtoLRotationMatrix->at(2, i) = e2.at(i);
155 GtoLRotationMatrix->at(3, i) = e3.at(i);
156 }
157 }
158
159 return GtoLRotationMatrix;
160}
161
162
163bool
164LinQuad3DPlaneStress :: computeGtoLRotationMatrix(FloatMatrix &answer)
165// Returns the rotation matrix of the receiver of the size [8,12]
166// r(local) = T * r(global)
167// for one node (r written transposed): {u,v} = T * {u,v,w}
168{
169 // test if pereviously computed
170 if ( GtoLRotationMatrix == NULL ) {
172 }
173
174 answer.resize(8, 12);
175 answer.zero();
176
177 for ( int i = 1; i <= 3; i++ ) {
178 answer.at(1, i) = answer.at(3, i + 3) = answer.at(5, i + 6) = answer.at(7, i+9) = GtoLRotationMatrix->at(1, i);
179 answer.at(2, i) = answer.at(4, i + 3) = answer.at(6, i + 6) = answer.at(8, i+9) = GtoLRotationMatrix->at(2, i);
180 }
181
182 return 1;
183}
184int
185LinQuad3DPlaneStress :: computeLoadGToLRotationMtrx(FloatMatrix &answer)
186// Returns the rotation matrix of the receiver of the size [6,6]
187// f(local) = T * f(global)
188{
189 // test if previously computed
190 if ( GtoLRotationMatrix == NULL ) {
192 }
193
194 answer.resize(6, 6);
195 answer.zero();
196
197 for ( int i = 1; i <= 3; i++ ) {
198 answer.at(1, i) = answer.at(4, i + 3) = GtoLRotationMatrix->at(1, i);
199 answer.at(2, i) = answer.at(5, i + 3) = GtoLRotationMatrix->at(2, i);
200 answer.at(3, i) = answer.at(6, i + 3) = GtoLRotationMatrix->at(3, i);
201 }
202
203 return 1;
204}
205
206void
207LinQuad3DPlaneStress :: giveCharacteristicTensor(FloatMatrix &answer, CharTensor type, GaussPoint *gp, TimeStep *tStep)
208// returns characteristic tensor of the receiver at given gp and tStep
209// strain vector = (Eps_X, Eps_y, Gamma_xy, Kappa_z)
210{
211 FloatArray charVect;
213
214 answer.resize(3, 3);
215 answer.zero();
216
217 if ( ( type == LocalForceTensor ) || ( type == GlobalForceTensor ) ) {
218 //this->computeStressVector(charVect, gp, tStep);
219 charVect = ms->giveStressVector();
220
221 answer.at(1, 1) = charVect.at(1);
222 answer.at(2, 2) = charVect.at(2);
223 answer.at(1, 2) = charVect.at(3);
224 answer.at(2, 1) = charVect.at(3);
225 } else if ( ( type == LocalMomentTensor ) || ( type == GlobalMomentTensor ) ) {
226 } else if ( ( type == LocalStrainTensor ) || ( type == GlobalStrainTensor ) ) {
227 //this->computeStrainVector(charVect, gp, tStep);
228 charVect = ms->giveStrainVector();
229
230 answer.at(1, 1) = charVect.at(1);
231 answer.at(2, 2) = charVect.at(2);
232 answer.at(1, 2) = charVect.at(3) / 2.;
233 answer.at(2, 1) = charVect.at(3) / 2.;
234 } else if ( ( type == LocalCurvatureTensor ) || ( type == GlobalCurvatureTensor ) ) {
235 } else {
236 OOFEM_ERROR("unsupported tensor mode");
237 }
238
239 if ( ( type == GlobalForceTensor ) || ( type == GlobalMomentTensor ) ||
240 ( type == GlobalStrainTensor ) || ( type == GlobalCurvatureTensor ) ) {
243 }
244}
245
246
247int
248LinQuad3DPlaneStress :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
249{
250 FloatMatrix globTensor;
251 CharTensor cht;
252
253 answer.resize(6);
254
255 if ( type == IST_ShellForceTensor || type == IST_ShellStrainTensor ) {
256 double c = 1.0;
257 if ( type == IST_ShellForceTensor ) {
258 cht = GlobalForceTensor;
259 } else {
260 cht = GlobalStrainTensor;
261 c = 2.0;
262 }
263
264 this->giveCharacteristicTensor(globTensor, cht, gp, tStep);
265
266 answer.at(1) = globTensor.at(1, 1); //xx
267 answer.at(2) = globTensor.at(2, 2); //yy
268 answer.at(3) = globTensor.at(3, 3); //zz
269 answer.at(4) = c * globTensor.at(2, 3); //yz
270 answer.at(5) = c * globTensor.at(1, 3); //xz
271 answer.at(6) = c * globTensor.at(1, 2); //xy
272
273 return 1;
274 } else if ( type == IST_ShellMomentTensor || type == IST_CurvatureTensor ) {
275 answer.clear();
276 return 1;
277 } else {
278 return PlaneStress2d :: giveIPValue(answer, gp, type, tStep);
279 }
280}
281
282
283void
284LinQuad3DPlaneStress :: printOutputAt(FILE *file, TimeStep *tStep)
285// Performs end-of-step operations.
286{
287 FloatArray v;
288
289 fprintf( file, "element %d (%8d) :\n", this->giveLabel(), this->giveNumber() );
290
291 for ( int i = 0; i < (int)integrationRulesArray.size(); i++ ) {
292 for ( GaussPoint *gp: *integrationRulesArray [ i ] ) {
293
294 fprintf( file, " GP %2d.%-2d :", i + 1, gp->giveNumber() );
295
296 this->giveIPValue(v, gp, IST_ShellStrainTensor, tStep);
297 fprintf(file, " strains ");
298 for ( auto &val : v ) fprintf(file, " %.4e", val);
299
300 /*
301 this->giveIPValue(v, gp, IST_CurvatureTensor, tStep);
302 fprintf(file, "\n curvatures ");
303 for ( auto &val : v ) fprintf(file, " %.4e", val);
304 */
305 // Forces - Moments
306 this->giveIPValue(v, gp, IST_ShellForceTensor, tStep);
307 fprintf(file, "\n forces ");
308 for ( auto &val : v ) fprintf(file, " %.4e", val);
309 /*
310 this->giveIPValue(v, gp, IST_ShellMomentTensor, tStep);
311 fprintf(file, "\n moments ");
312 for ( auto &val : v ) fprintf(file, " %.4e", val);
313 */
314 fprintf(file, "\n");
315 }
316 }
317}
318
319
320} // end namespace oofem
#define REGISTER_Element(class)
Node * giveNode(int i) const
Definition element.h:629
std::vector< std ::unique_ptr< IntegrationRule > > integrationRulesArray
Definition element.h:157
int giveLabel() const
Definition element.h:1125
int giveNumber() const
Definition femcmpnn.h:104
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
Definition floatarray.C:403
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Definition floatarray.C:476
void rotatedWith(const FloatMatrix &r, char mode='n')
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void zero()
Zeroes all coefficient of receiver.
double at(std::size_t i, std::size_t j) const
IntegrationPointStatus * giveMaterialStatus(IntegrationPointStatusIDType key=IPSID_Default)
Definition gausspoint.h:204
const FloatMatrix * computeGtoLRotationMatrix()
FEICellGeometry * giveCellGeometryWrapper() override
void computeLocalNodalCoordinates(std::vector< FloatArray > &lxy)
std ::vector< FloatArray > lc
Local vertex coordinates.
void giveCharacteristicTensor(FloatMatrix &answer, CharTensor type, GaussPoint *gp, TimeStep *tStep)
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
PlaneStress2d(int n, Domain *d)
Definition planstrss.C:62
Element_Geometry_Type giveGeometryType() const override
Definition planstrss.h:96
FEICellGeometry * cellGeometryWrapper
const FloatArray & giveStrainVector() const
Returns the const pointer to receiver's strain vector.
const FloatArray & giveStressVector() const
Returns the const pointer to receiver's stress vector.
#define OOFEM_ERROR(...)
Definition error.h:79
@ SPRNodalRecoveryModelInterfaceType
@ ZZNodalRecoveryModelInterfaceType
@ SpatialLocalizerInterfaceType

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011