13 #if !defined(KRATOS_VELOCITY_BOSSAK_SENSITIVITY_BUILDER_SCHEME_H_INCLUDED)
14 #define KRATOS_VELOCITY_BOSSAK_SENSITIVITY_BUILDER_SCHEME_H_INCLUDED
60 const double NewAlphaBossak,
66 mAlphaBossak = NewAlphaBossak;
67 mBetaNewmark = 0.25 * pow((1.00 - mAlphaBossak), 2);
68 mGammaNewmark = 0.5 - mAlphaBossak;
71 mMassMatrices.resize(number_of_threads);
72 mDampingMatrices.resize(number_of_threads);
73 mSecondDerivativesVectors.resize(number_of_threads);
86 mMassMatrices.clear();
87 mDampingMatrices.clear();
88 mSecondDerivativesVectors.clear();
106 <<
"Detected delta_time > 0 in the adjoint Bossak scheme. Adjoints "
107 "are calculated in reverse time, therefore DELTA_TIME should be "
112 ma1 =
delta_time * mBetaNewmark / mGammaNewmark;
113 mam = (1.0 - mAlphaBossak) / (mGammaNewmark *
delta_time);
123 std::string
Info()
const override
125 return "VelocityBossakSensitivityBuilderScheme";
136 double mGammaNewmark;
141 std::vector<Matrix> mMassMatrices;
142 std::vector<Matrix> mDampingMatrices;
143 std::vector<Vector> mSecondDerivativesVectors;
149 void CalculateLHSAndRHS(
155 CalculateEntityLHSAndRHS(rElement, rLHS, rRHS, rProcessInfo);
158 void CalculateLHSAndRHS(
162 const ProcessInfo& rProcessInfo)
override
164 CalculateEntityLHSAndRHS(rCondition, rLHS, rRHS, rProcessInfo);
167 template<
class EntityType>
168 void CalculateEntityLHSAndRHS(
172 const ProcessInfo& rProcessInfo)
176 auto& mass_matrix = mMassMatrices[
k];
177 auto& damping_matrix = mDampingMatrices[
k];
178 auto& second_derivatives_vector = mSecondDerivativesVectors[
k];
181 rEntity.CalculateLocalSystem(rLHS, rRHS, rProcessInfo);
182 rEntity.CalculateMassMatrix(mass_matrix, rProcessInfo);
183 rEntity.CalculateLocalVelocityContribution(damping_matrix, rRHS, rProcessInfo);
185 AddDynamicsToLHS(rLHS, damping_matrix, mass_matrix);
186 AddDynamicsToRHS(rRHS, second_derivatives_vector, mass_matrix, rEntity, rProcessInfo);
189 void AddDynamicsToLHS(
191 const Matrix& rDampingMatrix,
192 const Matrix& rMassMatrix)
const
198 if (rMassMatrix.size1() != 0) {
199 noalias(rLHS) += mam * rMassMatrix;
203 if (rDampingMatrix.size1() != 0) {
204 noalias(rLHS) += rDampingMatrix;
208 template <
class TEntityType>
209 void AddDynamicsToRHS(
211 Vector& rSecondDerivativesVector,
212 const Matrix& rMassMatrix,
213 TEntityType& rEntity,
214 const ProcessInfo& rProcessInfo)
217 if (rMassMatrix.size1() != 0) {
218 rEntity.Calculate(PRIMAL_RELAXED_SECOND_DERIVATIVE_VALUES, rSecondDerivativesVector, rProcessInfo);
219 noalias(rRHS) -=
prod(rMassMatrix, rSecondDerivativesVector);
A base class for adjoint response functions.
Definition: adjoint_response_function.h:39
Base class for all Conditions.
Definition: condition.h:59
Base class for all Elements.
Definition: element.h:60
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
This class defines the node.
Definition: node.h:65
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
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Scheme used in the Sensitivity Builder.
Definition: sensitivity_builder_scheme.h:53
Definition: simple_steady_sensitivity_builder_scheme.h:45
BaseType::ElementType ElementType
Definition: simple_steady_sensitivity_builder_scheme.h:58
BaseType::NodeType NodeType
Definition: simple_steady_sensitivity_builder_scheme.h:54
std::size_t IndexType
Definition: simple_steady_sensitivity_builder_scheme.h:60
BaseType::ConditionType ConditionType
Definition: simple_steady_sensitivity_builder_scheme.h:56
void InitializeSolutionStep(ModelPart &rModelPart, ModelPart &rSensitivityModelPart, AdjointResponseFunction &rResponseFunction) override
Definition: simple_steady_sensitivity_builder_scheme.h:113
SimpleSteadySensitivityBuilderScheme(const IndexType Dimension, const IndexType BlockSize)
Constructor.
Definition: simple_steady_sensitivity_builder_scheme.h:67
void Clear() override
Definition: simple_steady_sensitivity_builder_scheme.h:411
Definition: velocity_bossak_sensitivity_builder_scheme.h:35
void Clear() override
Definition: velocity_bossak_sensitivity_builder_scheme.h:83
void InitializeSolutionStep(ModelPart &rModelPart, ModelPart &rSensitivityModelPart, AdjointResponseFunction &rResponseFunction) override
Definition: velocity_bossak_sensitivity_builder_scheme.h:95
std::string Info() const override
Turn back information as a string.
Definition: velocity_bossak_sensitivity_builder_scheme.h:123
~VelocityBossakSensitivityBuilderScheme()=default
Destructor.
VelocityBossakSensitivityBuilderScheme(const double NewAlphaBossak, const IndexType Dimension, const IndexType BlockSize)
Constructor.
Definition: velocity_bossak_sensitivity_builder_scheme.h:59
KRATOS_CLASS_POINTER_DEFINITION(VelocityBossakSensitivityBuilderScheme)
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
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
delta_time
Definition: generate_frictional_mortar_condition.py:130
int k
Definition: quadrature.py:595