OOFEM 3.0
Loading...
Searching...
No Matches
qtrplstrslip.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 "fei2dtrquad.h"
37#include "node.h"
38#include "gausspoint.h"
39#include "floatmatrix.h"
40#include "floatarray.h"
41#include "intarray.h"
42#include "crosssection.h"
44#include "mathfem.h"
45#include "classfactory.h"
50
51
52namespace oofem {
54
55QTrPlaneStress2dSlip :: QTrPlaneStress2dSlip(int n, Domain *aDomain) :
56 QTrPlaneStress2d(n, aDomain)
57{
59}
60
61
63{
64 answer = {
65 D_u, D_v, S_u, S_v
66 };
67}
68
69
70void QTrPlaneStress2dSlip::computeStiffnessMatrix( FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep )
71{
72 int ndof=this->computeNumberOfDofs();
73
74 FloatMatrix Kaa, Kab, Kba, Kbb, daa, dab1, dab2, dba1, dba2, dbb1, dbb2, dbb3, dbb4;
75
76 for ( auto &gp : *this->giveDefaultIntegrationRulePtr() ) {
77 FloatMatrix Ba, Bb, Nb;
78 double dV;
79 this->computeBmatrixAt(gp, Ba);
80 this->computeBHmatrixAt(gp, Bb);
81 this->computeNmatrixAt(gp->giveNaturalCoordinates(), Nb);
82 dV = this->computeVolumeAround(gp);
83
84 //Get the sensitivities
85 FloatMatrix dStressdEps, dStressdS, dStressdG, dBStressdEps, dBStressdS, dBStressdG, dRStressdEps, dRStressdS, dRStressdG;
86 this->giveSensitivities(dStressdEps, dStressdS, dStressdG, dBStressdEps, dBStressdS, dBStressdG, dRStressdEps, dRStressdS, dRStressdG, rMode, gp, tStep );
87
88 daa.beProductOf(dStressdEps, Ba);
89 dab1.beProductOf(dStressdS,Nb);
90 dab2.beProductOf(dStressdG,Bb);
91 dba1.beProductOf(dBStressdEps,Ba);
92 dba2.beProductOf(dRStressdEps,Ba);
93 dbb1.beProductOf(dBStressdS,Nb);
94 dbb2.beProductOf(dBStressdG,Bb);
95 dbb3.beProductOf(dRStressdS,Nb);
96 dbb4.beProductOf(dRStressdG,Bb);
97
98 Kaa.plusProductUnsym(Ba, daa, dV);
99 Kab.plusProductUnsym(Ba, dab1, dV);
100 Kab.plusProductUnsym(Ba, dab2, dV);
101 Kba.plusProductUnsym(Nb,dba1,dV);
102 Kba.plusProductUnsym(Bb,dba2,dV);
103 Kbb.plusProductUnsym(Nb,dbb1,dV);
104 Kbb.plusProductUnsym(Nb,dbb2,dV);
105 Kbb.plusProductUnsym(Bb,dbb3,dV);
106 Kbb.plusProductUnsym(Bb,dbb4,dV);
107 }
108
109 answer.resize(ndof,ndof);
110 answer.assemble(Kaa,aMask,aMask);
111 answer.assemble(Kbb,bMask,bMask);
112 answer.assemble(Kab,aMask,bMask);
113 answer.assemble(Kba,bMask,aMask);
114
115}
116
117
118void QTrPlaneStress2dSlip::giveInternalForcesVector( FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord )
119{
120 int ndof=this->computeNumberOfDofs();
121
122 //Compute local fields at nodes
123 FloatArray u, a, b;
124 this->computeVectorOf(VM_Total, tStep, u);
125
126 a.beSubArrayOf(u,aMask);
127 b.beSubArrayOf(u,bMask);
128
129 FloatArray vStrain, vSlip, vSlipGradient;
130 FloatArray Stress, bStress, rStress;
131 FloatArray finta, fintb;
132
133 for ( auto &gp : *this->giveDefaultIntegrationRulePtr() ) {
134 FloatMatrix Ba, Bb, Nb;
135 FloatArray f;
136 double dV;
137 this->computeBmatrixAt(gp, Ba);
138 this->computeBHmatrixAt(gp, Bb);
139 this->computeNmatrixAt(gp->giveNaturalCoordinates(), Nb);
140 dV = this->computeVolumeAround(gp);
141
142 vStrain.beProductOf(Ba, a);
143 vSlip.beProductOf(Nb, b);
144 vSlipGradient.beProductOf(Bb, b);
145
146 this->giveHomogenizedFields(Stress, bStress, rStress, vStrain, vSlip, vSlipGradient, gp , tStep);
147
148 finta.plusProduct(Ba,Stress,dV);
149 fintb.plusProduct(Nb,bStress,dV);
150 fintb.plusProduct(Bb,rStress,dV);
151 }
152
153 answer.resize(ndof);
154 for (int i=1; i <= ndof/2 ; i++) {
155 if (i % 2 == 1) {
156 answer.at(2*i-1) = finta.at(i);
157 answer.at(2*i+1) = fintb.at(i);
158 } else if (i % 2 == 0) {
159 answer.at(2*i-2) = finta.at(i);
160 answer.at(2*i) = fintb.at(i);
161 }
162 }
163}
164
165
167{
168 if ( type == IST_DisplacementVector ) {
169 FloatArray u, a;
171 this->computeVectorOf(VM_Total, tStep, u);
172 a.beSubArrayOf(u, aMask);
174 answer.beProductOf(N, a);
175 return 1;
176 } else if ( type == IST_MacroSlipVector ) {
177 FloatArray u, b;
179 this->computeVectorOf(VM_Total, tStep, u);
180 b.beSubArrayOf(u,bMask);
182 answer.beProductOf(N, b);
183 return 1;
184 } else if ( type == IST_TransferStress ) {
186 answer = status->giveTransferStressVector();
187 return 1;
188 } else if ( type == IST_MacroSlipGradient ) {
189 FloatArray u, b;
190 FloatMatrix B;
191 this->computeVectorOf(VM_Total, tStep, u);
192 b.beSubArrayOf(u,bMask);
193 this->computeBHmatrixAt(gp, B);
194 answer.beProductOf(B, b);
195 return 1;
196 } else if (type == IST_ReinfMembraneStress ) {
198 answer = status->giveReinfStressVector();
199 return 1;
200 } else {
201 return Element :: giveIPValue(answer, gp, type, tStep);
202 }
203}
204
205
206void QTrPlaneStress2dSlip::giveHomogenizedFields( FloatArray &stress, FloatArray &bStress, FloatArray &rStress, const FloatArray &strain, const FloatArray &slip, const FloatArray &slipGradient, GaussPoint *gp, TimeStep *tStep )
207{
209 if ( mat ) {
210 mat->giveHomogenizedFields(stress, bStress, rStress, strain, slip, slipGradient, gp, tStep);
211 } else {
212 OOFEM_ERROR("Can't homogenize the fields. StructuralSlipFE2Material needed.");
213 }
214}
215
216
217void QTrPlaneStress2dSlip::giveSensitivities( FloatMatrix &dStressdEps, FloatMatrix &dStressdS, FloatMatrix &dStressdG, FloatMatrix &dBStressdEps, FloatMatrix &dBStressdS,
218 FloatMatrix &dBStressdG, FloatMatrix &dRStressdEps, FloatMatrix &dRStressdS, FloatMatrix &dRStressdG, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep )
219{
221 if ( mat ) {
222 mat->giveSensitivities(dStressdEps, dStressdS, dStressdG, dBStressdEps, dBStressdS, dBStressdG, dRStressdEps, dRStressdS, dRStressdG, mode, gp, tStep);
224// printf("dSdE \n");
225// dStressdEps.printYourself();
226// printf("dBSdE \n");
227// dBStressdEps.printYourself();
228// printf("dRSdE \n");
229// dRStressdEps.printYourself();
230// printf("dSdS \n");
231// dStressdS.printYourself();
232// printf("dBSdS \n");
233// dBStressdS.printYourself();
234// printf("dRSdS \n");
235// dRStressdS.printYourself();
236// printf("dSdG \n");
237// dStressdG.printYourself();
238// printf("dBSdG \n");
239// dBStressdG.printYourself();
240// printf("dRSdG \n");
241// dRStressdG.printYourself();
242 } else {
243 OOFEM_ERROR("Can't compute sensitivities. StructuralSlipFE2Material needed.");
244 }
245}
246} // end namespace oofem
#define N(a, b)
#define REGISTER_Element(class)
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Definition element.C:103
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 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)
void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override
void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override
int giveIPValue(FloatArray &answer, GaussPoint *gp, 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 giveDofManDofIDMask(int inode, IntArray &answer) const override
QTrPlaneStress2d(int n, Domain *d)
Definition qtrplstr.C:58
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