xc
EPState.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // XC program; finite element analysis code
4 // for structural analysis and design.
5 //
6 // Copyright (C) Luis C. Pérez Tato
7 //
8 // This program derives from OpenSees <http://opensees.berkeley.edu>
9 // developed by the «Pacific earthquake engineering research center».
10 //
11 // Except for the restrictions that may arise from the copyright
12 // of the original program (see copyright_opensees.txt)
13 // XC is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This software is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program.
26 // If not, see <http://www.gnu.org/licenses/>.
27 //----------------------------------------------------------------------------
28 /*
29 ################################################################################
30 # COPYRIGHT (C): :-)) #
31 # PROJECT: Object Oriented Finite Element Program #
32 # PURPOSE: General platform for elaso-plastic constitutive model #
33 # implementation #
34 # CLASS: EPState (the base class for all Elasto-plastic state) #
35 # #
36 # VERSION: #
37 # LANGUAGE: C++.ver >= 2.0 ( Borland C++ ver=3.00, SUN C++ ver=2.1 ) #
38 # TARGET OS: DOS || UNIX || . . . #
39 # DESIGNER(S): Boris Jeremic, Zhaohui Yang #
40 # PROGRAMMER(S): Boris Jeremic, Zhaohui Yang #
41 # #
42 # #
43 # DATE: 08-03-2000 #
44 # UPDATE HISTORY: #
45 # May 2004, Zhao Cheng splitting the elastic part #
46 # #
47 # #
48 # #
49 # #
50 # SHORT EXPLANATION: This class is used to hold all state parameters and #
51 # internal variables in an elasto-plastic constitutive #
52 # model. #
53 ################################################################################
54 */
55 
56 #ifndef EPState_H
57 #define EPState_H
58 
59 #include "utility/matrix/nDarray/stresst.h"
60 #include "utility/matrix/nDarray/straint.h"
61 #include "utility/matrix/nDarray/BJtensor.h"
62 #include "utility/kernel/CommandEntity.h"
63 
64 // Constants
65 const size_t MaxNScalarVar= 4;
66 const size_t MaxNTensorVar= 4;
67 
68 namespace XC {
69 
70 struct state_vars
71  {
75 
76  std::vector<double> ScalarVar;
77  std::vector<stresstensor> TensorVar;
79  state_vars(void);
80  state_vars(const std::vector<double> &Scalarp, const std::vector<stresstensor> &Tensorp);
81  state_vars(const stresstensor & Stressp,
82  const straintensor & Strainp,
83  const straintensor & ElasticStrainp);
84  state_vars(const stresstensor &Stress,
85  const straintensor &Strain,
86  const straintensor &ElasticStrain,
87  const std::vector<double> &Scalar,
88  const std::vector<stresstensor> &Tensor,
89  const XC::BJtensor &Eep);
90  state_vars(const stresstensor stressp,
91  const straintensor strainp,
92  const straintensor Estrainp,
93  const std::vector<double> &Scalarp,
94  const std::vector<stresstensor> &Tensorp);
95  const stresstensor &getStress(void) const;
96  void setStress(const stresstensor &);
97  const straintensor &getStrain(void) const;
98  void setStrain(const straintensor &);
99  const straintensor &getElasticStrain(void) const;
100  void setElasticStrain(const straintensor &);
101  inline size_t getNScalarVar() const
102  { return ScalarVar.size(); }
103  const std::vector<double> &getScalarVar(void) const;
104  const double &getScalarVar(size_t WhichOne) const;
105  boost::python::list getScalarVarPy(void) const;
106  void setScalarVar(const std::vector<double> &);
107  void setScalarVarPy(const boost::python::list &);
108  void setScalarVar(size_t WhichOne, const double &rval);
109  inline size_t getNTensorVar() const
110  { return TensorVar.size(); }
111  const std::vector<stresstensor> &getTensorVar(void) const;
112  const stresstensor &getTensorVar(size_t WhichOne) const;
113  boost::python::list getTensorVarPy(void) const;
114  void setTensorVar(const std::vector<stresstensor> &);
115  void setTensorVarPy(const boost::python::list &);
116  void setTensorVar(size_t WhichOne, const stresstensor &);
117  const BJtensor &getEep(void) const;
118  };
119 
121  {
126  trial_state_vars(void);
127  trial_state_vars(const std::vector<double> &Scalarp, const std::vector<stresstensor> &Tensorp);
128  trial_state_vars(const stresstensor &Stress,
129  const straintensor &Strain,
130  const straintensor &ElasticStrain,
131  const straintensor &Pstrainp);
132  trial_state_vars(const stresstensor &Stress,
133  const straintensor &Strain,
134  const straintensor &ElasticStrain,
135  const straintensor &Pstrainp,
136  const straintensor &dEstrainp,
137  const straintensor &dPstrainp,
138  const std::vector<double> &Scalar,
139  const std::vector<stresstensor> &Tensor,
140  const XC::BJtensor &Eep);
141  void set(const state_vars &initStateVars);
142  void init(const state_vars &initStateVars);
143  };
144 
151 class EPState: public CommandEntity
152  {
153  public:
154 //ZC05/2004 // Elastic parameters
155 //ZC05/2004 double Eo; // Young's modulus when p = p_atmosphere -- [in-plane] in terms of cross-anisotropic material
156 //ZC05/2004 double E_Young; // Young's modulus -- [in-plane] in terms of cross-anisotropic material
157 //ZC05/2004 double nu_Poisson; // Poisson's ratio -- [in-plane] in terms of cross-anisotropic materi
158 //ZC05/2004 double rho_mass_density; // Mass density
159 
160 
164 
165  bool Converged;
166 
167  double Delta_lambda;
168 
169 //ZC05/2004 // Flag to indicate if elastic portion is pressure dependent isotropic, pressure independent isotropic, pressure
170 //ZC05/2004 // independent cross-anisotropic or pressure dependentcross-anisotropic
171 //ZC05/2004 // 1 == pressure dependent isotropic (default case, for soil)
172 //ZC05/2004 // 2 == pressure independent isotropic
173 //ZC05/2004 // 3 == pressure independent cross-anisotropic
174 //ZC05/2004 // 4 == pressure dependent cross-anisotropic
175 //ZC05/2004
176 //ZC05/2004 int Elasticflag;
177 //ZC05/2004
178 //ZC05/2004 //Parameters for elastic cross-anistropic material
179 //ZC05/2004 double Ev; // Ev: Young's modulus in a vertical direction -- [out-of-plane]
180 //ZC05/2004 double nuhv; // nuhv: Poisson's ratio for strain in the vertical direction due to a horizontal direct stress -- [out-of-plane]
181 //ZC05/2004 double Ghv; // Ghv: Modulus of shear deformation in a vertical plane -- [out-of-plane]
182 //ZC05/2004
183 //ZC05/2004 double eo; // Initial void ratio Joey 02-11-03
184 //ZC05/2004 double ec; // Void ratio at critical state at po Joey 02-11-03
185 //ZC05/2004 double Lambda; // Slope of critical state line Joey 02-11-03
186 //ZC05/2004 double po; // Reference pressure (100 kPa by default) Joey 02-11-03
187  double e; // Void ratio Joey 02-11-03
188  double psi; // State parameter Joey 02-18-03
189  int integratorFlag; //Guanzhou Mar2005
190 //ZC05/2004 double a; // Exponent in E = Eo (p/p_atm)^a for nonlinear elastic model Joey 02-11-03
191 
192  public:
193  //Normal Constructor--no parameters
194  EPState(void);
195  ~EPState(void);
196 
197 //ZC05/2004 //Normal Constructor1
198 //ZC05/2004 EPState(double Eod,
199 //ZC05/2004 double Ed,
200 //ZC05/2004 double nu,
201 //ZC05/2004 double rho,
202 //ZC05/2004 const stresstensor &stressp,
203 //ZC05/2004 const straintensor &strainp,
204 //ZC05/2004 const straintensor &Estrainp,
205 //ZC05/2004 const straintensor &Pstrainp,
206 //ZC05/2004 const straintensor &dEstrainp,
207 //ZC05/2004 const straintensor &dPstrainp,
208 //ZC05/2004 int NScalarp,
209 //ZC05/2004 const std::vector<double> &Scalarp,
210 //ZC05/2004 int NTensorp,
211 //ZC05/2004 const std::vector<stresstensor> &Tensorp,
212 //ZC05/2004 const tensor &Eepp,
213 //ZC05/2004 const stresstensor &Stress_commitp,
214 //ZC05/2004 const straintensor &Strain_commitp,
215 //ZC05/2004 const std::vector<double> &Scalar_commitp,
216 //ZC05/2004 const std::vector<stresstensor> &Tensor_commitp,
217 //ZC05/2004 const tensor &Eep_commitp,
218 //ZC05/2004 const stresstensor &Stress_initp,
219 //ZC05/2004 const straintensor &Strain_initp,
220 //ZC05/2004 const const std::vector<double> &Scalar_initp,
221 //ZC05/2004 const std::vector<stresstensor> &Tensor_initp,
222 //ZC05/2004 const tensor &Eep_initp,
223 //ZC05/2004 bool Convergedp,
224 //ZC05/2004 int Elasticflagp = 0,
225 //ZC05/2004 double Evp = 0.0,
226 //ZC05/2004 double nuhvp = 0.0,
227 //ZC05/2004 double Ghvp = 0.0,
228 //ZC05/2004 double eop = 0.85,
229 //ZC05/2004 double ecp = 0.80,
230 //ZC05/2004 double Lam = 0.025,
231 //ZC05/2004 double pop = 100.0,
232 //ZC05/2004 double ep = 0.85,
233 //ZC05/2004 double psip = 0.05,
234 //ZC05/2004 double ap = 0.5
235 //ZC05/2004 );
236 //ZC05/2004
237 //ZC05/2004
238 //ZC05/2004 //Normal Constructor11
239 //ZC05/2004 EPState(double Eod,
240 //ZC05/2004 double Ed,
241 //ZC05/2004 double nu,
242 //ZC05/2004 double rho,
243 //ZC05/2004 const stresstensor stressp,
244 //ZC05/2004 const straintensor strainp,
245 //ZC05/2004 const straintensor Estrainp,
246 //ZC05/2004 const straintensor Pstrainp,
247 //ZC05/2004 int NScalarp,
248 //ZC05/2004 const std::vector<double> &Scalarp,
249 //ZC05/2004 int NTensorp,
250 //ZC05/2004 const std::vector<stresstensor> &Tensorp,
251 //ZC05/2004 int Elasticflagp = 0,
252 //ZC05/2004 double Evp = 0.0,
253 //ZC05/2004 double nuhvp = 0.0,
254 //ZC05/2004 double Ghvp = 0.0,
255 //ZC05/2004 double eop = 0.85,
256 //ZC05/2004 double ecp = 0.80,
257 //ZC05/2004 double Lam = 0.025,
258 //ZC05/2004 double pop = 100.0,
259 //ZC05/2004 double ap = 0.5
260 //ZC05/2004 );
261 //ZC05/2004
262 //ZC05/2004 //Normal Constructor2
263 //ZC05/2004 EPState(double Eod,
264 //ZC05/2004 double Ed,
265 //ZC05/2004 double nu,
266 //ZC05/2004 double rho,
267 //ZC05/2004 int NScalarp,
268 //ZC05/2004 const std::vector<double> &Scalarp,
269 //ZC05/2004 int NTensorp,
270 //ZC05/2004 const std::vector<stresstensor> &Tensorp,
271 //ZC05/2004 int Elasticflagp = 0,
272 //ZC05/2004 double Evp = 0.0,
273 //ZC05/2004 double nuhvp = 0.0,
274 //ZC05/2004 double Ghvp = 0.0,
275 //ZC05/2004 double eop = 0.85,
276 //ZC05/2004 double ecp = 0.80,
277 //ZC05/2004 double Lam = 0.025,
278 //ZC05/2004 double pop = 100.0,
279 //ZC05/2004 double ap = 0.5
280 //ZC05/2004 );
281 
282  //Normal Constructor1
283  EPState(const trial_state_vars &trialSt,
284  const state_vars &commitSt,
285  const state_vars &initSt,
286  bool Convergedp,
287  double ep = 0.85,
288  double psip = 0.05,
289  int flag = 0 );
290 
291  //Normal Constructor11
292  EPState(const trial_state_vars &trialSt,
293  const straintensor Pstrainp,
294  double ep = 0.85,
295  double psip = 0.05,
296  int flag = 0); //Guanzhou
297 
298  //Normal Constructor2
299  EPState(const std::vector<double> &Scalarp,
300  const std::vector<stresstensor> &Tensorp );
301 
302  EPState *getCopy(void) const; //create a clone of itself
303 
304 //ZC05/2004 int getElasticflag() const;
305 
306 //ZC05/2004 double getE() const;
307 //ZC05/2004 double getEo() const;
308 //ZC05/2004 double getEv() const;
309 //ZC05/2004 double getnu() const;
310 //ZC05/2004 double getnuhv() const;
311 //ZC05/2004 double getGhv() const;
312 //ZC05/2004 double getrho() const;
313 
314  size_t getNScalarVar() const;
315  size_t getNTensorVar() const;
316  bool getConverged() const;
317 
318 //ZC05/2004 // Added Joey 02-12-03
319 //ZC05/2004 double geteo() const;
320 //ZC05/2004 double getec() const;
321 //ZC05/2004 double getLam() const;
322  double gete() const;
323  double getpsi() const; //state parameter
324  int getIntegratorFlag() const; //Guanzhou Mar 2005
325 //ZC05/2004 double getpo() const;
326 //ZC05/2004 double geta() const;
327 
328  const stresstensor &getStress(void) const;
329  const stresstensor &getIterativeStress() const;
330  const straintensor &getStrain() const;
331  const straintensor &getElasticStrain() const;
332  const straintensor &getPlasticStrain() const;
333  const straintensor &getdElasticStrain() const;
334  const straintensor &getdPlasticStrain() const;
335  const BJtensor &getEep(void) const;
336 
337  //Get committed state vars
338  const stresstensor &getStress_commit() const;
339  const straintensor &getStrain_commit() const;
340  const straintensor &getElasticStrain_commit() const;
341  const std::vector<double> &getScalarVar_commit() const;
342  double getScalarVar_commit(int i) const;
343  const std::vector<stresstensor> &getTensorVar_commit() const;
344  const stresstensor &getTensorVar_commit(int i) const;
345  const BJtensor &getEep_commit() const;
346 
347  //Get initial state vars
348  const stresstensor &getStress_init() const;
349  const straintensor &getStrain_init() const;
350  const std::vector<double> & getScalarVar_init() const;
351  double getScalarVar_init(int i) const;
352  const std::vector<stresstensor> &getTensorVar_init() const;
353  const stresstensor &getTensorVar_init(int i) const;
354  const BJtensor &getEep_init() const;
355 
356 //ZC05/2004 void setElasticflag( int efd );
357 //ZC05/2004 void setEo( double Eod );
358 //ZC05/2004 void setE( double Ey );
359 //ZC05/2004 void setnu( double nud );
360 
361 //ZC05/2004 void setEv( double Evd );
362 //ZC05/2004 void setGhv( double Ghvd );
363 //ZC05/2004 void setnuhv( double nud );
364 
365  void setStress( const stresstensor &newstress );
366  void setIterativeStress( const stresstensor &newstress );
367  void setStrain( const straintensor &newstrain );
368 
369  void setStress_commit( const stresstensor &newstress );
370  void setStrain_commit( const straintensor &newstrain );
371  void setElasticStrain_commit( const straintensor &newstrain );
372 
373  void setStress_init( const stresstensor &newstress );
374  void setStrain_init( const straintensor &newstrain );
375 
376  void setElasticStrain( const straintensor &newstrain );
377  void setPlasticStrain( const straintensor &newstrain );
378  void setdElasticStrain( const straintensor &newstrain );
379  void setdPlasticStrain( const straintensor &newstrain );
380  void setEep(const BJtensor &);
381  void setConverged( bool b);
382 
383 //ZC05/2004 // Added Joey 02-12-03
384 //ZC05/2004 void seteo( double eod );
385 //ZC05/2004 void setec( double ecd );
386 //ZC05/2004 void setLam( double Lamd );
387  void sete( double ed );
388  void setpsi( double psid );
389 //ZC05/2004 void setpo( double pod );
390 //ZC05/2004 void seta( double ad );
391 
392  // WhichOne starts from 1 and ends up to getNScalarVar()
393  const double &getScalarVar(size_t WhichOne) const;
394  const stresstensor &getTensorVar(size_t WhichOne) const;
395 
396  // return the pointers
397  const std::vector<double> &getScalarVar(void) const;
398  boost::python::list getScalarVarPy(void) const;
399  const std::vector<stresstensor> &getTensorVar() const;
400  boost::python::list getTensorVarPy(void) const;
401 
402  // WhichOne starts from 1 and ends up to NTensorVar
403  void setScalarVar(size_t WhichOne, const double &rval);
404  void setScalarVar_commit(size_t WhichOne, const double &rval);
405  void setScalarVar_init(size_t WhichOne, const double &rval);
406 
407  void setTensorVar(size_t WhichOne, const stresstensor &rval);
408  void setTensorVar_commit(size_t WhichOne, const stresstensor &rval);
409  void setTensorVar_init(size_t WhichOne, const stresstensor &rval);
410 
411  void setScalarVar(const std::vector<double> &);
412  void setScalarVarPy(const boost::python::list &);
413  void setTensorVar(const std::vector<stresstensor> &rval);
414  void setTensorVarPy(const boost::python::list &);
415  void setInit();
416 
417  //added for OpenSees _Zhaohui 02-10-2000
418  int commitState(void);
419  int revertToLastCommit(void);
420  int revertToStart(void);
421 
422  void print(std::ostream &) const;
423  };
424 std::ostream & operator<<(std::ostream &, const EPState &);
425 } // end of XC namespace
426 
427 
428 #endif
429 
std::vector< double > ScalarVar
scalar variable array for scalar hardening vars
Definition: EPState.h:76
Definition: EPState.h:70
Stress tensor.
Definition: stresst.h:70
Definition: EPState.h:120
straintensor dPlasticStrain
Current plastic strain increment.
Definition: EPState.h:125
double Delta_lambda
Guanzhou Mar2005.
Definition: EPState.h:167
Boris Jeremic tensor class.
Definition: BJtensor.h:112
state_vars initStateVars
Initial state.
Definition: EPState.h:163
state_vars(void)
Default constructor.
Definition: EPState.cpp:58
state_vars commitStateVars
Committed state.
Definition: EPState.h:162
Base class for all elasto-plastic states.
Definition: EPState.h:151
Objet that can execute python scripts.
Definition: CommandEntity.h:40
BJtensor Eep
Elastic plastic stifness tensor.
Definition: EPState.h:78
straintensor PlasticStrain
Current cumulative plastic strain.
Definition: EPState.h:123
stresstensor IterativeStress
Iterative Stress.
Definition: EPState.h:122
straintensor ElasticStrain
GZ Mar2005.
Definition: EPState.h:74
std::vector< stresstensor > TensorVar
tensor variable array for tensor hardening vars
Definition: EPState.h:77
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
straintensor dElasticStrain
Current elastic strain increment.
Definition: EPState.h:124
straintensor Strain
strain –total
Definition: EPState.h:73
bool Converged
Bool to indicate whether this is the converged EPState by current CDriver.
Definition: EPState.h:165
Strain tensor.
Definition: straint.h:68
trial_state_vars trialStateVars
Trial state.
Definition: EPState.h:161
stresstensor Stress
stress –total
Definition: EPState.h:72