OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
structuralms.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 "../sm/Materials/structuralms.h"
36 #include "../sm/Materials/structuralmaterial.h"
37 #include "contextioerr.h"
38 #include "../sm/Elements/nlstructuralelement.h"
39 #include "gausspoint.h"
40 
41 namespace oofem {
43  MaterialStatus(n, d, g), strainVector(), stressVector(),
44  tempStressVector(), tempStrainVector(), FVector(), tempFVector()
45 {
47  strainVector.resize(rsize);
48  stressVector.resize(rsize);
49 
50  // reset temp vars.
53 
55  if ( gp->giveIntegrationRule() == NULL ) {
56  return;
57  }
58  if ( NLStructuralElement * el = dynamic_cast< NLStructuralElement * >( gp->giveElement() ) ) {
59  if ( el->giveGeometryMode() == 1 ) { // if large def, initialize F and P
60  PVector.resize(9);
61  FVector.resize(9);
62  FVector.at(1) = FVector.at(2) = FVector.at(3) = 1.;
63  }
66  }
67 }
68 
69 
71 
72 
74 // Prints the strains and stresses on the data file.
75 {
76  FloatArray helpVec;
77 
79 
80  fprintf(File, " strains ");
82  for ( auto &var : helpVec ) {
83  fprintf( File, " %.4e", var );
84  }
85 
86  fprintf(File, "\n stresses");
88 
89  for ( auto &var : helpVec ) {
90  fprintf( File, " %.4e", var );
91  }
92  fprintf(File, "\n");
93 }
94 
95 
97 // Performs end-of-step updates.
98 {
100 
105 }
106 
107 
109 //
110 // initialize record at the begining of new load step
111 //
112 {
114 
115  // see if vectors describing reached equilibrium are defined
116  if ( this->giveStrainVector().giveSize() == 0 ) {
118  }
119 
120  if ( this->giveStressVector().giveSize() == 0 ) {
122  }
123 
124  // reset temp vars.
129 }
130 
131 
134 //
135 // saves full ms context (saves state variables, that completely describe
136 // current state)
137 {
138  contextIOResultType iores;
139 
140  if ( ( iores = MaterialStatus :: saveContext(stream, mode, obj) ) != CIO_OK ) {
141  THROW_CIOERR(iores);
142  }
143 
144  if ( ( iores = strainVector.storeYourself(stream) ) != CIO_OK ) {
145  THROW_CIOERR(iores);
146  }
147 
148  if ( ( iores = stressVector.storeYourself(stream) ) != CIO_OK ) {
149  THROW_CIOERR(iores);
150  }
151 
152  return CIO_OK;
153 }
154 
155 
158 //
159 // restores full material context (saves state variables, that completely describe
160 // current state)
161 //
162 {
163  contextIOResultType iores;
164 
165  if ( ( iores = MaterialStatus :: restoreContext(stream, mode, obj) ) != CIO_OK ) {
166  THROW_CIOERR(iores);
167  }
168 
169  if ( ( iores = strainVector.restoreYourself(stream) ) != CIO_OK ) {
170  THROW_CIOERR(iores);
171  }
172 
173  if ( ( iores = stressVector.restoreYourself(stream) ) != CIO_OK ) {
174  THROW_CIOERR(iores);
175  }
176 
177  return CIO_OK;
178 }
179 
181 {
182  MaterialStatus &tmpStat = const_cast< MaterialStatus & >(iStatus);
183  const StructuralMaterialStatus &structStatus = dynamic_cast< StructuralMaterialStatus & >(tmpStat);
184 
185  strainVector = structStatus.giveStrainVector();
186  stressVector = structStatus.giveStressVector();
187  tempStressVector = structStatus.giveTempStressVector();
188  tempStrainVector = structStatus.giveTempStrainVector();
189 
190  PVector = structStatus.givePVector();
191  tempPVector = structStatus.giveTempPVector();
192  CVector = structStatus.giveCVector();
193  tempCVector = structStatus.giveTempCVector();
194  FVector = structStatus.giveFVector();
195  tempFVector = structStatus.giveTempFVector();
196 }
197 
199 {
200  printf("Entering StructuralMaterialStatus :: addStateVariables().\n");
201 }
202 } // end namespace oofem
static int giveSizeOfVoigtSymVector(MaterialMode mmode)
Returns the size of symmetric part of a reduced stress/strain vector according to given mode...
FloatArray PVector
Equilibrated first Piola-Kirchhoff stress vector.
Definition: structuralms.h:78
virtual void updateYourself(TimeStep *tStep)
Update equilibrium history variables according to temp-variables.
Definition: structuralms.C:96
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition: gausspoint.h:191
virtual void updateYourself(TimeStep *)
Update equilibrium history variables according to temp-variables.
Definition: matstatus.h:108
GaussPoint * gp
Associated integration point.
Class and object Domain.
Definition: domain.h:115
const FloatArray & giveTempCVector() const
Returns the const pointer to receiver&#39;s temporary Cauchy stress vector.
Definition: structuralms.h:121
Abstract base class for "structural" finite elements with geometrical nonlinearities.
FloatArray tempStrainVector
Temporary strain vector in reduced form (to find balanced state)
Definition: structuralms.h:75
const FloatArray & givePVector() const
Returns the const pointer to receiver&#39;s first Piola-Kirchhoff stress vector.
Definition: structuralms.h:109
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
contextIOResultType storeYourself(DataStream &stream) const
Definition: floatarray.C:872
double & at(int i)
Coefficient access function.
Definition: floatarray.h:131
FloatArray tempFVector
Temporary deformation gradient in reduced form (to find balanced state)
Definition: structuralms.h:88
This class implements a structural material status information.
Definition: structuralms.h:65
FloatArray stressVector
Equilibrated stress vector in reduced form.
Definition: structuralms.h:71
const FloatArray & giveCVector() const
Returns the const pointer to receiver&#39;s Cauchy stress vector.
Definition: structuralms.h:111
virtual ~StructuralMaterialStatus()
Destructor.
Definition: structuralms.C:70
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: femcmpnn.C:51
Element * giveElement()
Returns corresponding element to receiver.
Definition: gausspoint.h:188
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: structuralms.C:73
#define THROW_CIOERR(e)
Definition: contextioerr.h:61
static void giveFullSymVectorForm(FloatArray &answer, const FloatArray &vec, MaterialMode matMode)
Converts the reduced unsymmetric Voigt vector (2nd order tensor) to full form.
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Definition: matstatus.h:103
FloatArray tempCVector
Temporary Cauchy stress vector (to find balanced state)
Definition: structuralms.h:84
StructuralMaterialStatus(int n, Domain *d, GaussPoint *g)
Constructor. Creates new StructuralMaterialStatus with number n, belonging to domain d and Integratio...
Definition: structuralms.C:42
const FloatArray & giveTempPVector() const
Returns the const pointer to receiver&#39;s temporary first Piola-Kirchhoff stress vector.
Definition: structuralms.h:119
virtual void addStateVariables(const MaterialStatus &iStatus)
Definition: structuralms.C:198
FloatArray tempPVector
Temporary first Piola-Kirchhoff stress vector (to find balanced state)
Definition: structuralms.h:80
virtual void copyStateVariables(const MaterialStatus &iStatus)
Functions for MaterialStatusMapperInterface.
Definition: structuralms.C:180
FloatArray CVector
Equilibrated Cauchy stress vector.
Definition: structuralms.h:82
contextIOResultType restoreYourself(DataStream &stream)
Definition: floatarray.C:895
const FloatArray & giveTempStrainVector() const
Returns the const pointer to receiver&#39;s temporary strain vector.
Definition: structuralms.h:115
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: structuralms.C:157
IntegrationRule * giveIntegrationRule()
Returns corresponding integration rule to receiver.
Definition: gausspoint.h:186
Abstract base class representing a material status information.
Definition: matstatus.h:84
Class representing vector of real numbers.
Definition: floatarray.h:82
FloatArray strainVector
Equilibrated strain vector in reduced form.
Definition: structuralms.h:69
const FloatArray & giveStressVector() const
Returns the const pointer to receiver&#39;s stress vector.
Definition: structuralms.h:107
const FloatArray & giveFVector() const
Returns the const pointer to receiver&#39;s deformation gradient vector.
Definition: structuralms.h:113
FloatArray FVector
Equilibrated deformation gradient in reduced form.
Definition: structuralms.h:86
const FloatArray & giveTempFVector() const
Returns the const pointer to receiver&#39;s temporary deformation gradient vector.
Definition: structuralms.h:123
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
virtual void initTempStatus()
Initializes the temporary internal variables, describing the current state according to previously re...
Definition: structuralms.C:108
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
Definition: femcmpnn.C:64
const FloatArray & giveTempStressVector() const
Returns the const pointer to receiver&#39;s temporary stress vector.
Definition: structuralms.h:117
int giveSize() const
Returns the size of receiver.
Definition: floatarray.h:218
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Definition: structuralms.C:133
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual void printOutputAt(FILE *file, TimeStep *tStep)
Print receiver&#39;s output to given stream.
Definition: matstatus.h:97
const FloatArray & giveStrainVector() const
Returns the const pointer to receiver&#39;s strain vector.
Definition: structuralms.h:105
FloatArray tempStressVector
Temporary stress vector in reduced form (increments are used mainly in nonlinear analysis) ...
Definition: structuralms.h:73
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
void resize(int s)
Resizes receiver towards requested size.
Definition: floatarray.C:631

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:31 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011