OOFEM 3.0
Loading...
Searching...
No Matches
quad1_ht.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
36#include "fei2dquadlin.h"
37#include "crosssection.h"
38#include "gausspoint.h"
40#include "floatmatrix.h"
41#include "floatarray.h"
42#include "intarray.h"
43#include "mathfem.h"
44#include "classfactory.h"
45
46#ifdef __OOFEG
47 #include "oofeggraphiccontext.h"
48 #include "oofegutils.h"
49#endif
50
51namespace oofem {
55
56FEI2dQuadLin Quad1_ht :: interpolation(1, 2);
57
58Quad1_ht :: Quad1_ht(int n, Domain *aDomain) : TransportElement(n, aDomain, HeatTransferEM), SpatialLocalizerInterface(this), ZZNodalRecoveryModelInterface(this)
59{
62}
63
64Quad1_hmt :: Quad1_hmt(int n, Domain *aDomain) : Quad1_ht(n, aDomain)
65{
67}
68
69Quad1_mt :: Quad1_mt(int n, Domain *aDomain) : Quad1_ht(n, aDomain)
70{
72}
73
74
76Quad1_ht :: giveInterpolation() const { return & interpolation; }
77
78void
79Quad1_ht :: computeGaussPoints()
80{
81 if ( integrationRulesArray.size() == 0 ) {
82 integrationRulesArray.resize( 1 );
83 integrationRulesArray [ 0 ] = std::make_unique<GaussIntegrationRule>(1, this, 1, 3);
84 this->giveCrossSection()->setupIntegrationPoints(* integrationRulesArray [ 0 ], numberOfGaussPoints, this);
85 }
86}
87
88
89void
90Quad1_ht :: initializeFrom(InputRecord &ir, int priority)
91{
92 TransportElement :: initializeFrom(ir, priority);
93}
94
95
96double
97Quad1_ht :: computeVolumeAround(GaussPoint *gp)
98{
99 double determinant = fabs( this->interpolation.giveTransformationJacobian( gp->giveNaturalCoordinates(),
101 double thickness = this->giveCrossSection()->give(CS_Thickness, gp); // 't'
102 return determinant * gp->giveWeight() * thickness;
103}
104
105
106double
107Quad1_ht :: giveThicknessAt(const FloatArray &gcoords)
108{
109 return this->giveCrossSection()->give(CS_Thickness, gcoords, this, false);
110}
111
112
113double
114Quad1_ht :: computeEdgeVolumeAround(GaussPoint *gp, int iEdge)
115{
116 double result = this->interpolation.edgeGiveTransformationJacobian( iEdge, gp->giveNaturalCoordinates(),
119 this->interpolation.edgeLocal2global( gc, iEdge, gp->giveNaturalCoordinates(),
121 // temporary gauss point on element (not edge) to evaluate thickness
122 GaussPoint _gp( NULL, 1, gc, 1.0, gp->giveMaterialMode() );
123 double thick = this->giveCrossSection()->give(CS_Thickness, & _gp); // 't'
124 return result *thick *gp->giveWeight();
125}
126
127Interface *
128Quad1_ht :: giveInterface(InterfaceType interface)
129{
130 if ( interface == SpatialLocalizerInterfaceType ) {
131 return static_cast< SpatialLocalizerInterface * >(this);
132 } else if ( interface == EIPrimaryFieldInterfaceType ) {
133 return static_cast< EIPrimaryFieldInterface * >(this);
134 } else if ( interface == ZZNodalRecoveryModelInterfaceType ) {
135 return static_cast< ZZNodalRecoveryModelInterface * >(this);
136 }
137
138 return nullptr;
139}
140
141
142#ifdef __OOFEG
143void Quad1_ht :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
144{
145 WCRec p [ 4 ];
146 GraphicObj *go;
147
148 if ( !gc.testElementGraphicActivity(this) ) {
149 return;
150 }
151
152 EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
153 EASValsSetColor( gc.getElementColor() );
154 EASValsSetEdgeColor( gc.getElementEdgeColor() );
155 EASValsSetEdgeFlag(true);
156 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
157 EASValsSetFillStyle(FILL_HOLLOW);
158 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
159 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
160 p [ 0 ].z = 0.;
161 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
162 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
163 p [ 1 ].z = 0.;
164 p [ 2 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
165 p [ 2 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
166 p [ 2 ].z = 0.;
167 p [ 3 ].x = ( FPNum ) this->giveNode(4)->giveCoordinate(1);
168 p [ 3 ].y = ( FPNum ) this->giveNode(4)->giveCoordinate(2);
169 p [ 3 ].z = 0.;
170
171 go = CreateQuad3D(p);
172 EGWithMaskChangeAttributes(WIDTH_MASK | FILL_MASK | COLOR_MASK | EDGE_COLOR_MASK | EDGE_FLAG_MASK | LAYER_MASK, go);
173 EGAttachObject(go, ( EObjectP ) this);
174 EMAddGraphicsToModel(ESIModel(), go);
175}
176
177void Quad1_ht :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
178{
179 int i, result = 0;
180 WCRec p [ 4 ];
181 double s [ 4 ];
182 InternalStateType itype = gc.giveIntVarType();
183
184 if ( !gc.testElementGraphicActivity(this) ) {
185 return;
186 }
187
188 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
189
190 if ( itype == IST_HydrationDegree ) {
191 FloatArray v [ 4 ];
192 for ( i = 1; i <= 4; i++ ) {
193 result += this->giveInternalStateAtNode(v [ i - 1 ], gc.giveIntVarType(), gc.giveIntVarMode(), i, tStep);
194 }
195
196 if ( result != 4 ) {
197 return;
198 }
199
200 int indx = gc.giveIntVarIndx();
201
202 for ( i = 1; i <= 4; i++ ) {
203 s [ i - 1 ] = v [ i - 1 ].at(indx);
204 }
205
206 if ( gc.getScalarAlgo() == SA_ISO_SURF ) {
207 for ( i = 0; i < 4; i++ ) {
208 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
209 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
210 p [ i ].z = 0.;
211 }
212
213 gc.updateFringeTableMinMax(s, 4);
214 GraphicObj *tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
215 EGWithMaskChangeAttributes(LAYER_MASK, tr);
216 EMAddGraphicsToModel(ESIModel(), tr);
217 }
218 } else if ( ( ( ( emode == HeatTransferEM ) || ( emode == HeatMass1TransferEM ) ) && ( itype == IST_Temperature ) ) ||
219 ( ( emode == HeatMass1TransferEM ) && ( itype == IST_MassConcentration_1 ) ) ) {
220 IntArray dofMask(1);
221 if ( itype == IST_Temperature ) {
222 dofMask.at(1) = T_f;
223 } else {
224 dofMask.at(1) = C_1;
225 }
226
227 FloatArray r;
228 for ( i = 0; i < 4; i++ ) {
229 this->giveNode(i + 1)->giveUnknownVector(r, dofMask, VM_Total, tStep);
230 s [ i ] = r.at(1);
231
232 p [ i ].x = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(1);
233 p [ i ].y = ( FPNum ) this->giveNode(i + 1)->giveCoordinate(2);
234 p [ i ].z = 0.;
235 }
236
237 gc.updateFringeTableMinMax(s, 4);
238 GraphicObj *tr = CreateQuadWD3D(p, s [ 0 ], s [ 1 ], s [ 2 ], s [ 3 ]);
239 EGWithMaskChangeAttributes(LAYER_MASK, tr);
240 EMAddGraphicsToModel(ESIModel(), tr);
241 }
242}
243
244#endif
245} // end namespace oofem
#define REGISTER_Element(class)
Node * giveNode(int i) const
Definition element.h:629
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
CrossSection * giveCrossSection()
Definition element.C:534
double & at(Index i)
Definition floatarray.h:202
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
double giveWeight()
Returns integration weight of receiver.
Definition gausspoint.h:180
int & at(std::size_t i)
Definition intarray.h:104
Quad1_ht(int n, Domain *d)
Definition quad1_ht.C:58
static FEI2dQuadLin interpolation
Definition quad1_ht.h:55
SpatialLocalizerInterface(Element *element)
TransportElement(int n, Domain *d, ElementMode em=HeatTransferEM)
int giveInternalStateAtNode(FloatArray &answer, InternalStateType type, InternalStateMode mode, int node, TimeStep *tStep) override
ZZNodalRecoveryModelInterface(Element *element)
Constructor.
@ CS_Thickness
Thickness.
@ ZZNodalRecoveryModelInterfaceType
@ EIPrimaryFieldInterfaceType
@ SpatialLocalizerInterfaceType
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
#define OOFEG_VARPLOT_PATTERN_LAYER
#define OOFEG_RAW_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_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