OOFEM 3.0
Loading...
Searching...
No Matches
termlibrary4.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 "termlibrary4.h"
37#include "element.h"
38#include "mathfem.h"
39#include "field.h"
40
41namespace oofem {
42
43NTN::NTN (const Variable *testField, const Variable* unknownField) : Term(testField, unknownField) {}
44
45void NTN::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const {
46 FloatArray Np;
47 this->field->interpolation->evalN(Np, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e));
48 answer.beDyadicProductOf(Np, Np);
49}
50
51void NTN::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const {
52 FloatArray p;
54 cell.getUnknownVector(p, this->field, VM_Velocity, tstep);
55 this->evaluate_lin (S, cell,gp, tstep);
56 answer.beProductOf(S,p);
57}
58
59void NTN::getDimensions(Element& cell) const {
60 //int nnodes = interpol.giveNumberOfNodes();
61 //int ndofs = v.size;
62 //return nnodes*ndofs;
63}
64void NTN::initializeCell(Element& cell) const {}
65
66
67dnTaN::dnTaN (const Variable *testField, const Variable* unknownField, FieldPtr velocity) : Term(testField, unknownField), velocity(velocity) {}
68
69void dnTaN::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const {
70 FloatArray n, gc,lc,a;
71 FloatMatrix dndx;
72 this->testField->interpolation->evaldNdx(dndx, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e));
73 this->field->interpolation->evalN(n, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e));
74 FloatMatrix nm=FloatMatrix::fromArray(n, true), anm;
75 int nsd = this->field->interpolation->giveNsd(e.giveGeometryType());
76 FloatMatrix am(nsd,1);
77 //a.at(2,1)=1.0; // assume 2d flow for now
78 //a.at(1,1)=sqrt(0.5); a.at(2,1)=sqrt(0.5);
79 lc = gp->giveNaturalCoordinates();
81 this->velocity->evaluateAt(a, gc, VM_Total, tstep);
82 for (int i=1; i<=nsd; i++) {
83 am.at(i,1)=a.at(i);
84 }
85 anm.beProductOf(FloatMatrix::fromArray(a), nm);
86 answer.beProductOf(dndx, anm);
87}
88
89void dnTaN::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const {
90 FloatArray p;
92 cell.getUnknownVector(p, this->field, VM_Velocity, tstep);
93 this->evaluate_lin (S, cell,gp, tstep);
94 answer.beProductOf(S,p);
95}
96
97void dnTaN::getDimensions(Element& cell) const {
98 //int nnodes = interpol.giveNumberOfNodes();
99 //int ndofs = v.size;
100 //return nnodes*ndofs;
101}
102void dnTaN::initializeCell(Element& cell) const {}
103
104
105
106
107
108
109
110} // end namespace oofem
virtual const FEInterpolation * getGeometryInterpolation() const
Definition element.h:660
virtual Element_Geometry_Type giveGeometryType() const =0
virtual void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
double & at(Index i)
Definition floatarray.h:202
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
static FloatMatrix fromArray(const FloatArray &vector, bool transpose=false)
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void beDyadicProductOf(const FloatArray &vec1, const FloatArray &vec2)
double at(std::size_t i, std::size_t j) const
const FloatArray & giveNaturalCoordinates() const
Returns coordinate array of receiver.
Definition gausspoint.h:138
Base class for elements based on mp (multi-physics) concept.
Definition mpm.h:282
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
void initializeCell(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)$.
NTN(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 term (the lhs contribution).
const Variable * field
Definition mpm.h:136
const Variable * testField
Definition mpm.h:137
dnTaN(const Variable *testField, const Variable *unknownField, FieldPtr velocity)
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
FieldPtr velocity
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).
#define S(p)
Definition mdm.C:469
std::shared_ptr< Field > FieldPtr
Definition field.h:78
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]

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