OOFEM 3.0
Loading...
Searching...
No Matches
trabbonematerial.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 "trabbonematerial.h"
36#include "floatmatrix.h"
37#include "floatarray.h"
39#include "contextioerr.h"
40#include "mathfem.h"
41#include "classfactory.h"
42
43namespace oofem {
45
46TrabBoneMaterial :: TrabBoneMaterial(int n, Domain *d) : StructuralMaterial(n, d)
47{ }
48
49
50bool
51TrabBoneMaterial :: hasMaterialModeCapability(MaterialMode mode) const
52{
53 return mode == _1dMat;
54}
55
56
57double TrabBoneMaterial :: computeCumPlastStrain(GaussPoint *gp, TimeStep *tStep) const
58{
59 auto status = static_cast< TrabBoneMaterialStatus * >( this->giveStatus(gp) );
60 return status->giveTempAlpha();
61}
62
63
65TrabBoneMaterial :: give1dStressStiffMtrx(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const
66{
67 auto status = static_cast< TrabBoneMaterialStatus * >( this->giveStatus(gp) );
68
69 if ( mode == ElasticStiffness ) {
70 return {E0};
71 } else if ( mode == SecantStiffness ) {
72 double dam = status->giveTempDam();
73 double matconstc = status->giveMatConstC();
74
75 return {( 1.0 - dam ) * E0 + matconstc};
76 } else {
77 double epsnew = status->giveTempStrainVector().at(1);
78 auto &epsnewArray = status->giveTempStrainVector();
79 double epsp = status->giveTempPlasStrainVector().at(1);
80 double depsp = status->giveTempIncPlasStrainVector().at(1);
81 double alpha = status->giveTempAlpha();
82 double dam = status->giveTempDam();
83 double matconstc = status->giveMatConstC();
84
86 computeDensification(gp, epsnewArray);
87 if ( depsp != 0.0 ) {
88 return {( 1.0 - dam ) * ( E0 * ( Eil + Ek ) ) / ( E0 + Eil + Ek )
89 - E0 * E0 * ( epsnew - epsp ) / ( E0 + Eil + Ek ) * adam * exp(-adam * alpha) * depsp / fabs(depsp) + matconstc};
90 } else {
91 return {( 1.0 - dam ) * E0 + matconstc};
92 }
93 }
94}
95
96
97void
98TrabBoneMaterial :: performPlasticityReturn(GaussPoint *gp, const FloatArray &totalStrain) const
99{
100 auto status = static_cast< TrabBoneMaterialStatus * >( this->giveStatus(gp) );
101
102 double epsnew = totalStrain.at(1);
103 double epsold = status->giveStrainVector().at(1);
104 double epsp = status->givePlasStrainVector().at(1);
105 double alpha = status->giveAlpha();
106 double sigp = E0 * epsnew - ( E0 + Ek ) * epsp;
107
108 double sigY;
109 if ( sigp < 0.0 ) {
110 sigY = SigYn;
111 } else {
112 sigY = SigYp;
113 }
114
115 double depsp;
116 if ( sigp / fabs(sigp) * sigp > sigY + Eil * alpha + Eie * ( 1 - exp(-kie * alpha) ) ) {
117 depsp = epsnew - epsold;
118 double gNewton = sigp / fabs(sigp) * ( E0 * epsnew - ( E0 + Ek ) * ( epsp + depsp ) ) - ( sigY + Eil * ( alpha +
119 sigp / fabs(sigp) * depsp ) + Eie * ( 1 - exp( -kie * ( alpha + sigp / fabs(sigp) * depsp ) ) ) );
120 while ( fabs(gNewton) > 10.e-7 ) {
121 gNewton = sigp / fabs(sigp) * ( E0 * epsnew - ( E0 + Ek ) * ( epsp + depsp ) ) - ( sigY + Eil * ( alpha +
122 sigp / fabs(sigp) * depsp ) + Eie * ( 1 - exp( -kie * ( alpha + sigp / fabs(sigp) * depsp ) ) ) );
123 double dgNewton = -sigp / fabs(sigp) * ( ( E0 + Ek ) + Eil +
124 Eie * kie * exp( -kie * ( alpha + sigp / fabs(sigp) * depsp ) ) );
125 depsp += -gNewton / dgNewton;
126 }
127
128 epsp += depsp;
129 } else {
130 depsp = 0.0;
131 }
132
133 alpha += fabs(depsp);
134
135 status->setTempEpsp(epsp);
136 status->setTempDepsp(depsp);
137 status->setTempAlpha(alpha);
138}
139
140
141void
142TrabBoneMaterial :: computeDensification(GaussPoint *gp, const FloatArray &totalStrain) const
143{
144 auto status = static_cast< TrabBoneMaterialStatus * >( this->giveStatus(gp) );
145 double epsnew = totalStrain.at(1);
146 double sigc, matconstc;
147 if ( epsnew > EpsC ) {
148 sigc = 0.0;
149 matconstc = 0.0;
150 } else {
151 sigc = Cc * ( epsnew - EpsC ) + Cc2 * ( epsnew - EpsC ) * ( epsnew - EpsC ) * ( epsnew - EpsC ) * ( epsnew - EpsC ) * ( epsnew - EpsC ) * ( epsnew - EpsC ) * ( epsnew - EpsC );
152 matconstc = Cc + 7 * Cc2 * ( epsnew - EpsC ) * ( epsnew - EpsC ) * ( epsnew - EpsC ) * ( epsnew - EpsC ) * ( epsnew - EpsC ) * ( epsnew - EpsC );
153 }
154
155 status->setSigC(sigc);
156 status->setMatConstC(matconstc);
157}
158
159
160double
161TrabBoneMaterial :: computeDamageParam(double alpha, GaussPoint *gp) const
162{
163 double dam;
164 if ( alpha > 0. ) {
165 dam = 1.0 - exp(-adam * alpha);
166 // dam = adam*alpha;
167 } else {
168 dam = 0.0;
169 }
170
171 if ( alpha < 0. ) {
172 OOFEM_ERROR("Alpha less than zero. Not possible");
173 }
174
175 return dam;
176}
177
178
179double
180TrabBoneMaterial :: computeDamage(GaussPoint *gp, TimeStep *tStep) const
181{
182 double alpha = computeCumPlastStrain(gp, tStep);
183 return computeDamageParam(alpha, gp);
184}
185
186
188TrabBoneMaterial :: giveRealStressVector_1d(const FloatArrayF<1> &totalStrain,
189 GaussPoint *gp, TimeStep *tStep) const
190{
191 auto status = static_cast< TrabBoneMaterialStatus * >( this->giveStatus(gp) );
192
193 this->initTempStatus(gp);
194
195 performPlasticityReturn(gp, totalStrain);
196
197 computeDensification(gp, totalStrain);
198
199 double epsnew = totalStrain.at(1);
200 double dam = computeDamage(gp, tStep);
201 double epsp = status->giveTempPlasStrainVector().at(1);
202 double sigc = status->giveSigC();
203 double sig = ( 1 - dam ) * E0 * ( epsnew - epsp ) + sigc;
204
205 FloatArrayF<1> answer = {sig};
206 status->setTempDam(dam);
207 status->letTempStrainVectorBe(totalStrain);
208 status->letTempStressVectorBe(answer);
209
210 return answer;
211}
212
213
214void
231
232
236
237TrabBoneMaterialStatus :: TrabBoneMaterialStatus(GaussPoint *g) : StructuralMaterialStatus(g)
238{
239}
240
241
242void
243TrabBoneMaterialStatus :: printOutputAt(FILE *file, TimeStep *tStep) const
244{
245 StructuralMaterialStatus :: printOutputAt(file, tStep);
246 fprintf(file, "status { ");
247 fprintf(file, "plastrains %f, alpha %f, dam %f, Slope %f ", this->tempEpsp.at(1),
248 this->tempAlpha, this->tempDam, this->slope);
249 fprintf(file, "}\n");
250}
251
252
253void
254TrabBoneMaterialStatus :: initTempStatus()
255{
256 StructuralMaterialStatus :: initTempStatus();
257 this->tempAlpha = this->alpha;
258 this->tempDam = this->dam;
259 this->tempEpsp = this->epsp;
260}
261
262
263void
264TrabBoneMaterialStatus :: updateYourself(TimeStep *tStep)
265{
266 StructuralMaterialStatus :: updateYourself(tStep);
267 this->alpha = this->tempAlpha;
268 this->dam = this->tempDam;
269 this->epsp = this->tempEpsp;
270}
271
272
273void
274TrabBoneMaterialStatus :: saveContext(DataStream &stream, ContextMode mode)
275{
276 // save parent class status
277 StructuralMaterialStatus :: saveContext(stream, mode);
278
279 // write a raw data
280 //if (fwrite(&kappa,sizeof(double),1,stream) != CIO_OK) THROW_CIOERR(CIO_IOERR);
281 //if (fwrite(&damage,sizeof(double),1,stream)!= CIO_OK) THROW_CIOERR(CIO_IOERR);
282}
283
284
285void
286TrabBoneMaterialStatus :: restoreContext(DataStream &stream, ContextMode mode)
287{
288 // read parent class status
289 StructuralMaterialStatus :: restoreContext(stream, mode);
290
291 // read raw data
292 //if (fread (&kappa,sizeof(double),1,stream) != 1) THROW_CIOERR(CIO_IOERR);
293 //if (fread (&damage,sizeof(double),1,stream) != 1) THROW_CIOERR(CIO_IOERR);
294}
295
296
297std::unique_ptr<MaterialStatus> TrabBoneMaterial :: CreateStatus(GaussPoint *gp) const
298{
299 return std::make_unique<TrabBoneMaterialStatus>(gp);
300}
301} // end namespace oofem
#define REGISTER_Material(class)
double & at(std::size_t i)
double & at(Index i)
Definition floatarray.h:202
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Definition material.C:206
virtual void initTempStatus(GaussPoint *gp) const
Definition material.C:221
StructuralMaterialStatus(GaussPoint *g)
Constructor. Creates new StructuralMaterialStatus with IntegrationPoint g.
StructuralMaterial(int n, Domain *d)
double computeDamageParam(double alpha, GaussPoint *gp) const
void performPlasticityReturn(GaussPoint *gp, const FloatArray &totalStrain) const
void computeDensification(GaussPoint *gp, const FloatArray &totalStrain) const
double computeDamage(GaussPoint *gp, TimeStep *tStep) const
virtual double computeCumPlastStrain(GaussPoint *gp, TimeStep *tStep) const
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
long ContextMode
Definition contextmode.h:43
#define _IFT_TrabBoneMaterial_E0
#define _IFT_TrabBoneMaterial_Eil
#define _IFT_TrabBoneMaterial_Cc
#define _IFT_TrabBoneMaterial_Eie
#define _IFT_TrabBoneMaterial_Cc2
#define _IFT_TrabBoneMaterial_adam
#define _IFT_TrabBoneMaterial_SigYn
#define _IFT_TrabBoneMaterial_SigYp
#define _IFT_TrabBoneMaterial_kie
#define _IFT_TrabBoneMaterial_Ek
#define _IFT_TrabBoneMaterial_EpsC

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