KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
dam_chemo_mechanical_aging_young_process.hpp
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Lorenzo Gracia
11 //
12 //
13 
14 #if !defined(KRATOS_DAM_CHEMO_MECHANICAL_AGING_YOUNG_PROCESS)
15 #define KRATOS_DAM_CHEMO_MECHANICAL_AGING_YOUNG_PROCESS
16 
17 #include <cmath>
18 
19 // Project includes
20 #include "includes/kratos_flags.h"
22 #include "processes/process.h"
23 
24 // Application include
26 
27 namespace Kratos
28 {
29 
31 {
32 
33  public:
35 
36  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
37 
40  Parameters &rParameters) : Process(Flags()), mrModelPart(rModelPart)
41  {
43 
44  //only include validation with c++11 since raw_literals do not exist in c++03
45  Parameters default_parameters(R"(
46  {
47  "model_part_name":"PLEASE_CHOOSE_MODEL_PART_NAME",
48  "variable_name": "PLEASE_PRESCRIBE_VARIABLE_NAME",
49  "initial_elastic_modulus" : 30.0e9,
50  "initial_porosity" : 0.2,
51  "max_chemical_porosity" : 0.32,
52  "chemical_characteristic_aging_time" : 100.0,
53  "max_mechanical_damage" : 0.32,
54  "damage_characteristic_aging_time" : 100.0,
55  "interval":[
56  0.0,
57  0.0
58  ]
59  } )");
60 
61  // Some values need to be mandatorily prescribed since no meaningful default value exist. For this reason try accessing to them
62  // So that an error is thrown if they don't exist
63  rParameters["initial_elastic_modulus"];
64  rParameters["initial_porosity"];
65  rParameters["max_chemical_porosity"];
66 
67  // Now validate agains defaults -- this also ensures no type mismatch
68  rParameters.ValidateAndAssignDefaults(default_parameters);
69 
70  mVariableName = rParameters["variable_name"].GetString();
71  mInitialElasticModulus = rParameters["initial_elastic_modulus"].GetDouble();
72  mInitialPorosity = rParameters["initial_porosity"].GetDouble();
73  mMaxChemicalPorosity = rParameters["max_chemical_porosity"].GetDouble();
74  mChemicalTime = rParameters["chemical_characteristic_aging_time"].GetDouble();
75  mMaxMechaDamage = rParameters["max_mechanical_damage"].GetDouble();
76  mDamageTime = rParameters["damage_characteristic_aging_time"].GetDouble();
77 
78  KRATOS_CATCH("");
79  }
80 
82 
85 
86  // This is a chemo-mechanical degradation law of concrete usually used in the upstream wall when
87  // it is necessary to consider the aging/degradation problem.
88 
89  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
90 
91  void Execute() override
92  {
93  }
94 
95  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
96 
97 
98  void ExecuteInitialize() override
99  {
100  KRATOS_TRY;
101 
103  const int nnodes = mrModelPart.GetMesh(0).Nodes().size();
104 
105  // This model works in years so it is necessary to convert time in this unit
106  double time = mrModelPart.GetProcessInfo()[TIME] / 31536000.0;
107 
108  // Computing young modulus
109  double sound_concrete = mInitialElasticModulus * sqrt(1.0 + 0.0805 * log(time));
110  double chemical_porosity = mMaxChemicalPorosity * (1.0 - exp(-time / mChemicalTime));
111  double damage_mechanical = mMaxMechaDamage * (1.0 - exp(-time / mDamageTime));
112  double young = ((1.0 - mInitialPorosity - chemical_porosity) * (1.0 - damage_mechanical) * sound_concrete) / (1.0 - mInitialPorosity);
113 
114  if (nnodes != 0)
115  {
116  ModelPart::NodesContainerType::iterator it_begin = mrModelPart.GetMesh(0).NodesBegin();
117 
118 #pragma omp parallel for
119  for (int i = 0; i < nnodes; i++)
120  {
121  ModelPart::NodesContainerType::iterator it = it_begin + i;
122  it->FastGetSolutionStepValue(var) = young;
123  }
124  }
125 
126  KRATOS_CATCH("");
127  }
128 
129  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
130 
132  {
133  KRATOS_TRY;
134 
136  const int nnodes = mrModelPart.GetMesh(0).Nodes().size();
137 
138  // This model works in years so it is necessary to convert time in this unit
139  double time = mrModelPart.GetProcessInfo()[TIME] / 31536000.0;
140 
141  // Computing young modulus
142  double sound_concrete = mInitialElasticModulus * sqrt(1.0 + 0.0805 * log(time));
143  double chemical_porosity = mMaxChemicalPorosity * (1.0 - exp(-time / mChemicalTime));
144  double damage_mechanical = mMaxMechaDamage * (1.0 - exp(-time / mDamageTime));
145  double young = ((1.0 - mInitialPorosity - chemical_porosity) * (1.0 - damage_mechanical) * sound_concrete) / (1.0 - mInitialPorosity);
146 
147  if (nnodes != 0)
148  {
149  ModelPart::NodesContainerType::iterator it_begin = mrModelPart.GetMesh(0).NodesBegin();
150 
151 #pragma omp parallel for
152  for (int i = 0; i < nnodes; i++)
153  {
154  ModelPart::NodesContainerType::iterator it = it_begin + i;
155  it->FastGetSolutionStepValue(var) = young;
156  }
157  }
158 
159  KRATOS_CATCH("");
160  }
161 
162  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
163 
165  std::string Info() const override
166  {
167  return "DamChemoMechanicalAgingYoungProcess";
168  }
169 
171  void PrintInfo(std::ostream &rOStream) const override
172  {
173  rOStream << "DamChemoMechanicalAgingYoungProcess";
174  }
175 
177  void PrintData(std::ostream &rOStream) const override
178  {
179  }
180 
182 
183  protected:
186  std::string mVariableName;
192  double mDamageTime;
193 
194  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
195 
196  private:
199 
200 }; //Class
201 
203 inline std::istream &operator>>(std::istream &rIStream,
205 
207 inline std::ostream &operator<<(std::ostream &rOStream,
209 {
210  rThis.PrintInfo(rOStream);
211  rOStream << std::endl;
212  rThis.PrintData(rOStream);
213 
214  return rOStream;
215 }
216 
217 } /* namespace Kratos.*/
218 
219 #endif /* KRATOS_DAM_CHEMO_MECHANICAL_AGING_YOUNG_PROCESS defined */
Definition: dam_chemo_mechanical_aging_young_process.hpp:31
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: dam_chemo_mechanical_aging_young_process.hpp:91
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: dam_chemo_mechanical_aging_young_process.hpp:171
virtual ~DamChemoMechanicalAgingYoungProcess()
Destructor.
Definition: dam_chemo_mechanical_aging_young_process.hpp:84
double mMaxChemicalPorosity
Definition: dam_chemo_mechanical_aging_young_process.hpp:189
std::string mVariableName
Definition: dam_chemo_mechanical_aging_young_process.hpp:186
double mChemicalTime
Definition: dam_chemo_mechanical_aging_young_process.hpp:190
double mMaxMechaDamage
Definition: dam_chemo_mechanical_aging_young_process.hpp:191
double mInitialElasticModulus
Definition: dam_chemo_mechanical_aging_young_process.hpp:187
DamChemoMechanicalAgingYoungProcess(ModelPart &rModelPart, Parameters &rParameters)
Constructor.
Definition: dam_chemo_mechanical_aging_young_process.hpp:39
void ExecuteInitialize() override
This function is designed for being called at the beginning of the computations right after reading t...
Definition: dam_chemo_mechanical_aging_young_process.hpp:98
std::string Info() const override
Turn back information as a string.
Definition: dam_chemo_mechanical_aging_young_process.hpp:165
KRATOS_CLASS_POINTER_DEFINITION(DamChemoMechanicalAgingYoungProcess)
double mDamageTime
Definition: dam_chemo_mechanical_aging_young_process.hpp:192
void ExecuteInitializeSolutionStep() override
This function will be executed at every time step BEFORE performing the solve phase.
Definition: dam_chemo_mechanical_aging_young_process.hpp:131
double mInitialPorosity
Definition: dam_chemo_mechanical_aging_young_process.hpp:188
ModelPart & mrModelPart
Member Variables.
Definition: dam_chemo_mechanical_aging_young_process.hpp:185
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: dam_chemo_mechanical_aging_young_process.hpp:177
Definition: flags.h:58
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
NodesContainerType & Nodes()
Definition: mesh.h:346
NodeIterator NodesBegin()
Definition: mesh.h:326
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType & GetMesh(IndexType ThisIndex=0)
Definition: model_part.h:1791
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
time
Definition: face_heat.py:85
int nnodes
Definition: sensitivityMatrix.py:24
integer i
Definition: TensorModule.f:17