OOFEM 3.0
Loading...
Searching...
No Matches
qspace.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 "fei3dhexaquad.h"
38#include "node.h"
39#include "gausspoint.h"
41#include "floatmatrix.h"
42#include "floatarray.h"
43#include "intarray.h"
44#include "domain.h"
45#include "mathfem.h"
46#include "classfactory.h"
47
48namespace oofem {
50
51FEI3dHexaQuad QSpace :: interpolation;
52
53QSpace :: QSpace(int n, Domain *aDomain) : Structural3DElement(n, aDomain), ZZNodalRecoveryModelInterface(this), SpatialLocalizerInterface(this)
54{
55 numberOfDofMans = 20;
57}
58
59
60void
61QSpace :: initializeFrom(InputRecord &ir, int priority)
62{
63 Structural3DElement :: initializeFrom(ir, priority);
64}
65
66
67FEInterpolation *QSpace :: giveInterpolation() const { return & interpolation; }
68
69// ******************************
70// *** Surface load support ***
71// ******************************
72
73int
74QSpace :: computeLoadLSToLRotationMatrix(FloatMatrix &answer, int iSurf, GaussPoint *gp)
75{
76 // returns transformation matrix from
77 // surface local coordinate system
78 // to element local c.s
79 // (same as global c.s in this case)
80 //
81 // i.e. f(element local) = T * f(edge local)
82
83 // definition of local c.s on surface:
84 // local z axis - perpendicular to surface, pointing outwards from element
85 // local x axis - is in global xy plane (perpendicular to global z axis)
86 // local y axis - completes the righ hand side cs.
87
88 /*
89 * OOFEM_ERROR("surface local coordinate system not supported");
90 * return 1;
91 */
92 FloatArray gc(3);
93 FloatArray h1(3), h2(3), nn(3), n(3);
94
95 answer.resize(3, 3);
96 answer.zero();
97
98 const auto &snodes = this->interpolation.computeSurfaceMapping(dofManArray, iSurf);
99 for ( int i = 1; i <= 4; i++ ) {
100 gc.add( domain->giveNode( snodes.at(i) )->giveCoordinates() );
101 }
102
103 gc.times(1. / 4.);
104 // determine "average normal"
105 for ( int i = 1; i <= 4; i++ ) {
106 int j = ( i ) % 4 + 1;
107 h1.beDifferenceOf(domain->giveNode( snodes.at(i) )->giveCoordinates(), gc);
108 h2.beDifferenceOf(domain->giveNode( snodes.at(j) )->giveCoordinates(), gc);
109 n.beVectorProductOf(h1, h2);
110 if ( n.computeSquaredNorm() > 1.e-6 ) {
111 n.normalize();
112 }
113
114 nn.add(n);
115 }
116
117 nn.times(1. / 4.);
118 if ( nn.computeSquaredNorm() < 1.e-6 ) {
119 answer.zero();
120 }
121
122 nn.normalize();
123 for ( int i = 1; i <= 3; i++ ) {
124 answer.at(i, 3) = nn.at(i);
125 }
126
127 // determine lcs of surface
128 // local x axis in xy plane
129 double test = fabs(fabs( nn.at(3) ) - 1.0);
130 if ( test < 1.e-5 ) {
131 h1.at(1) = answer.at(1, 1) = 1.0;
132 h1.at(2) = answer.at(2, 1) = 0.0;
133 } else {
134 h1.at(1) = answer.at(1, 1) = answer.at(2, 3);
135 h1.at(2) = answer.at(2, 1) = -answer.at(1, 3);
136 }
137
138 h1.at(3) = answer.at(3, 1) = 0.0;
139 // local y axis perpendicular to local x,z axes
140 h2.beVectorProductOf(nn, h1);
141 for ( int i = 1; i <= 3; i++ ) {
142 answer.at(i, 2) = h2.at(i);
143 }
144
145 return 1;
146}
147
148Interface *
149QSpace :: giveInterface(InterfaceType interface)
150{
151 if ( interface == ZZNodalRecoveryModelInterfaceType ) {
152 return static_cast< ZZNodalRecoveryModelInterface * >(this);
153 } else if ( interface == SPRNodalRecoveryModelInterfaceType ) {
154 return static_cast< SPRNodalRecoveryModelInterface * >(this);
155 } else if ( interface == NodalAveragingRecoveryModelInterfaceType ) {
156 return static_cast< NodalAveragingRecoveryModelInterface * >(this);
157 } else if ( interface == SpatialLocalizerInterfaceType ) {
158 return static_cast< SpatialLocalizerInterface * >(this);
159 }
160
161 OOFEM_LOG_INFO("Interface on Qspace element not supported");
162 return NULL;
163}
164
165void
166QSpace :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap)
167{
168 pap.resize(20);
169 for ( int i = 1; i <= 20; i++ ) {
170 pap.at(i) = this->giveNode(i)->giveNumber();
171 }
172}
173
174void
175QSpace :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
176{
177 int found = 0;
178 answer.resize(1);
179
180 for ( int i = 1; i <= 20; i++ ) {
181 if ( this->giveNode(i)->giveNumber() == pap ) {
182 found = 1;
183 }
184 }
185
186 if ( found ) {
187 answer.at(1) = pap;
188 } else {
189 OOFEM_ERROR("unknown node number %d", pap);
190 }
191}
192
193int
194QSpace :: SPRNodalRecoveryMI_giveNumberOfIP()
195{
196 return this->integrationRulesArray [ 0 ]->giveNumberOfIntegrationPoints();
197}
198
199
201QSpace :: SPRNodalRecoveryMI_givePatchType()
202{
204}
205
206
207void
208QSpace :: NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep)
209{
210 answer.clear();
211 OOFEM_WARNING("IP values will not be transferred to nodes. Use ZZNodalRecovery instead (parameter stype 1)");
212}
213
214} // end namespace oofem
#define REGISTER_Element(class)
Node * giveNode(int i) const
Definition element.h:629
IntArray dofManArray
Array containing dofmanager numbers.
Definition element.h:138
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
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
int giveNumber() const
Definition femcmpnn.h:104
double computeSquaredNorm() const
Definition floatarray.C:867
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
Definition floatarray.C:476
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
void resize(int n)
Definition intarray.C:73
int & at(std::size_t i)
Definition intarray.h:104
static FEI3dHexaQuad interpolation
Definition qspace.h:59
SpatialLocalizerInterface(Element *element)
Structural3DElement(int n, Domain *d)
ZZNodalRecoveryModelInterface(Element *element)
Constructor.
#define OOFEM_WARNING(...)
Definition error.h:80
#define OOFEM_ERROR(...)
Definition error.h:79
#define OOFEM_LOG_INFO(...)
Definition logger.h:143
@ SPRNodalRecoveryModelInterfaceType
@ ZZNodalRecoveryModelInterfaceType
@ SpatialLocalizerInterfaceType
@ NodalAveragingRecoveryModelInterfaceType
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]

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