OOFEM 3.0
Loading...
Searching...
No Matches
interfaceelement1d.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 "interfaceelement1d.h"
36#include "domain.h"
37#include "node.h"
39#include "floatmatrix.h"
40#include "floatarray.h"
41#include "intarray.h"
42#include "mathfem.h"
43#include "feinterpol.h"
45#include "classfactory.h"
46#include "floatmatrixf.h"
47#include "parametermanager.h"
48#include "paramkey.h"
49
50#ifdef __OOFEG
51 #include "oofeggraphiccontext.h"
52
53 #include <Emarkwd3d.h>
54#endif
55
56namespace oofem {
61
62InterfaceElem1d :: InterfaceElem1d(int n, Domain *aDomain) :
63 StructuralElement(n, aDomain)
64{
66 referenceNode = 0;
67 normal.resize(3);
68 normal.zero();
69}
70
71
72void
73InterfaceElem1d :: setCoordMode()
74{
75 switch ( domain->giveNumberOfSpatialDimensions() ) {
76 case 1:
77 this->mode = ie1d_1d;
78 break;
79 case 2:
80 this->mode = ie1d_2d;
81 break;
82 case 3:
83 this->mode = ie1d_3d;
84 break;
85 default:
86 OOFEM_ERROR("Unsupported domain type")
87 }
88}
89
90
91void
92InterfaceElem1d :: computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep)
93{
95 switch ( mode ) {
96 case ie1d_1d: answer = FloatArray{static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->giveEngTraction_1d(strain.at(1), gp, tStep)}; return;
97 case ie1d_2d: answer = static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->giveEngTraction_2d(strain, gp, tStep); return;
98 case ie1d_3d: answer = static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->giveEngTraction_3d(strain, gp, tStep); return;
99 }
100}
101
102
103void
104InterfaceElem1d :: computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep)
105{
106 setCoordMode();
107 switch ( mode ) {
108 case ie1d_1d: answer = static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->give1dStiffnessMatrix_Eng(rMode, gp, tStep); return;
109 case ie1d_2d: answer = static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->give2dStiffnessMatrix_Eng(rMode, gp, tStep); return;
110 case ie1d_3d: answer = static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->give3dStiffnessMatrix_Eng(rMode, gp, tStep); return;
111 }
112}
113
114
115
116MaterialMode
117InterfaceElem1d :: giveMaterialMode()
118{
119 setCoordMode();
120 switch ( mode ) {
121 case ie1d_1d: return _1dInterface;
122
123 case ie1d_2d: return _2dInterface;
124
125 case ie1d_3d: return _3dInterface;
126
127 default: OOFEM_ERROR("Unsupported coord mode");
128 }
129 //return _1dInterface; // to make the compiler happy
130}
131
132
133void
134InterfaceElem1d :: computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep)
135// Returns the lumped mass matrix (which is zero matrix) of the receiver. This expression is
136// valid in both local and global axes.
137{
138 int ndofs = this->computeNumberOfDofs();
139 answer.resize(ndofs, ndofs);
140 answer.zero();
141}
142
143
144void
145InterfaceElem1d :: computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int li, int ui)
146//
147// Returns linear part of geometrical equations of the receiver at gp.
148// Returns the linear part of the B matrix
149//
150{
151 setCoordMode();
152 //double area = this->giveCrossSection()->give(CS_Area);
153 double area = 1.;
155 FloatMatrix bLoc, lcs;
157 switch ( mode ) {
158 case ie1d_1d:
159 bLoc.resize(1, 2);
160 bLoc.at(1, 1) = -1.0;
161 bLoc.at(1, 2) = +1.0;
162 break;
163 case ie1d_2d:
164 bLoc.resize(2, 4);
165 bLoc.zero();
166 bLoc.at(1, 1) = -1.0;
167 bLoc.at(1, 3) = +1.0;
168 bLoc.at(2, 2) = -1.0;
169 bLoc.at(2, 4) = +1.0;
170 break;
171 case ie1d_3d:
172 bLoc.resize(3, 6);
173 bLoc.zero();
174 bLoc.at(1, 1) = -1.0;
175 bLoc.at(1, 4) = +1.0;
176 bLoc.at(2, 2) = -1.0;
177 bLoc.at(2, 5) = +1.0;
178 bLoc.at(3, 3) = -1.0;
179 bLoc.at(3, 6) = +1.0;
180 break;
181 default:
182 OOFEM_ERROR("unsupported mode");
183 }
184
185 bLoc.times(area);
186 answer.beProductOf(lcs, bLoc);
187}
188
189
190void
191InterfaceElem1d :: evaluateLocalCoordinateSystem(FloatMatrix &lcs)
192//
193// Computes unit vectors of local coordinate system, stored by rows.
194//
195{
196 setCoordMode();
197 switch ( mode ) {
198 case ie1d_1d:
199 lcs.resize(1, 1);
200 lcs.at(1, 1) = 1.;
201 return;
202
203 case ie1d_2d:
204 lcs.resize(2, 2);
205 lcs.at(1, 1) = normal.at(1);
206 lcs.at(1, 2) = normal.at(2);
207 lcs.at(2, 1) = -normal.at(2);
208 lcs.at(2, 2) = normal.at(1);
209 return;
210
211 case ie1d_3d:
212 {
213 FloatArray ly(3), lz(3);
214 normal.normalize();
215 ly.zero();
216 if ( fabs( normal.at(1) ) > fabs( normal.at(2) ) ) {
217 ly.at(2) = 1.;
218 } else {
219 ly.at(1) = 1.;
220 }
221
223 lz.normalize();
224 ly.beVectorProductOf(lz, normal);
225 ly.normalize();
226
227 lcs.resize(3, 3);
228 int i;
229 for ( i = 1; i <= 3; i++ ) {
230 lcs.at(1, i) = normal.at(i);
231 lcs.at(2, i) = ly.at(i);
232 lcs.at(3, i) = lz.at(i);
233 }
234
235 return;
236 }
237
238 default:
239 OOFEM_ERROR("unsupported mode");
240 }
241}
242
243
244void
245InterfaceElem1d :: computeGaussPoints()
246// Sets up the array of Gauss Points of the receiver.
247{
248 if ( integrationRulesArray.size() == 0 ) {
249 integrationRulesArray.resize( 1 );
250 integrationRulesArray [ 0 ] = std::make_unique<GaussIntegrationRule>(1, this, 1, 2);
251 integrationRulesArray [ 0 ]->SetUpPointsOnLine(1, this->giveMaterialMode() );
252 }
253}
254
255
256int
257InterfaceElem1d :: computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
258{
259 answer = this->giveNode(1)->giveCoordinates();
260
261 return 1;
262}
263
264
265bool
266InterfaceElem1d :: computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords)
267{
268 OOFEM_ERROR("Not implemented");
269 //return false;
270}
271
272double
273InterfaceElem1d :: computeVolumeAround(GaussPoint *gp)
274// Returns the length of the receiver. This method is valid only if 1
275// Gauss point is used.
276{
277 return 1.0; //MUST be set to 1.0
278}
279
280
281void
282InterfaceElem1d :: initializeFrom(InputRecord &ir, int priority)
283{
284 ParameterManager &ppm = this->giveDomain()->elementPPM;
285 StructuralElement :: initializeFrom(ir, priority);
286
290}
291
292void
293InterfaceElem1d :: initializeFinish()
294{
295 ParameterManager &ppm = this->giveDomain()->elementPPM;
296 StructuralElement :: initializeFinish();
297
298 if ( referenceNode == 0 && normal.at(1) == 0 && normal.at(2) == 0 && normal.at(1) == 0 && normal.at(3) == 0 ) {
299 OOFEM_ERROR("wrong reference node or normal specified");
300 }
301 if (!ppm.checkIfSet(this->number, IPK_InterfaceElem1d_dofIDs.getIndex()) ) {
302
303 switch ( domain->giveNumberOfSpatialDimensions() ) {
304 case 1:
305 this->dofids = IntArray{D_u};
306 break;
307 case 2:
308 this->dofids = {D_u, D_v};
309 break;
310 case 3:
311 this->dofids = {D_u, D_v, D_w};
312 break;
313 default:
314 OOFEM_ERROR("Unsupported domain type")
315 }
316 }
317
319
320}
321
322int
323InterfaceElem1d :: computeNumberOfDofs()
324{
325 setCoordMode();
326 switch ( mode ) {
327 case ie1d_1d:
328 return 2;
329
330 case ie1d_2d:
331 return 4;
332
333 case ie1d_3d:
334 return 6;
335
336 default:
337 OOFEM_ERROR("unsupported mode");
338 }
339
340 //return 0; // to suppress compiler warning
341}
342
343
344void
345InterfaceElem1d :: giveDofManDofIDMask(int inode, IntArray &answer) const
346{
347 answer = this->dofids;
348}
349
350
351void
352InterfaceElem1d :: computeLocalSlipDir(FloatArray &normal)
353{
354 normal.resizeWithValues(3);
355 if ( this->referenceNode ) {
356 // normal
357 normal.at(1) = domain->giveNode(this->referenceNode)->giveCoordinate(1) - this->giveNode(1)->giveCoordinate(1);
358 normal.at(2) = domain->giveNode(this->referenceNode)->giveCoordinate(2) - this->giveNode(1)->giveCoordinate(2);
359 normal.at(3) = domain->giveNode(this->referenceNode)->giveCoordinate(3) - this->giveNode(1)->giveCoordinate(3);
360 } else {
361 if ( normal.at(1) == 0 && normal.at(2) == 0 && normal.at(3) == 0 ) {
362 OOFEM_ERROR("normal is not defined (referenceNode=0,normal=(0,0,0))");
363 }
364 }
365
366 normal.normalize();
367}
368
369
370#ifdef __OOFEG
371void InterfaceElem1d :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
372{
373 GraphicObj *go;
374 // if (!go) { // create new one
375 WCRec p [ 1 ]; /* poin */
376 if ( !gc.testElementGraphicActivity(this) ) {
377 return;
378 }
379
380 EASValsSetColor( gc.getElementColor() );
381 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
382 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
383 EASValsSetColor( gc.getDeformedElementColor() );
384 p [ 0 ].x = ( FPNum ) ( this->giveNode(1)->giveCoordinate(1) );
385 p [ 0 ].y = ( FPNum ) ( this->giveNode(1)->giveCoordinate(2) );
386 p [ 0 ].z = ( FPNum ) ( this->giveNode(1)->giveCoordinate(3) );
387
388 EASValsSetMType(CIRCLE_MARKER);
389 go = CreateMarker3D(p);
390 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
391 EMAddGraphicsToModel(ESIModel(), go);
392}
393
394
395void InterfaceElem1d :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
396{
397 GraphicObj *go;
398 // if (!go) { // create new one
399 WCRec p [ 1 ]; /* poin */
400 if ( !gc.testElementGraphicActivity(this) ) {
401 return;
402 }
403
404 double defScale = gc.getDefScale();
405
406 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
407 EASValsSetColor( gc.getDeformedElementColor() );
408 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER);
409 p [ 0 ].x = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale) +
410 this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale) );
411 p [ 0 ].y = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale) +
412 this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale) );
413 p [ 0 ].z = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(3, tStep, defScale) +
414 this->giveNode(2)->giveUpdatedCoordinate(3, tStep, defScale) );
415
416 EASValsSetMType(CIRCLE_MARKER);
417 go = CreateMarker3D(p);
418 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
419 EMAddGraphicsToModel(ESIModel(), go);
420}
421
422
423void InterfaceElem1d :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
424{
425 int indx, result = 0;
426 FloatArray gcoord(3), v1;
427 WCRec p [ 1 ];
428 GraphicObj *go;
429 double val [ 1 ];
430
431 if ( !gc.testElementGraphicActivity(this) ) {
432 return;
433 }
434
435 if ( gc.getInternalVarsDefGeoFlag() ) {
436 double defScale = gc.getDefScale();
437 p [ 0 ].x = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale) +
438 this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale) );
439 p [ 0 ].y = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale) +
440 this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale) );
441 p [ 0 ].z = ( FPNum ) 0.5 * ( this->giveNode(1)->giveUpdatedCoordinate(3, tStep, defScale) +
442 this->giveNode(2)->giveUpdatedCoordinate(3, tStep, defScale) );
443 } else {
444 p [ 0 ].x = ( FPNum ) ( this->giveNode(1)->giveCoordinate(1) );
445 p [ 0 ].y = ( FPNum ) ( this->giveNode(1)->giveCoordinate(2) );
446 p [ 0 ].z = ( FPNum ) ( this->giveNode(1)->giveCoordinate(3) );
447 }
448
450 //result += giveIPValue(v1, iRule->getIntegrationPoint(0), gc.giveIntVarType(), tStep);
451
452
453 for ( GaussPoint *gp: *this->giveDefaultIntegrationRulePtr() ) {
454 result = 0;
455 result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
456 if ( result != 1 ) {
457 continue;
458 }
459
460 indx = gc.giveIntVarIndx();
461
462 val [ 0 ] = v1.at(indx);
463 gc.updateFringeTableMinMax(val, 1);
464
465 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
466 EASValsSetMType(FILLED_CIRCLE_MARKER);
467 go = CreateMarkerWD3D(p, val [ 0 ]);
468 EGWithMaskChangeAttributes(LAYER_MASK | FILL_MASK | MTYPE_MASK, go);
469 EMAddGraphicsToModel(ESIModel(), go);
470 //}
471 }
472}
473
474#endif
475} // 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
CrossSection * giveCrossSection()
Definition element.C:534
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Definition element.h:886
Domain * giveDomain() const
Definition femcmpnn.h:97
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
double & at(Index i)
Definition floatarray.h:202
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Definition floatarray.C:476
void times(double f)
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void zero()
Zeroes all coefficient of receiver.
double at(std::size_t i, std::size_t j) const
int computeNumberOfDofs() override
void computeLocalSlipDir(FloatArray &normal)
static ParamKey IPK_InterfaceElem1d_refnode
MaterialMode giveMaterialMode() override
enum oofem::InterfaceElem1d::cmode mode
static ParamKey IPK_InterfaceElem1d_dofIDs
void evaluateLocalCoordinateSystem(FloatMatrix &)
static ParamKey IPK_InterfaceElem1d_normal
bool checkIfSet(size_t componentIndex, size_t paramIndex)
StructuralElement(int n, Domain *d)
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
#define OOFEM_ERROR(...)
Definition error.h:79
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_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