OOFEM 3.0
Loading...
Searching...
No Matches
graddpelement.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 *
14 * Copyright (C) 1993 - 2025 Borek Patzak
15 *
16 *
17 *
18 * Czech Technical University, Faculty of Civil Engineering,
19 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
20 *
21 * This library is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU Lesser General Public
23 * License as published by the Free Software Foundation; either
24 * version 2.1 of the License, or (at your option) any later version.
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Lesser General Public License for more details.
30 *
31 * You should have received a copy of the GNU Lesser General Public
32 * License along with this library; if not, write to the Free Software
33 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
34 */
35
36
41#include "sm/Materials/graddpmaterialextensioninterface.h"
42#include "node.h"
43#include "material.h"
44#include "gausspoint.h"
46#include "floatmatrix.h"
47#include "floatarray.h"
48#include "intarray.h"
49#include "domain.h"
50#include "cltypes.h"
51#include "mathfem.h"
52#include "nonlocalbarrier.h"
53#include "engngm.h"
54
55#include <cstdio>
56
57namespace oofem {
58GradDpElement :: GradDpElement()
59{ }
60
61void
62GradDpElement :: setDisplacementLocationArray()
63{
64 locU.resize(locSize);
65
66 for ( int i = 1; i <= totalSize; i++ ) {
67 if ( i < nSecNodes * nPrimVars + 1 ) {
68 locU.at(i) = i + ( int ) ( ( ( i - 1 ) / nPrimVars ) ) * nSecVars;
69 } else if ( i > nSecNodes * ( nPrimVars + nSecVars ) ) {
70 locU.at(i - nSecVars * nSecNodes) = i;
71 }
72 }
73}
74
75void
76GradDpElement :: setNonlocalLocationArray()
77{
78 locK.resize(nlSize);
79 for ( int i = 1; i <= nlSize; i++ ) {
80 locK.at(i) = i * nPrimVars + i;
81 }
82}
83
84
85void
86GradDpElement :: computeDisplacementDegreesOfFreedom(FloatArray &answer, TimeStep *tStep)
87{
88 this->giveStructuralElement()->computeVectorOf({D_u, D_v, D_w}, VM_Total, tStep, answer);
89}
90
91void GradDpElement :: computeNonlocalDegreesOfFreedom(FloatArray &answer, TimeStep *tStep)
92{
93 this->giveStructuralElement()->computeVectorOf({G_0}, VM_Total, tStep, answer);
94}
95
96void
97GradDpElement :: computeStressVectorAndLocalCumulatedStrain(FloatArray &answer, double localCumulatedStrain, GaussPoint *gp, TimeStep *tStep)
98{
100
101 double nlCumulatedStrain;
102
103 int nlGeo = elem->giveGeometryMode();
105 GradDpMaterialExtensionInterface *dpmat = static_cast< GradDpMaterialExtensionInterface * >(
106 cs->giveMaterialInterface(GradDpMaterialExtensionInterfaceType, gp) );
107
108 if ( !dpmat ) {
109 OOFEM_ERROR("Material doesn't implement the required DpGrad interface!");
110 }
111
112 this->computeNonlocalCumulatedStrain(nlCumulatedStrain, gp, tStep);
113 if ( nlGeo == 0 ) {
114 FloatArray Epsilon;
115 this->computeLocalStrainVector(Epsilon, gp, tStep);
116 dpmat->giveRealStressVectorGrad(answer, localCumulatedStrain, gp, Epsilon, nlCumulatedStrain, tStep);
117 } else if ( nlGeo == 1 ) {
118 if ( elem->giveDomain()->giveEngngModel()->giveFormulation() == TL ) {
119 FloatArray vF;
120 this->computeDeformationGradientVector(vF, gp, tStep);
121 dpmat->giveFirstPKStressVectorGrad(answer, localCumulatedStrain, gp, vF, nlCumulatedStrain, tStep);
122 } else {
123 FloatArray vF;
124 this->computeDeformationGradientVector(vF, gp, tStep);
125 dpmat->giveCauchyStressVectorGrad(answer, localCumulatedStrain, gp, vF, nlCumulatedStrain, tStep);
126 }
127 }
128}
129
130
131void
132GradDpElement :: computeLocalStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)
133{
134 FloatArray u;
135 FloatMatrix b;
137
139 elem->computeBmatrixAt(gp, b);
140 answer.beProductOf(b, u);
141}
142
143void
144GradDpElement :: computeDeformationGradientVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)
145{
146 // Computes the deformation gradient in the Voigt format at the Gauss point gp of
147 // the receiver at time step tStep.
148 // Order of components: 11, 22, 33, 23, 13, 12, 32, 31, 21 in the 3D.
149
150 // Obtain the current displacement vector of the element and subtract initial displacements (if present)
151 FloatArray u;
152 FloatMatrix B;
154
156 // Displacement gradient H = du/dX
157 elem->computeBHmatrixAt(gp, B);
158 answer.beProductOf(B, u);
159
160 // Deformation gradient F = H + I
161 MaterialMode matMode = gp->giveMaterialMode();
162 if ( matMode == _3dMat || matMode == _PlaneStrain ) {
163 answer.at(1) += 1.0;
164 answer.at(2) += 1.0;
165 answer.at(3) += 1.0;
166 } else if ( matMode == _PlaneStress ) {
167 answer.at(1) += 1.0;
168 answer.at(2) += 1.0;
169 } else if ( matMode == _1dMat ) {
170 answer.at(1) += 1.0;
171 } else {
172 OOFEM_ERROR( "MaterialMode is not supported yet (%s)", __MaterialModeToString(matMode) );
173 }
174}
175
176void
177GradDpElement :: computeNonlocalCumulatedStrain(double &answer, GaussPoint *gp, TimeStep *tStep)
178{
179 FloatArray Nk, u;
180
181 this->computeNkappaMatrixAt(gp, Nk);
182 this->computeNonlocalDegreesOfFreedom(u, tStep);
183 answer = Nk.dotProduct(u);
184}
185
186
187void
188GradDpElement :: computeNonlocalGradient(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)
189{
190 FloatMatrix Bk;
191 FloatArray u;
192
193 this->computeBkappaMatrixAt(gp, Bk);
194 this->computeNonlocalDegreesOfFreedom(u, tStep);
195 answer.beProductOf(Bk, u);
196}
197
198
199void
200GradDpElement :: giveNonlocalInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord)
201{
202 double localCumulatedStrain = 0.;
204 FloatMatrix stiffKappa;
205 FloatArray Nk;
206 FloatArray aux, dKappa, stress;
207
208 int size = nSecVars * nSecNodes;
209
210 //set displacement and nonlocal location array
213
214 answer.resize(size);
215 for ( GaussPoint *gp: *elem->giveIntegrationRule(0) ) {
216 this->computeNkappaMatrixAt(gp, Nk);
217
218 double dV = elem->computeVolumeAround(gp);
219 this->computeStressVectorAndLocalCumulatedStrain(stress, localCumulatedStrain, gp, tStep);
220 aux.add(-dV * localCumulatedStrain, Nk);
221 }
222
223 this->computeStiffnessMatrix_kk(stiffKappa, TangentStiffness, tStep);
224 this->computeNonlocalDegreesOfFreedom(dKappa, tStep);
225 answer.beProductOf(stiffKappa, dKappa);
226 answer.add(aux);
227}
228
229
230void
231GradDpElement :: giveLocalInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord)
232{
234 int nlGeo = elem->giveGeometryMode();
235 FloatArray BS, vStress;
236 FloatMatrix B;
237 for ( GaussPoint *gp: *elem->giveIntegrationRule(0) ) {
238
239 if ( nlGeo == 0 || elem->domain->giveEngngModel()->giveFormulation() == AL ) {
240 elem->computeBmatrixAt(gp, B);
241 } else if ( nlGeo == 1 ) {
242 elem->computeBHmatrixAt(gp, B);
243 }
244 vStress = static_cast< StructuralMaterialStatus * >( gp->giveMaterialStatus() )->giveTempStressVector();
245
246 if ( vStress.giveSize() == 0 ) {
247 break;
248 }
249
250 // Compute nodal internal forces at nodes as f = B^T*Stress dV
251 double dV = elem->computeVolumeAround(gp);
252 BS.beTProductOf(B, vStress);
253 answer.add(dV, BS);
254 }
255}
256
257#if 0
258void
259GradDpElement :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord)
260{
261 NLStructuralElement *elem = this->giveNLStructuralElement();
263 FloatArray answerU, answerK;
264
265 double localCumulatedStrain = 0.;
266 FloatMatrix stiffKappa, B;
267 FloatArray Nk, aux, dKappa, stress;
268 FloatMatrix lStiff;
269 FloatMatrix Bk;
270 FloatArray gKappa, L_gKappa;
271
272 //set displacement and nonlocal location array
273 this->setDisplacementLocationArray();
274 this->setNonlocalLocationArray();
275
276 this->computeNonlocalDegreesOfFreedom(dKappa, tStep);
277
278 int nlGeo = elem->giveGeometryMode();
279 for ( auto &gp: *elem->giveIntegrationRule(0) ) {
280 GradDpMaterialExtensionInterface *dpmat = dynamic_cast< GradDpMaterialExtensionInterface * >(
281 cs->giveMaterialInterface(GradDpMaterialExtensionInterfaceType, gp) );
282 if ( !dpmat ) {
283 OOFEM_ERROR("Material doesn't implement the required DpGrad interface!");
284 }
285
286 double dV = elem->computeVolumeAround(gp);
287
288 if ( nlGeo == 0 || elem->domain->giveEngngModel()->giveFormulation() == AL ) {
289 elem->computeBmatrixAt(gp, B);
290 } else if ( nlGeo == 1 ) {
291 elem->computeBHmatrixAt(gp, B);
292 }
293 this->computeStressVectorAndLocalCumulatedStrain(stress, localCumulatedStrain, gp, tStep);
294
295 answerU.plusProduct(B, stress, dV);
296
297 // Gradient part:
298 this->computeNkappaMatrixAt(gp, Nk);
299 this->computeBkappaMatrixAt(gp, Bk);
300
301 dpmat->givePDGradMatrix_kk(lStiff, TangentStiffness, gp, tStep);
302 double kappa = Nk.dotProduct(dKappa);
303 gKappa.beProductOf(Bk, dKappa);
304
305 answerK.add(-dV * localCumulatedStrain, Nk);
306 answerK.add(kappa * dV, Nk);
307
308 if ( dpmat->giveAveragingType() == 0 || dpmat->giveAveragingType() == 1 ) {
309 double l = lStiff.at(1, 1);
310 answerK.plusProduct(Bk, gKappa, l * l * dV);
311 } else if ( dpmat->giveAveragingType() == 2 ) {
312 L_gKappa.beProductOf(lStiff, gKappa);
313 answerK.plusProduct(Bk, L_gKappa, dV);
314 }
315 }
316
317 //this->computeStiffnessMatrix_kk(stiffKappa, TangentStiffness, tStep);
318 //answerK.beProductOf(stiffKappa, dKappa);
319 answerK.add(aux);
320
321 answer.resize(totalSize);
322 answer.zero();
323 answer.assemble(answerU, locU);
324 answer.assemble(answerK, locK);
325}
326#else
327void
328GradDpElement :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord)
329{
330 answer.resize(totalSize);
331 answer.zero();
332 FloatArray answerU;
333 answerU.resize(locSize);
334 answer.zero();
335 FloatArray answerK(nlSize);
336 answerK.zero();
337
340 this->giveNonlocalInternalForcesVector(answerK, tStep, useUpdatedGpRecord);
341 this->giveLocalInternalForcesVector(answerU, tStep, useUpdatedGpRecord);
342
343
344 answer.assemble(answerU, locU);
345 answer.assemble(answerK, locK);
346}
347#endif
348
349/************************************************************************/
350
351#if 0
352void
353GradDpElement :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
354{
355 //set displacement and nonlocal location array
356 this->setDisplacementLocationArray();
357 this->setNonlocalLocationArray();
358
359 NLStructuralElement *elem = this->giveNLStructuralElement();
361 FloatMatrix B, D, DB;
362 FloatMatrix DkuB, Dku;
363 FloatArray Nk;
364 FloatMatrix SNk, gPSigma;
365 FloatMatrix lStiff;
366 FloatMatrix Bk, LBk;
367 FloatMatrix answer_uu, answer_ku, answer_uk, answer_kk;
368
369 int nlGeo = elem->giveGeometryMode();
370 bool matStiffSymmFlag = elem->giveCrossSection()->isCharacteristicMtrxSymmetric(rMode);
371
372 for ( auto &gp : *elem->giveIntegrationRule(0) ) {
373 GradDpMaterialExtensionInterface *dpmat = dynamic_cast< GradDpMaterialExtensionInterface * >(
374 cs->giveMaterialInterface(GradDpMaterialExtensionInterfaceType, gp) );
375 if ( !dpmat ) {
376 OOFEM_ERROR("Material doesn't implement the required DpGrad interface!");
377 }
378
379 double dV = elem->computeVolumeAround(gp);
380
381 if ( nlGeo == 0 ) {
382 elem->computeBmatrixAt(gp, B);
383 } else if ( nlGeo == 1 ) {
384 if ( elem->domain->giveEngngModel()->giveFormulation() == AL ) {
385 elem->computeBmatrixAt(gp, B);
386 } else {
387 elem->computeBHmatrixAt(gp, B);
388 }
389 }
390 this->computeNkappaMatrixAt(gp, Nk);
391 this->computeBkappaMatrixAt(gp, Bk);
392
393 dpmat->givePDGradMatrix_uu(D, rMode, gp, tStep);
394 dpmat->givePDGradMatrix_ku(Dku, rMode, gp, tStep);
395 dpmat->givePDGradMatrix_uk(gPSigma, rMode, gp, tStep);
396 dpmat->givePDGradMatrix_kk(lStiff, rMode, gp, tStep);
397
399 DB.beProductOf(D, B);
400 if ( matStiffSymmFlag ) {
401 answer_uu.plusProductSymmUpper(B, DB, dV);
402 } else {
403 answer_uu.plusProductUnsym(B, DB, dV);
404 }
405
407 DkuB.beProductOf(Dku, B);
408 answer_ku.plusProductUnsym(Nk, DkuB, -dV);
409
410 if ( dpmat->giveAveragingType() == 2 ) {
411 double dl1, dl2, dl3;
412 FloatMatrix LDB;
413 FloatMatrix GkLDB, MGkLDB;
414 FloatMatrix M22, M12;
415 FloatMatrix dL1(1, 3), dL2(1, 3), dLdS;
416 FloatArray Gk, n1, n2;
417
418
419 dpmat->givePDGradMatrix_LD(dLdS, rMode, gp, tStep);
420 this->computeNonlocalGradient(Gk, gp, tStep);
421
422 dl1 = dLdS.at(3, 3);
423 dl2 = dLdS.at(4, 4);
424 dl3 = dLdS.at(5, 5);
425 n1 = {dLdS.at(1, 1), dLdS.at(2, 1)};
426 n2 = {dLdS.at(1, 2), dLdS.at(2, 2)};
427
428 // first term Bk^T M22 G L1 D B
429 // M22 = n2 \otimes n2
430 M22.plusDyadUnsym(n2, n2, 1.);
431 // dL1
432 dL1.at(1, 1) = dl1 * n1.at(1) * n1.at(1) + dl2 * n2.at(1) * n2.at(1);
433 dL1.at(1, 2) = dl1 * n1.at(2) * n1.at(2) + dl2 * n2.at(2) * n2.at(2);
434 dL1.at(1, 3) = dl1 * n1.at(1) * n1.at(2) + dl2 * n2.at(1) * n2.at(2);
435
436 LDB.beProductOf(dL1, DB);
437 GkLDB.beProductOf(Gk, LDB);
438 MGkLDB.beProductOf(M22, GkLDB);
439 answer.plusProductUnsym(Bk, MGkLDB, dV);
440
441 // M12 + M21 = n1 \otimes n2 + n2 \otimes n1
442 M12.plusDyadUnsym(n1, n2, 1.);
443 M12.plusDyadUnsym(n2, n1, 1.);
444 //dL2
445 dL2.at(1, 1) = dl3 * ( n1.at(1) * n2.at(1) + n1.at(1) * n2.at(1) );
446 dL2.at(1, 2) = dl3 * ( n1.at(2) * n2.at(2) + n1.at(2) * n2.at(2) );
447 dL2.at(1, 3) = dl3 * ( n1.at(2) * n2.at(1) + n1.at(1) * n2.at(2) );
448
449 // Bk * ((M12 * L2 + M22 * L1) * DB)
450 LDB.beProductOf(dL2, DB);
451 GkLDB.beProductOf(Gk, LDB);
452 MGkLDB.beProductOf(M12, GkLDB);
453 answer.plusProductUnsym(Bk, MGkLDB, dV);
454 }
455
457 SNk.beProductOf(gPSigma, Nk);
458 answer_uk.plusProductUnsym(B, SNk, -dV); // uk
459
461 answer_kk.plusProductUnsym(Nk, Nk, dV);
462 if ( dpmat->giveAveragingType() == 0 || dpmat->giveAveragingType() == 1 ) {
463 double l = lStiff.at(1, 1);
464 answer_kk.plusProductUnsym(Bk, Bk, l * l * dV);
465 } else if ( dpmat->giveAveragingType() == 2 ) {
466 LBk.beProductOf(lStiff, Bk);
467 answer_kk.plusProductUnsym(Bk, LBk, dV);
468 }
469 }
470
471 if ( elem->domain->giveEngngModel()->giveFormulation() == AL ) {
472 FloatMatrix initialStressMatrix;
473 elem->computeInitialStressMatrix(initialStressMatrix, tStep);
474 answer_uu.add(initialStressMatrix);
475 }
476
477 if ( matStiffSymmFlag ) {
478 answer_uu.symmetrized();
479 }
480
481 answer.resize(totalSize, totalSize);
482 answer.zero();
483 answer.assemble(answer_uu, locU);
484 answer.assemble(answer_uk, locU, locK);
485 answer.assemble(answer_ku, locK, locU);
486 answer.assemble(answer_kk,locK);
487}
488#else
489
490void
491GradDpElement :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
492{
493 //set displacement and nonlocal location array
496
497 answer.resize(totalSize, totalSize);
498 answer.zero();
499
500 FloatMatrix answer1, answer2, answer3, answer4;
501 this->computeStiffnessMatrix_uu(answer1, rMode, tStep);
502 this->computeStiffnessMatrix_uk(answer2, rMode, tStep);
503 this->computeStiffnessMatrix_ku(answer3, rMode, tStep);
504 this->computeStiffnessMatrix_kk(answer4, rMode, tStep);
505 answer.assemble(answer1, locU);
506 answer.assemble(answer2, locU, locK);
507 answer.assemble(answer3, locK, locU);
508 answer.assemble(answer4, locK);
509}
510#endif
511
512void
513GradDpElement :: computeStiffnessMatrix_uu(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
514{
517 FloatMatrix B, D, DB;
518
519 int nlGeo = elem->giveGeometryMode();
520 bool matStiffSymmFlag = elem->giveCrossSection()->isCharacteristicMtrxSymmetric(rMode);
521 answer.clear();
522 for ( GaussPoint *gp: *elem->giveIntegrationRule(0) ) {
523
524 GradDpMaterialExtensionInterface *dpmat = dynamic_cast< GradDpMaterialExtensionInterface * >(
525 cs->giveMaterialInterface(GradDpMaterialExtensionInterfaceType, gp) );
526 if ( !dpmat ) {
527 OOFEM_ERROR("Material doesn't implement the required DpGrad interface!");
528 }
529 if ( nlGeo == 0 ) {
530 elem->computeBmatrixAt(gp, B);
531 } else if ( nlGeo == 1 ) {
532 if ( elem->domain->giveEngngModel()->giveFormulation() == AL ) {
533 elem->computeBmatrixAt(gp, B);
534 } else {
535 elem->computeBHmatrixAt(gp, B);
536 }
537 }
538
539 dpmat->givePDGradMatrix_uu(D, rMode, gp, tStep);
540 double dV = elem->computeVolumeAround(gp);
541 DB.beProductOf(D, B);
542 if ( matStiffSymmFlag ) {
543 answer.plusProductSymmUpper(B, DB, dV);
544 } else {
545 answer.plusProductUnsym(B, DB, dV);
546 }
547 }
548
549 if ( elem->domain->giveEngngModel()->giveFormulation() == AL ) {
550 FloatMatrix initialStressMatrix;
551 elem->computeInitialStressMatrix(initialStressMatrix, tStep);
552 answer.add(initialStressMatrix);
553 }
554
555 if ( matStiffSymmFlag ) {
556 answer.symmetrized();
557 }
558}
559
560
561void
562GradDpElement :: computeStiffnessMatrix_ku(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
563{
564 double dV;
566 FloatArray Nk;
567 FloatMatrix B, DkuB, Dku;
569
570 answer.clear();
571
572 int nlGeo = elem->giveGeometryMode();
573
574 for ( auto &gp: *elem->giveIntegrationRule(0) ) {
575
576 GradDpMaterialExtensionInterface *dpmat = dynamic_cast< GradDpMaterialExtensionInterface * >(
577 cs->giveMaterialInterface(GradDpMaterialExtensionInterfaceType, gp) );
578 if ( !dpmat ) {
579 OOFEM_ERROR("Material doesn't implement the required DpGrad interface!");
580 }
581
582 elem->computeBmatrixAt(gp, B);
583 if ( nlGeo == 1 ) {
584 if ( elem->domain->giveEngngModel()->giveFormulation() == AL ) {
585 elem->computeBmatrixAt(gp, B);
586 } else {
587 elem->computeBHmatrixAt(gp, B);
588 }
589 }
590
591 dpmat->givePDGradMatrix_ku(Dku, rMode, gp, tStep);
592 this->computeNkappaMatrixAt(gp, Nk);
593 dV = elem->computeVolumeAround(gp);
594 DkuB.beProductOf(Dku, B);
595 answer.plusProductUnsym(Nk, DkuB, -dV);
596
597 if ( dpmat->giveAveragingType() == 2 ) {
598 double dl1, dl2, dl3;
599 FloatArray Gk;
600 FloatMatrix D, DB, LDB;
601 FloatMatrix Bk, BktM22, BktM22Gk, BktM12, BktM12Gk, M22(2, 2), M12(2, 2);
602 FloatMatrix dL1(1, 3), dL2(1, 3), result1, result2, dLdS, n(2, 2);
603
604 this->computeBkappaMatrixAt(gp, Bk);
605 dpmat->givePDGradMatrix_uu(D, rMode, gp, tStep);
606 dpmat->givePDGradMatrix_LD(dLdS, rMode, gp, tStep);
607 this->computeNonlocalGradient(Gk, gp, tStep);
608
609 dl1 = dLdS.at(3, 3);
610 dl2 = dLdS.at(4, 4);
611 dl3 = dLdS.at(5, 5);
612
613 n.at(1, 1) = dLdS.at(1, 1);
614 n.at(1, 2) = dLdS.at(1, 2);
615 n.at(2, 1) = dLdS.at(2, 1);
616 n.at(2, 2) = dLdS.at(2, 2);
617 // first term Bk^T M22 G L1 D B
618 // M22 = n2 \otimes n2
619 M22.at(1, 1) = n.at(1, 2) * n.at(1, 2);
620 M22.at(1, 2) = n.at(1, 2) * n.at(2, 2);
621 M22.at(2, 1) = n.at(2, 2) * n.at(1, 2);
622 M22.at(2, 2) = n.at(2, 2) * n.at(2, 2);
623 // dL1
624 dL1.at(1, 1) = dl1 * n.at(1, 1) * n.at(1, 1) + dl2 *n.at(1, 2) * n.at(1, 2);
625 dL1.at(1, 2) = dl1 * n.at(2, 1) * n.at(2, 1) + dl2 *n.at(2, 2) * n.at(2, 2);
626 dL1.at(1, 3) = dl1 * n.at(1, 1) * n.at(2, 1) + dl2 *n.at(1, 2) * n.at(2, 2);
627
628 DB.beProductOf(D, B);
629 LDB.beProductOf(dL1, DB);
630 BktM22.beTProductOf(Bk, M22);
632 //BktM22Gk.beProductOf(BktM22,Gk);
633 result1.beProductOf(BktM22Gk, LDB);
634 answer.add(dV, result1);
635 // This would be slightly shorter and faster;
636 //GkLDB.beProductOf(Gk, LDB);
637 //MGkLDB.beProductOf(M22, GkLDB);
638 //answer.plusProductUnsym(Bk, MGkLDB, dV);
639
640 // M12 + M21 = n1 \otimes n2 + n2 \otimes n1
641 M12.at(1, 1) = n.at(1, 1) * n.at(1, 2) + n.at(1, 2) * n.at(1, 1);
642 M12.at(1, 2) = n.at(1, 1) * n.at(2, 2) + n.at(1, 2) * n.at(2, 1);
643 M12.at(2, 1) = n.at(2, 1) * n.at(1, 2) + n.at(2, 2) * n.at(1, 1);
644 M12.at(2, 2) = n.at(2, 1) * n.at(2, 2) + n.at(2, 2) * n.at(2, 1);
645 //dL2
646 dL2.at(1, 1) = dl3 * ( n.at(1, 1) * n.at(1, 2) + n.at(1, 1) * n.at(1, 2) );
647 dL2.at(1, 2) = dl3 * ( n.at(2, 1) * n.at(2, 2) + n.at(2, 1) * n.at(2, 2) );
648 dL2.at(1, 3) = dl3 * ( n.at(1, 2) * n.at(2, 1) + n.at(1, 1) * n.at(2, 2) );
649
650 LDB.beProductOf(dL2, DB);
651 BktM12.beTProductOf(Bk, M12);
653 //BktM12Gk.beProductOf(BktM12,Gk);
654 result2.beProductOf(BktM12Gk, LDB);
655 answer.add(dV, result2);
656 // This would be slightly shorter and faster;
657 //GkLDB.beProductOf(Gk, LDB);
658 //MGkLDB.beProductOf(M12, GkLDB);
659 //answer.plusProductUnsym(Bk, MGkLDB, dV);
660 }
661 }
662}
663
664
665void
666GradDpElement :: computeStiffnessMatrix_kk(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
667{
669 double dV;
670 FloatMatrix lStiff;
671 FloatArray Nk;
672 FloatMatrix Bk, LBk;
674
675 answer.clear();
676
677 for ( auto &gp: *elem->giveIntegrationRule(0) ) {
678
679 GradDpMaterialExtensionInterface *dpmat = dynamic_cast< GradDpMaterialExtensionInterface * >(
680 cs->giveMaterialInterface(GradDpMaterialExtensionInterfaceType, gp) );
681 if ( !dpmat ) {
682 OOFEM_ERROR("Material doesn't implement the required DpGrad interface!");
683 }
684
685 this->computeNkappaMatrixAt(gp, Nk);
686 this->computeBkappaMatrixAt(gp, Bk);
687 dV = elem->computeVolumeAround(gp);
688
689 dpmat->givePDGradMatrix_kk(lStiff, rMode, gp, tStep);
690 answer.plusProductUnsym(Nk, Nk, dV);
691 if ( dpmat->giveAveragingType() == 0 || dpmat->giveAveragingType() == 1 ) {
692 double l = lStiff.at(1, 1);
693 answer.plusProductUnsym(Bk, Bk, l * l * dV);
694 } else if ( dpmat->giveAveragingType() == 2 ) {
695 LBk.beProductOf(lStiff, Bk);
696 answer.plusProductUnsym(Bk, LBk, dV);
697 }
698 }
699}
700
701
702void
703GradDpElement :: computeStiffnessMatrix_uk(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
704{
706 double dV;
708 int nlGeo = elem->giveGeometryMode();
709 FloatArray Nk;
710 FloatMatrix B, SNk, gPSigma;
711
712 answer.clear();
713
714 for ( auto &gp: *elem->giveIntegrationRule(0) ) {
715
716 GradDpMaterialExtensionInterface *dpmat = dynamic_cast< GradDpMaterialExtensionInterface * >(
717 cs->giveMaterialInterface(GradDpMaterialExtensionInterfaceType, gp) );
718 if ( !dpmat ) {
719 OOFEM_ERROR("Material doesn't implement the required DpGrad interface!");
720 }
721 dpmat->givePDGradMatrix_uk(gPSigma, rMode, gp, tStep);
722 this->computeNkappaMatrixAt(gp, Nk);
723 elem->computeBmatrixAt(gp, B);
724 if ( nlGeo == 1 ) {
725 if ( elem->domain->giveEngngModel()->giveFormulation() == AL ) {
726 elem->computeBmatrixAt(gp, B);
727 } else {
728 elem->computeBHmatrixAt(gp, B);
729 }
730 }
731 dV = elem->computeVolumeAround(gp);
732
733 SNk.beProductOf(gPSigma, Nk);
734 answer.plusProductUnsym(B, SNk, -dV);
735 }
736}
737
738} // end namespace oofem
virtual bool isCharacteristicMtrxSymmetric(MatResponseMode rMode) const
EngngModel * giveEngngModel()
Definition domain.C:419
virtual IntegrationRule * giveIntegrationRule(int i)
Definition element.h:899
CrossSection * giveCrossSection()
Definition element.C:534
virtual double computeVolumeAround(GaussPoint *gp)
Definition element.h:530
virtual fMode giveFormulation()
Definition engngm.h:1165
Domain * giveDomain() const
Definition femcmpnn.h:97
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
void assemble(const FloatArray &fe, const IntArray &loc)
Definition floatarray.C:616
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
void plusProduct(const FloatMatrix &b, const FloatArray &s, double dV)
Definition floatarray.C:288
double dotProduct(const FloatArray &x) const
Definition floatarray.C:524
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void zero()
Zeroes all coefficients of receiver.
Definition floatarray.C:683
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:721
void add(const FloatArray &src)
Definition floatarray.C:218
void plusProductSymmUpper(const FloatMatrix &a, const FloatMatrix &b, double dV)
void add(const FloatMatrix &a)
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
*Sets size of receiver to be an empty matrix It will have zero rows and zero columns size void clear()
void plusProductUnsym(const FloatMatrix &a, const FloatMatrix &b, double dV)
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void zero()
Zeroes all coefficient of receiver.
void assemble(const FloatMatrix &src, const IntArray &loc)
double at(std::size_t i, std::size_t j) const
void beTProductOf(const FloatMatrix &a, const FloatMatrix &b)
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition gausspoint.h:190
void computeDisplacementDegreesOfFreedom(FloatArray &answer, TimeStep *tStep)
void giveLocalInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord)
void computeStressVectorAndLocalCumulatedStrain(FloatArray &answer, double localCumulatedPlasticStrain, GaussPoint *gp, TimeStep *tStep)
void computeLocalStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)
void computeStiffnessMatrix_ku(FloatMatrix &, MatResponseMode, TimeStep *)
virtual StructuralElement * giveStructuralElement()=0
void computeNonlocalCumulatedStrain(double &answer, GaussPoint *gp, TimeStep *tStep)
virtual void computeBkappaMatrixAt(GaussPoint *gp, FloatMatrix &answer)=0
void computeDeformationGradientVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)
void computeNonlocalDegreesOfFreedom(FloatArray &answer, TimeStep *tStep)
void giveNonlocalInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord)
void computeNonlocalGradient(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)
void computeStiffnessMatrix_uk(FloatMatrix &, MatResponseMode, TimeStep *)
virtual void computeNkappaMatrixAt(GaussPoint *gp, FloatArray &answer)=0
void computeStiffnessMatrix_uu(FloatMatrix &, MatResponseMode, TimeStep *)
void computeStiffnessMatrix_kk(FloatMatrix &, MatResponseMode, TimeStep *)
void setDisplacementLocationArray()
virtual NLStructuralElement * giveNLStructuralElement()=0
void computeInitialStressMatrix(FloatMatrix &answer, TimeStep *tStep) override
virtual void computeBHmatrixAt(GaussPoint *gp, FloatMatrix &answer)
virtual Interface * giveMaterialInterface(InterfaceType t, IntegrationPoint *ip)
StructuralCrossSection * giveStructuralCrossSection()
Helper function which returns the structural cross-section for the element.
virtual void computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int lowerIndx=1, int upperIndx=ALL_STRAINS)=0
const FloatArray & giveTempStressVector() const
Returns the const pointer to receiver's temporary stress vector.
#define OOFEM_ERROR(...)
Definition error.h:79
@ AL
Updated Lagrange.
Definition fmode.h:45
@ TL
Total Lagrange.
Definition fmode.h:44

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