OOFEM 3.0
Loading...
Searching...
No Matches
interfaceelem2dquad.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 "interfaceelem2dquad.h"
36#include "node.h"
37#include "gausspoint.h"
39#include "floatmatrix.h"
40#include "floatmatrixf.h"
41#include "floatarray.h"
42#include "floatarrayf.h"
43#include "intarray.h"
44#include "mathfem.h"
45#include "fei2dlinequad.h"
47#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 {
58
59FEI2dLineQuad InterfaceElem2dQuad :: interp(1, 2);
61
62
63InterfaceElem2dQuad :: InterfaceElem2dQuad(int n, Domain *aDomain) :
64 StructuralElement(n, aDomain)
65{
67 axisymmode = false;
68}
69
70
71void
72InterfaceElem2dQuad :: computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int li, int ui)
73//
74// Returns linear part of geometrical equations of the receiver at gp.
75// Returns the linear part of the B matrix
76//
77{
79 double ksi, n1, n2, n3;
80
81 ksi = gp->giveNaturalCoordinate(1);
82 n3 = 1. - ksi * ksi;
83 n1 = ( 1. - ksi ) * 0.5 - 0.5 * n3;
84 n2 = ( 1. + ksi ) * 0.5 - 0.5 * n3;
85 answer.resize(2, 12);
86 answer.zero();
87
88 answer.at(1, 2) = answer.at(2, 1) = -n1;
89 answer.at(1, 4) = answer.at(2, 3) = -n2;
90 answer.at(1, 6) = answer.at(2, 5) = -n3;
91
92 answer.at(1, 8) = answer.at(2, 7) = n1;
93 answer.at(1, 10) = answer.at(2, 9) = n2;
94 answer.at(1, 12) = answer.at(2, 11) = n3;
95}
96
97
98void
99InterfaceElem2dQuad :: computeGaussPoints()
100// Sets up the array of Gauss Points of the receiver.
101{
102 if ( integrationRulesArray.size() == 0 ) {
103 integrationRulesArray.resize( 1 );
104 //integrationRulesArray[0] = std::make_unique<LobattoIntegrationRule>(1,domain, 1, 2);
105 integrationRulesArray [ 0 ] = std::make_unique<GaussIntegrationRule>(1, this, 1, 2);
106 integrationRulesArray [ 0 ]->SetUpPointsOnLine(4, _2dInterface);
107 }
108}
109
110
111double
112InterfaceElem2dQuad :: computeVolumeAround(GaussPoint *gp)
113// Returns the length of the receiver. This method is valid only if 1
114// Gauss point is used.
115{
116 double weight = gp->giveWeight();
117 double ksi = gp->giveNaturalCoordinate(1);
118 double dn1 = ksi - 0.5;
119 double dn2 = ksi + 0.5;
120 double dn3 = -2.0 * ksi;
121
122 double x1 = this->giveNode(1)->giveCoordinate(1);
123 double x2 = this->giveNode(2)->giveCoordinate(1);
124 double x3 = this->giveNode(3)->giveCoordinate(1);
125
126 double y1 = this->giveNode(1)->giveCoordinate(2);
127 double y2 = this->giveNode(2)->giveCoordinate(2);
128 double y3 = this->giveNode(3)->giveCoordinate(2);
129
130 double dx = ( dn1 * x1 ) + ( dn2 * x2 ) + ( dn3 * x3 );
131 double dy = ( dn1 * y1 ) + ( dn2 * y2 ) + ( dn3 * y3 );
132 double thickness = this->giveCrossSection()->give(CS_Thickness, gp);
133
134 double r = 1.0;
135 if (this->axisymmode) {
136 double n3 = 1. - ksi * ksi;
137 double n1 = ( 1. - ksi ) * 0.5 - 0.5 * n3;
138 double n2 = ( 1. + ksi ) * 0.5 - 0.5 * n3;
139 r = n1*this->giveNode(1)->giveCoordinate(1) + n2*this->giveNode(2)->giveCoordinate(1)+ n3*this->giveNode(3)->giveCoordinate(1);
140 }
141
142 return sqrt(dx * dx + dy * dy) * weight * thickness * r;
143}
144
145
146void
147InterfaceElem2dQuad :: computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep)
148{
149 answer = static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->giveEngTraction_2d(strain, gp, tStep);
150}
151
152
153void
154InterfaceElem2dQuad :: computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep)
155{
156 answer = static_cast< StructuralInterfaceCrossSection* >(this->giveCrossSection())->give2dStiffnessMatrix_Eng(rMode, gp, tStep);
157}
158
159
160void
161InterfaceElem2dQuad :: initializeFrom(InputRecord &ir, int priority)
162{
163 ParameterManager &ppm = this->giveDomain()->elementPPM;
165 StructuralElement :: initializeFrom(ir, priority);
166}
167
168
169void
170InterfaceElem2dQuad :: giveDofManDofIDMask(int inode, IntArray &answer) const
171{
172 answer = {D_u, D_v};
173}
174
175
176bool
177InterfaceElem2dQuad :: computeGtoLRotationMatrix(FloatMatrix &answer)
178{
179 FloatArray grad(2);
180
181 //double ksi = gp -> giveCoordinate(1) ;
182 double ksi = 0.0; // compute tangent in the middle
183 double dn1 = ksi - 0.5;
184 double dn2 = ksi + 0.5;
185 double dn3 = -2.0 * ksi;
186
187 // tangent
188 grad.at(1) = dn1 * this->giveNode(1)->giveCoordinate(1) + dn2 *this->giveNode(2)->giveCoordinate(1) + dn3 *this->giveNode(3)->giveCoordinate(1);
189 grad.at(2) = dn1 * this->giveNode(1)->giveCoordinate(2) + dn2 *this->giveNode(2)->giveCoordinate(2) + dn3 *this->giveNode(3)->giveCoordinate(2);
190 grad.normalize();
191
192 answer.resize(12, 12);
193 for ( int i = 0; i < 6; i++ ) {
194 answer.at(i * 2 + 1, i * 2 + 1) = grad.at(1);
195 answer.at(i * 2 + 1, i * 2 + 2) = grad.at(2);
196 answer.at(i * 2 + 2, i * 2 + 1) = -grad.at(2);
197 answer.at(i * 2 + 2, i * 2 + 2) = grad.at(1);
198 }
199
200 return 1;
201}
202
203
205InterfaceElem2dQuad :: giveInterpolation() const
206{
207 return & interp;
208}
209
211/*
212 * void
213 * InterfaceElem2dQuad :: computeStiffnessMatrix (FloatMatrix& answer, MatResponseMode rMode,
214 * TimeStep* tStep)
215 * // Computes numerically the stiffness matrix of the receiver.
216 * {
217 * double dV ;
218 * FloatMatrix d, bj, bjl, dbj, t;
219 * GaussPoint *gp ;
220 * IntegrationRule* iRule;
221 * bool matStiffSymmFlag = this->giveCrossSection()->isCharacteristicMtrxSymmetric(rMode, this->material);
222 *
223 * answer.resize (computeNumberOfDofs(),computeNumberOfDofs());
224 * answer.zero();
225 *
226 * iRule = integrationRulesArray[giveDefaultIntegrationRule()];
227 *
228 * for ( GaussPoint *gp: *iRule ) {
229 * this -> computeBmatrixAt(gp, bjl) ;
230 * this -> computeConstitutiveMatrixAt(d, rMode, gp, tStep);
231 * this -> computeGtoLRotationMatrix(t, gp);
232 * bj.beProductOf(bjl,t);
233 * dbj.beProductOf (d, bj) ;
234 * dV = this->computeVolumeAround (gp);
235 * if (matStiffSymmFlag) answer.plusProductSymmUpper (bj,dbj,dV); else answer.plusProductUnsym (bj,dbj,dV);
236 *
237 * }
238 * }
239 */
240
241
242#ifdef __OOFEG
243void InterfaceElem2dQuad :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
244{
245 GraphicObj *go;
246 // if (!go) { // create new one
247 WCRec p [ 2 ]; /* poin */
248 if ( !gc.testElementGraphicActivity(this) ) {
249 return;
250 }
251
252 EASValsSetLineWidth(OOFEG_RAW_GEOMETRY_WIDTH);
253 EASValsSetColor( gc.getElementColor() );
254 EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER);
255 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveCoordinate(1);
256 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveCoordinate(2);
257 p [ 0 ].z = 0.0;
258 p [ 1 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
259 p [ 1 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
260 p [ 1 ].z = 0.0;
261 go = CreateLine3D(p);
262 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
263 EGAttachObject(go, ( EObjectP ) this);
264 EMAddGraphicsToModel(ESIModel(), go);
265 p [ 0 ].x = ( FPNum ) this->giveNode(3)->giveCoordinate(1);
266 p [ 0 ].y = ( FPNum ) this->giveNode(3)->giveCoordinate(2);
267 p [ 0 ].z = 0.0;
268 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveCoordinate(1);
269 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveCoordinate(2);
270 p [ 1 ].z = 0.0;
271 go = CreateLine3D(p);
272 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
273 EGAttachObject(go, ( EObjectP ) this);
274 EMAddGraphicsToModel(ESIModel(), go);
275}
276
277
278void InterfaceElem2dQuad :: drawDeformedGeometry(oofegGraphicContext &gc, TimeStep *tStep, UnknownType type)
279{
280 GraphicObj *go;
281 // if (!go) { // create new one
282 WCRec p [ 2 ]; /* poin */
283 if ( !gc.testElementGraphicActivity(this) ) {
284 return;
285 }
286
287 double defScale = gc.getDefScale();
288
289 EASValsSetLineWidth(OOFEG_DEFORMED_GEOMETRY_WIDTH);
290 EASValsSetColor( gc.getDeformedElementColor() );
291 EASValsSetLayer(OOFEG_DEFORMED_GEOMETRY_LAYER + 1);
292 p [ 0 ].x = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(1, tStep, defScale);
293 p [ 0 ].y = ( FPNum ) this->giveNode(1)->giveUpdatedCoordinate(2, tStep, defScale);
294 p [ 0 ].z = 0.0;
295 p [ 1 ].x = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(1, tStep, defScale);
296 p [ 1 ].y = ( FPNum ) this->giveNode(2)->giveUpdatedCoordinate(2, tStep, defScale);
297 p [ 1 ].z = 0.0;
298 go = CreateLine3D(p);
299 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
300 EMAddGraphicsToModel(ESIModel(), go);
301
302 p [ 0 ].x = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(1, tStep, defScale);
303 p [ 0 ].y = ( FPNum ) this->giveNode(4)->giveUpdatedCoordinate(2, tStep, defScale);
304 p [ 0 ].z = 0.0;
305 p [ 1 ].x = ( FPNum ) this->giveNode(5)->giveUpdatedCoordinate(1, tStep, defScale);
306 p [ 1 ].y = ( FPNum ) this->giveNode(5)->giveUpdatedCoordinate(2, tStep, defScale);
307 p [ 1 ].z = 0.0;
308 go = CreateLine3D(p);
309 EGWithMaskChangeAttributes(WIDTH_MASK | COLOR_MASK | LAYER_MASK, go);
310 EMAddGraphicsToModel(ESIModel(), go);
311}
312
313
314void InterfaceElem2dQuad :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
315{
316 int indx, result = 0;
317 FloatArray gcoord(3), v1;
318 WCRec p [ 1 ];
319 GraphicObj *go;
320 double val [ 1 ];
321
322 if ( !gc.testElementGraphicActivity(this) ) {
323 return;
324 }
325
326 if ( gc.giveIntVarMode() == ISM_recovered ) {
327 return;
328 }
329
330 for ( GaussPoint *gp: *this->giveDefaultIntegrationRulePtr() ) {
331 result = 0;
332 result += giveIPValue(v1, gp, gc.giveIntVarType(), tStep);
333 if ( result != 1 ) {
334 continue;
335 }
336
337 indx = gc.giveIntVarIndx();
338
339 result += this->computeGlobalCoordinates( gcoord, gp->giveNaturalCoordinates() );
340
341 p [ 0 ].x = ( FPNum ) gcoord.at(1);
342 p [ 0 ].y = ( FPNum ) gcoord.at(2);
343 p [ 0 ].z = 0.;
344
345 val [ 0 ] = v1.at(indx);
346 gc.updateFringeTableMinMax(val, 1);
347 //if (val[0] > 0.) {
348
349 EASValsSetLayer(OOFEG_VARPLOT_PATTERN_LAYER);
350 EASValsSetMType(FILLED_CIRCLE_MARKER);
351 go = CreateMarkerWD3D(p, val [ 0 ]);
352 EGWithMaskChangeAttributes(LAYER_MASK | FILL_MASK | MTYPE_MASK, go);
353 EMAddGraphicsToModel(ESIModel(), go);
354 //}
355 }
356}
357
358#endif
359} // end namespace oofem
#define REGISTER_Element(class)
Node * giveNode(int i) const
Definition element.h:629
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Definition element.C:1225
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
int number
Component number.
Definition femcmpnn.h:77
double & at(Index i)
Definition floatarray.h:202
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void zero()
Zeroes all coefficient of receiver.
double at(std::size_t i, std::size_t j) const
double giveNaturalCoordinate(int i) const
Returns i-th natural element coordinate of receiver.
Definition gausspoint.h:136
double giveWeight()
Returns integration weight of receiver.
Definition gausspoint.h:180
static ParamKey IPK_InterfaceElem2dQuad_axisymmode
bool axisymmode
Flag controlling axisymmetric mode (integration over unit circumferential angle).
StructuralElement(int n, Domain *d)
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
@ CS_Thickness
Thickness.
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