OOFEM 3.0
Loading...
Searching...
No Matches
termlibrary3.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#include "mpm.h"
36#include "termlibrary3.h"
37#include "termlibrary2.h"
38#include "element.h"
39#include "material.h"
40#include "crosssection.h"
41
42namespace oofem {
43
44
46
47void TMBTSigTerm::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const {
48 FloatArray eps, sig;
50 this->computeTMgeneralizedStrain(eps, B, cell, gp->giveNaturalCoordinates(), gp->giveMaterialMode(), tstep);
51
52
53 cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(sig, eps, MatResponseMode::Stress, gp, tstep);
54 answer.beTProductOf(B, sig);
55}
56
57void TMBTSigTerm::computeTMgeneralizedStrain (FloatArray& answer, FloatMatrix& B, MPElement& cell, const FloatArray& lcoords, MaterialMode mmode, TimeStep* tstep) const {
58 FloatArray u, gradT;
59 FloatMatrix dndx ;
60 cell.getUnknownVector(u, this->field, VM_TotalIntrinsic, tstep);
61 this->grad(B, this->field, this->field->interpolation, cell, lcoords, mmode);
62 FloatArray Bu;
63 Bu.beProductOf(B, u);
64
65 FloatArray rt, Nt;
66 cell.getUnknownVector(rt, temperatureField, VM_TotalIntrinsic, tstep);
67 // evaluate matrix of derivatives, the member at i,j position contains value of dNi/dxj
68 this->temperatureField->interpolation->evaldNdx(dndx, lcoords, FEIElementGeometryWrapper(&cell));
69 // evaluate temperature gradient at given point
70 gradT.beTProductOf(dndx, rt);
71 // evaluate temperature at given point
72 this->temperatureField->interpolation->evalN(Nt, lcoords, FEIElementGeometryWrapper(&cell));
73 double t = Nt.dotProduct(rt);
74 answer=FloatArray::fromConcatenated({Bu,gradT,Vec1(t)});
75}
76
77TMgNTfTerm::TMgNTfTerm (const Variable *testField, const Variable* unknownField, MatResponseMode lhsType, MatResponseMode rhsType) : gNTfTerm(testField, unknownField, lhsType, rhsType) {}
78void TMgNTfTerm::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const {
79 FloatArray sv(10), Nt, p, gradp, fp;
81 cell.getUnknownVector(p, this->field, VM_TotalIntrinsic, tstep);
82 this->grad(B, this->field, this->field->interpolation, cell, gp->giveNaturalCoordinates());
83 this->field->interpolation->evalN(Nt, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&cell));
84 double t = Nt.dotProduct(p);
85 gradp.beProductOf(B, p);
86 sv(6) = gradp(0);
87 sv(7) = gradp(1);
88 sv(8) = gradp(2);
89 sv(9) = t;
90 cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(fp, sv, rhsType, gp, tstep); // update
91 answer.beTProductOf(B, fp);
92}
93
94
95
96BDalphaPiTerm::BDalphaPiTerm (const Variable *testField, const Variable* unknownField, ValueModeType m) : Term(testField, unknownField), m(m) {}
97
98
100 FloatMatrix D, alphaPi, B, DaPI, BDaPI;
102 // alphaPi term
103 e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, Conductivity, gp, tstep); // 3x3 in 3D
104 // expand it
105 alphaPi.resize(6,1);
106 alphaPi.zero();
107 alphaPi(0,0) = -D(0,0);
108 alphaPi(1,0) = -D(1,1);
109 alphaPi(2,0) = -D(2,2);
110 e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, TangentStiffness, gp, tstep); // 3x3 in 3D
111 evalB(B, this->testField, this->testField->interpolation, e, gp->giveNaturalCoordinates(), gp->giveMaterialMode());
112 this->field->interpolation->evalN(Nt, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e));
113
114 DaPI.beProductOf(D, alphaPi);
115 BDaPI.beTProductOf(B,DaPI);
117 answer.beProductOf(BDaPI,Ntm);
118
119}
120
121void BDalphaPiTerm::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const {
122 // this is a partial linearization of BtSigma term with respect to temperature
123 // thus the residual (rhs) contribution should come from BtSigma term
124 answer.resize(this->testField->interpolation->giveNumberOfNodes(cell.giveGeometryType())*this->testField->size);
125 answer.zero();
126}
127
130
131
132BTdSigmadT::BTdSigmadT (const Variable *testField, const Variable* unknownField) : Term(testField, unknownField) {}
133
134
135void BTdSigmadT::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const {
136 FloatMatrix D, B, DB;
138 // aplhaPi term
139 e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, DSigmaDT, gp, tstep);
140 this->field->interpolation->evalN(Nt, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e));
141 evalB(B, this->testField, this->testField->interpolation, e, gp->giveNaturalCoordinates(), gp->giveMaterialMode());
143 DB.beProductOf(D, Ntm);
144 //answer.plusProductSymmUpper(B, DB, 1.0);
145 answer.beTProductOf(B,DB);
146}
147
148void BTdSigmadT::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const {
149 // this is a partial linearization of BtSigma term with respect to temperature
150 // thus the residual (rhs) contribution should come from BtSigma term
151 answer.resize(this->testField->interpolation->giveNumberOfNodes(cell.giveGeometryType())*this->testField->size);
152 answer.zero();
153}
154
157
158
159NTaTmTe:: NTaTmTe (const Variable *testField, const Variable* unknownField, BoundaryLoad* _bl, int bid, char btype) : Term(testField, unknownField), bl(_bl), boundaryID(bid), boundaryType(btype) {};
160void NTaTmTe::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const {
162 if (boundaryType == 's') {
163 this->testField->interpolation->boundarySurfaceEvalN(Nt, boundaryID, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e));
164 } else {
165 this->testField->interpolation->boundaryEdgeEvalN(Nt, boundaryID, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e));
166 }
167 answer.resize(Nt.giveSize(), Nt.giveSize());
168 answer.zero();
169 answer.plusDyadUnsym(Nt, Nt, this->bl->giveProperty('a', tstep));
170}
171
172void NTaTmTe::evaluate (FloatArray& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const {
173 FloatArray Nt, rt, Te, coords;
174 if (boundaryType == 's') {
175 this->testField->interpolation->boundarySurfaceEvalN(Nt, boundaryID, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e));
176 } else {
177 this->testField->interpolation->boundaryEdgeEvalN(Nt, boundaryID, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e));
178 }
179 // get surface unknown vector
180
181 e.getBoundaryUnknownVector(rt, this->field, VM_TotalIntrinsic, this->boundaryID, this->boundaryType, tstep);
182 double t = Nt.dotProduct(rt);
183 answer= Nt;
184 if ( this->bl->giveFormulationType() == Load :: FT_Entity ) {
185 coords = gp->giveNaturalCoordinates();
186 } else {
187 //this->computeSurfIpGlobalCoords(gcoords, gp->giveNaturalCoordinates(), iSurf);
189 }
190 this->bl->computeValues(Te, tstep, coords, this->field->dofIDs, VM_TotalIntrinsic);
191 answer *= this->bl->giveProperty('a', tstep)*(t-Te.at(1));
192}
193
194void NTaTmTe::getDimensions(Element& cell) const {}
196
198
200 FloatArray eps, n, f;
201 FloatMatrix B, N;
202 this->computeTMgeneralizedStrain(eps, B, cell, gp->giveNaturalCoordinates(), gp->giveMaterialMode(), tstep);
203 cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(f, eps, MatResponseMode::IntSource, gp, tstep);
204 this->testField->interpolation->evalN(n, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&cell));
205 N.beNMatrixOf(n, testField->size);
206 answer.beTProductOf(N, f);
207}
208
209
210} // end namespace oofem
#define N(a, b)
BDalphaPiTerm(const Variable *testField, const Variable *unknownField, ValueModeType m)
void initializeCell(Element &cell) const override
void getDimensions(Element &cell) const override
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Empty, this should be evaluated by BTSigTerm term$.
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates the linearization of $B^T\sigma(u)$, i.e. $B^TDBu$.
BTSigTerm(const Variable *testField, const Variable *unknownField)
void grad(FloatMatrix &answer, const Variable *v, const FEInterpolation *interpol, const Element &cell, const FloatArray &coords, const MaterialMode mmode) const
Evaluates B matrix; i.e. $LN$ where $L$ is operator matrix and $N$ is interpolation matrix of unknown...
Definition termlibrary.C:80
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $b^T\sigma(u)$.
BTdSigmadT(const Variable *testField, const Variable *unknownField)
void getDimensions(Element &cell) const override
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates the linearization of $B^T\sigma(u)$, i.e. $B^TDBu$.
void initializeCell(Element &cell) const override
virtual Material * giveMaterial(IntegrationPoint *ip) const =0
hidden by virtual oofem::Material* TransportCrossSection::giveMaterial() const
virtual const FEInterpolation * getGeometryInterpolation() const
Definition element.h:660
CrossSection * giveCrossSection()
Definition element.C:534
virtual Element_Geometry_Type giveGeometryType() const =0
virtual void boundarySurfaceLocal2global(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
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
static FloatArray fromConcatenated(std::initializer_list< FloatArray > ini)
Definition floatarray.C:146
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:721
static FloatMatrix fromArray(const FloatArray &vector, bool transpose=false)
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void plusDyadUnsym(const FloatArray &a, const FloatArray &b, double dV)
void zero()
Zeroes all coefficient of receiver.
void beTProductOf(const FloatMatrix &a, const FloatMatrix &b)
const FloatArray & giveNaturalCoordinates() const
Returns coordinate array of receiver.
Definition gausspoint.h:138
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition gausspoint.h:190
InternalTMFluxSourceTerm(const Variable *testField, const Variable *unknownField, const Variable *temperatureField)
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $b^T\sigma(u)$.
Base class for elements based on mp (multi-physics) concept.
Definition mpm.h:282
virtual void getBoundaryUnknownVector(FloatArray &answer, const Variable *field, ValueModeType mode, int ibc, char bt, TimeStep *tStep)
Definition mpm.h:425
virtual const void getUnknownVector(FloatArray &answer, const Variable *field, ValueModeType mode, TimeStep *tstep)
Returns vector of nodal unknowns for given Variable.
Definition mpm.h:473
virtual void giveCharacteristicVector(FloatArray &answer, FloatArray &flux, MatResponseMode type, GaussPoint *gp, TimeStep *tStep) const
Returns characteristic vector of the receiver.
Definition material.h:145
virtual void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode type, GaussPoint *gp, TimeStep *tStep) const
Returns characteristic matrix of the receiver.
Definition material.h:140
NTaTmTe(const Variable *testField, const Variable *unknownField, BoundaryLoad *bl, int boundaryID, char boundaryType)
void getDimensions(Element &cell) const override
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates the linearization of $B^T\sigma(u)$, i.e. $B^TDBu$.
BoundaryLoad * bl
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $b^T\sigma(u)$.
void initializeCell(Element &cell) const override
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $b^T\sigma(u)$.
void computeTMgeneralizedStrain(FloatArray &answer, FloatMatrix &B, MPElement &cell, const FloatArray &lcoords, MaterialMode mmode, TimeStep *tstep) const
const Variable * temperatureField
TMBTSigTerm(const Variable *testField, const Variable *unknownField, const Variable *temperatureField)
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$.
TMgNTfTerm(const Variable *testField, const Variable *unknownField, MatResponseMode lhsType, MatResponseMode rhsType)
const Variable * field
Definition mpm.h:136
const Variable * testField
Definition mpm.h:137
MatResponseMode lhsType
Definition termlibrary.h:94
gNTfTerm(const Variable *testField, const Variable *unknownField, MatResponseMode lhsType, MatResponseMode rhsType)
void grad(FloatMatrix &answer, const Variable *v, const FEInterpolation *interpol, const Element &cell, const FloatArray &coords) const
Evaluates B matrix; i.e. $\grad N$ where $N$ is interpolation matrix of unknown (p).
MatResponseMode rhsType
Definition termlibrary.h:94
#define Nt(p, q)
Definition mdm.C:468
void evalB(FloatMatrix &answer, const Variable *v, const FEInterpolation *interpol, const Element &cell, const FloatArray &coords, const MaterialMode mmode)
Evaluates $B$ = matrix;.
static FloatArray Vec1(const double &a)
Definition floatarray.h:605

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