OOFEM 3.0
Loading...
Searching...
No Matches
intelline1.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
37#include "node.h"
38#include "gausspoint.h"
40#include "lobattoir.h"
41#include "floatmatrix.h"
42#include "floatarray.h"
43#include "intarray.h"
44#include "mathfem.h"
45#include "fei2dlinelin.h"
46#include "classfactory.h"
48#include "parametermanager.h"
49#include "paramkey.h"
50
51#ifdef __OOFEG
52 #include "oofeggraphiccontext.h"
53 #include <Emarkwd3d.h>
54#endif
55
56namespace oofem {
59
60FEI2dLineLin IntElLine1 :: interp(1, 1);
61
62
63IntElLine1 :: IntElLine1(int n, Domain *aDomain) :
65{
68}
69
70
71void
72IntElLine1 :: computeNmatrixAt(GaussPoint *ip, FloatMatrix &answer)
73{
74 // Returns the modified N-matrix which multiplied with u give the spatial jump.
75 auto N = interp.evalN(ip->giveNaturalCoordinates().at(1));
76
77 answer.resize(2, 8);
78 answer.zero();
79 answer.at(1, 1) = answer.at(2, 2) = -N.at(1);
80 answer.at(1, 3) = answer.at(2, 4) = -N.at(2);
81
82 answer.at(1, 5) = answer.at(2, 6) = N.at(1);
83 answer.at(1, 7) = answer.at(2, 8) = N.at(2);
84}
85
86
87void
88IntElLine1 :: computeGaussPoints()
89{
90 if ( integrationRulesArray.size() == 0 ) {
91 integrationRulesArray.resize( 1 );
92
93// integrationRulesArray[ 0 ] = std::make_unique<LobattoIntegrationRule>(1,this, 1, 2, false);
94// integrationRulesArray [ 0 ]->SetUpPointsOnLine(2, _2dInterface);
95
96 integrationRulesArray [ 0 ] = std::make_unique<GaussIntegrationRule>(1, this, 1, 2);
97 integrationRulesArray [ 0 ]->SetUpPointsOnLine(this->numberOfGaussPoints, _2dInterface);
98 }
99}
100
102IntElLine1 :: computeCovarBaseVectorAt(IntegrationPoint *ip) const
103{
105 FloatMatrix dNdxi;
106 interp->evaldNdxi( dNdxi, ip->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) );
107
109 int numNodes = this->giveNumberOfNodes();
110 for ( int i = 1; i <= dNdxi.giveNumberOfRows(); i++ ) {
111 double X1_i = 0.5 * ( this->giveNode(i)->giveCoordinate(1) + this->giveNode(i + numNodes / 2)->giveCoordinate(1) ); // (mean) point on the fictious mid surface
112 double X2_i = 0.5 * ( this->giveNode(i)->giveCoordinate(2) + this->giveNode(i + numNodes / 2)->giveCoordinate(2) );
113 G.at(1) += dNdxi.at(i, 1) * X1_i;
114 G.at(2) += dNdxi.at(i, 1) * X2_i;
115 }
116 return G;
117}
118
119double
120IntElLine1 :: computeAreaAround(IntegrationPoint *ip)
121{
122 auto G = this->computeCovarBaseVectorAt(ip);
123
124 double weight = ip->giveWeight();
125 double ds = norm(G) * weight;
126 if ( this->axisymmode ) {
127 int numNodes = this->giveNumberOfNodes();
128 auto N = this->interp.evalN(ip->giveNaturalCoordinates().at(1));
129 // interpolate radius
130 double r = 0.0;
131 for ( int i = 1; i <= N.giveSize(); i++ ) {
132 double X_i = 0.5 * ( this->giveNode(i)->giveCoordinate(1) + this->giveNode(i + numNodes / 2)->giveCoordinate(1) ); // X-coord of the fictious mid surface
133 r += N.at(i) * X_i;
134 }
135 return ds * r;
136 } else { // regular 2d
137 double thickness = this->giveCrossSection()->give(CS_Thickness, ip);
138 return ds * thickness;
139 }
140}
141
142
143void
144IntElLine1 :: initializeFrom(InputRecord &ir, int priority)
145{
146 StructuralInterfaceElement :: initializeFrom(ir, priority);
147 ParameterManager &ppm = domain->elementPPM;
149}
150
152{
153 StructuralInterfaceElement :: postInitialize();
154 // Check if node numbering is ok
155 int nodeInd1 = this->giveDofManagerNumber(1);
156 int arrayInd1 = domain->giveDofManPlaceInArray(nodeInd1);
157 DofManager *node1 = domain->giveDofManager(arrayInd1);
158 const auto &x1 = node1->giveCoordinates();
159
160// DofManager *node2 = this->giveDofManager(2);
161 int nodeInd2 = this->giveDofManagerNumber(2);
162 int arrayInd2 = domain->giveDofManPlaceInArray(nodeInd2);
163 DofManager *node2 = domain->giveDofManager(arrayInd2);
164 const auto &x2 = node2->giveCoordinates();
165
166// DofManager *node3 = this->giveDofManager(3);
167 int nodeInd3 = this->giveDofManagerNumber(3);
168 int arrayInd3 = domain->giveDofManPlaceInArray(nodeInd3);
169 DofManager *node3 = domain->giveDofManager(arrayInd3);
170 const auto &x3 = node3->giveCoordinates();
171
172
173 double L2 = distance_square(x1, x2);
174 double L3 = distance_square(x1, x3);
175
176 if ( L2 < L3 ) {
177 printf("Renumbering element %d\n.\n", this->giveNumber());
178 dofManArray = {dofManArray.at(3), dofManArray.at(1), dofManArray.at(4), dofManArray.at(2)};
179 }
180}
181
182void
183IntElLine1 :: giveDofManDofIDMask(int inode, IntArray &answer) const
184{
185 answer = {D_u, D_v};
186}
187
188void
189IntElLine1 :: computeTransformationMatrixAt(GaussPoint *gp, FloatMatrix &answer)
190{
191 // Transformation matrix to the local coordinate system
192 // xy plane
193 auto G = this->computeCovarBaseVectorAt(gp);
194 G /= norm(G);
195
196 answer.resize(2, 2);
197// answer.at(1, 1) = G.at(1);//tangent vector
198// answer.at(2, 1) = -G.at(2);
199// answer.at(1, 2) = G.at(2);
200// answer.at(2, 2) = G.at(1);
201 //normal is -G.at(2), G.at(1), perpendicular to nodes 1 2
202 answer.at(1, 1) = -G.at(2);//normal vector
203 answer.at(2, 1) = G.at(1);
204 answer.at(1, 2) = G.at(1);
205 answer.at(2, 2) = G.at(2);
206}
207
209IntElLine1 :: giveInterpolation() const
210{
211 return & interp;
212}
213
214
216{
217 if ( interface == NodalAveragingRecoveryModelInterfaceType ) {
218 return static_cast<NodalAveragingRecoveryModelInterface *>(this);
219 } else {
220 return nullptr;
221 }
222}
223
225{
226 FloatArray nodeMap, gpValsA, gpValsB, N, locCoord;
227 nodeMap.resize(1);
228
230
231 //Since it's linear interpolation, it suffices to take first and last Gauss point
232 //and recover nodal values using only them.
233
234 GaussPoint* gpA = integrationRulesArray[0]->getIntegrationPoint(0);
235 GaussPoint* gpB = integrationRulesArray[0]->getIntegrationPoint(numberOfGaussPoints-1);
236
237 //Get internal values at Gauss Points A and B
238 this->giveIPValue(gpValsA, gpA, type, tStep);
239 this->giveIPValue(gpValsB, gpB, type, tStep);
240
241 if ( (node == 1 ) || (node == 3) ) { //nodes 1 and 3 pertain to gpA
242 locCoord = gpA->giveNaturalCoordinates();
243 } else if ( (node == 2 ) || (node == 4) ) { //nodes 2 and 4 pertain to gpB
244 locCoord = gpB->giveNaturalCoordinates();
245 }
246
247 nodeMap.at(1) = 1/locCoord.at(1);
248 //Evaluate shape functions (associated with Gauss Points) at element nodes
249 interp->evalN( N, nodeMap, FEIElementGeometryWrapper(this) );
250 answer.resize( gpValsA.giveSize() );
251 answer.at(1)= N.at(1)*gpValsA.at(1) + N.at(2)*gpValsB.at(1);
252 answer.at(2)= N.at(1)*gpValsA.at(2) + N.at(2)*gpValsB.at(2);
253 answer.at(3)= N.at(1)*gpValsA.at(3) + N.at(2)*gpValsB.at(3);
254}
255
256
257#ifdef __OOFEG
258void IntElLine1 :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
259{
260 GraphicObj *go;
261 // if (!go) { // create new one
262 WCRec p [ 2 ]; /* poin */
263 if ( !gc.testElementGraphicActivity(this) ) {
264 return;
265 }
266
267 EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
268 EASValsSetColor( gc.getElementColor() );
269 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
270 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
271 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
272 p [ 0 ].z = 0.0;
273 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
274 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
275 p [ 1 ].z = 0.0;
276 go = CreateLine3D(p);
277 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
278 EGAttachObject(go, ( EObjectP ) this);
279 EMAddGraphicsToModel(ESIModel(), go);
280}
281
282
283void IntElLine1 :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
284{
285 GraphicObj *go;
286 // if (!go) { // create new one
287 WCRec p [ 2 ]; /* poin */
288 if ( !gc.testElementGraphicActivity(this) ) {
289 return;
290 }
291
292 double defScale = gc.getDefScale();
293
294 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
295 EASValsSetColor( gc.getDeformedElementColor() );
296 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER + 1);
297 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
298 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
299 p [ 0 ].z = 0.0;
300 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
301 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
302 p [ 1 ].z = 0.0;
303 go = CreateLine3D(p);
304 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
305 EMAddGraphicsToModel(ESIModel(), go);
306
307 p [ 0 ].x = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(1, tStep, defScale);
308 p [ 0 ].y = ( FPNum ) this->giveNode(3)->giveUpdatedCoordinate(2, tStep, defScale);
309 p [ 0 ].z = 0.0;
310 p [ 1 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
311 p [ 1 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
312 p [ 1 ].z = 0.0;
313 go = CreateLine3D(p);
314 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
315 EMAddGraphicsToModel(ESIModel(), go);
316}
317
318
319void IntElLine1 :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
320{
321 int indx, result = 0;
323 FloatArray gcoord(3), v1;
324 WCRec p [ 1 ];
325 GraphicObj *go;
326 double val [ 1 ];
327
328 if ( !gc.testElementGraphicActivity(this) ) {
329 return;
330 }
331
332 if ( gc.giveIntVarMode() == ISM_recovered ) {
333 return;
334 }
335
336 for ( GaussPoint *gp: *iRule ) {
337 result = 0;
338 result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
339 if ( result != 1 ) {
340 continue;
341 }
342
343 indx = gc.giveIntVarIndx();
344
345 result += this->computeGlobalCoordinates( gcoord, gp->giveNaturalCoordinates() );
346
347 p [ 0 ].x = ( FPNum ) gcoord.at(1);
348 p [ 0 ].y = ( FPNum ) gcoord.at(2);
349 p [ 0 ].z = 0.;
350
351 val [ 0 ] = v1.at(indx);
352 gc.updateFringeTableMinMax(val, 1);
353 //if (val[0] > 0.) {
354
355 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
356 EASValsSetMType(FILLED_CIRCLE_MARKER);
357 go = CreateMarkerWD3D(p, val [ 0 ]);
358 EGWithMaskChangeAttributes(LAYER_MASK | FILL_MASK | MTYPE_MASK, go);
359 EMAddGraphicsToModel(ESIModel(), go);
360 //}
361 }
362}
363
364#endif
365
366} // end namespace oofem
#define N(a, b)
#define REGISTER_Element(class)
const FloatArray & giveCoordinates() const
Definition dofmanager.h:390
Node * giveNode(int i) const
Definition element.h:629
IntArray dofManArray
Array containing dofmanager numbers.
Definition element.h:138
virtual int giveNumberOfNodes() const
Definition element.h:703
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
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Definition element.h:886
int giveDofManagerNumber(int i) const
Definition element.h:609
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
int number
Component number.
Definition femcmpnn.h:77
int giveNumber() const
Definition femcmpnn.h:104
double & at(std::size_t i)
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void zero()
Zeroes all coefficient of receiver.
int giveNumberOfRows() const
Returns number of rows of receiver.
double at(std::size_t i, std::size_t j) const
const FloatArray & giveNaturalCoordinates() const
Returns coordinate array of receiver.
Definition gausspoint.h:138
double giveWeight()
Returns integration weight of receiver.
Definition gausspoint.h:180
virtual FloatArrayF< 2 > computeCovarBaseVectorAt(GaussPoint *gp) const
Definition intelline1.C:102
static ParamKey IPK_IntElLine1_axisymmode
Definition intelline1.h:65
void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep) override
Definition intelline1.C:224
bool axisymmode
Flag controlling axisymmetric mode (integration over unit circumferential angle).
Definition intelline1.h:63
Interface * giveInterface(InterfaceType interface) override
Definition intelline1.C:215
static FEI2dLineLin interp
Definition intelline1.h:61
FEInterpolation * giveInterpolation() const override
Definition intelline1.C:209
void postInitialize() override
Performs post initialization steps.
Definition intelline1.C:151
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) override
double norm(const FloatArray &x)
@ CS_Thickness
Thickness.
GaussPoint IntegrationPoint
Definition gausspoint.h:272
@ NodalAveragingRecoveryModelInterfaceType
double distance_square(const FloatArray &x, const FloatArray &y)
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
#define OOFEG_VARPLOT_PATTERN_LAYER
#define OOFEG_DEFORMED_GEOMETRY_LAYER
#define OOFEG_DEFORMED_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_WIDTH
#define OOFEG_RAW_GEOMETRY_LAYER
#define PM_UPDATE_PARAMETER(_val, _pm, _ir, _componentnum, _paramkey, _prio)

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