OOFEM 3.0
Loading...
Searching...
No Matches
termlibrary.h
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#ifndef termlibrary_h
35#define termlibrary_h
36
37#include "mpm.h"
38#include "boundaryload.h"
39#include "bodyload.h"
40
41namespace oofem {
42
43#define _IFT_BTamNTerm_Name "BTamNTerm"
44#define _IFT_NTamTBTerm_Name "NTamTBTerm"
45#define _IFT_NTcN_Name "NTcN"
46
47
52class BTSigTerm : public Term {
53 protected:
54 public:
55 BTSigTerm (const Variable *testField, const Variable* unknownField) ;
56
64 void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override;
71 void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override;
72 void getDimensions(Element& cell) const override;
73 void initializeCell(Element& cell) const override;
74
75 protected:
85 void grad(FloatMatrix& answer, const Variable *v, const FEInterpolation* interpol, const Element& cell, const FloatArray& coords, const MaterialMode mmode) const ;
86
87};
88
92class gNTfTerm : public Term {
93 protected:
94 MatResponseMode lhsType, rhsType;
95 public:
96 gNTfTerm (const Variable *testField, const Variable* unknownField, MatResponseMode lhsType, MatResponseMode rhsType) ;
97
105 void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override;
112 void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override;
113 void getDimensions(Element& cell) const override;
114 void initializeCell(Element& cell) const override;
115
116 protected:
126 void grad(FloatMatrix& answer, const Variable *v, const FEInterpolation* interpol, const Element& cell, const FloatArray& coords) const ;
127
128};
129
134 protected:
135 MatResponseMode aType = BiotConstant;
136 public:
138 BTamNTerm (const Variable *testField, const Variable* unknownField, MatResponseMode at = BiotConstant) ;
139
147 void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override;
154 void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override;
155 void getDimensions(Element& cell) const override;
156 void initializeFrom(InputRecord &ir, EngngModel* problem) override {
158 int value = 0;
159 IR_GIVE_FIELD(ir, value, "atype");
160 aType = static_cast<MatResponseMode>(value);
161 }
162
163
164 protected:
174 void grad(FloatMatrix& answer, const Variable *v, const FEInterpolation* interpol, const Element& cell, const FloatArray& coords, const MaterialMode mmode) const ;
175
176};
177
182 protected:
183 MatResponseMode aType = BiotConstant;
184 ValueModeType unknownFieldVMT = VM_Velocity;
185 public:
187 NTamTBTerm (const Variable *testField, const Variable* unknownField, MatResponseMode at = BiotConstant, ValueModeType unknownFieldVMT = VM_Velocity) ;
188
196 void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override;
203 void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override;
204 void getDimensions(Element& cell) const override;
205 void initializeFrom(InputRecord &ir, EngngModel* problem) override {
207 int value = 0;
208 IR_GIVE_FIELD(ir, value, "atype");
209 aType = static_cast<MatResponseMode>(value);
210
211 value = unknownFieldVMT; // VM_Velocity
212 IR_GIVE_OPTIONAL_FIELD(ir, value, "uvmt" );
213 unknownFieldVMT = static_cast<ValueModeType>(value);
214 }
215 protected:
225 void grad(FloatMatrix& answer, const Variable *v, const FEInterpolation* interpol, const Element& cell, const FloatArray& coords, const MaterialMode mmode) const ;
226
227};
228
229
233class NTcN : public MPMSymbolicTerm {
234 protected:
235 MatResponseMode ctype;
236 ValueModeType unknownFieldVMT = VM_Velocity;
237 public:
239 NTcN (const Variable *testField, const Variable* unknownField, MatResponseMode ctype, ValueModeType uFieldVMT = VM_Velocity) ;
240
248 void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override;
255 void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override;
256 void getDimensions(Element& cell) const override;
257 void initializeFrom(InputRecord &ir, EngngModel* problem) override {
259 int value = 0;
260 IR_GIVE_FIELD(ir, value, "ctype");
261 ctype = static_cast<MatResponseMode>(value);
262
263 value = unknownFieldVMT; // VM_Velocity
264 IR_GIVE_OPTIONAL_FIELD(ir, value, "uvmt" );
265 unknownFieldVMT = static_cast<ValueModeType>(value);
266 }
267
268};
269
275 public:
276 virtual void evaluate(FloatArray& answer, const FloatArray& coords, MPElement& cell, const Variable *testField, TimeStep* tStep) const = 0;
277};
278
279
281 protected:
284 int isurf;
285 char type; // indicates boundary type: 'e' for edge, 's' for surface
286 public:
287 BoundaryFluxFunctor(BoundaryLoad *load, int surf, const IntArray& dofIDs, char btype) : load(load), dofIDs(dofIDs), isurf(surf), type(btype) {}
288
289 void evaluate(FloatArray& answer, const FloatArray& lcoords, MPElement& cell, const Variable *testField, TimeStep* tStep) const override {
290
291 ValueModeType mode = VM_Total;
292 if ( load->giveFormulationType() == Load :: FT_Entity ) {
293 load->computeValues(answer, tStep, lcoords, dofIDs, mode);
294 } else {
295 FloatArray globalIPcoords;
296 testField->interpolation->local2global(globalIPcoords, lcoords, FEIElementGeometryWrapper(&cell) );
297 load->computeValues(answer, tStep, globalIPcoords, dofIDs, mode);
298 }
299
301 // We always want the global values in the end, so we might as well compute them here directly:
302 // transform force
303 if ( load->giveCoordSystMode() == Load :: CST_Global ) {
304 // then just keep it in global c.s
305 } else {
306 FloatMatrix T;
307 // then to global c.s
308 if ( cell.computeFluxLBToLRotationMatrix(T, isurf, lcoords, testField->q, type )) {
309 answer.rotatedWith(T, 'n');
310 }
311 }
312 }
313};
314
316 protected:
319 public:
321
322 void evaluate(FloatArray& answer, const FloatArray& lcoords, MPElement& cell, const Variable *testField, TimeStep* tStep) const override {
323
324 ValueModeType mode = VM_Total;
325 if ( load->giveFormulationType() == Load :: FT_Entity ) {
326 load->computeValues(answer, tStep, lcoords, dofIDs, mode);
327 } else {
328 FloatArray globalIPcoords;
329 testField->interpolation->local2global(globalIPcoords, lcoords, FEIElementGeometryWrapper(&cell) );
330 load->computeValues(answer, tStep, globalIPcoords, dofIDs, mode);
331 }
332
334 // We always want the global values in the end, so we might as well compute them here directly:
335 // transform force
336 if ( load->giveCoordSystMode() == Load :: CST_Global ) {
337 // then just keep it in global c.s
338 } else {
339 OOFEM_ERROR("Body load in local coordinate system not supported yet.")
340 }
341 }
342};
343
344
348class NTf_Surface : public Term {
349 protected:
350 const NTfFunctor& f;
351 int isurf;
352 public:
353 NTf_Surface (const Variable *testField, const NTfFunctor& f, int surf) ;
354
362 void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override {}
369 void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override ;
370 void getDimensions(Element& cell) const override {}
371 void initializeCell(Element& cell) const override {}
372
373};
374
378class NTf_Edge : public Term {
379 protected:
380 const NTfFunctor& f;
381 int isurf;
382 public:
383 NTf_Edge (const Variable *testField, const NTfFunctor& f, int surf) ;
384
392 void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override {}
399 void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override ;
400 void getDimensions(Element& cell) const override {}
401 void initializeCell(Element& cell) const override {}
402
403};
404
408class NTf_Body : public Term {
409 protected:
410 const NTfFunctor& f;
411 public:
412 NTf_Body (const Variable *testField, const NTfFunctor& f) ;
413
421 void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override {}
428 void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override ;
429 void getDimensions(Element& cell) const override {}
430 void initializeCell(Element& cell) const override {}
431
432};
433
434} // end namespace oofem
435#endif // termlibrary_h
void initializeCell(Element &cell) const override
Definition termlibrary.C:78
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$.
Definition termlibrary.C:54
BTSigTerm(const Variable *testField, const Variable *unknownField)
void getDimensions(Element &cell) const override
Definition termlibrary.C:73
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $b^T\sigma(u)$.
Definition termlibrary.C:63
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
MatResponseMode aType
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$.
void getDimensions(Element &cell) const override
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. $\grad N$ where $N$ is interpolation matrix of unknown (p).
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates the linearization of receiver, i.e. the LHS term.
void initializeFrom(InputRecord &ir, EngngModel *problem) override
BodyFluxFunctor(BodyLoad *load, const IntArray &dofIDs)
void evaluate(FloatArray &answer, const FloatArray &lcoords, MPElement &cell, const Variable *testField, TimeStep *tStep) const override
void evaluate(FloatArray &answer, const FloatArray &lcoords, MPElement &cell, const Variable *testField, TimeStep *tStep) const override
BoundaryFluxFunctor(BoundaryLoad *load, int surf, const IntArray &dofIDs, char btype)
virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
void rotatedWith(FloatMatrix &r, char mode)
Definition floatarray.C:814
Base class for elements based on mp (multi-physics) concept.
Definition mpm.h:282
virtual int computeFluxLBToLRotationMatrix(FloatMatrix &answer, int iSurf, const FloatArray &lc, const Variable::VariableQuantity q, char btype)
Definition mpm.h:514
void initializeFrom(InputRecord &ir, EngngModel *problem) override
Definition mpm.h:168
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates the linearization of receiver, i.e. the LHS term.
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. $\grad N$ where $N$ is interpolation matrix of unknown (p).
MatResponseMode aType
void getDimensions(Element &cell) const override
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$.
ValueModeType unknownFieldVMT
void initializeFrom(InputRecord &ir, EngngModel *problem) override
MatResponseMode ctype
ValueModeType unknownFieldVMT
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates the linearization of term (the lhs contribution).
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$.
void getDimensions(Element &cell) const override
void initializeFrom(InputRecord &ir, EngngModel *problem) override
An external flux functor.
virtual void evaluate(FloatArray &answer, const FloatArray &coords, MPElement &cell, const Variable *testField, TimeStep *tStep) const =0
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$.
void getDimensions(Element &cell) const override
const NTfFunctor & f
void initializeCell(Element &cell) const override
NTf_Body(const Variable *testField, const NTfFunctor &f)
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates the linearization of term (the lhs contribution).
void getDimensions(Element &cell) const override
void initializeCell(Element &cell) const override
NTf_Edge(const Variable *testField, const NTfFunctor &f, int surf)
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates the linearization of term (the lhs contribution).
const NTfFunctor & f
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$.
const NTfFunctor & f
void getDimensions(Element &cell) const override
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates the linearization of term (the lhs contribution).
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$.
NTf_Surface(const Variable *testField, const NTfFunctor &f, int surf)
void initializeCell(Element &cell) const override
const Variable * testField
Definition mpm.h:137
const FEInterpolation * interpolation
Definition mpm.h:94
VariableQuantity q
Definition mpm.h:97
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
void getDimensions(Element &cell) const override
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$.
void initializeCell(Element &cell) const override
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Evaluates $\bf{H}$ matrix, the linearization of $w^T(\grad N)^T f(p)$, i.e. $(\grad N)^T \bf{k}...
#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

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