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.
incrementalupdate_static_smoothing_scheme.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosDamApplication $
3 // Last Modified by: $Author:Lorenzo Gracia $
4 // Date: $Date: October 2016 $
5 // Revision: $Revision: 1.0 $
6 //
7 
8 #if !defined(KRATOS_INCREMENTAL_UPDATE_STATIC_SMOOTHING_SCHEME )
9 #define KRATOS_INCREMENTAL_UPDATE_STATIC_SMOOTHING_SCHEME
10 
11 // Application includes
14 
15 namespace Kratos
16 {
17 
18 template<class TSparseSpace, class TDenseSpace>
19 
21 {
22 
23 public:
24 
26 
30 
31 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
32 
35  : ResidualBasedIncrementalUpdateStaticScheme<TSparseSpace,TDenseSpace>() {}
36 
37  //------------------------------------------------------------------------------------
38 
41 
42 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
43 
45  ModelPart& rModelPart,
48  TSystemVectorType& b) override
49  {
51 
52  unsigned int Dim = rModelPart.GetProcessInfo()[DOMAIN_SIZE];
53 
54  // Clear nodal variables
55  #pragma omp parallel
56  {
57  ModelPart::NodeIterator NodesBegin;
58  ModelPart::NodeIterator NodesEnd;
59  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
60 
61  for (ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode)
62  {
63  itNode->FastGetSolutionStepValue(NODAL_AREA) = 0.0;
64  Matrix& rNodalStress = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS_TENSOR);
65  if(rNodalStress.size1() != Dim)
66  rNodalStress.resize(Dim,Dim,false);
67  noalias(rNodalStress) = ZeroMatrix(Dim,Dim);
68  itNode->FastGetSolutionStepValue(NODAL_JOINT_AREA) = 0.0;
69  itNode->FastGetSolutionStepValue(NODAL_JOINT_WIDTH) = 0.0;
70  }
71  }
72 
73  BaseType::FinalizeSolutionStep(rModelPart,A,Dx,b);
74 
75  // Compute smoothed nodal variables
76  #pragma omp parallel
77  {
78  ModelPart::NodeIterator NodesBegin;
79  ModelPart::NodeIterator NodesEnd;
80  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
81 
82  for (ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode)
83  {
84  const double& NodalArea = itNode->FastGetSolutionStepValue(NODAL_AREA);
85  if (NodalArea>1.0e-15)
86  {
87  const double InvNodalArea = 1.0/(NodalArea);
88  Matrix& rNodalStress = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS_TENSOR);
89  for(unsigned int i = 0; i<Dim; i++)
90  {
91  for(unsigned int j = 0; j<Dim; j++)
92  {
93  rNodalStress(i,j) *= InvNodalArea;
94  }
95  }
96  }
97 
98  const double& NodalJointArea = itNode->FastGetSolutionStepValue(NODAL_JOINT_AREA);
99  if (NodalJointArea>1.0e-15)
100  {
101  double& NodalJointWidth = itNode->FastGetSolutionStepValue(NODAL_JOINT_WIDTH);
102  NodalJointWidth = NodalJointWidth/NodalJointArea;
103  }
104  }
105  }
106 
107  KRATOS_CATCH("")
108  }
109 
110 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
111 
112 }; // Class IncrementalUpdateStaticSmoothingScheme
113 } // namespace Kratos
114 
115 #endif // KRATOS_INCREMENTAL_UPDATE_STATIC_SMOOTHING_SCHEME defined
Definition: incrementalupdate_static_smoothing_scheme.hpp:21
IncrementalUpdateStaticSmoothingScheme()
Constructor.
Definition: incrementalupdate_static_smoothing_scheme.hpp:34
virtual ~IncrementalUpdateStaticSmoothingScheme()
Destructor.
Definition: incrementalupdate_static_smoothing_scheme.hpp:40
BaseType::TSystemMatrixType TSystemMatrixType
Definition: incrementalupdate_static_smoothing_scheme.hpp:28
void FinalizeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: incrementalupdate_static_smoothing_scheme.hpp:44
BaseType::TSystemVectorType TSystemVectorType
Definition: incrementalupdate_static_smoothing_scheme.hpp:29
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: incrementalupdate_static_smoothing_scheme.hpp:27
KRATOS_CLASS_POINTER_DEFINITION(IncrementalUpdateStaticSmoothingScheme)
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
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
This class provides the implementation of a static scheme.
Definition: residualbased_incrementalupdate_static_scheme.h:57
BaseType::TSystemMatrixType TSystemMatrixType
Matrix type definition.
Definition: residualbased_incrementalupdate_static_scheme.h:78
BaseType::TSystemVectorType TSystemVectorType
Vector type definition.
Definition: residualbased_incrementalupdate_static_scheme.h:80
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
typename TSparseSpace::MatrixType TSystemMatrixType
Matrix type definition.
Definition: scheme.h:71
typename TSparseSpace::VectorType TSystemVectorType
Vector type definition.
Definition: scheme.h:74
virtual void FinalizeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: scheme.h:294
#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
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
int j
Definition: quadrature.py:648
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17