14 #if !defined(KRATOS_RESIDUAL_BASED_BDF_DISPLACEMENT_SCHEME )
15 #define KRATOS_RESIDUAL_BASED_BDF_DISPLACEMENT_SCHEME
52 template<
class TSparseSpace,
class TDenseSpace>
130 typename BaseType::Pointer
Clone()
override
132 return Kratos::make_shared<ResidualBasedBDFDisplacementScheme>(*
this);
154 return Kratos::make_shared<ClassType>(ThisParameters);
179 const auto it_node_begin = rModelPart.
Nodes().begin();
182 KRATOS_WARNING_IF(
"ResidualBasedBDFDisplacementScheme", !r_current_process_info.
Has(DOMAIN_SIZE)) <<
"DOMAIN_SIZE not defined. Please define DOMAIN_SIZE. 3D case will be assumed" << std::endl;
183 const std::size_t
dimension = r_current_process_info.
Has(DOMAIN_SIZE) ? r_current_process_info.
GetValue(DOMAIN_SIZE) : 3;
186 const int velpos = it_node_begin->HasDofFor(VELOCITY_X) ?
static_cast<int>(it_node_begin->GetDofPosition(VELOCITY_X)) : -1;
187 const int accelpos = it_node_begin->HasDofFor(ACCELERATION_X) ?
static_cast<int>(it_node_begin->GetDofPosition(ACCELERATION_X)) : -1;
189 std::array<bool, 3> fixed = {
false,
false,
false};
190 const std::array<const Variable<ComponentType>*, 3> disp_components = {&DISPLACEMENT_X, &DISPLACEMENT_Y, &DISPLACEMENT_Z};
191 const std::array<const Variable<ComponentType>*, 3> vel_components = {&VELOCITY_X, &VELOCITY_Y, &VELOCITY_Z};
192 const std::array<const Variable<ComponentType>*, 3> accel_components = {&ACCELERATION_X, &ACCELERATION_Y, &ACCELERATION_Z};
195 for (std::size_t i_dim = 0; i_dim < dimension; ++i_dim) {
196 rFixedTLS[i_dim] = false;
200 for (std::size_t i_dim = 0; i_dim <
dimension; ++i_dim) {
201 if (rNode.
GetDof(*accel_components[i_dim], accelpos + i_dim).
IsFixed()) {
202 rNode.Fix(*disp_components[i_dim]);
203 rFixedTLS[i_dim] = true;
208 for (std::size_t i_dim = 0; i_dim <
dimension; ++i_dim) {
209 if (rNode.
GetDof(*vel_components[i_dim], velpos + i_dim).
IsFixed() && !rFixedTLS[i_dim]) {
210 rNode.Fix(*disp_components[i_dim]);
216 KRATOS_CATCH(
"ResidualBasedBDFDisplacementScheme.InitializeSolutionStep");
240 const double delta_time = r_current_process_info[DELTA_TIME];
243 const int num_nodes =
static_cast<int>( rModelPart.
Nodes().size() );
244 const auto it_node_begin = rModelPart.
Nodes().begin();
247 KRATOS_ERROR_IF_NOT(it_node_begin->HasDofFor(DISPLACEMENT_X)) <<
"ResidualBasedBDFDisplacementScheme:: DISPLACEMENT is not added" << std::endl;
248 const int disppos = it_node_begin->GetDofPosition(DISPLACEMENT_X);
249 const int velpos = it_node_begin->HasDofFor(VELOCITY_X) ?
static_cast<int>(it_node_begin->GetDofPosition(VELOCITY_X)) : -1;
250 const int accelpos = it_node_begin->HasDofFor(ACCELERATION_X) ?
static_cast<int>(it_node_begin->GetDofPosition(ACCELERATION_X)) : -1;
253 KRATOS_WARNING_IF(
"ResidualBasedBDFDisplacementScheme", !r_current_process_info.
Has(DOMAIN_SIZE)) <<
"DOMAIN_SIZE not defined. Please define DOMAIN_SIZE. 3D case will be assumed" << std::endl;
254 const std::size_t
dimension = r_current_process_info.
Has(DOMAIN_SIZE) ? r_current_process_info.
GetValue(DOMAIN_SIZE) : 3;
257 std::array<bool, 3> predicted = {
false,
false,
false};
258 const std::array<const Variable<ComponentType>*, 3> disp_components = {&DISPLACEMENT_X, &DISPLACEMENT_Y, &DISPLACEMENT_Z};
259 const std::array<const Variable<ComponentType>*, 3> vel_components = {&VELOCITY_X, &VELOCITY_Y, &VELOCITY_Z};
260 const std::array<const Variable<ComponentType>*, 3> accel_components = {&ACCELERATION_X, &ACCELERATION_Y, &ACCELERATION_Z};
263 auto it_node = it_node_begin +
Index;
265 for (std::size_t i_dim = 0; i_dim <
dimension; ++i_dim) {
266 rPredictedTLS[i_dim] =
false;
277 for (std::size_t i_dim = 0; i_dim <
dimension; ++i_dim) {
278 if (it_node->GetDof(*accel_components[i_dim], accelpos + i_dim).IsFixed()) {
279 dotun0[i_dim] = dot2un0[i_dim];
280 for (std::size_t i_order = 1; i_order < this->mOrder + 1; ++i_order)
281 dotun0[i_dim] -= this->mBDF[i_order] * it_node->FastGetSolutionStepValue(*vel_components[i_dim], i_order);
282 dotun0[i_dim] /= this->mBDF[i_dim];
284 un0[i_dim] = dotun0[i_dim];
285 for (std::size_t i_order = 1; i_order < this->mOrder + 1; ++i_order)
286 un0[i_dim] -= this->mBDF[i_order] * it_node->FastGetSolutionStepValue(*disp_components[i_dim], i_order);
287 un0[i_dim] /= this->mBDF[i_dim];
288 rPredictedTLS[i_dim] = true;
293 for (std::size_t i_dim = 0; i_dim <
dimension; ++i_dim) {
294 if (it_node->GetDof(*vel_components[i_dim], velpos + i_dim).IsFixed() && !rPredictedTLS[i_dim]) {
295 un0[i_dim] = dotun0[i_dim];
296 for (std::size_t i_order = 1; i_order < this->mOrder + 1; ++i_order)
297 un0[i_dim] -= this->mBDF[i_order] * it_node->FastGetSolutionStepValue(*disp_components[i_dim], i_order);
298 un0[i_dim] /= this->mBDF[i_dim];
299 rPredictedTLS[i_dim] = true;
303 for (std::size_t i_dim = 0; i_dim <
dimension; ++i_dim) {
304 if (!it_node->GetDof(*disp_components[i_dim], disppos + i_dim).IsFixed() && !rPredictedTLS[i_dim]) {
305 un0[i_dim] = un1[i_dim] + delta_time * dotun1[i_dim] + 0.5 * std::pow(delta_time, 2) * dot2un1[i_dim];
310 UpdateFirstDerivative(it_node);
311 UpdateSecondDerivative(it_node);
329 const int err = BDFBaseType::Check(rModelPart);
330 if(err!=0)
return err;
333 for(
auto& rnode : rModelPart.
Nodes()) {
356 "name" : "bdf_displacement_scheme",
357 "integration_order" : 2
361 const Parameters base_default_parameters = BDFBaseType::GetDefaultParameters();
363 return default_parameters;
372 return "bdf_displacement_scheme";
388 std::string
Info()
const override
390 return "ResidualBasedBDFDisplacementScheme";
433 noalias(dotun0) = this->mBDF[0] * itNode->FastGetSolutionStepValue(DISPLACEMENT);
434 for (std::size_t i_order = 1; i_order < this->mOrder + 1; ++i_order)
435 noalias(dotun0) += this->mBDF[i_order] * itNode->FastGetSolutionStepValue(DISPLACEMENT, i_order);
445 noalias(dot2un0) = this->mBDF[0] * itNode->FastGetSolutionStepValue(VELOCITY);
446 for (std::size_t i_order = 1; i_order < this->mOrder + 1; ++i_order)
447 noalias(dot2un0) += this->mBDF[i_order] * itNode->FastGetSolutionStepValue(VELOCITY, i_order);
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
bool Has(const Variable< TDataType > &rThisVariable) const
Checks if the data container has a value associated with a given variable.
Definition: data_value_container.h:382
TDataType & GetValue(const Variable< TDataType > &rThisVariable)
Gets the value associated with a given variable.
Definition: data_value_container.h:268
bool IsFixed() const
Definition: dof.h:376
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
This class is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
const DofType & GetDof(TVariableType const &rDofVariable, int pos) const
Get dof with a given position. If not found it is search.
Definition: node.h:649
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
void RecursivelyAddMissingParameters(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing contain at least all parameters...
Definition: kratos_parameters.cpp:1457
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
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
BDF integration scheme (displacement based)
Definition: residual_based_bdf_displacement_scheme.h:55
std::string Info() const override
Turn back information as a string.
Definition: residual_based_bdf_displacement_scheme.h:388
BDFBaseType::TDataType TDataType
Data type definition.
Definition: residual_based_bdf_displacement_scheme.h:70
BDFBaseType::LocalSystemMatrixType LocalSystemMatrixType
Local system vector type definition.
Definition: residual_based_bdf_displacement_scheme.h:78
BDFBaseType::DofsArrayType DofsArrayType
DoF array type definition.
Definition: residual_based_bdf_displacement_scheme.h:81
BaseType::Pointer Create(Parameters ThisParameters) const override
Create method.
Definition: residual_based_bdf_displacement_scheme.h:152
ModelPart::ConditionsContainerType ConditionsArrayType
Conditions containers definition.
Definition: residual_based_bdf_displacement_scheme.h:90
ResidualBasedBDFDisplacementScheme(const std::size_t Order=2)
Constructor. The BDF method.
Definition: residual_based_bdf_displacement_scheme.h:115
Element::DofsVectorType DofsVectorType
DoF vector type definition.
Definition: residual_based_bdf_displacement_scheme.h:83
ResidualBasedBDFDisplacementScheme(ResidualBasedBDFDisplacementScheme &rOther)
Definition: residual_based_bdf_displacement_scheme.h:122
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: residual_based_bdf_displacement_scheme.h:370
ResidualBasedImplicitTimeScheme< TSparseSpace, TDenseSpace > ImplicitBaseType
Definition: residual_based_bdf_displacement_scheme.h:65
void InitializeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
It initializes time step solution. Only for reasons if the time step solution is restarted.
Definition: residual_based_bdf_displacement_scheme.h:164
void Predict(ModelPart &rModelPart, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Performing the prediction of the solution.
Definition: residual_based_bdf_displacement_scheme.h:228
double ComponentType
Definition: residual_based_bdf_displacement_scheme.h:92
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedBDFDisplacementScheme)
Pointer definition of ResidualBasedBDFDisplacementScheme.
void UpdateSecondDerivative(NodesArrayType::iterator itNode) override
Updating second time derivative (acceleration)
Definition: residual_based_bdf_displacement_scheme.h:442
ResidualBasedBDFDisplacementScheme< TSparseSpace, TDenseSpace > ClassType
Definition: residual_based_bdf_displacement_scheme.h:67
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: residual_based_bdf_displacement_scheme.h:394
~ResidualBasedBDFDisplacementScheme() override
Definition: residual_based_bdf_displacement_scheme.h:138
BDFBaseType::LocalSystemVectorType LocalSystemVectorType
Local system matrix type definition.
Definition: residual_based_bdf_displacement_scheme.h:76
BDFBaseType::TSystemMatrixType TSystemMatrixType
Matrix type definition.
Definition: residual_based_bdf_displacement_scheme.h:72
ResidualBasedBDFScheme< TSparseSpace, TDenseSpace > BDFBaseType
Definition: residual_based_bdf_displacement_scheme.h:66
ModelPart::NodesContainerType NodesArrayType
Nodes containers definition.
Definition: residual_based_bdf_displacement_scheme.h:86
BDFBaseType::TSystemVectorType TSystemVectorType
Vector type definition.
Definition: residual_based_bdf_displacement_scheme.h:74
ModelPart::ElementsContainerType ElementsArrayType
Elements containers definition.
Definition: residual_based_bdf_displacement_scheme.h:88
Scheme< TSparseSpace, TDenseSpace > BaseType
Base class definition.
Definition: residual_based_bdf_displacement_scheme.h:64
BaseType::Pointer Clone() override
Definition: residual_based_bdf_displacement_scheme.h:130
void UpdateFirstDerivative(NodesArrayType::iterator itNode) override
Updating first time derivative (velocity)
Definition: residual_based_bdf_displacement_scheme.h:430
int Check(const ModelPart &rModelPart) const override
This function is designed to be called once to perform all the checks needed on the input provided.
Definition: residual_based_bdf_displacement_scheme.h:325
ResidualBasedBDFDisplacementScheme(Parameters ThisParameters)
Constructor. The BDF method (parameters)
Definition: residual_based_bdf_displacement_scheme.h:102
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: residual_based_bdf_displacement_scheme.h:400
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: residual_based_bdf_displacement_scheme.h:352
BDF integration scheme (for dynamic problems)
Definition: residual_based_bdf_scheme.h:83
ImplicitBaseType::TDataType TDataType
Definition: residual_based_bdf_scheme.h:95
ImplicitBaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residual_based_bdf_scheme.h:105
void InitializeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
It initializes time step solution. Only for reasons if the time step solution is restarted.
Definition: residual_based_bdf_scheme.h:236
ImplicitBaseType::TSystemVectorType TSystemVectorType
Definition: residual_based_bdf_scheme.h:103
ImplicitBaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residual_based_bdf_scheme.h:107
ImplicitBaseType::TSystemMatrixType TSystemMatrixType
Definition: residual_based_bdf_scheme.h:101
This is the base class for the implicit time schemes.
Definition: residual_based_implicit_time_scheme.h:55
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
virtual Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const
This method validate and assign default parameters.
Definition: scheme.h:773
virtual void AssignSettings(const Parameters ThisParameters)
This method assigns settings to member variables.
Definition: scheme.h:786
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_CHECK_DOF_IN_NODE(TheVariable, TheNode)
Definition: checks.h:176
#define KRATOS_CHECK_VARIABLE_IN_NODAL_DATA(TheVariable, TheNode)
Definition: checks.h:171
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
delta_time
Definition: generate_frictional_mortar_condition.py:130
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
A
Definition: sensitivityMatrix.py:70