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.
set_material_properties_to_solid_nodes_process.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosPfemFluidApplication $
3 // Created by: $Author: AFranci $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: October 2018 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_SET_MATERIAL_PROPERTIES_TO_SOLID_NODES_PROCESS_H_INCLUDED)
11 #define KRATOS_SET_MATERIAL_PROPERTIES_TO_SOLID_NODES_PROCESS_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
18 
20 
23 #include "includes/model_part.h"
24 #include "utilities/openmp_utils.h"
25 #include "utilities/math_utils.h"
27 
29 //Data:
30 //StepData:
31 //Flags: (checked)
32 // (set)
33 // (modified)
34 // (reset)
35 
36 namespace Kratos
37 {
38 
41 
48 typedef std::size_t SizeType;
49 
53 
57 
61 
63 
66  : public MesherProcess
67 {
68 public:
71 
74 
78 
81  : mrModelPart(rModelPart)
82  {
83  }
84 
87  {
88  }
89 
90  void operator()()
91  {
92  Execute();
93  }
94 
98 
99  void Execute() override
100  {
101  KRATOS_TRY
102 
103  double density = 0;
104  double young_modulus = 0;
105  double poisson_ratio = 0;
106 
107 #pragma omp parallel
108  {
109 
110  ModelPart::ElementIterator ElemBegin;
113  for (ModelPart::ElementIterator itElem = ElemBegin; itElem != ElemEnd; ++itElem)
114  {
115  ModelPart::PropertiesType &elemProperties = itElem->GetProperties();
116 
117  density = elemProperties[DENSITY];
118  young_modulus = elemProperties[YOUNG_MODULUS];
119  poisson_ratio = elemProperties[POISSON_RATIO];
120 
121  Geometry<Node> &rGeom = itElem->GetGeometry();
122  const SizeType NumNodes = rGeom.PointsNumber();
123  for (SizeType i = 0; i < NumNodes; ++i)
124  {
125  rGeom[i].FastGetSolutionStepValue(YOUNG_MODULUS) = young_modulus;
126  if (rGeom[i].SolutionStepsDataHas(SOLID_DENSITY))
127  {
128  rGeom[i].FastGetSolutionStepValue(SOLID_DENSITY) = density;
129  }
130  rGeom[i].FastGetSolutionStepValue(DENSITY) = density;
131  rGeom[i].FastGetSolutionStepValue(POISSON_RATIO) = poisson_ratio;
132  }
133  }
134  }
135 
136  KRATOS_CATCH(" ")
137  };
138 
142 
146 
150 
154 
156  std::string Info() const override
157  {
158  return "SetMaterialPropertiesToSolidNodesProcess";
159  }
160 
162  void PrintInfo(std::ostream &rOStream) const override
163  {
164  rOStream << "SetMaterialPropertiesToSolidNodesProcess";
165  }
166 
167 protected:
170 
174 
179 
183 
187 
189 
190 private:
193 
197 
201 
205 
209 
213 
217 
220 
222  //SetMaterialPropertiesToSolidNodesProcess(SetMaterialPropertiesToSolidNodesProcess const& rOther);
223 
225 
226 }; // Class SetMaterialPropertiesToSolidNodesProcess
227 
229 
232 
236 
238 inline std::istream &operator>>(std::istream &rIStream,
240 
242 inline std::ostream &operator<<(std::ostream &rOStream,
244 {
245  rThis.PrintInfo(rOStream);
246  rOStream << std::endl;
247  rThis.PrintData(rOStream);
248 
249  return rOStream;
250 }
252 
253 } // namespace Kratos.
254 
255 #endif // KRATOS_SET_MATERIAL_PROPERTIES_TO_SOLID_NODES_PROCESS_H_INCLUDED defined
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
PointerVector< TPointType > PointsArrayType
Definition: geometry.h:118
The base class for processes passed to the solution scheme.
Definition: mesher_process.hpp:37
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: mesher_process.hpp:157
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
MeshType::ElementIterator ElementIterator
Definition: model_part.h:174
static void PartitionedIterators(TVector &rVector, typename TVector::iterator &rBegin, typename TVector::iterator &rEnd)
Generate a partition for an std::vector-like array, providing iterators to the begin and end position...
Definition: openmp_utils.h:179
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
Short class definition.
Definition: set_material_properties_to_solid_nodes_process.hpp:67
virtual ~SetMaterialPropertiesToSolidNodesProcess()
Destructor.
Definition: set_material_properties_to_solid_nodes_process.hpp:86
void operator()()
Definition: set_material_properties_to_solid_nodes_process.hpp:90
ModelPart & mrModelPart
Definition: set_material_properties_to_solid_nodes_process.hpp:178
std::string Info() const override
Turn back information as a string.
Definition: set_material_properties_to_solid_nodes_process.hpp:156
KRATOS_CLASS_POINTER_DEFINITION(SetMaterialPropertiesToSolidNodesProcess)
Pointer definition of SetMaterialPropertiesToSolidNodesProcess.
SetMaterialPropertiesToSolidNodesProcess(ModelPart &rModelPart)
Default constructor.
Definition: set_material_properties_to_solid_nodes_process.hpp:80
void Execute() override
Execute method is used to execute the MesherProcess algorithms.
Definition: set_material_properties_to_solid_nodes_process.hpp:99
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: set_material_properties_to_solid_nodes_process.hpp:162
#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
ModelPart::NodesContainerType NodesContainerType
Definition: find_conditions_neighbours_process.h:44
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
ModelPart::ElementsContainerType ElementsContainerType
Definition: clear_contact_conditions_mesher_process.hpp:43
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
GeometryType::PointsArrayType PointsArrayType
Definition: settle_model_structure_process.hpp:48
float density
Definition: face_heat.py:56
integer i
Definition: TensorModule.f:17