OOFEM 3.0
Loading...
Searching...
No Matches
prototype.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 "element.h"
38#include "gausspoint.h"
39#include "feinterpol.h"
40#include "intarray.h"
41#include "classfactory.h"
42
43// for demo
44#include "fei2dtrlin.h"
46
47
48namespace oofem {
49
50
51class PoissonTerm : public Term {
52 protected:
53 double c;
54 public:
55 PoissonTerm (const Variable* unknownField, const Variable *testField, double c) : Term(unknownField, testField) {
56 this->c = c;
57 }
58
59 void grad(FloatMatrix& answer, const Variable *v, const FEInterpolation* interpol, const Element& cell, const FloatArray& coords) const {
60 interpol->evaldNdx(answer, coords, FEIElementGeometryWrapper(&cell));
61 }
62
63
64 void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep *tstep) const override {
65 const FEInterpolation * si = field->interpolation;
66 const FEInterpolation * ti = testField->interpolation;
67 FloatMatrix bs, bt;
68 this->grad(bs, this->field,si,e,gp->giveNaturalCoordinates());
69 this->grad(bt, this->testField,ti,e,gp->giveNaturalCoordinates());
70
71 FloatMatrix gc, c(2,2);
72 c.at(1,1) = this->c;
73 c.at(2,2) = this->c;
74
75 gc.beProductOf(bs, c);
76 answer.beProductTOf(gc, bt);
77 }
78
79 void evaluate (FloatArray&, MPElement& cell, GaussPoint*gp, TimeStep* tstep) const override {}
80 void getDimensions(Element& cell) const override {}
81 void initializeCell(Element& cell) const override {}
82};
83
84
85
86#define _IFT_PoissonElement_Name "pe"
87
88
89class PoissonElement : public MPElement {
90 protected:
96 public:
98 MPElement(n,d),
99 interpol(1,2),
100 t(&interpol, Variable::VariableQuantity::Temperature, Variable::VariableType::scalar, 3),
101 dt(&interpol, Variable::VariableQuantity::Temperature, Variable::VariableType::scalar, 3, &t),
102 p(&t,&dt,1.0),
103 ir(1, this)
104 {
105 numberOfDofMans = 3;
107 ir.SetUpPointsOnTriangle(numberOfGaussPoints, _2dHeat);
108 }
109
110 // Note: performance can be probably improved once it will be possible
111 // to directly assemble multiple term contributions to the system matrix.
112 // template metaprogramming?
113 void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, TimeStep *tStep) override {
114 if (type == ConductivityMatrix) {
115 FloatMatrix term;
116 answer.resize(3,3);
117 this->integrateTerm_dw (term, this->p, &this->ir, tStep) ;
118 this->assembleTermContribution(answer, term, this->p);
119 answer.printYourself("Conductivity");
120
121 }
122 }
123
124 void getDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int n) const override {
125 answer = {n};
126 }
127 void getInternalDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override {
128 answer={};
129 }
130
131 int getNumberOfSurfaceDOFs() const override {return 0;}
132 int getNumberOfEdgeDOFs() const override {return 0;}
133 void getSurfaceLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {
134 answer.clear();
135 }
136 void getEdgeLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {
137 answer.clear();
138 }
139
140 const char *giveInputRecordName() const override {return "pe";}
141
142 const FEInterpolation* getGeometryInterpolation() const override {return &this->interpol;}
143 Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;}
144
145};
146
147REGISTER_Element(PoissonElement)
148
149
150} // end namespace oofem
#define REGISTER_Element(class)
int numberOfDofMans
Number of dofmanagers.
Definition element.h:136
int numberOfGaussPoints
Definition element.h:175
virtual double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void beProductTOf(const FloatMatrix &a, const FloatMatrix &b)
*Prints matrix to stdout Useful for debugging void printYourself() 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
void assembleTermContribution(FloatMatrix &answer, FloatMatrix &contrib, const Term &t)
Assembles the partial element contribution into local element matrix.
Definition mpm.h:446
MPElement(int n, Domain *aDomain)
Definition mpm.h:285
void integrateTerm_dw(FloatMatrix &answer, const Term &term, IntegrationRule *iRule, TimeStep *tstep)
Definition mpm.h:293
FEI2dTrLin interpol
Definition prototype.C:91
Element_Geometry_Type giveGeometryType() const override
Definition prototype.C:143
PoissonElement(int n, Domain *d)
Definition prototype.C:97
int getNumberOfEdgeDOFs() const override
Definition prototype.C:132
void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, TimeStep *tStep) override
Definition prototype.C:113
const FEInterpolation * getGeometryInterpolation() const override
Definition prototype.C:142
void getDofManLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q, int n) const override
Definition prototype.C:124
void getEdgeLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q) const override
Definition prototype.C:136
int getNumberOfSurfaceDOFs() const override
Definition prototype.C:131
void getSurfaceLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q) const override
Definition prototype.C:133
GaussIntegrationRule ir
Definition prototype.C:95
const char * giveInputRecordName() const override
Definition prototype.C:140
void getInternalDofManLocalCodeNumbers(IntArray &answer, const Variable::VariableQuantity q, int num) const override
Definition prototype.C:127
void evaluate_lin(FloatMatrix &answer, MPElement &e, GaussPoint *gp, TimeStep *tstep) const override
Definition prototype.C:64
void initializeCell(Element &cell) const override
Definition prototype.C:81
void grad(FloatMatrix &answer, const Variable *v, const FEInterpolation *interpol, const Element &cell, const FloatArray &coords) const
Definition prototype.C:59
void getDimensions(Element &cell) const override
Definition prototype.C:80
void evaluate(FloatArray &, MPElement &cell, GaussPoint *gp, TimeStep *tstep) const override
Definition prototype.C:79
PoissonTerm(const Variable *unknownField, const Variable *testField, double c)
Definition prototype.C:55
const Variable * field
Definition mpm.h:136
const Variable * testField
Definition mpm.h:137
oofem::VariableQuantity VariableQuantity
Definition mpm.h:92
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