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.
transfer_selfweight_stress_utility.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_TRANSFER_SELFWEIGHT_STRESS_UTILITIES)
15 #define KRATOS_TRANSFER_SELFWEIGHT_STRESS_UTILITIES
16 
17 // System includes
18 #include <cmath>
19 
20 // Project includes
21 #include "includes/model_part.h"
23 #include "utilities/openmp_utils.h"
24 #include "utilities/math_utils.h"
25 #include "includes/element.h"
26 
27 // Application includes
29 
30 namespace Kratos
31 {
32 
34 {
35 
36  public:
37  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
38 
41 
43 
46 
47  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
48 
49  // Transforming local stress vector in global coordinates
50  void Transfer(ModelPart &selfweight_model_part, ModelPart &r_model_part, const int TDim)
51  {
52 
53  KRATOS_TRY;
54 
55  const int NNodes = static_cast<int>(r_model_part.Nodes().size());
56  ModelPart::NodesContainerType::iterator node_begin = r_model_part.NodesBegin();
57  ModelPart::NodesContainerType::iterator node_begin_selfweight = selfweight_model_part.NodesBegin();
58 
59  #pragma omp parallel for
60  for (int i = 0; i < NNodes; i++)
61  {
62  ModelPart::NodesContainerType::iterator itNode = node_begin + i;
63  ModelPart::NodesContainerType::iterator itNodeSelf = node_begin_selfweight + i;
64 
65  const Matrix &NodalStressSelfweight = itNodeSelf->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS_TENSOR);
66  Matrix &NodalStress = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS_TENSOR);
67 
68  for (int j = 0; j < TDim; j++)
69  {
70  for (int k = 0; k < TDim; k++)
71  {
72  NodalStress(j, k) += NodalStressSelfweight(j, k);
73  }
74  }
75  }
76 
77  KRATOS_CATCH("");
78  }
79 
80  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
81 
82  // Transforming local stress vector in global coordinates
83  void TransferInitialStress(ModelPart &r_model_part, const int TDim)
84  {
85 
86  KRATOS_TRY;
87 
88  const int NNodes = static_cast<int>(r_model_part.Nodes().size());
89  ModelPart::NodesContainerType::iterator node_begin = r_model_part.NodesBegin();
90 
91  #pragma omp parallel for
92  for (int i = 0; i < NNodes; i++)
93  {
94  ModelPart::NodesContainerType::iterator itNode = node_begin + i;
95 
96  const Matrix &InitialNodalStress = itNode->FastGetSolutionStepValue(INITIAL_NODAL_CAUCHY_STRESS_TENSOR);
97  Matrix &NodalStress = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS_TENSOR);
98 
99  for (int j = 0; j < TDim; j++)
100  {
101  for (int k = 0; k < TDim; k++)
102  {
103  NodalStress(j, k) += InitialNodalStress(j, k);
104  }
105  }
106  }
107 
108  KRATOS_CATCH("");
109  }
110 
112 
113  protected:
114  //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
115 
116 }; //Class
117 
118 } /* namespace Kratos.*/
119 
120 #endif /* KRATOS_TRANSFER_SELFWEIGHT_STRESS_UTILITIES defined */
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Definition: transfer_selfweight_stress_utility.hpp:34
~TransferSelfweightStressUtility()
Destructor.
Definition: transfer_selfweight_stress_utility.hpp:45
void Transfer(ModelPart &selfweight_model_part, ModelPart &r_model_part, const int TDim)
Definition: transfer_selfweight_stress_utility.hpp:50
void TransferInitialStress(ModelPart &r_model_part, const int TDim)
Definition: transfer_selfweight_stress_utility.hpp:83
TransferSelfweightStressUtility()
Constructor.
Definition: transfer_selfweight_stress_utility.hpp:40
#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
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17