53 #if !defined(KRATOS_RESIDUALBASED_PREDICTOR_CORRECTOR_BOSSAK_SCHEME )
54 #define KRATOS_RESIDUALBASED_PREDICTOR_CORRECTOR_BOSSAK_SCHEME
125 template<
class TSparseSpace,
161 :
Scheme<TSparseSpace, TDenseSpace>()
169 int NumThreads = OpenMPUtils::GetNumThreads();
170 mMass.resize(NumThreads);
171 mDamp.resize(NumThreads);
172 mvel.resize(NumThreads);
173 macc.resize(NumThreads);
185 std::cout <<
"using the Bossak Time Integration Scheme" << std::endl;
221 i_dof->GetSolutionStepValue() += Dx[i_dof->EquationId()];
231 noalias(DeltaDisp) = (
i)->FastGetSolutionStepValue(DISPLACEMENT) - (
i)->FastGetSolutionStepValue(DISPLACEMENT, 1);
240 UpdateVelocity(CurrentVelocity, DeltaDisp, OldVelocity, OldAcceleration);
282 std::cout <<
"Prediction" << std::endl;
301 if ((
i->pGetDof(DISPLACEMENT_X))->IsFixed() ==
false)
302 (CurrentDisp[0]) = OldDisp[0] + DeltaTime * OldVelocity[0];
303 if (
i->pGetDof(DISPLACEMENT_Y)->IsFixed() ==
false)
304 (CurrentDisp[1]) = OldDisp[1] + DeltaTime * OldVelocity[1];
305 if (
i->HasDofFor(DISPLACEMENT_Z))
306 if (
i->pGetDof(DISPLACEMENT_Z)->IsFixed() ==
false)
307 (CurrentDisp[2]) = OldDisp[2] + DeltaTime * OldVelocity[2];
312 noalias(DeltaDisp) = CurrentDisp - OldDisp;
323 UpdateVelocity(CurrentVelocity, DeltaDisp, OldVelocity, OldAcceleration);
345 Element::Pointer rCurrentElement,
357 (rCurrentElement)->CalculateLocalSystem(LHS_Contribution, RHS_Contribution, CurrentProcessInfo);
361 (rCurrentElement)->CalculateMassMatrix(
mMass[
k], CurrentProcessInfo);
363 (rCurrentElement)->CalculateDampingMatrix(
mDamp[
k], CurrentProcessInfo);
365 (rCurrentElement)->EquationIdVector(
EquationId, CurrentProcessInfo);
385 Element::Pointer rCurrentElement,
393 (rCurrentElement)->CalculateRightHandSide(RHS_Contribution, CurrentProcessInfo);
394 (rCurrentElement)->CalculateMassMatrix(
mMass[
k], CurrentProcessInfo);
395 (rCurrentElement)->CalculateDampingMatrix(
mDamp[
k], CurrentProcessInfo);
396 (rCurrentElement)->EquationIdVector(
EquationId, CurrentProcessInfo);
408 Condition::Pointer rCurrentCondition,
418 (rCurrentCondition)->CalculateLocalSystem(LHS_Contribution, RHS_Contribution, CurrentProcessInfo);
419 (rCurrentCondition)->CalculateMassMatrix(
mMass[
k], CurrentProcessInfo);
420 (rCurrentCondition)->CalculateDampingMatrix(
mDamp[
k], CurrentProcessInfo);
421 (rCurrentCondition)->EquationIdVector(
EquationId, CurrentProcessInfo);
435 Condition::Pointer rCurrentCondition,
445 (rCurrentCondition)->CalculateRightHandSide(RHS_Contribution, CurrentProcessInfo);
446 (rCurrentCondition)->CalculateMassMatrix(
mMass[
k], CurrentProcessInfo);
447 (rCurrentCondition)->CalculateDampingMatrix(
mDamp[
k], CurrentProcessInfo);
448 (rCurrentCondition)->EquationIdVector(
EquationId, CurrentProcessInfo);
468 double DeltaTime = CurrentProcessInfo[DELTA_TIME];
471 KRATOS_THROW_ERROR(std::logic_error,
"detected delta_time = 0 in the Bossak Scheme ... check if the time step is created correctly for the current model part",
"");
495 if(err!=0)
return err;
499 if(DISPLACEMENT.Key() == 0)
500 KRATOS_THROW_ERROR(std::invalid_argument,
"DISPLACEMENT has Key zero! (check if the application is correctly registered",
"");
501 if(VELOCITY.Key() == 0)
502 KRATOS_THROW_ERROR(std::invalid_argument,
"VELOCITY has Key zero! (check if the application is correctly registered",
"");
503 if(ACCELERATION.Key() == 0)
504 KRATOS_THROW_ERROR(std::invalid_argument,
"ACCELERATION has Key zero! (check if the application is correctly registered",
"");
507 for(ModelPart::NodesContainerType::iterator it=r_model_part.
NodesBegin();
510 if (it->SolutionStepsDataHas(DISPLACEMENT) ==
false)
511 KRATOS_THROW_ERROR(std::logic_error,
"DISPLACEMENT variable is not allocated for node ", it->Id() );
512 if (it->SolutionStepsDataHas(VELOCITY) ==
false)
513 KRATOS_THROW_ERROR(std::logic_error,
"DISPLACEMENT variable is not allocated for node ", it->Id() );
514 if (it->SolutionStepsDataHas(ACCELERATION) ==
false)
515 KRATOS_THROW_ERROR(std::logic_error,
"DISPLACEMENT variable is not allocated for node ", it->Id() );
519 for(ModelPart::NodesContainerType::iterator it=r_model_part.
NodesBegin();
522 if(it->HasDofFor(DISPLACEMENT_X) ==
false)
523 KRATOS_THROW_ERROR(std::invalid_argument,
"missing DISPLACEMENT_X dof on node ",it->Id());
524 if(it->HasDofFor(DISPLACEMENT_Y) ==
false)
525 KRATOS_THROW_ERROR(std::invalid_argument,
"missing DISPLACEMENT_Y dof on node ",it->Id());
526 if(it->HasDofFor(DISPLACEMENT_Z) ==
false)
527 KRATOS_THROW_ERROR(std::invalid_argument,
"missing DISPLACEMENT_Z dof on node ",it->Id());
533 KRATOS_THROW_ERROR(std::logic_error,
"Value not admissible for AlphaBossak. Admissible values should be between 0.0 and -0.3. Current value is ",
mAlphaBossak)
609 noalias(CurrentVelocity) =
ma1 * DeltaDisp -
ma4 * OldVelocity -
ma5*OldAcceleration;
623 noalias(CurrentAcceleration) =
ma0 * DeltaDisp -
ma2 * OldVelocity -
ma3*OldAcceleration;
671 Element::Pointer rCurrentElement,
683 rCurrentElement->GetSecondDerivativesVector(
macc[
k], 0);
686 rCurrentElement->GetSecondDerivativesVector(
maccold[
k], 1);
701 rCurrentElement->GetFirstDerivativesVector(
mvel[
k], 0);
711 Condition::Pointer rCurrentCondition,
722 rCurrentCondition->GetSecondDerivativesVector(
macc[
k], 0);
724 rCurrentCondition->GetSecondDerivativesVector(
maccold[
k], 1);
734 rCurrentCondition->GetFirstDerivativesVector(
mvel[
k], 0);
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
IndexType GetBufferSize() const
This method gets the suffer size of the model part database.
Definition: model_part.h:1876
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: pointer_vector_set.h:95
iterator begin()
Returns an iterator pointing to the beginning of the container.
Definition: pointer_vector_set.h:278
iterator end()
Returns an iterator pointing to the end of the container.
Definition: pointer_vector_set.h:314
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Definition: residualbased_predictorcorrector_bossak_scheme.h:129
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_predictorcorrector_bossak_scheme.h:144
std::vector< Vector > macc
Definition: residualbased_predictorcorrector_bossak_scheme.h:590
double ma1
Definition: residualbased_predictorcorrector_bossak_scheme.h:580
std::vector< Vector > maccold
Definition: residualbased_predictorcorrector_bossak_scheme.h:591
void AddDynamicsToLHS(LocalSystemMatrixType &LHS_Contribution, LocalSystemMatrixType &D, LocalSystemMatrixType &M, ProcessInfo &CurrentProcessInfo)
Definition: residualbased_predictorcorrector_bossak_scheme.h:635
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_predictorcorrector_bossak_scheme.h:146
void UpdateVelocity(array_1d< double, 3 > &CurrentVelocity, const array_1d< double, 3 > &DeltaDisp, const array_1d< double, 3 > &OldVelocity, const array_1d< double, 3 > &OldAcceleration)
Definition: residualbased_predictorcorrector_bossak_scheme.h:601
BaseType::TDataType TDataType
Definition: residualbased_predictorcorrector_bossak_scheme.h:138
double ma3
Definition: residualbased_predictorcorrector_bossak_scheme.h:582
void UpdateAcceleration(array_1d< double, 3 > &CurrentAcceleration, const array_1d< double, 3 > &DeltaDisp, const array_1d< double, 3 > &OldVelocity, const array_1d< double, 3 > &OldAcceleration)
Definition: residualbased_predictorcorrector_bossak_scheme.h:617
void Predict(ModelPart &r_model_part, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Performing the prediction of the solution.
Definition: residualbased_predictorcorrector_bossak_scheme.h:274
BaseType::DofsArrayType DofsArrayType
Definition: residualbased_predictorcorrector_bossak_scheme.h:140
void Calculate_RHS_Contribution(Element::Pointer rCurrentElement, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, ProcessInfo &CurrentProcessInfo)
Definition: residualbased_predictorcorrector_bossak_scheme.h:384
void AddDynamicsToRHS(Condition::Pointer rCurrentCondition, LocalSystemVectorType &RHS_Contribution, LocalSystemMatrixType &D, LocalSystemMatrixType &M, ProcessInfo &CurrentProcessInfo)
Definition: residualbased_predictorcorrector_bossak_scheme.h:710
ResidualBasedPredictorCorrectorBossakScheme(double NewAlphaBossak)
Definition: residualbased_predictorcorrector_bossak_scheme.h:160
double ma4
Definition: residualbased_predictorcorrector_bossak_scheme.h:583
double ma2
Definition: residualbased_predictorcorrector_bossak_scheme.h:581
void AddDynamicsToRHS(Element::Pointer rCurrentElement, LocalSystemVectorType &RHS_Contribution, LocalSystemMatrixType &D, LocalSystemMatrixType &M, ProcessInfo &CurrentProcessInfo)
Definition: residualbased_predictorcorrector_bossak_scheme.h:670
virtual ~ResidualBasedPredictorCorrectorBossakScheme()
Definition: residualbased_predictorcorrector_bossak_scheme.h:190
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residualbased_predictorcorrector_bossak_scheme.h:150
double mGammaNewmark
Definition: residualbased_predictorcorrector_bossak_scheme.h:577
std::vector< Matrix > mMass
Definition: residualbased_predictorcorrector_bossak_scheme.h:587
double ma5
Definition: residualbased_predictorcorrector_bossak_scheme.h:584
void CalculateSystemContributions(Element::Pointer rCurrentElement, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, ProcessInfo &CurrentProcessInfo)
Definition: residualbased_predictorcorrector_bossak_scheme.h:344
double ma0
Definition: residualbased_predictorcorrector_bossak_scheme.h:579
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: residualbased_predictorcorrector_bossak_scheme.h:136
void InitializeSolutionStep(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Function called once at the beginning of each solution step.
Definition: residualbased_predictorcorrector_bossak_scheme.h:457
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residualbased_predictorcorrector_bossak_scheme.h:148
virtual int Check(ModelPart &r_model_part)
Definition: residualbased_predictorcorrector_bossak_scheme.h:490
std::vector< Matrix > mDamp
Definition: residualbased_predictorcorrector_bossak_scheme.h:588
virtual void Condition_Calculate_RHS_Contribution(Condition::Pointer rCurrentCondition, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, ProcessInfo &CurrentProcessInfo)
Definition: residualbased_predictorcorrector_bossak_scheme.h:434
std::vector< Vector > mvel
Definition: residualbased_predictorcorrector_bossak_scheme.h:589
void Update(ModelPart &r_model_part, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Definition: residualbased_predictorcorrector_bossak_scheme.h:206
double mam
Definition: residualbased_predictorcorrector_bossak_scheme.h:585
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedPredictorCorrectorBossakScheme)
double mAlphaBossak
Definition: residualbased_predictorcorrector_bossak_scheme.h:575
double mBetaNewmark
Definition: residualbased_predictorcorrector_bossak_scheme.h:576
virtual void Condition_CalculateSystemContributions(Condition::Pointer rCurrentCondition, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, ProcessInfo &CurrentProcessInfo)
Definition: residualbased_predictorcorrector_bossak_scheme.h:407
Element::DofsVectorType DofsVectorType
Definition: residualbased_predictorcorrector_bossak_scheme.h:142
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
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 TSparseSpace::VectorType TSystemVectorType
Vector type definition.
Definition: scheme.h:74
typename TDenseSpace::VectorType LocalSystemVectorType
Local system vector type definition.
Definition: scheme.h:80
virtual void InitializeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Function called once at the beginning of each solution step.
Definition: scheme.h:272
typename TSparseSpace::DataType TDataType
Data type definition.
Definition: scheme.h:68
typename TDenseSpace::MatrixType LocalSystemMatrixType
Local system matrix type definition.
Definition: scheme.h:77
virtual int Check(const ModelPart &rModelPart) const
This function is designed to be called once to perform all the checks needed on the input provided....
Definition: scheme.h:508
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.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
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
int k
Definition: quadrature.py:595
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17