OOFEM 3.0
Loading...
Searching...
No Matches
qplanstrssslip.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
36#include "fei2dquadquad.h"
37#include "crosssection.h"
38#include "gausspoint.h"
39#include "floatmatrix.h"
40#include "floatarray.h"
41#include "intarray.h"
42#include "classfactory.h"
47
48#ifdef __OOFEG
49 #include "oofeggraphiccontext.h"
50#endif
51
52namespace oofem {
54
55QPlaneStress2dSlip :: QPlaneStress2dSlip(int n, Domain *aDomain) : QPlaneStress2d(n, aDomain)
56 // Constructor.
57{
58}
59
60void QPlaneStress2dSlip :: giveDofManDofIDMask(int inode, IntArray &answer) const
61{
62 answer = {
63 D_u, D_v, S_u, S_v
64 };
65}
66
67
68void QPlaneStress2dSlip :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
69{
70 int ndof=this->computeNumberOfDofs();
71
72 FloatMatrix Kaa, Kab, Kba, Kbb, daa, dab1, dab2, dba1, dba2, dbb1, dbb2, dbb3, dbb4;
73
74 for ( auto &gp : *this->giveDefaultIntegrationRulePtr() ) {
75 FloatMatrix Ba, Bb, Nb;
76 double dV;
77 this->computeBmatrixAt(gp, Ba);
78 this->computeBHmatrixAt(gp, Bb);
79 this->computeNmatrixAt(gp->giveNaturalCoordinates(), Nb);
80 dV = this->computeVolumeAround(gp);
81
82 //Compute the sensitivities
83 FloatMatrix dStressdEps, dStressdS, dStressdG, dBStressdEps, dBStressdS, dBStressdG, dRStressdEps, dRStressdS, dRStressdG;
84 this->giveSensitivities(dStressdEps, dStressdS, dStressdG, dBStressdEps, dBStressdS, dBStressdG, dRStressdEps, dRStressdS, dRStressdG, rMode, gp, tStep );
85
86 daa.beProductOf(dStressdEps, Ba);
87 dab1.beProductOf(dStressdS,Nb);
88 dab2.beProductOf(dStressdG,Bb);
89 dba1.beProductOf(dBStressdEps,Ba);
90 dba2.beProductOf(dRStressdEps,Ba);
91 dbb1.beProductOf(dBStressdS,Nb);
92 dbb2.beProductOf(dBStressdG,Bb);
93 dbb3.beProductOf(dRStressdS,Nb);
94 dbb4.beProductOf(dRStressdG,Bb);
95
96 Kaa.plusProductUnsym(Ba, daa, dV);
97 Kab.plusProductUnsym(Ba, dab1, dV);
98 Kab.plusProductUnsym(Ba, dab2, dV);
99 Kba.plusProductUnsym(Nb,dba1,dV);
100 Kba.plusProductUnsym(Bb,dba2,dV);
101 Kbb.plusProductUnsym(Nb,dbb1,dV);
102 Kbb.plusProductUnsym(Nb,dbb2,dV);
103 Kbb.plusProductUnsym(Bb,dbb3,dV);
104 Kbb.plusProductUnsym(Bb,dbb4,dV);
105 }
106
107 answer.resize(ndof,ndof);
108 answer.assemble(Kaa,aMask,aMask);
109 answer.assemble(Kbb,bMask,bMask);
110 answer.assemble(Kab,aMask,bMask);
111 answer.assemble(Kba,bMask,aMask);
112}
113
114void QPlaneStress2dSlip :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord)
115{
116 int ndof=this->computeNumberOfDofs();
117
118 //Compute local fields at nodes
119 FloatArray u, a, b;
120 this->computeVectorOf(VM_Total, tStep, u);
121
122 a.beSubArrayOf(u,aMask);
123 b.beSubArrayOf(u,bMask);
124
125 FloatArray vStrain, vSlip, vSlipGradient;
126 FloatArray Stress, bStress, rStress;
127 FloatArray finta, fintb;
128
129 for ( auto &gp : *this->giveDefaultIntegrationRulePtr() ) {
130 FloatMatrix Ba, Bb, Nb;
131 FloatArray f;
132 double dV;
133 this->computeBmatrixAt(gp, Ba);
134 this->computeBHmatrixAt(gp, Bb);
135 this->computeNmatrixAt(gp->giveNaturalCoordinates(), Nb);
136 dV = this->computeVolumeAround(gp);
137
138 vStrain.beProductOf(Ba, a);
139 vSlip.beProductOf(Nb, b);
140 vSlipGradient.beProductOf(Bb, b);
141
142 this->giveHomogenizedFields(Stress, bStress, rStress, vStrain, vSlip, vSlipGradient, gp , tStep);
143
144 finta.plusProduct(Ba,Stress,dV);
145 fintb.plusProduct(Nb,bStress,dV);
146 fintb.plusProduct(Bb,rStress,dV);
147 }
148
149 answer.resize(ndof);
150 for (int i=1; i <= ndof/2 ; i++) {
151 if (i % 2 == 1) {
152 answer.at(2*i-1) = finta.at(i);
153 answer.at(2*i+1) = fintb.at(i);
154 } else if (i % 2 == 0) {
155 answer.at(2*i-2) = finta.at(i);
156 answer.at(2*i) = fintb.at(i);
157 }
158 }
159}
160
161
162
163int QPlaneStress2dSlip :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
164{
165 if ( type == IST_DisplacementVector ) {
166 FloatArray u, a;
168 this->computeVectorOf(VM_Total, tStep, u);
169 a.beSubArrayOf(u, aMask);
171 answer.beProductOf(N, a);
172 return 1;
173 } else if ( type == IST_MacroSlipVector ) {
174 FloatArray u, b;
176 this->computeVectorOf(VM_Total, tStep, u);
177 b.beSubArrayOf(u,bMask);
179 answer.beProductOf(N, b);
180 return 1;
181 } else if ( type == IST_TransferStress ) {
183 answer = status->giveTransferStressVector();
184 return 1;
185 } else if ( type == IST_MacroSlipGradient ) {
186 FloatArray u, b;
187 FloatMatrix B;
188 this->computeVectorOf(VM_Total, tStep, u);
189 b.beSubArrayOf(u,bMask);
190 this->computeBHmatrixAt(gp, B);
191 answer.beProductOf(B, b);
192 return 1;
193 } else if (type == IST_ReinfMembraneStress ) {
195 answer = status->giveReinfStressVector();
196 return 1;
197 } else {
198 return Element :: giveIPValue(answer, gp, type, tStep);
199 }
200}
201
202
203void QPlaneStress2dSlip::giveHomogenizedFields( FloatArray &stress, FloatArray &bStress, FloatArray &rStress, const FloatArray &strain, const FloatArray &slip, const FloatArray &slipGradient, GaussPoint *gp, TimeStep *tStep )
204{
206 if ( mat ) {
207 mat->giveHomogenizedFields(stress, bStress, rStress, strain, slip, slipGradient, gp, tStep);
208 } else {
209 OOFEM_ERROR("Can't homogenize the fields. StructuralSlipFE2Material needed.");
210 }
211
212}
213
214
215void QPlaneStress2dSlip::giveSensitivities( FloatMatrix &dStressdEps, FloatMatrix &dStressdS, FloatMatrix &dStressdG, FloatMatrix &dBStressdEps, FloatMatrix &dBStressdS, FloatMatrix &dBStressdG, FloatMatrix &dRStressdEps, FloatMatrix &dRStressdS, FloatMatrix &dRStressdG, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep )
216{
218 if ( mat ) {
219 mat->giveSensitivities(dStressdEps, dStressdS, dStressdG, dBStressdEps, dBStressdS, dBStressdG, dRStressdEps, dRStressdS, dRStressdG, mode, gp, tStep);
221// printf("dSdE \n");
222// dStressdEps.printYourself();
223// printf("dBSdE \n");
224// dBStressdEps.printYourself();
225// printf("dRSdE \n");
226// dRStressdEps.printYourself();
227// printf("dSdS \n");
228// dStressdS.printYourself();
229// printf("dBSdS \n");
230// dBStressdS.printYourself();
231// printf("dRSdS \n");
232// dRStressdS.printYourself();
233// printf("dSdG \n");
234// dStressdG.printYourself();
235// printf("dBSdG \n");
236// dBStressdG.printYourself();
237// printf("dRSdG \n");
238// dRStressdG.printYourself();
239 } else {
240 OOFEM_ERROR("Can't compute sensitivities. StructuralSlipFE2Material needed.");
241 }
242}
243
244
246{
247 if ( numberOfGaussPoints == 9 ) {
248 GaussPoint *gp;
249
250 int i=0;
251 switch ( node ) {
252 case 1: i = 9;
253 break;
254 case 2: i = 3;
255 break;
256 case 3: i = 1;
257 break;
258 case 4: i = 7;
259 break;
260 case 5: i = 6;
261 break;
262 case 6: i = 2;
263 break;
264 case 7: i = 4;
265 break;
266 case 8: i = 8;
267 break;
268 }
269
270 gp = integrationRulesArray [ 0 ]->getIntegrationPoint(i - 1);
271 this->giveIPValue(answer, gp, type, tStep);
272 } else {
274 }
275}
276
277
278} // end namespace oofem
#define N(a, b)
#define REGISTER_Element(class)
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Definition element.C:103
std::vector< std ::unique_ptr< IntegrationRule > > integrationRulesArray
Definition element.h:157
int numberOfGaussPoints
Definition element.h:175
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Definition element.h:886
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
void plusProduct(const FloatMatrix &b, const FloatArray &s, double dV)
Definition floatarray.C:288
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
void beSubArrayOf(const FloatArray &src, const IntArray &indx)
Definition floatarray.C:440
void resize(Index rows, Index cols)
Definition floatmatrix.C:79
void plusProductUnsym(const FloatMatrix &a, const FloatMatrix &b, double dV)
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void assemble(const FloatMatrix &src, const IntArray &loc)
const FloatArray & giveSubPatchCoordinates() const
Returns local sub-patch coordinates of the receiver.
Definition gausspoint.h:142
IntegrationPointStatus * giveMaterialStatus(IntegrationPointStatusIDType key=IPSID_Default)
Definition gausspoint.h:204
void computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int lowerIndx=1, int upperIndx=ALL_STRAINS) override
void computeBHmatrixAt(GaussPoint *gp, FloatMatrix &answer) override
void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep) override
void giveHomogenizedFields(FloatArray &stress, FloatArray &bStress, FloatArray &rStress, const FloatArray &strain, const FloatArray &slip, const FloatArray &slipGradient, GaussPoint *gp, TimeStep *tStep)
void giveSensitivities(FloatMatrix &dStressdEps, FloatMatrix &dStressdS, FloatMatrix &dStressdG, FloatMatrix &dBStressdEps, FloatMatrix &dBStressdS, FloatMatrix &dBStressdG, FloatMatrix &dRStressdEps, FloatMatrix &dRStressdS, FloatMatrix &dRStressdG, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
QPlaneStress2d(int n, Domain *d)
Definition qplanstrss.C:55
void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep) override
Definition qplanstrss.C:389
double computeVolumeAround(GaussPoint *gp) override
Material * giveMaterial(IntegrationPoint *ip) const override
StructuralCrossSection * giveStructuralCrossSection()
Helper function which returns the structural cross-section for the element.
virtual void computeNmatrixAt(const FloatArray &iLocCoord, FloatMatrix &answer)
virtual void giveHomogenizedFields(FloatArray &stress, FloatArray &bStress, FloatArray &rStress, const FloatArray &strain, const FloatArray &slip, const FloatArray &slipGradient, GaussPoint *gp, TimeStep *tStep)
virtual void giveSensitivities(FloatMatrix &dStressdEps, FloatMatrix &dStressdS, FloatMatrix &dStressdG, FloatMatrix &dBStressdEps, FloatMatrix &dBStressdS, FloatMatrix &dBStressdG, FloatMatrix &dRStressdEps, FloatMatrix &dRStressdS, FloatMatrix &dRStressdG, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
#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