OOFEM 3.0
Loading...
Searching...
No Matches
trabboneembed.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 "trabboneembed.h"
36#include "floatmatrix.h"
37#include "floatarray.h"
38#include "mathfem.h"
39#include "contextioerr.h"
40#include "classfactory.h"
41
42namespace oofem {
44
45TrabBoneEmbed :: TrabBoneEmbed(int n, Domain *d) : StructuralMaterial(n, d)
46{ }
47
48
49double TrabBoneEmbed :: computeCumPlastStrain(GaussPoint *gp, TimeStep *tStep) const
50{
51 return 0.;
52}
53
54
56TrabBoneEmbed :: give3dMaterialStiffnessMatrix(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const
57{
58 // 'auto status = static_cast< TrabBoneEmbedStatus * >( this->giveStatus(gp) );
59
60 auto compliance = this->constructIsoComplTensor(eps0, nu0);
61 auto elasticity = inv(compliance);
62
63 return elasticity;
64}
65
66
67void
68TrabBoneEmbed :: performPlasticityReturn(GaussPoint *gp, const FloatArrayF<6> &totalStrain) const
69{
70 auto status = static_cast< TrabBoneEmbedStatus * >( this->giveStatus(gp) );
71
72 status->setTempPlasDef(zeros<6>());
73 status->setTempAlpha(0.);
74}
75
76
77double
78TrabBoneEmbed :: computeDamageParam(double alpha, GaussPoint *gp) const
79{
80 double tempDam = 0.0;
81
82 return tempDam;
83}
84
85
86double
87TrabBoneEmbed :: computeDamage(GaussPoint *gp, TimeStep *tStep) const
88{
89 double tempAlpha = computeCumPlastStrain(gp, tStep);
90 double tempDam = computeDamageParam(tempAlpha, gp);
91
92 // double dam=0.0;
93
94 return tempDam;
95}
96
97
99TrabBoneEmbed :: giveRealStressVector_3d(const FloatArrayF<6> &strain, GaussPoint *gp,
100 TimeStep *tStep) const
101{
102 auto status = static_cast< TrabBoneEmbedStatus * >( this->giveStatus(gp) );
103
104 auto compliance = this->constructIsoComplTensor(eps0, nu0);
105 auto elasticity = inv(compliance);
106
107 this->initTempStatus(gp);
108
109 performPlasticityReturn(gp, strain);
110
111 double tempDam = computeDamage(gp, tStep);
112 //FloatArrayF<6> plasDef;
113
114 auto stress = dot(elasticity, strain);
115
116 double tempTSED = 0.5 * dot(strain, stress);
117
118 status->setTempDam(tempDam);
119 status->letTempStrainVectorBe(strain);
120 status->letTempStressVectorBe(stress);
121 status->setTempTSED(tempTSED);
122 return stress;
123}
124
125
127TrabBoneEmbed :: constructIsoComplTensor(double eps0, double nu0)
128{
129 double mu0 = eps0 / ( 2 * ( 1 + nu0 ) );
130
132 c.at(1, 1) = c.at(2, 2) = c.at(3, 3) = 1 / eps0;
133 c.at(1, 2) = c.at(2, 1) = c.at(1, 3) = -nu0 / eps0;
134 c.at(3, 1) = c.at(2, 3) = c.at(3, 2) = -nu0 / eps0;
135 c.at(4, 4) = c.at(5, 5) = c.at(6, 6) = 1 / mu0;
136 return c;
137}
138
139
140void
141TrabBoneEmbed :: initializeFrom(InputRecord &ir)
142{
143 StructuralMaterial :: initializeFrom(ir);
144
147}
148
149
150int
151TrabBoneEmbed :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
152{
153 auto status = static_cast< TrabBoneEmbedStatus * >( this->giveStatus(gp) );
154 if ( type == IST_DamageScalar ) {
155 answer.resize(1);
156 answer.at(1) = 0.;
157 OOFEM_WARNING("No damage is exported (why?!)");
158 return 1;
159 } else if ( type == IST_PlasticStrainTensor ) {
160 answer = status->givePlasDef();
161 OOFEM_WARNING("Unsure what components are stored in the plastic strain tensor");
162 return 1;
163 } else if ( type == IST_MaxEquivalentStrainLevel ) {
164 answer.resize(1);
165 answer.at(1) = 0.;
166 return 1;
167 } else if ( type == IST_BoneVolumeFraction ) {
168 answer.resize(1);
169 answer.at(1) = 1.;
170 return 1;
171 } else if ( type == IST_PlasStrainEnerDens ) {
172 answer.resize(1);
173 answer.at(1) = 0.;
174 return 1;
175 } else if ( type == IST_ElasStrainEnerDens ) {
176 answer.resize(1);
177 answer.at(1) = status->giveTempTSED();
178 return 1;
179 } else if ( type == IST_TotalStrainEnerDens ) {
180 answer.resize(1);
181 answer.at(1) = status->giveTempTSED();
182 return 1;
183 } else {
184 return StructuralMaterial :: giveIPValue(answer, gp, type, tStep);
185 }
186}
187
188
192
193TrabBoneEmbedStatus :: TrabBoneEmbedStatus(GaussPoint *g) : StructuralMaterialStatus(g)
194{
195}
196
197
198void
199TrabBoneEmbedStatus :: printOutputAt(FILE *file, TimeStep *tStep) const
200{
201 StructuralMaterialStatus :: printOutputAt(file, tStep);
202 fprintf(file, "status { ");
203 fprintf( file, "plastrains: %f %f %f %f %f %f", this->tempPlasDef.at(1), this->tempPlasDef.at(2), this->tempPlasDef.at(3), this->tempPlasDef.at(4), this->tempPlasDef.at(5), this->tempPlasDef.at(6) );
204 fprintf(file, " , alpha 0. , dam 0. , esed %f , psed 0. , tsed %f ", this->tempTSED, this->tempTSED);
205 fprintf(file, "}\n");
206}
207
208
209void
210TrabBoneEmbedStatus :: initTempStatus()
211{
212 StructuralMaterialStatus :: initTempStatus();
213 this->tempAlpha = this->alpha;
214 this->tempDam = this->dam;
215 this->tempTSED = this->tsed;
216 this->tempPlasDef = this->plasDef;
217}
218
219
220void
221TrabBoneEmbedStatus :: updateYourself(TimeStep *tStep)
222{
223 StructuralMaterialStatus :: updateYourself(tStep);
224 this->alpha = this->tempAlpha;
225 this->dam = this->tempDam;
226 this->tsed = this->tempTSED;
227 this->plasDef = this->tempPlasDef;
228}
229
230
231void
232TrabBoneEmbedStatus :: saveContext(DataStream &stream, ContextMode mode)
233{
234 // save parent class status
235 StructuralMaterialStatus :: saveContext(stream, mode);
236
237 // write a raw data
238 //if (fwrite(&kappa,sizeof(double),1,stream) != 1) THROW_CIOERR(CIO_IOERR);
239 //if (fwrite(&damage,sizeof(double),1,stream)!= 1) THROW_CIOERR(CIO_IOERR);
240}
241
242
243void
244TrabBoneEmbedStatus :: restoreContext(DataStream &stream, ContextMode mode)
245{
246 // read parent class status
247 StructuralMaterialStatus :: restoreContext(stream, mode);
248
249 // read raw data
250 //if (fread (&kappa,sizeof(double),1,stream) != 1) THROW_CIOERR(CIO_IOERR);
251 //if (fread (&damage,sizeof(double),1,stream) != 1) THROW_CIOERR(CIO_IOERR);
252}
253
254
255std::unique_ptr<MaterialStatus> TrabBoneEmbed :: CreateStatus(GaussPoint *gp) const
256{
257 return std::make_unique<TrabBoneEmbedStatus>(gp);
258}
259} // end namespace oofem
#define REGISTER_Material(class)
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
double at(std::size_t i, std::size_t j) const
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)
FloatArrayF< 6 > tempPlasDef
void setTempPlasDef(const FloatArrayF< 6 > &epsip)
double computeDamageParam(double alpha, GaussPoint *gp) const
double computeDamage(GaussPoint *gp, TimeStep *tStep) const
static FloatMatrixF< 6, 6 > constructIsoComplTensor(double eps0, double nu0)
Constructs the anisotropic compliance tensor.
void performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &totalStrain) const
virtual double computeCumPlastStrain(GaussPoint *gp, TimeStep *tStep) const
#define OOFEM_WARNING(...)
Definition error.h:80
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
long ContextMode
Definition contextmode.h:43
double dot(const FloatArray &x, const FloatArray &y)
FloatMatrixF< N, N > inv(const FloatMatrixF< N, N > &mat, double zeropiv=1e-24)
Computes the inverse.
FloatArrayF< N > zeros()
For more readable code.
#define _IFT_TrabBoneEmbed_nu0
#define _IFT_TrabBoneEmbed_eps0

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