OOFEM 3.0
Loading...
Searching...
No Matches
contactpoint.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 "contactpoint.h"
36#include "floatarray.h"
37#include "floatmatrix.h"
38#include "feinterpol2d.h"
39#include "feinterpol3d.h"
40
41namespace oofem {
42
43
44
47{
48 int spatial_dimension = this->surface_dimension+1;
49 if(spatial_dimension == 3) {
50 auto fe= dynamic_cast<FEInterpolation3d*>(contactSurface->giveContactElement(contactElementId)->giveInterpolation());
51 return fe;
52 } else if(spatial_dimension == 2) {
53 auto fe= dynamic_cast<FEInterpolation2d*>(contactSurface->giveContactElement(contactElementId)->giveInterpolation());
54 return fe;
55 } else {
56 OOFEM_ERROR("Incorrect spatial dimension");
57 }
58}
59
61{
62 contactSurface->giveContactElement(contactElementId)->computeNmatrixAt(this->giveLocalCoordinates(), answer);
63}
64
65
66
67void
68FEContactPoint :: compute_dNdxi_matrix(FloatMatrix &dNdxi, int index)
69{
70
71 FloatMatrix dN;
72 this->giveInterpolation()->surfaceEvaldNdxi(dN, this->giveLocalCoordinates());
73 //
74 int spatial_dimension = this->surface_dimension+1;
75 dNdxi.resize(spatial_dimension, spatial_dimension * dN.giveNumberOfRows());
76 for (int i = 1; i <= dN.giveNumberOfRows(); i++) {
77 FloatMatrix dn(spatial_dimension,spatial_dimension), dNdi;
78 dn.beUnitMatrix();
79 //
80 dn.times(dN.at(i, index));
81 //
82 dNdxi.setSubMatrix(dn, 1, 1 + (i - 1) * spatial_dimension);
83 }
84
85}
86
87
89FEContactPoint :: giveNormalVector()
90{
91 return contactSurface->giveContactElement(contactElementId)->computeNormalVectorAt(this->giveLocalCoordinates());
92}
93
94
95void
96FEContactPoint :: computeCurvature(FloatMatrix &kappa, const FloatArray &normal, TimeStep *tStep)
97{
98 //get curvature
99 // kappa = [dro/dksidksi * normal, dro/dksideta * normal;
100 // dro/detadksi * normal, dro/detadeta * normal]
101 auto ce = contactSurface->giveContactElement(contactElementId);
102 FEIElementDeformedGeometryWrapper cellgeo(ce, tStep);
103 auto fe = this->giveInterpolation();
104 FloatMatrix d2Ndxi2;
105 fe->surfaceEvald2Ndxi2(d2Ndxi2, this->giveLocalCoordinates());
106
107 FloatArray d2Ndxidxi, d2Ndetadeta, d2Ndxideta;
108 for (int i = 1; i <= ce->giveNumberOfNodes(); ++i) {
109 d2Ndxidxi.add(d2Ndxi2.at(i, 1), cellgeo.giveVertexCoordinates(i));
110 if(surface_dimension == 2) {
111 d2Ndetadeta.add(d2Ndxi2.at(i, 2), cellgeo.giveVertexCoordinates(i));
112 d2Ndxideta.add(d2Ndxi2.at(i, 3), cellgeo.giveVertexCoordinates(i));
113 }
114 }
116 kappa.at(1,1) = d2Ndxidxi.dotProduct(normal);
117 if(surface_dimension == 2) {
118 kappa.at(1,2) = d2Ndxideta.dotProduct(normal);
119 kappa.at(2,1) = kappa.at(1,2);
120 kappa.at(2,2) = d2Ndetadeta.dotProduct(normal);
121 }
122}
123
124
125void
126FEContactPoint :: computeVectorOf(ValueModeType mode, TimeStep *tStep, FloatArray &answer)
127{
128 contactSurface->giveContactElement(contactElementId)->computeVectorOf(mode, tStep, answer);
129}
130
131
132
133void
134FEContactPoint :: giveUpdatedCoordinates(FloatArray &coords, TimeStep* tStep)
135{
136 this->giveInterpolation()->local2global(coords, this->giveLocalCoordinates(), FEIElementDeformedGeometryWrapper(contactSurface->giveContactElement(contactElementId), tStep));
137}
138
139
140
141
142bool
143FEContactPoint :: giveLocationArray(IntArray &locationArray, const IntArray &dofIDArry, const UnknownNumberingScheme &s) const
144{
145 if(contactElementId != -1) {
146 contactSurface->giveContactElement(contactElementId)->giveLocationArray(locationArray,dofIDArry, s);
147 return true;
148 } else {
149 return false;
150 }
151}
152
153
154void
155FEContactPoint ::giveUnknownVector(FloatArray &answer, const IntArray &dofMask, ValueModeType mode, TimeStep *tStep, bool padding)
156{
157 this->contactSurface->giveContactElement(contactElementId)->computeVectorOf(dofMask, mode, tStep, answer);
158}
159
160
162FEContactPoint_Master :: giveGlobalCoordinates()
163{
164 FloatArray ret;
165 this->contactSurface->giveContactElement(contactElementId)->computeGlobalCoordinates(ret, this->localCoordinates);
166 return ret;
167}
168
169
170} // end namespace oofem
const FloatArray & giveLocalCoordinates() override=0
Returns the local (parametric) coordinates of the contact point.
std::unique_ptr< FEContactSurface > contactSurface
void computeNmatrix(FloatMatrix &answer) override
Computes the interpolation matrix (N-matrix) for this contact point.
FEInterpolation * giveInterpolation()
const FloatArray giveVertexCoordinates(int i) const override
Definition feinterpol.C:65
double dotProduct(const FloatArray &x) const
Definition floatarray.C:524
void add(const FloatArray &src)
Definition floatarray.C:218
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void setSubMatrix(const FloatMatrix &src, int sr, int sc)
int giveNumberOfRows() const
Returns number of rows of receiver.
double at(std::size_t i, std::size_t j) const
void beUnitMatrix()
Sets receiver to unity matrix.
#define OOFEM_ERROR(...)
Definition error.h:79

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