OOFEM 3.0
Loading...
Searching...
No Matches
tr2shell7.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 "load.h"
39#include "mathfem.h"
40#include "domain.h"
42#include "gausspoint.h"
43#include "fei3dtrquad.h"
44#include "boundaryload.h"
45#include "vtkxmlexportmodule.h"
46#include "classfactory.h"
47
48namespace oofem {
50
51FEI3dTrQuad Tr2Shell7 :: interpolation;
52
53IntArray Tr2Shell7 :: orderingDofTypes = {1, 2, 3, 8, 9, 10, 15, 16, 17, 22, 23, 24, 29, 30, 31, 36, 37, 38,
54 4, 5, 6, 11, 12, 13, 18, 19, 20, 25, 26, 27, 32, 33, 34, 39, 40, 41,
55 7, 14, 21, 28, 35, 42};
56IntArray Tr2Shell7 :: orderingNodes = {1, 2, 3, 19, 20, 21, 37, 4, 5, 6, 22, 23, 24, 38, 7, 8, 9, 25, 26, 27, 39,
57 10, 11, 12, 28, 29, 30, 40, 13, 14, 15, 31, 32, 33, 41, 16, 17, 18,
58 34, 35, 36, 42};
59IntArray Tr2Shell7 :: orderingEdgeNodes = {1, 2, 3, 10, 11, 12, 19, 4, 5, 6, 13, 14, 15, 20, 7, 8, 9, 16, 17, 18, 21};
60
61
62Tr2Shell7 :: Tr2Shell7(int n, Domain *aDomain) : Shell7Base(n, aDomain)
63{
64 this->numberOfDofMans = 6;
65 this->numInPlaneIP = 6;
66}
67
68const IntArray &
69Tr2Shell7 :: giveOrderingDofTypes() const
70{
71 return this->orderingDofTypes;
72}
73
74const IntArray &
75Tr2Shell7 :: giveOrderingNodes() const
76{
77 return this->orderingNodes;
78}
79const IntArray &
80Tr2Shell7 :: giveOrderingEdgeNodes() const
81{
82 return this->orderingEdgeNodes;
83}
84
85FEInterpolation *Tr2Shell7 :: giveInterpolation() const { return & interpolation; }
86
87
88
89void
90Tr2Shell7 :: computeGaussPoints()
91{
92 if ( integrationRulesArray.size() == 0 ) {
93 int nPointsTri = 6; // points in the plane
94
95 // Layered cross section for bulk integration
96 //@todo - must use a cast here since check consistency has not been called yet
97 LayeredCrossSection *layeredCS = dynamic_cast< LayeredCrossSection * >( Tr2Shell7 :: giveCrossSection() );
98 if ( layeredCS == NULL ) {
99 OOFEM_ERROR("Tr2Shell7 only supports layered cross section");
100 }
101 this->numberOfGaussPoints = layeredCS->giveNumberOfLayers() * nPointsTri * layeredCS->giveNumIntegrationPointsInLayer();
102 layeredCS->setupLayeredIntegrationRule(integrationRulesArray, this, nPointsTri);
103
104 }
105}
106
107
108void
109Tr2Shell7 :: giveBoundaryLocationArray(IntArray &locationArray, const IntArray &bNodes, const UnknownNumberingScheme &s, IntArray *dofIdArray)
110{
111 IntArray localloc;
112
113 // not a nice solution here, trying to deduce if Boundary is egde or surface
114 if (bNodes.giveSize() == 3) { // should be edge
115 //detect edge number
116 if (bNodes.at(1)==1 && bNodes.at(2)==2 && bNodes.at(3)==4) {
117 // edge #1
118 giveEdgeDofMapping(localloc, 1);
119 } else if (bNodes.at(1)==2 && bNodes.at(2)==3 && bNodes.at(3)==5) {
120 // edge #2
121 giveEdgeDofMapping(localloc, 2);
122 } else if (bNodes.at(1)==3 && bNodes.at(2)==1 && bNodes.at(3)==6) {
123 // edge #3
124 giveEdgeDofMapping(localloc, 3);
125 } else {
126 OOFEM_ERROR ("wrong edge number detected");
127 }
128 } else if (bNodes.giveSize() == 6) { // should be surface
129 this->giveSurfaceDofMapping(localloc, 1);
130 } else {
131 OOFEM_ERROR ("boundary not supported/detected");
132 }
133 IntArray eloc, dofID;
134 this->giveLocationArray(eloc, s, &dofID);
135 locationArray.resize(localloc.giveSize());
136 dofIdArray->resize(localloc.giveSize());
137 for (int i=1; i<=localloc.giveSize(); i++) {
138 locationArray.at(i)=eloc.at(localloc.at(i));
139 dofIdArray->at(i) = dofID.at(localloc.at(i));
140 }
141
142}
143
144void
145Tr2Shell7 :: giveEdgeDofMapping(IntArray &answer, int iEdge) const
146{
147 /*
148 * provides dof mapping of local edge dofs (only nonzero are taken into account)
149 * to global element dofs
150 */
151
152 if ( iEdge == 1 ) { // edge between nodes 1-4-2
153 answer = {1, 2, 3, 8, 9, 10, 22, 23, 24, 4, 5, 6, 11, 12, 13, 25, 26, 27, 7, 14, 28};
154 } else if ( iEdge == 2 ) { // edge between nodes 2-5-3
155 answer = { 8, 9, 10, 15, 16, 17, 29, 30, 31, 11, 12, 13, 18, 19, 20, 32, 33, 34, 14, 21, 35};
156 } else if ( iEdge == 3 ) { // edge between nodes 3-6-1
157 answer = { 15, 16, 17, 1, 2, 3, 36, 37, 38, 18, 19, 20, 4, 5, 6, 39, 40, 41, 21, 7, 42};
158 } else {
159 OOFEM_ERROR("wrong edge number");
160 }
161}
162
163
164void
165Tr2Shell7 :: giveSurfaceDofMapping(IntArray &answer, int iSurf) const
166{
167 answer.resize(42);
168 for ( int i = 1; i <= 42; i++ ) {
169 answer.at(i) = i;
170 }
171}
172
173
174double
175Tr2Shell7 :: computeAreaAround(GaussPoint *gp, double xi)
176{
177 FloatArray G1, G2, temp;
178 FloatMatrix Gcov;
179 FloatArray lcoords(3);
180 lcoords.at(1) = gp->giveNaturalCoordinate(1);
181 lcoords.at(2) = gp->giveNaturalCoordinate(2);
182 lcoords.at(3) = xi;
183 Gcov = this->evalInitialCovarBaseVectorsAt(lcoords);
184 G1.beColumnOf(Gcov, 1);
185 G2.beColumnOf(Gcov, 2);
186 temp.beVectorProductOf(G1, G2);
187 double detJ = temp.computeNorm();
188 return detJ *gp->giveWeight();
189}
190
191
192
193double
194Tr2Shell7 :: computeVolumeAroundLayer(GaussPoint *gp, int layer)
195{
196 const auto &lcoords = gp->giveNaturalCoordinates();
197 auto Gcov = this->evalInitialCovarBaseVectorsAt(lcoords);
198 double detJ = det(Gcov) * 0.5 * this->layeredCS->giveLayerThickness(layer);
199 return detJ *gp->giveWeight();
200}
201
202
203void
204Tr2Shell7 :: compareMatrices(const FloatMatrix &matrix1, const FloatMatrix &matrix2, FloatMatrix &answer)
205{
206 int ndofs = 42;
207 answer.resize(ndofs, ndofs);
208 for ( int i = 1; i <= ndofs; i++ ) {
209 for ( int j = 1; j <= 18; j++ ) {
210 if ( fabs( matrix1.at(i, j) ) > 1.0e-12 ) {
211 double diff = ( matrix1.at(i, j) - matrix2.at(i, j) );
212 double relDiff = diff / matrix1.at(i, j);
213 if ( fabs(relDiff) < 1.0e-4 ) {
214 answer.at(i, j) = 0.0;
215 } else if ( fabs(diff) < 1.0e3 ) {
216 answer.at(i, j) = 0.0;
217 } else {
218 answer.at(i, j) = relDiff;
219 }
220 } else {
221 answer.at(i, j) = -1.0;
222 }
223 }
224 }
225}
226} // end namespace oofem
#define REGISTER_Element(class)
void giveLocationArray(IntArray &locationArray, const UnknownNumberingScheme &s, IntArray *dofIds=NULL) const
Definition element.C:429
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
double computeNorm() const
Definition floatarray.C:861
double & at(Index i)
Definition floatarray.h:202
void beColumnOf(const FloatMatrix &mat, int col)
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Definition floatarray.C:476
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
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
const FloatArray & giveNaturalCoordinates() const
Returns coordinate array of receiver.
Definition gausspoint.h:138
double giveWeight()
Returns integration weight of receiver.
Definition gausspoint.h:180
void resize(int n)
Definition intarray.C:73
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
Shell7Base(int n, Domain *d)
Definition shell7base.C:63
FloatMatrixF< 3, 3 > evalInitialCovarBaseVectorsAt(const FloatArrayF< 3 > &lCoords)
Definition shell7base.C:220
LayeredCrossSection * layeredCS
Definition shell7base.h:113
void giveSurfaceDofMapping(IntArray &answer, int iSurf) const override
Definition tr2shell7.C:165
static IntArray orderingDofTypes
Definition tr2shell7.h:69
static IntArray orderingEdgeNodes
Definition tr2shell7.h:71
static FEI3dTrQuad interpolation
Definition tr2shell7.h:68
void giveEdgeDofMapping(IntArray &answer, int iEdge) const override
Definition tr2shell7.C:145
static IntArray orderingNodes
Definition tr2shell7.h:70
#define OOFEM_ERROR(...)
Definition error.h:79
double det(const FloatMatrixF< 2, 2 > &mat)
Computes the determinant.

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