OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 2013 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 
43 namespace oofem {
44 REGISTER_Material(MazarsNLMaterial);
45 
47  //
48  // constructor
49  //
50 {
51  //linearElasticMaterial = new IsotropicLinearElasticMaterial (n,d);
52  R = 0.;
53 }
54 
55 
57 //
58 // destructor
59 //
60 { }
61 
62 Interface *
64 {
66  return static_cast< StructuralNonlocalMaterialExtensionInterface * >(this);
67  } else {
68  return NULL;
69  }
70 }
71 
72 
73 
74 void
76 {
77  /* Implements the service updating local variables in given integration points,
78  * which take part in nonlocal average process. Actually, no update is necessary,
79  * because the value used for nonlocal averaging is strain vector used for nonlocal secant stiffness
80  * computation. It is therefore necessary only to store local strain in corresponding status.
81  * This service is declared at StructuralNonlocalMaterial level.
82  */
83  FloatArray SDstrainVector;
84  double equivStrain;
85  MazarsNLMaterialStatus *nlstatus = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(gp) );
86 
87  this->initTempStatus(gp);
88 
89  // subtract stress independent part
90  // note: eigenStrains (temperature) is not contained in mechanical strain stored in gp
91  // therefore it is necessary to subtract always the total eigen strain value
92  this->giveStressDependentPartOfStrainVector(SDstrainVector, gp, strainVector, tStep, VM_Total);
93 
94  // compute equivalent strain
95  this->computeLocalEquivalentStrain(equivStrain, SDstrainVector, gp, tStep);
96 
97  nlstatus->setLocalEquivalentStrainForAverage(equivStrain);
98 }
99 
100 
101 
102 void
104 {
105  double nonlocalContribution, nonlocalEquivalentStrain = 0.0;
106  MazarsNLMaterialStatus *nonlocStatus, *status = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(gp) );
107 
108  this->buildNonlocalPointTable(gp);
109  this->updateDomainBeforeNonlocAverage(tStep);
110 
111  // compute nonlocal strain increment first
112  for ( auto &lir: *this->giveIPIntegrationList(gp) ) {
113  nonlocStatus = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(lir.nearGp) );
114  nonlocalContribution = nonlocStatus->giveLocalEquivalentStrainForAverage();
115  nonlocalContribution *= lir.weight;
116 
117  nonlocalEquivalentStrain += nonlocalContribution;
118  }
119 
120  nonlocalEquivalentStrain *= 1. / status->giveIntegrationScale();
121  this->endIPNonlocalAverage(gp); // !
122  kappa = nonlocalEquivalentStrain;
123 }
124 
127 {
128  IRResultType result; // Required by IR_GIVE_FIELD macro
129 
131  if ( result != IRRT_OK ) return result;
133  if ( result != IRRT_OK ) return result;
134 
136  if ( R < 0.0 ) {
137  R = 0.0;
138  }
139 
140  this->hReft = this->hRefc = 1.0;
141 
142  return IRRT_OK;
143 }
144 
145 
146 double
148 {
149  // Bell shaped function decaying with the distance.
150 
151  double dist = src.distance(coord);
152 
153  if ( ( dist >= 0. ) && ( dist <= this->R ) ) {
154  double help = ( 1. - dist * dist / ( R * R ) );
155  return help * help;
156  }
157 
158  return 0.0;
159 }
160 
161 
162 void
163 MazarsNLMaterial :: initDamaged(double kappa, FloatArray &totalStrainVector, GaussPoint *gp)
164 {
165  /*
166  * Perfoms initialization, when damage first appear. The Le characteristic length is
167  * set equal to 1.0, it doesnot matter - nonlocal approach is used. The only
168  * same value with reference length (which is used in local model, which
169  * computeDmaga function is reused).
170  */
171  MazarsNLMaterialStatus *status = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(gp) );
172 
173  status->setLe(1.0);
174  status->setLec(1.0);
175 }
176 
177 
180 {
182 }
183 
184 
186 { }
187 
188 
189 void
191 {
193  fprintf(file, "status { ");
194  if ( this->damage > 0.0 ) {
195  fprintf(file, "nonloc-kappa %f, damage %f ", this->kappa, this->damage);
196  }
197 
198  fprintf(file, "}\n");
199 }
200 
201 
202 void
204 //
205 // initializes temp variables according to variables form previous equlibrium state.
206 // builds new crackMap
207 //
208 {
210 }
211 
212 
213 void
215 //
216 // updates variables (nonTemp variables describing situation at previous equilibrium state)
217 // after a new equilibrium state has been reached
218 // temporary variables are having values corresponding to newly reched equilibrium.
219 //
220 {
222 }
223 
224 
227 //
228 // saves full information stored in this Status
229 // no temp variables stored
230 //
231 {
232  contextIOResultType iores;
233 
234  // save parent class status
235  if ( ( iores = MazarsMaterialStatus :: saveContext(stream, mode, obj) ) != CIO_OK ) {
236  THROW_CIOERR(iores);
237  }
238 
239  //if (!stream.write(&localEquivalentStrainForAverage,1)) THROW_CIOERR(CIO_IOERR);
240  return CIO_OK;
241 }
242 
245 //
246 // restores full information stored in stream to this Status
247 //
248 {
249  contextIOResultType iores;
250  // read parent class status
251  if ( ( iores = MazarsMaterialStatus :: restoreContext(stream, mode, obj) ) != CIO_OK ) {
252  THROW_CIOERR(iores);
253  }
254 
255  // read raw data
256  //if (!stream.read (&localEquivalentStrainForAverage,1)) THROW_CIOERR(CIO_IOERR);
257 
258  return CIO_OK;
259 }
260 
261 Interface *
263 {
265  return static_cast< StructuralNonlocalMaterialStatusExtensionInterface * >(this);
266  } else {
267  return NULL;
268  }
269 }
270 
271 
272 int
274 {
275  MazarsNLMaterialStatus *status = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(ip) );
276 
277  this->buildNonlocalPointTable(ip);
278  this->updateDomainBeforeNonlocAverage(tStep);
279 
280  return buff.write( status->giveLocalEquivalentStrainForAverage() );
281 }
282 
283 int
285 {
286  int result;
287  MazarsNLMaterialStatus *status = static_cast< MazarsNLMaterialStatus * >( this->giveStatus(ip) );
289 
290  result = buff.read(localEquivalentStrainForAverage);
291  status->setLocalEquivalentStrainForAverage(localEquivalentStrainForAverage);
292  return result;
293 }
294 
295 int
297 {
298  //
299  // Note: status localStrainVectorForAverage memeber must be properly sized!
300  //
301  //MazarsNLMaterialStatus *status = (MazarsNLMaterialStatus*) this -> giveStatus (ip);
302 
303  return buff.givePackSizeOfDouble(1);
304 }
305 
306 } // end namespace oofem
Abstract base class for all nonlocal structural materials.
double giveLocalEquivalentStrainForAverage()
Returns the local equivalent strain to be averaged.
Definition: mazarsmodelnl.h:68
void updateDomainBeforeNonlocAverage(TimeStep *tStep)
Updates data in all integration points before nonlocal average takes place.
Class and object Domain.
Definition: domain.h:115
void endIPNonlocalAverage(GaussPoint *gp)
Notifies the receiver, that the nonlocal averaging has been finished for given ip.
double R
Interaction radius, related to the nonlocal characteristic length of material.
This class implements associated Material Status to MazarsNLModel.
Definition: mazarsmodelnl.h:53
double kappa
Scalar measure of the largest strain level ever reached in material.
virtual int unpackAndUpdateUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip)
Unpack and updates all necessary data of given integration point (according to element parallel_mode)...
virtual int estimatePackSize(DataStream &buff, GaussPoint *ip)
Estimates the necessary pack size to hold all packed data of receiver.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
double damage
Damage level of material.
virtual double computeWeightFunction(const FloatArray &src, const FloatArray &coord)
Evaluates the basic nonlocal weight function for two points with given coordinates.
void setLe(double ls)
Sets characteristic length to given value.
void buildNonlocalPointTable(GaussPoint *gp)
Builds list of integration points which take part in nonlocal average in given integration point...
MazarsNLMaterialStatus(int n, Domain *d, GaussPoint *g)
Constructor.
MazarsNLMaterial(int n, Domain *d)
Constructor.
Definition: mazarsmodelnl.C:46
void giveStressDependentPartOfStrainVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrainVector, TimeStep *tStep, ValueModeType mode)
Method for subtracting from reduced space strain vector its stress-independent parts (caused by tempe...
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: structuralms.C:73
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
virtual Interface * giveInterface(InterfaceType it)
Interface requesting service.
Definition: mazarsmodelnl.C:63
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
double hReft
Reference elem-length for objectivity.
Definition: mazarsmodel.h:103
IRResultType initializeFrom(InputRecord *ir)
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
double distance(const FloatArray &x) const
Computes the distance between position represented by receiver and position given as parameter...
Definition: floatarray.C:489
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
virtual ~MazarsNLMaterial()
Destructor.
Definition: mazarsmodelnl.C:56
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
void setLocalEquivalentStrainForAverage(double ls)
Sets the local equivalent strain for average to given value.
Definition: mazarsmodelnl.h:70
std::vector< localIntegrationRecord > * giveIPIntegrationList(GaussPoint *gp)
Returns integration list corresponding to given integration point.
virtual Interface * giveInterface(InterfaceType it)
Interface requesting service.
virtual ~MazarsNLMaterialStatus()
Destructor.
#define _IFT_MazarsNLMaterial_r
Definition: mazarsmodelnl.h:44
void computeLocalEquivalentStrain(double &kappa, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep)
Computes the equivalent local strain measure from given strain vector (full form).
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Returns material status of receiver in given integration point.
Definition: idm1.C:1354
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: mazarsmodel.C:519
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
virtual int givePackSizeOfDouble(int count)=0
virtual void computeEquivalentStrain(double &kappa, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep)
Computes the equivalent strain measure from given strain vector (full form).
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: mazarsmodel.C:68
virtual void updateBeforeNonlocAverage(const FloatArray &strainVector, GaussPoint *gp, TimeStep *tStep)
Declares the service updating local variables in given integration points, which take part in nonloca...
Definition: mazarsmodelnl.C:75
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Base class for all nonlocal structural material statuses.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: mazarsmodel.C:540
void initDamaged(double kappa, FloatArray &totalStrainVector, GaussPoint *gp)
Perfoms initialization, when damage first appear.
Class Interface.
Definition: interface.h:82
double localEquivalentStrainForAverage
Equivalent strain for averaging.
Definition: mazarsmodelnl.h:57
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
InterfaceType
Enumerative type, used to identify interface type.
Definition: interfacetype.h:43
double giveIntegrationScale()
Returns associated integration scale.
REGISTER_Material(DummyMaterial)
void setLec(double ls)
Sets characteristic length to given value.
Definition: mazarsmodel.h:77
This class implements associated Material Status to MazarsMaterial.
Definition: mazarsmodel.h:62
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
virtual void initTempStatus(GaussPoint *gp)
Initializes temporary variables stored in integration point status at the beginning of new time step...
Definition: material.C:267
This class implements a Mazars damage model form concrete.
Definition: mazarsmodel.h:95
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
virtual int packUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip)
Pack all necessary data of integration point (according to element parallel_mode) into given communic...
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011