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.
bossak_displacement_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_BOSSAK_DISPLACEMENT_SMOOTHING_SCHEME )
9 #define KRATOS_BOSSAK_DISPLACEMENT_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 
31 
32 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
33 
35  BossakDisplacementSmoothingScheme(double rAlpham = 0.0, double rayleigh_m = 0.0, double rayleigh_k = 0.0)
36  : ResidualBasedBossakDisplacementScheme<TSparseSpace,TDenseSpace>(rAlpham)
37 
38  {
39 
40  mRayleighAlpha = rayleigh_m;
41  mRayleighBeta = rayleigh_k;
42 
43  }
44 
45  //------------------------------------------------------------------------------------
46 
49 
50 
51 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
52 
53  void Initialize(ModelPart& r_model_part) override
54  {
56 
57  r_model_part.GetProcessInfo()[RAYLEIGH_ALPHA] = mRayleighAlpha;
58  r_model_part.GetProcessInfo()[RAYLEIGH_BETA] = mRayleighBeta;
59 
60  mSchemeIsInitialized = true;
61 
62  KRATOS_CATCH("")
63  }
64 
65 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
66 
68  ModelPart& rModelPart,
71  TSystemVectorType& b) override
72  {
74 
75  unsigned int Dim = rModelPart.GetProcessInfo()[DOMAIN_SIZE];
76 
77  // Clear nodal variables
78  #pragma omp parallel
79  {
80  ModelPart::NodeIterator NodesBegin;
81  ModelPart::NodeIterator NodesEnd;
82  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
83 
84  for (ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode)
85  {
86  itNode->FastGetSolutionStepValue(NODAL_AREA) = 0.0;
87  Matrix& rNodalStress = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS_TENSOR);
88  if(rNodalStress.size1() != Dim)
89  rNodalStress.resize(Dim,Dim,false);
90  noalias(rNodalStress) = ZeroMatrix(Dim,Dim);
91  itNode->FastGetSolutionStepValue(NODAL_JOINT_AREA) = 0.0;
92  itNode->FastGetSolutionStepValue(NODAL_JOINT_WIDTH) = 0.0;
93  }
94  }
95 
96  BaseType::FinalizeSolutionStep(rModelPart,A,Dx,b);
97 
98  // Compute smoothed nodal variables
99  #pragma omp parallel
100  {
101  ModelPart::NodeIterator NodesBegin;
102  ModelPart::NodeIterator NodesEnd;
103  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
104 
105  for (ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode)
106  {
107  const double& NodalArea = itNode->FastGetSolutionStepValue(NODAL_AREA);
108  if (NodalArea>1.0e-15)
109  {
110  const double InvNodalArea = 1.0/(NodalArea);
111  Matrix& rNodalStress = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS_TENSOR);
112  for(unsigned int i = 0; i<Dim; i++)
113  {
114  for(unsigned int j = 0; j<Dim; j++)
115  {
116  rNodalStress(i,j) *= InvNodalArea;
117  }
118  }
119  }
120 
121  const double& NodalJointArea = itNode->FastGetSolutionStepValue(NODAL_JOINT_AREA);
122  if (NodalJointArea>1.0e-15)
123  {
124  double& NodalJointWidth = itNode->FastGetSolutionStepValue(NODAL_JOINT_WIDTH);
125  NodalJointWidth = NodalJointWidth/NodalJointArea;
126  }
127  }
128  }
129 
130  KRATOS_CATCH("")
131  }
132 
133 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
134 
135 protected:
136 
137  //Member variables
140 
141 
142 }; // Class BossakDisplacementSmoothingScheme
143 } // namespace Kratos
144 
145 #endif // KRATOS_BOSSAK_DISPLACEMENT_SMOOTHING_SCHEME defined
Definition: bossak_displacement_smoothing_scheme.hpp:21
virtual ~BossakDisplacementSmoothingScheme()
Destructor.
Definition: bossak_displacement_smoothing_scheme.hpp:48
double mRayleighAlpha
Definition: bossak_displacement_smoothing_scheme.hpp:138
double mRayleighBeta
Definition: bossak_displacement_smoothing_scheme.hpp:139
KRATOS_CLASS_POINTER_DEFINITION(BossakDisplacementSmoothingScheme)
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: bossak_displacement_smoothing_scheme.hpp:67
BaseType::TSystemMatrixType TSystemMatrixType
Definition: bossak_displacement_smoothing_scheme.hpp:28
BaseType::TSystemVectorType TSystemVectorType
Definition: bossak_displacement_smoothing_scheme.hpp:29
void Initialize(ModelPart &r_model_part) override
This is the place to initialize the Scheme.
Definition: bossak_displacement_smoothing_scheme.hpp:53
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: bossak_displacement_smoothing_scheme.hpp:27
BossakDisplacementSmoothingScheme(double rAlpham=0.0, double rayleigh_m=0.0, double rayleigh_k=0.0)
Constructor.
Definition: bossak_displacement_smoothing_scheme.hpp:35
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
Bossak integration scheme (for linear and nonlinear dynamic problems) for displacements.
Definition: residual_based_bossak_displacement_scheme.hpp:43
typename ImplicitBaseType::TSystemMatrixType TSystemMatrixType
Type for the system matrix within ImplicitBaseType.
Definition: residual_based_bossak_displacement_scheme.hpp:69
typename ImplicitBaseType::TSystemVectorType TSystemVectorType
Type for the system vector within ImplicitBaseType.
Definition: residual_based_bossak_displacement_scheme.hpp:72
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
bool mSchemeIsInitialized
Definition: scheme.h:755
#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