OOFEM 3.0
Loading...
Searching...
No Matches
tm.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
35
36#include "mpm.h"
37#include "termlibrary3.h"
38#include "termlibrary.h"
39#include "element.h"
40#include "gausspoint.h"
41#include "feinterpol.h"
42#include "intarray.h"
43#include "classfactory.h"
45
46#include "fei3dtetlin.h"
47#include "fei3dtetquad.h"
48#include "fei3dhexalin.h"
49#include "fei2dquadlin.h"
50#include "mathfem.h"
51
52#include "material.h"
53#include "matstatus.h"
54
55#include "boundaryload.h"
56#include "bodyload.h"
58
59namespace oofem {
60
61
66class TMElement : public MPElement {
67
68 private:
69 virtual int giveNumberOfUDofs() const = 0;
70 virtual int giveNumberOfTDofs() const = 0;
71 virtual const Variable* getU() const = 0;
72 virtual const Variable* getT() const = 0;
73
74 public:
75 TMElement(int n, Domain* d):
76 MPElement(n,d) { }
77
78 // Note: performance can be probably improved once it will be possible
79 // to directly assemble multiple term contributions to the system matrix.
80 // template metaprogramming?
81 void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, TimeStep *tStep) override {
83
84 if (type == MomentumBalance_StiffnessMatrix) {
85 int udofs = this->giveNumberOfUDofs();
86 answer.resize(udofs,udofs);
87 answer.zero();
88 this->integrateTerm_dw (answer, TMBTSigTerm (getU(),getU(), getT()), ir, tStep) ;
89 } else if (type == MomentumBalance_ThermalCouplingMatrix) {
90 int udofs = this->giveNumberOfUDofs();
91 int tdofs = this->giveNumberOfTDofs();
92 answer.resize(udofs,tdofs);
93 answer.zero();
94 this->integrateTerm_dw (answer, BDalphaPiTerm (getU(),getT(), VM_TotalIntrinsic), ir, tStep) ;
95 this->integrateTerm_dw (answer, BTdSigmadT(getU(),getT()), ir, tStep) ;
96 } else if (type == EnergyBalance_ConductivityMatrix) {
97 int tdofs = this->giveNumberOfTDofs();
98 answer.resize(tdofs,tdofs);
99 answer.zero();
100 this->integrateTerm_dw (answer, TMgNTfTerm(getT(),getT(), Conductivity, Flux), ir, tStep) ;
101 } else if (type == EnergyBalance_CapacityMatrix) {
102 int tdofs = this->giveNumberOfTDofs();
103 answer.resize(tdofs,tdofs);
104 answer.zero();
105 this->integrateTerm_dw (answer, NTcN(getT(), getT(), Capacity), ir, tStep) ;
106 } else {
107 OOFEM_ERROR("Unknown characteristic matrix type");
108 }
109 }
110
111 void giveCharacteristicVector(FloatArray &answer, CharType type, ValueModeType mode, TimeStep *tStep) override {
113 if (type == MomentumBalance_StressResidual) {
114 answer.resize(this->giveNumberOfUDofs());
115 answer.zero();
116 this->integrateTerm_c (answer, TMBTSigTerm(getU(),getU(),getT()), ir, tStep) ;
117 } else if (type == EnergyBalance_Residual) {
118 answer.resize(this->giveNumberOfTDofs());
119 answer.zero();
120 this->integrateTerm_c(answer, TMgNTfTerm(getT(),getT(), Conductivity, Flux), ir, tStep) ;
121 answer.times(-1.0);
122 this->integrateTerm_c (answer, NTcN(getT(), getT(), Capacity), ir, tStep) ;
123 // add internal (material generated) heat source r(T) to the residual
124 FloatArray temp;
125 this->integrateTerm_c(temp, InternalTMFluxSourceTerm(getT(),getU(),getT()), ir, tStep);
126 answer.subtract(temp);
127 } else if (type == ExternalForcesVector) {
128 answer.zero();
129 } else {
130 OOFEM_ERROR("Unknown characteristic vector type");
131 }
132 }
133
134 void giveCharacteristicMatrixFromBC(FloatMatrix &answer, CharType type, TimeStep *tStep, GeneralBoundaryCondition *bc, int boundaryID) override {
135 if (bc->giveType() == ConvectionBC) {
136 BoundaryLoad *bbc = dynamic_cast<BoundaryLoad*>(bc);
137 if (bbc) {
138 FloatMatrix contrib;
139 IntArray loc;
141 std::unique_ptr<IntegrationRule> ir;
142 answer.clear();
145 //this->integrateSurfaceTerm_dw(contrib, NTf_Surface(getT(), BoundaryFluxFunctor(bbc, boundaryID, getT().dofIDs,'s'), boundaryID), ir.get(), boundaryID, tStep);
146 this->integrateSurfaceTerm_dw(answer, NTaTmTe(getT(), getT(), bbc, boundaryID, 's'), ir.get(), boundaryID, tStep);
147 } else if (bbc->giveBCGeoType() == bcGeomType::EdgeLoadBGT) {
149 //this->integrateSurfaceTerm_dw(contrib, NTf_Surface(getT(), BoundaryFluxFunctor(bbc, boundaryID, getT().dofIDs,'e'), boundaryID), ir.get(), boundaryID, tStep);
150 this->integrateSurfaceTerm_dw(answer, NTaTmTe(getT(), getT(), bbc, boundaryID, 'e'), ir.get(), boundaryID, tStep);
151 } else {
152 OOFEM_ERROR("Unsupported boundary condition geometry type");
153 }
154 }
155 } else {
156 answer.clear();
157 }
158 }
159
160
161 virtual void giveCharacteristicVectorFromBC(FloatArray &answer, CharType type, ValueModeType mode, TimeStep *tStep, GeneralBoundaryCondition *bc, int boundaryID) override {
162
163 if ((type == EnergyBalance_ConvectionBCResidual) && (bc->giveType() == ConvectionBC)) {
164 BoundaryLoad *bl = dynamic_cast<BoundaryLoad*>(bc);
165 IntArray loct, tc;
166 FloatArray contrib2;
167 answer.clear();
170 std::unique_ptr<IntegrationRule> ir2 = this->getGeometryInterpolation()->giveBoundarySurfaceIntegrationRule(o, boundaryID, this->giveGeometryType());
171 this->integrateSurfaceTerm_c(answer, NTaTmTe(getT(), getT(), bl, boundaryID, 's'), ir2.get(), boundaryID, tStep);
172 } else {
173 std::unique_ptr<IntegrationRule> ir2 = this->getGeometryInterpolation()->giveBoundaryEdgeIntegrationRule(o, boundaryID, this->giveGeometryType());
174 this->integrateEdgeTerm_c(answer, NTaTmTe(getT(), getT(), bl, boundaryID, 'e'), ir2.get(), boundaryID, tStep);
175 }
176 } else {
177 answer.clear();
178 }
179
180 }
181
182 void computeBoundarySurfaceLoadVector(FloatArray &answer, BoundaryLoad *load, int boundary, CharType type, ValueModeType mode, TimeStep *tStep, bool global = true) override {
183 answer.resize(this->getNumberOfSurfaceDOFs());
184 answer.zero();
185
186 if ( type != ExternalForcesVector ) {
187 return;
188 }
189
190 bcType bct = load->giveType();
191 if (bct == TransmissionBC ) {
192
193 IntArray locu, loct;
194 FloatArray contrib, contrib2;
195 getSurfaceLocalCodeNumbers (locu, Variable::VariableQuantity::Displacement) ;
196 getSurfaceLocalCodeNumbers (loct, Variable::VariableQuantity::Temperature) ;
197
198 // integrate traction contribution (momentum balance)
200 std::unique_ptr<IntegrationRule> ir = this->getGeometryInterpolation()->giveBoundarySurfaceIntegrationRule(o, boundary, this->giveGeometryType());
201 this->integrateSurfaceTerm_c(contrib, NTf_Surface(getU(), BoundaryFluxFunctor(load, boundary, getU()->dofIDs, 's'), boundary), ir.get(), boundary, tStep);
202 answer.assemble(contrib, locu);
203
204 // integrate mass (fluid) flux normal to the boundary (mass balance)
206 std::unique_ptr<IntegrationRule> ir2 = this->getGeometryInterpolation()->giveBoundarySurfaceIntegrationRule(o, boundary, this->giveGeometryType());
207 this->integrateSurfaceTerm_c(contrib2, NTf_Surface(getT(), BoundaryFluxFunctor(load, boundary, getT()->dofIDs,'s'), boundary), ir2.get(), boundary, tStep);
208 contrib2.times(-1.0);
209 answer.assemble(contrib2, loct);
210
211 } else if (bct == ConvectionBC) {
212 // convection handled in residual evaluation
213 } else {
214 OOFEM_ERROR("Unsupported boundary condition type");
215 }
216 }
217
218 void computeBoundaryEdgeLoadVector(FloatArray &answer, BoundaryLoad *load, int boundary, CharType type, ValueModeType mode, TimeStep *tStep, bool global=true) override {
219 answer.resize(this->getNumberOfEdgeDOFs());
220 answer.zero();
221
222 if ( type != ExternalForcesVector ) {
223 return;
224 }
225
226 bcType bct = load->giveType();
227 if (bct == TransmissionBC ) {
228 IntArray locu, loct;
229 FloatArray contrib, contrib2;
230 getEdgeLocalCodeNumbers (locu, Variable::VariableQuantity::Displacement) ;
231 getEdgeLocalCodeNumbers (loct, Variable::VariableQuantity::Pressure) ;
232
233 // integrate traction contribution (momentum balance)
235 std::unique_ptr<IntegrationRule> ir = this->getGeometryInterpolation()->giveBoundaryEdgeIntegrationRule(o, boundary, this->giveGeometryType());
236 this->integrateEdgeTerm_c(contrib, NTf_Edge(getU(), BoundaryFluxFunctor(load, boundary, getU()->dofIDs,'e'), boundary), ir.get(), boundary, tStep);
237 answer.assemble(contrib, locu);
238
239 // integrate mass (fluid) flux normal to the boundary (mass balance)
241 std::unique_ptr<IntegrationRule> ir2 = this->getGeometryInterpolation()->giveBoundaryEdgeIntegrationRule(o, boundary, this->giveGeometryType());
242 this->integrateEdgeTerm_c(contrib2, NTf_Edge(getT(), BoundaryFluxFunctor(load, boundary, getT()->dofIDs,'e'), boundary), ir2.get(), boundary, tStep);
243 contrib2.times(-1.0);
244 answer.assemble(contrib2, loct);
245 } else if (bct == ConvectionBC) {
246 // convection handled in residual evaluation
247 } else {
248 OOFEM_ERROR("Unsupported boundary condition type");
249 }
250 }
251
252 void computeLoadVector(FloatArray &answer, BodyLoad *load, CharType type, ValueModeType mode, TimeStep *tStep) override {
253 answer.resize(this->giveNumberOfDofs());
254 answer.zero();
255 if (type == ExternalForcesVector) {
256 if (load->giveBCValType() == ForceLoadBVT) {
257 FloatArray contribu, contribt;
258 IntArray locu, loct;
259 getLocalCodeNumbers (locu, Variable::VariableQuantity::Displacement) ;
260 getLocalCodeNumbers (loct, Variable::VariableQuantity::Temperature) ;
261 this->integrateTerm_c(contribu, NTf_Body(getU(), BodyFluxFunctor(load, getU()->dofIDs)), this->giveDefaultIntegrationRulePtr(), tStep);
262 this->integrateTerm_c(contribt, NTf_Body(getT(), BodyFluxFunctor(load, getT()->dofIDs)), this->giveDefaultIntegrationRulePtr(), tStep);
263 answer.assemble(contribu, locu);
264 answer.assemble(contribt, loct);
265 } else {
266 OOFEM_ERROR("Unsupported body load type");
267 }
268 } else {
269 OOFEM_ERROR("Unsupported load type");
270 }
271 }
272
273
274 int computeFluxLBToLRotationMatrix(FloatMatrix &answer, int iSurf, const FloatArray& lc, const Variable::VariableQuantity q, char btype) override {
275 if (q == Variable::VariableQuantity::Displacement) {
276 // better to integrate this into FEInterpolation class
277 FloatArray nn, h1(3), h2(3);
278 answer.resize(3,3);
279 if (btype == 's') {
281 } else {
282 OOFEM_ERROR ("Unsupported boundary entity");
283 }
284 nn.normalize();
285 for ( int i = 1; i <= 3; i++ ) {
286 answer.at(i, 3) = nn.at(i);
287 }
288
289 // determine lcs of surface
290 // local x axis in xy plane
291 double test = fabs(fabs( nn.at(3) ) - 1.0);
292 if ( test < 1.e-5 ) {
293 h1.at(1) = answer.at(1, 1) = 1.0;
294 h1.at(2) = answer.at(2, 1) = 0.0;
295 } else {
296 h1.at(1) = answer.at(1, 1) = answer.at(2, 3);
297 h1.at(2) = answer.at(2, 1) = -answer.at(1, 3);
298 }
299
300 h1.at(3) = answer.at(3, 1) = 0.0;
301 // local y axis perpendicular to local x,z axes
302 h2.beVectorProductOf(nn, h1);
303 for ( int i = 1; i <= 3; i++ ) {
304 answer.at(i, 2) = h2.at(i);
305 }
306
307 return 1;
308 } else {
309 answer.clear();
310 return 0;
311 }
312 }
313 //virtual void getLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q ) const = 0;
314 //virtual void giveDofManDofIDMask(int inode, IntArray &answer) const =0;
315
316};
317
318
319
325 protected:
326 //FEI3dTetLin pInterpol;
327 //FEI3dTetQuad uInterpol;
330 const static Variable t;
331 const static Variable u;
332
333 public:
334 TMBrick11(int n, Domain* d):
336 {
337 numberOfDofMans = 8;
339 this->computeGaussPoints();
340 }
341
342 void getDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override {
343 /* dof ordering: u1 v1 w1 p1 u2 v2 w2 p2 u3 v3 w3 p3 u4 v4 w4 u5 v5 w5 u6 v6 w6*/
344 if (q == Variable::VariableQuantity::Displacement) {
345 //answer={1,2,3, 5,6,7, 9,10,11, 13,14,15, 17,18,19, 21,22,23, 25,26,27, 29,30,31 };
346 int o = (num-1)*4+1;
347 answer={o, o+1, o+2};
348 } else if (q == Variable::VariableQuantity::Temperature) {
349 //answer = {4, 8, 12, 16, 20, 24, 28, 32};
350 answer={num*4};
351 }
352 }
353 void getInternalDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override {
354 answer={};
355 }
356
357 void giveDofManDofIDMask(int inode, IntArray &answer) const override {
358 answer = {1,2,3,10};
359 }
360 int giveNumberOfDofs() override { return 32; }
361 const char *giveInputRecordName() const override {return "tmbrick11";}
362 const char *giveClassName() const override { return "TMBrick11"; }
363
364
365 const FEInterpolation* getGeometryInterpolation() const override {return &this->tInterpol;}
366
368 return EGT_hexa_1;
369 }
370 int getNumberOfSurfaceDOFs() const override {return 16;}
371 int getNumberOfEdgeDOFs() const override {return 0;}
372 void getSurfaceLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {
373 if (q == Variable::VariableQuantity::Displacement) {
374 answer={1,2,3, 5,6,7, 9,10,11, 13,14,15};
375 } else {
376 answer ={4, 8, 12, 16};
377 }
378 }
379 void getEdgeLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {}
382 return this;
383 } else {
384 return NULL;
385 }
386 }
387
388
389
390private:
391 virtual int giveNumberOfUDofs() const override {return 24;}
392 virtual int giveNumberOfTDofs() const override {return 8;}
393 virtual const Variable* getU() const override {return &u;}
394 virtual const Variable* getT() const override {return &t;}
395 void computeGaussPoints() override {
396 if ( integrationRulesArray.size() == 0 ) {
397 integrationRulesArray.resize( 1 );
398 integrationRulesArray [ 0 ] = std::make_unique<GaussIntegrationRule>(1, this);
399 integrationRulesArray [ 0 ]->SetUpPointsOnCube(numberOfGaussPoints, _3dMat);
400 }
401 }
402};
403
404const FEI3dHexaLin TMBrick11::uInterpol;
405const FEI3dHexaLin TMBrick11::tInterpol;
406const Variable TMBrick11::t(&TMBrick11::tInterpol, Variable::VariableQuantity::Temperature, Variable::VariableType::scalar, 1, NULL, {10});
407const Variable TMBrick11::u(&TMBrick11::uInterpol, Variable::VariableQuantity::Displacement, Variable::VariableType::vector, 3, NULL, {1,2,3});
408
409#define _IFT_TMBrick11_Name "tmbrick11"
411
412
413
417class TMTetra11 : public TMElement, public ZZNodalRecoveryModelInterface {
418 protected:
419 //FEI3dTetLin pInterpol;
420 //FEI3dTetQuad uInterpol;
421 const static FEI3dTetLin tInterpol;
422 const static FEI3dTetLin uInterpol;
423 const static Variable t;
424 const static Variable u;
425
426 public:
427 TMTetra11(int n, Domain* d):
429 {
430 numberOfDofMans = 4;
431 numberOfGaussPoints = 4;
432 this->computeGaussPoints();
433 }
434
435 void getDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override {
436 /* dof ordering: u1 v1 w1 p1 u2 v2 w2 p2 u3 v3 w3 p3 u4 v4 w4 u5 v5 w5 u6 v6 w6*/
437 if (q == Variable::VariableQuantity::Displacement) {
438 //answer={1,2,3, 5,6,7, 9,10,11, 13,14,15};
439 int o = (num-1)*4+1;
440 answer={o, o+1, o+2};
441 } else if (q == Variable::VariableQuantity::Temperature) {
442 //answer = {4, 8, 12, 16};
443 answer={num*4};
444 }
445 }
446 void getInternalDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override {
447 answer={};
448 }
449
450 void giveDofManDofIDMask(int inode, IntArray &answer) const override {
451 answer = {1,2,3,10};
452 }
453 int giveNumberOfDofs() override { return 16; }
454 const char *giveInputRecordName() const override {return "tmtetra11";}
455 const char *giveClassName() const override { return "TMTetra11"; }
456
457
458 const FEInterpolation* getGeometryInterpolation() const override {return &this->tInterpol;}
459
460 Element_Geometry_Type giveGeometryType() const override {
461 return EGT_tetra_1;
462 }
463 int getNumberOfSurfaceDOFs() const override {return 12;}
464 int getNumberOfEdgeDOFs() const override {return 0;}
465 void getSurfaceLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {
466 if (q == Variable::VariableQuantity::Displacement) {
467 answer={1,2,3, 5,6,7, 9,10,11};
468 } else {
469 answer ={4, 8, 12};
470 }
471 }
472 void getEdgeLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {}
473 Interface *giveInterface(InterfaceType it) override {
475 return this;
476 } else {
477 return NULL;
478 }
479 }
480
481
482
483private:
484 virtual int giveNumberOfUDofs() const override {return 12;}
485 virtual int giveNumberOfTDofs() const override {return 4;}
486 virtual const Variable* getU() const override {return &u;}
487 virtual const Variable* getT() const override {return &t;}
488 void computeGaussPoints() override {
489 if ( integrationRulesArray.size() == 0 ) {
490 integrationRulesArray.resize( 1 );
491 integrationRulesArray [ 0 ] = std::make_unique<GaussIntegrationRule>(1, this);
492 integrationRulesArray [ 0 ]->SetUpPointsOnTetrahedra(numberOfGaussPoints, _3dMat);
493 }
494 }
495};
496
497const FEI3dTetLin TMTetra11::uInterpol;
498const FEI3dTetLin TMTetra11::tInterpol;
499const Variable TMTetra11::t(&TMTetra11::tInterpol, Variable::VariableQuantity::Temperature, Variable::VariableType::scalar, 1, NULL, {10});
500const Variable TMTetra11::u(&TMTetra11::uInterpol, Variable::VariableQuantity::Displacement, Variable::VariableType::vector, 3, NULL, {1,2,3});
501
502#define _IFT_TMTetra11_Name "tmtetra11"
504
505
506#define _IFT_TMSimpleMaterial_Name "tmm"
507#define _IFT_TMSimpleMaterial_E "e"
508#define _IFT_TMSimpleMaterial_nu "nu"
509#define _IFT_TMSimpleMaterial_lambda "lambda"
510#define _IFT_TMSimpleMaterial_alpha "alpha"
511#define _IFT_TMSimpleMaterial_c "c"
512
513class TMMaterialStatus : public MaterialStatus
514{
515protected:
517 FloatArray strainVector;
519 FloatArray stressVector;
521 FloatArray tempStressVector;
523 FloatArray tempStrainVector;
525 FloatArray tempFluxVector;
527 FloatArray fluxVector;
528public:
530 TMMaterialStatus (GaussPoint * g) : MaterialStatus(g), strainVector(), stressVector(),
531 tempStressVector(), tempStrainVector()
532 {}
533
535 const FloatArray &giveStrainVector() const { return strainVector; }
537 const FloatArray &giveStressVector() const { return stressVector; }
539 const FloatArray &giveTempStrainVector() const { return tempStrainVector; }
541 const FloatArray &giveTempStressVector() const { return tempStressVector; }
543 const FloatArray &giveTempFluxVector() const { return tempFluxVector; }
545 const FloatArray &giveFluxVector() const { return fluxVector; }
547 void letTempStressVectorBe(const FloatArray &v) { tempStressVector = v; }
549 void letTempStrainVectorBe(const FloatArray &v) { tempStrainVector = v; }
551 void letTempFluxVectorBe(const FloatArray &v) { tempFluxVector = v; }
552
553 void printOutputAt(FILE *file, TimeStep *tStep) const override {
554 MaterialStatus :: printOutputAt(file, tStep);
555 fprintf(file, " strains ");
556 for ( auto &var : strainVector ) {
557 fprintf( file, " %+.4e", var );
558 }
559
560 fprintf(file, "\n stresses");
561 for ( auto &var : stressVector ) {
562 fprintf( file, " %+.4e", var );
563 }
564
565 fprintf(file, "\n fluxes");
566 for ( auto &var : fluxVector ) {
567 fprintf( file, " %+.4e", var );
568 }
569 fprintf(file, "\n");
570 }
571
572 void initTempStatus() override {
573 MaterialStatus :: initTempStatus();
574 tempStressVector = stressVector;
575 tempStrainVector = strainVector;
576 tempFluxVector = fluxVector;
577 }
578 void updateYourself(TimeStep *tStep) override {
579 MaterialStatus :: updateYourself(tStep);
580 stressVector = tempStressVector;
581 strainVector = tempStrainVector;
582 fluxVector = tempFluxVector;
583 }
584 const char *giveClassName() const override {return "TMMaterialStatus";}
585
586};
587
589 protected:
590 double e, nu; // elastic isotropic constants
591 double lambda; // isotropic conductivity
592 double alpha; // thermal expansion coefficient
593 double c; // thermal capacity
594 public:
595 TMSimpleMaterial (int n, Domain* d) : Material (n,d) {e=1.0; nu=0.15; lambda=1.0; alpha=1.0; c=0.1;}
596
597 void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override {
598 MaterialMode mmode = gp->giveMaterialMode();
599 if (type == TangentStiffness) {
600 double ee;
601
602 ee = e / ( ( 1. + nu ) * ( 1. - 2. * nu ) );
603 answer.resize(6, 6);
604 answer.zero();
605
606 answer.at(1, 1) = 1. - nu;
607 answer.at(1, 2) = nu;
608 answer.at(1, 3) = nu;
609 answer.at(2, 1) = nu;
610 answer.at(2, 2) = 1. - nu;
611 answer.at(2, 3) = nu;
612 answer.at(3, 1) = nu;
613 answer.at(3, 2) = nu;
614 answer.at(3, 3) = 1. - nu;
615
616 answer.at(4, 4) = ( 1. - 2. * nu ) * 0.5;
617 answer.at(5, 5) = ( 1. - 2. * nu ) * 0.5;
618 answer.at(6, 6) = ( 1. - 2. * nu ) * 0.5;
619
620 answer.times(ee);
621 } else if (type == DSigmaDT) {
622 answer.resize(6,1);
623 answer.zero();
624 } else if (type == Conductivity) {
625 if (mmode == _3dMat) {
626 answer.resize(3,3);
627 answer.beUnitMatrix();
628 answer.times(this->lambda);
629 }
630 } else {
631 OOFEM_ERROR("Unknown characteristic matrix type");
632 }
633 }
634
637 void giveCharacteristicVector(FloatArray &answer, FloatArray& flux, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override {
638 TMMaterialStatus *status = static_cast< TMMaterialStatus * >( this->giveStatus(gp) );
639 if (type == Stress) {
640 FloatMatrix d;
641 FloatArray eps(6);
642 for (int i=0; i<6; i++) {
643 eps(i) = flux(i);
644 }
645 double t = flux(9);
646 eps(0)-= t*alpha;
647 eps(1)-= t*alpha;
648 eps(2)-= t*alpha;
649
650 this->giveCharacteristicMatrix(d, TangentStiffness, gp, tStep);
651
652 answer.beProductOf(d, eps);
653 // update gp status
654 status->letTempStrainVectorBe(flux);
655 status->letTempStressVectorBe(answer);
656
657 } else if (type == Flux) {
658 FloatMatrix k;
659 FloatArray grad(3);
660 this->giveCharacteristicMatrix(k, Conductivity, gp, tStep);
661 grad(0) = -flux(6);
662 grad(1) = -flux(7);
663 grad(2) = -flux(8);
664 answer.beProductOf(k, grad);
665 status->letTempFluxVectorBe(answer);
666 } else if (type == IntSource) {
667 answer.resize(1);
668 answer.zero();
669 } else {
670 OOFEM_ERROR("Unknown characteristic vector type");
671 }
672 }
673
674
675 double giveCharacteristicValue(MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override {
676 if (type == BiotConstant) {
677 return alpha;
678 } else if (type == Capacity) {
679 return c;
680 } else {
681 return 0.0;
682 }
683 };
684
695 // void giveInputRecord(DynamicInputRecord &input) override {};
696 void giveInputRecord(DynamicInputRecord &input) override {};
697 std::unique_ptr<MaterialStatus> CreateStatus(GaussPoint *gp) const override { return std::make_unique<TMMaterialStatus>(gp); }
698
699 const char *giveClassName() const override {return "TMSimpleMaterial";}
700 const char *giveInputRecordName() const override {return _IFT_TMSimpleMaterial_Name;}
701 int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override {
702 TMMaterialStatus *status = static_cast< TMMaterialStatus * >( this->giveStatus(gp) );
703 if ( type == IST_StrainTensor ) {
704 answer = status->giveStrainVector();
705 return 1;
706 }
707 if ( type == IST_StressTensor ) {
708 answer = status->giveStressVector();
709 return 1;
710 } else {
711 return Material::giveIPValue(answer, gp, type, tStep);
712 }
713 }
714
715};
716REGISTER_Material(TMSimpleMaterial)
717
718} // end namespace oofem
#define REGISTER_Material(class)
#define REGISTER_Element(class)
momentum balance term (lhs only) (\int (\partial N)^T D (-\alpha\Pi))
evaluates lhs of ∫(𝐡𝑒)𝑇(π‘‘πœŽ(πœ€,𝑇)/𝑑𝑇)
bcType giveType() const override
int giveApproxOrder() override=0
virtual int giveNumberOfDofs()
Definition element.h:239
virtual const FEInterpolation * getGeometryInterpolation() const
Definition element.h:660
int numberOfDofMans
Number of dofmanagers.
Definition element.h:136
std::vector< std ::unique_ptr< IntegrationRule > > integrationRulesArray
Definition element.h:157
int numberOfGaussPoints
Definition element.h:175
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Definition element.h:886
virtual Element_Geometry_Type giveGeometryType() const =0
virtual std::unique_ptr< IntegrationRule > giveBoundaryEdgeIntegrationRule(int order, int boundary, const Element_Geometry_Type) const
Definition feinterpol.C:112
virtual std::unique_ptr< IntegrationRule > giveBoundarySurfaceIntegrationRule(int order, int boundary, const Element_Geometry_Type) const
Definition feinterpol.C:123
int giveInterpolationOrder() const
Definition feinterpol.h:199
virtual double boundarySurfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
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 zero()
Zeroes all coefficients of receiver.
Definition floatarray.C:683
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Definition floatarray.C:476
void subtract(const FloatArray &src)
Definition floatarray.C:320
void times(double s)
Definition floatarray.C:834
void times(double f)
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 zero()
Zeroes all coefficient of receiver.
double at(std::size_t i, std::size_t j) const
void beUnitMatrix()
Sets receiver to unity matrix.
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition gausspoint.h:190
virtual bcGeomType giveBCGeoType() const
virtual int getNumberOfSurfaceDOFs() const =0
virtual void getEdgeLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q) const =0
virtual void getLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q) const
Definition mpm.h:375
virtual int getNumberOfEdgeDOFs() const =0
void integrateSurfaceTerm_c(FloatArray &answer, const Term &term, IntegrationRule *iRule, int isurf, TimeStep *tstep)
Definition mpm.h:329
virtual void getSurfaceLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q) const =0
MPElement(int n, Domain *aDomain)
Definition mpm.h:285
void integrateEdgeTerm_c(FloatArray &answer, const Term &term, IntegrationRule *iRule, int iedge, TimeStep *tstep)
Definition mpm.h:353
void integrateTerm_c(FloatArray &answer, const Term &term, IntegrationRule *iRule, TimeStep *tstep)
Definition mpm.h:305
void integrateSurfaceTerm_dw(FloatMatrix &answer, const Term &term, IntegrationRule *iRule, int isurf, TimeStep *tstep)
Definition mpm.h:317
void integrateTerm_dw(FloatMatrix &answer, const Term &term, IntegrationRule *iRule, TimeStep *tstep)
Definition mpm.h:293
Material(int n, Domain *d)
Definition material.C:46
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Definition material.C:206
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Definition material.C:138
evaluates flux due to convection BC ∫(Nt)a(T-Te)ds, Te being external temperature and a being convect...
A continuity equation compressibility matrix $S=(N_p)^T c\ N_p$, where $c=({\alpha-n}...
A external flux term $S=(N)^T f$, where $f$ is functor evaluating the flux.
A external flux term $S=(N)^T f$, where $f$ is functor evaluating the flux.
A external flux term $S=(N)^T f$, where $f$ is functor evaluating the flux.
A Linear momentum balance equation term ($B^T\sigma(u)$).
3D Equal order linear Brick TS Element
Definition tm.C:324
virtual int giveNumberOfTDofs() const override
Definition tm.C:392
static const FEI3dHexaLin tInterpol
Definition tm.C:328
const char * giveInputRecordName() const override
Definition tm.C:361
void computeGaussPoints() override
Definition tm.C:395
void getEdgeLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q) const override
Definition tm.C:379
int getNumberOfSurfaceDOFs() const override
Definition tm.C:370
const char * giveClassName() const override
Definition tm.C:362
int giveNumberOfDofs() override
Definition tm.C:360
void getSurfaceLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q) const override
Definition tm.C:372
void getDofManLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q, int num) const override
Definition tm.C:342
static const Variable t
Definition tm.C:330
Element_Geometry_Type giveGeometryType() const override
Definition tm.C:367
static const FEI3dHexaLin uInterpol
Definition tm.C:329
virtual const Variable * getU() const override
Definition tm.C:393
TMBrick11(int n, Domain *d)
Definition tm.C:334
virtual const Variable * getT() const override
Definition tm.C:394
virtual int giveNumberOfUDofs() const override
Definition tm.C:391
static const Variable u
Definition tm.C:331
void getInternalDofManLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q, int num) const override
Definition tm.C:353
const FEInterpolation * getGeometryInterpolation() const override
Definition tm.C:365
void giveDofManDofIDMask(int inode, IntArray &answer) const override
Definition tm.C:357
Interface * giveInterface(InterfaceType it) override
Definition tm.C:380
int getNumberOfEdgeDOFs() const override
Definition tm.C:371
Base class for fully coupled, nonlinear thermo mechanical elements.
Definition tm.C:66
int computeFluxLBToLRotationMatrix(FloatMatrix &answer, int iSurf, const FloatArray &lc, const Variable::VariableQuantity q, char btype) override
Definition tm.C:274
virtual int giveNumberOfTDofs() const =0
void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, TimeStep *tStep) override
Definition tm.C:81
void computeBoundaryEdgeLoadVector(FloatArray &answer, BoundaryLoad *load, int boundary, CharType type, ValueModeType mode, TimeStep *tStep, bool global=true) override
Definition tm.C:218
virtual void giveCharacteristicVectorFromBC(FloatArray &answer, CharType type, ValueModeType mode, TimeStep *tStep, GeneralBoundaryCondition *bc, int boundaryID) override
Definition tm.C:161
virtual const Variable * getU() const =0
TMElement(int n, Domain *d)
Definition tm.C:75
virtual int giveNumberOfUDofs() const =0
void giveCharacteristicVector(FloatArray &answer, CharType type, ValueModeType mode, TimeStep *tStep) override
Definition tm.C:111
virtual const Variable * getT() const =0
void computeLoadVector(FloatArray &answer, BodyLoad *load, CharType type, ValueModeType mode, TimeStep *tStep) override
Definition tm.C:252
void computeBoundarySurfaceLoadVector(FloatArray &answer, BoundaryLoad *load, int boundary, CharType type, ValueModeType mode, TimeStep *tStep, bool global=true) override
Definition tm.C:182
void giveCharacteristicMatrixFromBC(FloatMatrix &answer, CharType type, TimeStep *tStep, GeneralBoundaryCondition *bc, int boundaryID) override
Definition tm.C:134
double giveCharacteristicValue(MatResponseMode type, GaussPoint *gp, TimeStep *tStep) const override
Returns characteristic value of the receiver.
Definition tm.C:675
const char * giveClassName() const override
Definition tm.C:699
const char * giveInputRecordName() const override
Definition tm.C:700
void giveCharacteristicVector(FloatArray &answer, FloatArray &flux, MatResponseMode type, GaussPoint *gp, TimeStep *tStep) const override
Definition tm.C:637
void initializeFrom(InputRecord &ir) override
Definition tm.C:685
TMSimpleMaterial(int n, Domain *d)
Definition tm.C:595
std::unique_ptr< MaterialStatus > CreateStatus(GaussPoint *gp) const override
Definition tm.C:697
void giveInputRecord(DynamicInputRecord &input) override
Definition tm.C:696
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
Definition tm.C:701
void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode type, GaussPoint *gp, TimeStep *tStep) const override
Returns characteristic matrix of the receiver.
Definition tm.C:597
oofem::VariableQuantity VariableQuantity
Definition mpm.h:92
const FEInterpolation * interpolation
Definition mpm.h:94
ZZNodalRecoveryModelInterface(Element *element)
Constructor.
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
@ SurfaceLoadBGT
Distributed surface load.
Definition bcgeomtype.h:45
@ EdgeLoadBGT
Distributed edge load.
Definition bcgeomtype.h:44
@ ForceLoadBVT
Definition bcvaltype.h:43
@ ZZNodalRecoveryModelInterfaceType
bcType
Type representing the type of bc.
Definition bctype.h:40
@ TransmissionBC
Neumann type (prescribed flux).
Definition bctype.h:43
@ ConvectionBC
Newton type - transfer coefficient.
Definition bctype.h:44
#define _IFT_TMSimpleMaterial_alpha
#define _IFT_TMSimpleMaterial_nu
#define _IFT_TMSimpleMaterial_c
#define _IFT_TMSimpleMaterial_E
#define _IFT_TMSimpleMaterial_Name
#define _IFT_TMSimpleMaterial_lambda

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