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.
poro_newmark_quasistatic_damped_U_Pw_scheme.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosPoromechanicsApplication $
3 // Last Modified by: $Author: Ignasi de Pouplana $
4 // Date: $Date: January 2016 $
5 // Revision: $Revision: 1.0 $
6 //
7 
8 #if !defined(KRATOS_PORO_NEWMARK_QUASISTATIC_DAMPED_U_PW_SCHEME )
9 #define KRATOS_PORO_NEWMARK_QUASISTATIC_DAMPED_U_PW_SCHEME
10 
11 // Application includes
14 
15 namespace Kratos
16 {
17 
18 template<class TSparseSpace, class TDenseSpace>
19 
21 {
22 
23 public:
24 
26 
33 
34 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
35 
37  PoroNewmarkQuasistaticDampedUPwScheme(double beta, double gamma, double theta)
38  : PoroNewmarkQuasistaticUPwScheme<TSparseSpace,TDenseSpace>(beta, gamma, theta)
39  {
40  //Allocate auxiliary memory
41  int NumThreads = ParallelUtilities::GetNumThreads();
42  mDampingMatrix.resize(NumThreads);
43  mVelocityVector.resize(NumThreads);
44  }
45 
46  //------------------------------------------------------------------------------------
47 
50 
51 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
52 
53 // Note: this is in a parallel loop
54 
56  Element& rCurrentElement,
57  LocalSystemMatrixType& LHS_Contribution,
58  LocalSystemVectorType& RHS_Contribution,
60  const ProcessInfo& CurrentProcessInfo) override
61  {
63 
64  int thread = OpenMPUtils::ThisThread();
65 
66  rCurrentElement.CalculateLocalSystem(LHS_Contribution,RHS_Contribution,CurrentProcessInfo);
67 
68  rCurrentElement.CalculateDampingMatrix(mDampingMatrix[thread],CurrentProcessInfo);
69 
70  this->AddDampingToLHS (LHS_Contribution, mDampingMatrix[thread], CurrentProcessInfo);
71 
72  this->AddDampingToRHS (rCurrentElement, RHS_Contribution, mDampingMatrix[thread], CurrentProcessInfo);
73 
74  rCurrentElement.EquationIdVector(EquationId,CurrentProcessInfo);
75 
76  KRATOS_CATCH( "" )
77  }
78 
79 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
80 
81 // Note: this is in a parallel loop
82 
84  Element& rCurrentElement,
85  LocalSystemVectorType& RHS_Contribution,
87  const ProcessInfo& CurrentProcessInfo) override
88  {
90 
91  int thread = OpenMPUtils::ThisThread();
92 
93  rCurrentElement.CalculateRightHandSide(RHS_Contribution,CurrentProcessInfo);
94 
95  rCurrentElement.CalculateDampingMatrix(mDampingMatrix[thread],CurrentProcessInfo);
96 
97  this->AddDampingToRHS (rCurrentElement, RHS_Contribution, mDampingMatrix[thread], CurrentProcessInfo);
98 
99  rCurrentElement.EquationIdVector(EquationId,CurrentProcessInfo);
100 
101  KRATOS_CATCH( "" )
102  }
103 
104 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
105 
106 // Note: this is in a parallel loop
107 
109  Element& rCurrentElement,
110  LocalSystemMatrixType& LHS_Contribution,
112  const ProcessInfo& CurrentProcessInfo) override
113  {
114  KRATOS_TRY
115 
116  int thread = OpenMPUtils::ThisThread();
117 
118  rCurrentElement.CalculateLeftHandSide(LHS_Contribution,CurrentProcessInfo);
119 
120  rCurrentElement.CalculateDampingMatrix(mDampingMatrix[thread],CurrentProcessInfo);
121 
122  this->AddDampingToLHS (LHS_Contribution, mDampingMatrix[thread], CurrentProcessInfo);
123 
124  rCurrentElement.EquationIdVector(EquationId,CurrentProcessInfo);
125 
126  KRATOS_CATCH( "" )
127  }
128 
129 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
130 
131 protected:
132 
134 
135  std::vector< Matrix > mDampingMatrix;
136  std::vector< Vector > mVelocityVector;
137 
138 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
139 
140  void AddDampingToLHS(LocalSystemMatrixType& LHS_Contribution,LocalSystemMatrixType& C,const ProcessInfo& CurrentProcessInfo)
141  {
142  // adding damping contribution
143  if (C.size1() != 0)
144  noalias(LHS_Contribution) += mGamma/(mBeta*mDeltaTime)*C;
145  }
146 
147 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
148 
149  void AddDampingToRHS(Element& rCurrentElement,LocalSystemVectorType& RHS_Contribution,
150  LocalSystemMatrixType& C,const ProcessInfo& CurrentProcessInfo)
151  {
152  int thread = OpenMPUtils::ThisThread();
153 
154  //adding damping contribution
155  if (C.size1() != 0)
156  {
157  rCurrentElement.GetFirstDerivativesVector(mVelocityVector[thread], 0);
158 
159  noalias(RHS_Contribution) -= prod(C, mVelocityVector[thread]);
160  }
161  }
162 
163 }; // Class PoroNewmarkQuasistaticDampedUPwScheme
164 } // namespace Kratos
165 
166 #endif // KRATOS_PORO_NEWMARK_QUASISTATIC_DAMPED_U_PW_SCHEME defined
Base class for all Elements.
Definition: element.h:60
virtual void GetFirstDerivativesVector(Vector &values, int Step=0) const
Definition: element.h:310
virtual void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:423
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:437
virtual void CalculateDampingMatrix(MatrixType &rDampingMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:583
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: element.h:258
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:405
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:21
std::vector< Vector > mVelocityVector
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:136
void AddDampingToRHS(Element &rCurrentElement, LocalSystemVectorType &RHS_Contribution, LocalSystemMatrixType &C, const ProcessInfo &CurrentProcessInfo)
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:149
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:29
KRATOS_CLASS_POINTER_DEFINITION(PoroNewmarkQuasistaticDampedUPwScheme)
~PoroNewmarkQuasistaticDampedUPwScheme() override
Destructor.
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:49
std::vector< Matrix > mDampingMatrix
Member Variables.
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:135
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:27
void CalculateRHSContribution(Element &rCurrentElement, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to calculate just the RHS contribution.
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:83
void AddDampingToLHS(LocalSystemMatrixType &LHS_Contribution, LocalSystemMatrixType &C, const ProcessInfo &CurrentProcessInfo)
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:140
PoroNewmarkQuasistaticDampedUPwScheme(double beta, double gamma, double theta)
Constructor.
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:37
void CalculateSystemContributions(Element &rCurrentElement, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to be called in the builder and solver to introduce the selected time integ...
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:55
void CalculateLHSContribution(Element &rCurrentElement, LocalSystemMatrixType &LHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to calculate just the LHS contribution.
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:108
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: poro_newmark_quasistatic_damped_U_Pw_scheme.hpp:28
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:32
double mGamma
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:526
double mBeta
Member Variables.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:525
double mDeltaTime
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:528
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
virtual void EquationId(const Element &rElement, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo)
This method gets the eqaution id corresponding to the current element.
Definition: scheme.h:636
typename TDenseSpace::VectorType LocalSystemVectorType
Local system vector type definition.
Definition: scheme.h:80
typename TDenseSpace::MatrixType LocalSystemMatrixType
Local system matrix type definition.
Definition: scheme.h:77
#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
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
int C
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:27
float gamma
Definition: generate_two_fluid_navier_stokes.py:131