OOFEM 3.0
Loading...
Searching...
No Matches
prescribedgenstrainshell7.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 "dofiditem.h"
37#include "dofmanager.h"
38#include "dof.h"
39#include "valuemodetype.h"
40#include "floatarray.h"
41#include "floatmatrix.h"
42#include "function.h"
43#include "engngm.h"
44#include "set.h"
45#include "node.h"
46#include "element.h"
47#include "classfactory.h"
48#include "dynamicinputrecord.h"
49#include "feinterpol.h"
50#include "sparsemtrx.h"
51#include "sparselinsystemnm.h"
53
54namespace oofem {
56
57double PrescribedGenStrainShell7 :: give(Dof *dof, ValueModeType mode, double time)
58{
59 DofIDItem id = dof->giveDofID();
60 const auto &coords = dof->giveDofManager()->giveCoordinates();
61
62 if ( coords.giveSize() != this->centerCoord.giveSize() ) {
63 OOFEM_ERROR("PrescribedGenStrainShell7 :: give - Size of coordinate system different from center coordinate in b.c.");
64 }
65
66 double factor = 0;
67 if ( mode == VM_Total ) {
68 factor = this->giveTimeFunction()->evaluateAtTime(time);
69 } else if ( mode == VM_Velocity ) {
70 factor = this->giveTimeFunction()->evaluateVelocityAtTime(time);
71 } else if ( mode == VM_Acceleration ) {
72 factor = this->giveTimeFunction()->evaluateAccelerationAtTime(time);
73 } else {
74 OOFEM_ERROR("Should not be called for value mode type then total, velocity, or acceleration.");
75 }
76
77 // Reminder: u_i = F_ij . (x_j - xb_j) = H_ij . dx_j
78 FloatArray dx;
79 dx.beDifferenceOf(coords, this->centerCoord);
80
81 // Assuming the coordinate system to be local, dx(3) = z
82 this->setDeformationGradient( dx.at(3) );
83
84 FloatArray u, u2;
85 u.beProductOf(gradient, dx);
86
87 // Add second order contribution, note only higher order in the thickness direction
88 this->evaluateHigherOrderContribution(u2, dx.at(3), dx);
89 u.add(u2);
90
91 u.times( factor );
92
93 switch ( id ) {
94 case D_u:
95 case V_u:
96 return u.at(1);
97
98 case D_v:
99 case V_v:
100 return u.at(2);
101
102 case D_w:
103 case V_w:
104 return u.at(3);
105
106 default:
107 return 0.0;
108 }
109}
110
111
112
114PrescribedGenStrainShell7 :: evalCovarBaseVectorsAt(FloatArray &genEps, double zeta)
115{
116 // Evaluates the covariant base vectors in the current configuration
117 FloatArrayF<3> dxdxi1, dxdxi2, m, dmdxi1, dmdxi2;
118 double dgamdxi1, dgamdxi2, gam;
119 Shell7Base :: giveGeneralizedStrainComponents(genEps, dxdxi1, dxdxi2, dmdxi1, dmdxi2, m, dgamdxi1, dgamdxi2, gam);
120 double fac1 = ( zeta + 0.5 * gam * zeta * zeta );
121 double fac2 = ( 0.5 * zeta * zeta );
122 double fac3 = ( 1.0 + zeta * gam );
123
124 auto g1 = dxdxi1 + fac1*dmdxi1 + fac2*dgamdxi1*m;
125 auto g2 = dxdxi2 + fac1*dmdxi2 + fac2*dgamdxi2*m;
126 auto g3 = fac3*m;
127 #pragma GCC diagnostic push
128 #pragma GCC diagnostic ignored "-Warray-bounds"
130 gcov.setColumn(g1,1); gcov.setColumn(g2,2); gcov.setColumn(g3,3);
131 #pragma GCC diagnostic pop
132 return gcov;
133}
134
135
137PrescribedGenStrainShell7 :: evalInitialCovarBaseVectorsAt(FloatArray &genEps, double zeta)
138{
139 // Evaluates the initial base vectors given the array of generalized strain
140 FloatArrayF<3> G1, G2, G3;
141
142 G1.at(1) = genEps.at(1) + zeta * genEps.at(7);
143 G1.at(2) = genEps.at(2) + zeta * genEps.at(8);
144 G1.at(3) = genEps.at(3) + zeta * genEps.at(9);
145
146 G2.at(1) = genEps.at(4) + zeta * genEps.at(10);
147 G2.at(2) = genEps.at(5) + zeta * genEps.at(11);
148 G2.at(3) = genEps.at(6) + zeta * genEps.at(12);
149
150 G3.at(1) = genEps.at(13);
151 G3.at(2) = genEps.at(14);
152 G3.at(3) = genEps.at(15);
153
154
156 Gcov.setColumn(G1,0); Gcov.setColumn(G2,1); Gcov.setColumn(G3,2);
157 return Gcov;
158}
159
160
161void
162PrescribedGenStrainShell7 :: setDeformationGradient(double zeta)
163{
164 // Computes the deformation gradient in matrix form as open product(g_i, G^i) = gcov*Gcon^T
165 auto gcov = this->evalCovarBaseVectorsAt(this->genEps, zeta);
166 auto Gcov = this->evalInitialCovarBaseVectorsAt(this->initialGenEps, zeta);
167 auto Gcon = Shell7Base :: giveDualBase(Gcov);
168
169 this->gradient = dotT(gcov, Gcon) - eye<3>();
170}
171
172void
173PrescribedGenStrainShell7 :: evaluateHigherOrderContribution(FloatArray &answer, double zeta, FloatArray &dx)
174{
175 // Computes the higher order contribution from the second gradient F2_ijk = (g3,3)_i * (G^3)_j * (G^3)_k
176 // Simplified version with only contribtion in the xi-direction
177 //auto gcov = this->evalCovarBaseVectorsAt(this->genEps, zeta);
178 auto Gcov = this->evalInitialCovarBaseVectorsAt(this->initialGenEps, zeta);
179 auto Gcon = Shell7Base :: giveDualBase(Gcov);
180
181 FloatArrayF<3> G3, m;
182 G3.at(1) = Gcon.at(1,3);
183 G3.at(2) = Gcon.at(2,3);
184 G3.at(3) = Gcon.at(3,3);
185
186 double factor = dot(G3, dx);
187 double gamma = this->genEps.at(18);
188 m.at(1) = this->genEps.at(13);
189 m.at(2) = this->genEps.at(14);
190 m.at(3) = this->genEps.at(15);
191 auto g3prime = gamma*m;
192
193 answer = 0.5*factor*factor * g3prime;
194
195
196}
197
198#if 0
199void PrescribedGenStrainShell7 :: updateCoefficientMatrix(FloatMatrix &C)
200// This is written in a very general way, supporting both fm and sm problems.
201// v_prescribed = C.d = (x-xbar).d;
202// C = [x 0 y]
203// [0 y x]
204// [ ... ] in 2D, voigt form [d_11, d_22, d_12]
205// C = [x 0 0 y z 0]
206// [0 y 0 x 0 z]
207// [0 0 z 0 x y]
208// [ ......... ] in 3D, voigt form [d_11, d_22, d_33, d_23, d_13, d_12]
209{
210 Domain *domain = this->giveDomain();
211 int nNodes = domain->giveNumberOfDofManagers();
212
213 int nsd = domain->giveNumberOfSpatialDimensions();
215 C.resize(npeq, nsd * ( nsd + 1 ) / 2);
216 C.zero();
217
218 FloatArray &cCoords = this->giveCenterCoordinate();
219 double xbar = cCoords.at(1), ybar = cCoords.at(2), zbar = 0.0;
220 if ( nsd == 3 ) {
221 zbar = cCoords.at(3);
222 }
223
224 for ( int i = 1; i <= nNodes; i++ ) {
225 Node *n = domain->giveNode(i);
226 FloatArray *coords = n->giveCoordinates();
227 Dof *d1 = n->giveDofWithID( this->dofs[0] );
228 Dof *d2 = n->giveDofWithID( this->dofs[1] );
229 int k1 = d1->__givePrescribedEquationNumber();
230 int k2 = d2->__givePrescribedEquationNumber();
231 if ( nsd == 2 ) {
232 if ( k1 ) {
233 C.at(k1, 1) = coords->at(1) - xbar;
234 C.at(k1, 3) = coords->at(2) - ybar;
235 }
236
237 if ( k2 ) {
238 C.at(k2, 2) = coords->at(2) - ybar;
239 C.at(k2, 3) = coords->at(1) - xbar;
240 }
241 } else { // nsd == 3
242 OOFEM_ERROR("PrescribedGenStrainShell7 :: updateCoefficientMatrix - 3D Not tested yet!");
243 Dof *d3 = n->giveDofWithID( this->dofs(2) );
244 int k3 = d3->__givePrescribedEquationNumber();
245
246 if ( k1 ) {
247 C.at(k1, 1) = coords->at(1) - xbar;
248 C.at(k1, 4) = coords->at(2) - ybar;
249 C.at(k1, 5) = coords->at(3) - zbar;
250 }
251 if ( k2 ) {
252 C.at(k2, 2) = coords->at(2) - ybar;
253 C.at(k2, 4) = coords->at(1) - xbar;
254 C.at(k2, 6) = coords->at(3) - zbar;
255 }
256 if ( k3 ) {
257 C.at(k3, 3) = coords->at(3) - zbar;
258 C.at(k3, 5) = coords->at(1) - xbar;
259 C.at(k3, 6) = coords->at(2) - ybar;
260 }
261 }
262 }
263}
264#endif
265
266double PrescribedGenStrainShell7 :: domainSize()
267{
268 int nsd = this->domain->giveNumberOfSpatialDimensions();
269 double domain_size = 0.0;
270 // This requires the boundary to be consistent and ordered correctly.
271 Set *set = this->giveDomain()->giveSet(this->set);
272 const IntArray &boundaries = set->giveBoundaryList();
273
274 for ( int pos = 1; pos <= boundaries.giveSize() / 2; ++pos ) {
275 Element *e = this->giveDomain()->giveElement( boundaries.at(pos * 2 - 1) );
276 int boundary = boundaries.at(pos * 2);
278 domain_size += fei->evalNXIntegral( boundary, FEIElementGeometryWrapper(e) );
279 }
280 return domain_size / nsd;
281}
282
283
284
285
286void PrescribedGenStrainShell7 :: initializeFrom(InputRecord &ir)
287{
288 GeneralBoundaryCondition :: initializeFrom(ir);
289
292
293 FloatArray c;
295 this->centerCoord = c;
296}
297
298
299void PrescribedGenStrainShell7 :: giveInputRecord(DynamicInputRecord &input)
300{
301 BoundaryCondition :: giveInputRecord(input);
305}
306} // end namespace oofem
#define REGISTER_BoundaryCondition(class)
const FloatArray & giveCoordinates() const
Definition dofmanager.h:390
DofIDItem giveDofID() const
Definition dof.h:276
DofManager * giveDofManager() const
Definition dof.h:123
virtual int __givePrescribedEquationNumber()=0
int giveNumber()
Returns domain number.
Definition domain.h:281
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition domain.h:461
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Definition domain.C:1137
Node * giveNode(int n)
Definition domain.h:398
EngngModel * giveEngngModel()
Definition domain.C:419
void setField(int item, InputFieldType id)
virtual FEInterpolation * giveInterpolation() const
Definition element.h:648
virtual int giveNumberOfDomainEquations(int di, const UnknownNumberingScheme &num)
Definition engngm.C:452
virtual double evalNXIntegral(int boundary, const FEICellGeometry &cellgeo) const
Definition feinterpol.h:477
Domain * giveDomain() const
Definition femcmpnn.h:97
double & at(std::size_t i)
double & at(Index i)
Definition floatarray.h:202
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
Definition floatarray.C:403
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
void add(const FloatArray &src)
Definition floatarray.C:218
void times(double s)
Definition floatarray.C:834
void setColumn(const FloatArrayF< N > &src, std::size_t c)
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
int set
Set number for boundary condition to be applied to.
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
FloatMatrixF< 3, 3 > evalCovarBaseVectorsAt(FloatArray &genEps, double zeta)
FloatMatrixF< 3, 3 > evalInitialCovarBaseVectorsAt(FloatArray &genEps, double zeta)
FloatMatrixF< 3, 3 > gradient
Prescribed gradient .
FloatArrayF< 3 > centerCoord
Center coordinate .
void evaluateHigherOrderContribution(FloatArray &answer, double zeta, FloatArray &dx)
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
FloatMatrixF< N, P > dotT(const FloatMatrixF< N, M > &a, const FloatMatrixF< P, M > &b)
Computes .
double dot(const FloatArray &x, const FloatArray &y)
FloatMatrixF< N, N > eye()
Constructs an identity matrix.
#define _IFT_PrescribedGenStrainShell7_centercoords
#define _IFT_PrescribedGenStrainShell7_generalizedstrain
#define _IFT_PrescribedGenStrainShell7_initialgeneralizedstrain

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