OOFEM 3.0
Loading...
Searching...
No Matches
mazarsmodelnl.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 "mazarsmodelnl.h"
36#include "gausspoint.h"
37#include "floatarray.h"
38#include "nonlocalmaterialext.h"
39#include "contextioerr.h"
40#include "classfactory.h"
41#include "datastream.h"
42
43namespace oofem {
45
46MazarsNLMaterial :: MazarsNLMaterial(int n, Domain *d) : MazarsMaterial(n, d), StructuralNonlocalMaterialExtensionInterface(d)
47{}
48
49
51MazarsNLMaterial :: giveInterface(InterfaceType type)
52{
54 return static_cast< StructuralNonlocalMaterialExtensionInterface * >(this);
55 } else {
56 return nullptr;
57 }
58}
59
60
61
62void
63MazarsNLMaterial :: updateBeforeNonlocAverage(const FloatArray &strainVector, GaussPoint *gp, TimeStep *tStep) const
64{
65 /* Implements the service updating local variables in given integration points,
66 * which take part in nonlocal average process. Actually, no update is necessary,
67 * because the value used for nonlocal averaging is strain vector used for nonlocal secant stiffness
68 * computation. It is therefore necessary only to store local strain in corresponding status.
69 * This service is declared at StructuralNonlocalMaterial level.
70 */
71 auto nlstatus = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(gp) );
72 FloatArray SDstrainVector;
73 double equivStrain;
74
75 this->initTempStatus(gp);
76
77 // subtract stress independent part
78 // note: eigenStrains (temperature) is not contained in mechanical strain stored in gp
79 // therefore it is necessary to subtract always the total eigen strain value
80 this->giveStressDependentPartOfStrainVector(SDstrainVector, gp, strainVector, tStep, VM_Total);
81
82 // compute equivalent strain
83 equivStrain = this->computeLocalEquivalentStrain(SDstrainVector, gp, tStep);
84
85 nlstatus->setLocalEquivalentStrainForAverage(equivStrain);
86}
87
88
89
90double
91MazarsNLMaterial :: computeEquivalentStrain(const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) const
92{
93 auto status = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(gp) );
94 double nonlocalEquivalentStrain = 0.0;
95
98
99 // compute nonlocal strain increment first
100 for ( auto &lir: *this->giveIPIntegrationList(gp) ) {
101 auto nonlocStatus = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(lir.nearGp) );
102 auto nonlocalContribution = nonlocStatus->giveLocalEquivalentStrainForAverage();
103 nonlocalContribution *= lir.weight;
104
105 nonlocalEquivalentStrain += nonlocalContribution;
106 }
107
108 nonlocalEquivalentStrain *= 1. / status->giveIntegrationScale();
109 this->endIPNonlocalAverage(gp); // !
110 return nonlocalEquivalentStrain;
111}
112
113void
114MazarsNLMaterial :: initializeFrom(InputRecord &ir)
115{
116 MazarsMaterial :: initializeFrom(ir);
117 StructuralNonlocalMaterialExtensionInterface :: initializeFrom(ir);
118
120 if ( R < 0.0 ) {
121 R = 0.0;
122 }
123
124 this->hReft = this->hRefc = 1.0;
125}
126
127
128double
129MazarsNLMaterial :: computeWeightFunction(const double R, const FloatArray &src, const FloatArray &coord) const
130{
131 // Bell shaped function decaying with the distance.
132
133 double dist = distance(src, coord);
134
135 if ( ( dist >= 0. ) && ( dist <= this->R ) ) {
136 double help = ( 1. - dist * dist / ( R * R ) );
137 return help * help;
138 }
139
140 return 0.0;
141}
142
143
144void
145MazarsNLMaterial :: initDamaged(double kappa, FloatArray &totalStrainVector, GaussPoint *gp) const
146{
147 /*
148 * Perfoms initialization, when damage first appear. The Le characteristic length is
149 * set equal to 1.0, it doesnot matter - nonlocal approach is used. The only
150 * same value with reference length (which is used in local model, which
151 * computeDmaga function is reused).
152 */
153 MazarsNLMaterialStatus *status = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(gp) );
154
155 status->setLe(1.0);
156 status->setLec(1.0);
157}
158
159
160MazarsNLMaterialStatus :: MazarsNLMaterialStatus(GaussPoint *g) :
162{}
163
164
165void
166MazarsNLMaterialStatus :: printOutputAt(FILE *file, TimeStep *tStep) const
167{
168 StructuralMaterialStatus :: printOutputAt(file, tStep);
169 fprintf(file, "status { ");
170 if ( this->damage > 0.0 ) {
171 fprintf(file, "nonloc-kappa %f, damage %f ", this->kappa, this->damage);
172 }
173
174 fprintf(file, "}\n");
175}
176
177
178void
179MazarsNLMaterialStatus :: initTempStatus()
180//
181// initializes temp variables according to variables form previous equlibrium state.
182// builds new crackMap
183//
184{
185 MazarsMaterialStatus :: initTempStatus();
186}
187
188
189void
190MazarsNLMaterialStatus :: updateYourself(TimeStep *tStep)
191//
192// updates variables (nonTemp variables describing situation at previous equilibrium state)
193// after a new equilibrium state has been reached
194// temporary variables are having values corresponding to newly reched equilibrium.
195//
196{
197 MazarsMaterialStatus :: updateYourself(tStep);
198}
199
200
201void
202MazarsNLMaterialStatus :: saveContext(DataStream &stream, ContextMode mode)
203{
204 MazarsMaterialStatus :: saveContext(stream, mode);
205 //if (!stream.write(&localEquivalentStrainForAverage,1)) THROW_CIOERR(CIO_IOERR);
206}
207
208void
209MazarsNLMaterialStatus :: restoreContext(DataStream &stream, ContextMode mode)
210{
211 MazarsMaterialStatus :: restoreContext(stream, mode);
212 //if (!stream.read (&localEquivalentStrainForAverage,1)) THROW_CIOERR(CIO_IOERR);
213}
214
215Interface *
216MazarsNLMaterialStatus :: giveInterface(InterfaceType type)
217{
219 return static_cast< StructuralNonlocalMaterialStatusExtensionInterface * >(this);
220 } else {
221 return NULL;
222 }
223}
224
225
226int
227MazarsNLMaterial :: packUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip)
228{
229 MazarsNLMaterialStatus *status = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(ip) );
230
231 this->buildNonlocalPointTable(ip);
233
234 return buff.write( status->giveLocalEquivalentStrainForAverage() );
235}
236
237int
238MazarsNLMaterial :: unpackAndUpdateUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip)
239{
240 int result;
241 MazarsNLMaterialStatus *status = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(ip) );
242 double localEquivalentStrainForAverage;
243
244 result = buff.read(localEquivalentStrainForAverage);
245 status->setLocalEquivalentStrainForAverage(localEquivalentStrainForAverage);
246 return result;
247}
248
249int
250MazarsNLMaterial :: estimatePackSize(DataStream &buff, GaussPoint *ip)
251{
252 //
253 // Note: status localStrainVectorForAverage memeber must be properly sized!
254 //
255 //MazarsNLMaterialStatus *status = (MazarsNLMaterialStatus*) this -> giveStatus (ip);
256
257 return buff.givePackSizeOfDouble(1);
258}
259
260} // end namespace oofem
#define REGISTER_Material(class)
virtual int read(int *data, std::size_t count)=0
Reads count integer values into array pointed by data.
virtual int givePackSizeOfDouble(std::size_t count)=0
virtual int write(const int *data, std::size_t count)=0
Writes count integer values from array pointed by data.
MaterialStatus * giveStatus(GaussPoint *gp) const override
Definition idm1.C:1392
double damage
Damage level of material.
double kappa
Scalar measure of the largest strain level ever reached in material.
void setLe(double ls)
Sets characteristic length to given value.
virtual void initTempStatus(GaussPoint *gp) const
Definition material.C:221
MazarsMaterialStatus(GaussPoint *g)
Constructor.
void setLec(double ls)
Sets characteristic length to given value.
Definition mazarsmodel.h:75
MazarsMaterial(int n, Domain *d)
Constructor.
Definition mazarsmodel.C:51
double hReft
Reference elem-length for objectivity.
void setLocalEquivalentStrainForAverage(double ls)
Sets the local equivalent strain for average to given value.
double giveLocalEquivalentStrainForAverage()
Returns the local equivalent strain to be averaged.
double computeLocalEquivalentStrain(const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) const
double R
Interaction radius, related to the nonlocal characteristic length of material.
void buildNonlocalPointTable(GaussPoint *gp) const
void updateDomainBeforeNonlocAverage(TimeStep *tStep) const
std ::vector< localIntegrationRecord > * giveIPIntegrationList(GaussPoint *gp) const
void giveStressDependentPartOfStrainVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrainVector, TimeStep *tStep, ValueModeType mode) const
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
#define _IFT_MazarsNLMaterial_r
long ContextMode
Definition contextmode.h:43
@ NonlocalMaterialStatusExtensionInterfaceType
@ NonlocalMaterialExtensionInterfaceType
double distance(const FloatArray &x, const FloatArray &y)

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