14 #if !defined(KRATOS_EXPLICIT_SOLVING_STRATEGY_BFECC)
15 #define KRATOS_EXPLICIT_SOLVING_STRATEGY_BFECC
89 template <
class TSparseSpace,
class TDenseSpace>
172 typename ExplicitBuilderType::Pointer pExplicitBuilder,
174 int RebuildLevel = 0)
187 int RebuildLevel = 0)
197 typename SolvingStrategyType::Pointer
Create(
202 return Kratos::make_shared<ClassType>(rModelPart, ThisParameters);
221 "name" : "explicit_solving_strategy_bfecc"
227 return default_parameters;
246 s <<
"explicit_solving_strategy_bfecc";
270 std::string
Info()
const override
272 std::stringstream ss;
273 ss <<
"ExplicitSolvingStrategyBFECC";
315 KRATOS_ERROR_IF(
dt < 1.0e-12) <<
"ProcessInfo DELTA_TIME is close to zero." << std::endl;
342 auto& r_dof_set = r_explicit_bs.GetDofSet();
343 const SizeType dof_size = r_explicit_bs.GetEquationSystemSize();
348 auto r_dof = *(r_dof_set.begin() + i_dof);
349 double& r_u_0 = r_dof.GetSolutionStepValue(destination);
350 if (r_dof.IsFixed()) {
351 u_fixed(i_dof) = r_u_0;
353 r_u_0 = r_dof.GetSolutionStepValue(source);
366 auto& r_dof_set = r_explicit_bs.GetDofSet();
367 const SizeType dof_size = r_explicit_bs.GetEquationSystemSize();
372 const auto it_dof = r_dof_set.cbegin() + i_dof;
373 u_copy[i_dof] = it_dof->GetSolutionStepValue(BufferPosition);
426 auto& r_dof_set = r_explicit_bs.GetDofSet();
427 const auto& r_lumped_mass_vector = r_explicit_bs.GetLumpedMassMatrixVector();
431 KRATOS_ERROR_IF(
dt < 1.0e-12) <<
"ProcessInfo DELTA_TIME is close to zero." << std::endl;
433 auto& r_process_info = r_model_part.GetProcessInfo();
436 const auto substep_settings = InitializeSubstep(SubstepType);
438 r_process_info.GetValue(TIME_INTEGRATION_THETA) = substep_settings.theta;
439 r_explicit_bs.BuildRHS(r_model_part);
443 auto it_dof = r_dof_set.begin() + i_dof;
446 const double residual = it_dof->GetSolutionStepReactionValue();
449 double& r_u = it_dof->GetSolutionStepValue(0);
450 double& r_u_prev_step = it_dof->GetSolutionStepValue(1);
452 if (!it_dof->IsFixed()) {
453 const double mass = r_lumped_mass_vector[i_dof];
454 r_u += substep_settings.TimeDirection() * (dt / mass) * residual;
456 r_u = substep_settings.theta*substep_settings.u_fixed[i_dof] + (1 - substep_settings.theta)*r_u_prev_step;
461 FinalizeSubstep(SubstepType);
465 case FORWARD:
return "FORWARD";
467 case FINAL:
return "FINAL";
468 default:
return std::to_string(
static_cast<int>(substep));
481 auto& r_dof_set = r_explicit_bs.GetDofSet();
486 const double prev_step_solution = rPrevStepSolution[dof_index];
487 auto& r_dof = *(r_dof_set.begin() + dof_index);
489 const double error = (r_dof.GetSolutionStepValue(0) - prev_step_solution)/2.0;
491 r_dof.GetSolutionStepValue(1) = prev_step_solution -
error;
533 SubstepData InitializeSubstep(
const Substep SubstepType)
559 KRATOS_ERROR <<
"Invalid value for Substep" << std::endl;
563 void FinalizeSubstep(
const Substep SubstepType)
565 switch(SubstepType) {
569 default:
KRATOS_ERROR <<
"Invalid value for Substep" << std::endl;
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
Explicit Back-and-Forth Error Compensation Correction time-integration scheme.
Definition: explicit_solving_strategy_bfecc.h:91
ExplicitSolvingStrategyBFECC(const ExplicitSolvingStrategyBFECC &Other)=delete
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: explicit_solving_strategy_bfecc.h:243
virtual void InitializeBFECCFinalSubstep()
Initialize the BFECC final substep This method is intended to implement all the operations required b...
Definition: explicit_solving_strategy_bfecc.h:408
virtual void PerformSubstep(const Substep SubstepType)
Performs a substep.
Definition: explicit_solving_strategy_bfecc.h:420
ExplicitSolvingStrategyBFECC()
Default constructor. (empty)
Definition: explicit_solving_strategy_bfecc.h:144
ExplicitSolvingStrategy< TSparseSpace, TDenseSpace > BaseType
Definition: explicit_solving_strategy_bfecc.h:104
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: explicit_solving_strategy_bfecc.h:278
std::string Info() const override
Turn back information as a string.
Definition: explicit_solving_strategy_bfecc.h:270
virtual void FinalizeBFECCBackwardSubstep()
Finalize the BFECC backward substep This method is intended to implement all the operations required ...
Definition: explicit_solving_strategy_bfecc.h:402
LocalSystemVectorType ExtractSolutionStepData(const SizeType BufferPosition) const
Definition: explicit_solving_strategy_bfecc.h:362
ExplicitSolvingStrategyBFECC(ModelPart &rModelPart, typename ExplicitBuilderType::Pointer pExplicitBuilder, bool MoveMeshFlag=false, int RebuildLevel=0)
Default constructor.
Definition: explicit_solving_strategy_bfecc.h:170
virtual void InitializeBFECCBackwardSubstep()
Initialize the BFECC backward substep This method is intended to implement all the operations require...
Definition: explicit_solving_strategy_bfecc.h:396
void Initialize() override
Initialization of member variables and prior operations.
Definition: explicit_solving_strategy_bfecc.h:259
ExplicitSolvingStrategyBFECC(ModelPart &rModelPart, Parameters ThisParameters)
Default constructor. (with parameters)
Definition: explicit_solving_strategy_bfecc.h:154
~ExplicitSolvingStrategyBFECC() override=default
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: explicit_solving_strategy_bfecc.h:284
ExplicitSolvingStrategyBFECC(ModelPart &rModelPart, bool MoveMeshFlag=false, int RebuildLevel=0)
Default constructor.
Definition: explicit_solving_strategy_bfecc.h:184
KRATOS_CLASS_POINTER_DEFINITION(ExplicitSolvingStrategyBFECC)
BaseType::ExplicitBuilderType ExplicitBuilderType
Definition: explicit_solving_strategy_bfecc.h:110
ModelPart::SizeType SizeType
Definition: explicit_solving_strategy_bfecc.h:98
LocalSystemVectorType CopySolutionStepData(const SubstepData SData)
Definition: explicit_solving_strategy_bfecc.h:333
void CorrectErrorAfterForwardsAndBackwards(const LocalSystemVectorType &rPrevStepSolution)
Definition: explicit_solving_strategy_bfecc.h:478
Substep
Definition: explicit_solving_strategy_bfecc.h:96
@ FORWARD
Definition: explicit_solving_strategy_bfecc.h:96
@ FINAL
Definition: explicit_solving_strategy_bfecc.h:96
@ BACKWARD
Definition: explicit_solving_strategy_bfecc.h:96
ExplicitSolvingStrategyBFECC< TSparseSpace, TDenseSpace > ClassType
The definition of the current class.
Definition: explicit_solving_strategy_bfecc.h:107
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: explicit_solving_strategy_bfecc.h:117
void SolveWithLumpedMassMatrix() override
Calculate the explicit update This method is intended to implement the explicit update calculation No...
Definition: explicit_solving_strategy_bfecc.h:309
virtual void FinalizeBFECCFinalSubstep()
Finalize the BFECC final substep This method is intended to implement all the operations required aft...
Definition: explicit_solving_strategy_bfecc.h:414
virtual void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: explicit_solving_strategy_bfecc.h:234
virtual void FinalizeBFECCForwardSubstep()
Finalize the BFECC initial forward substep This method is intended to implement all the operations re...
Definition: explicit_solving_strategy_bfecc.h:390
virtual Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: explicit_solving_strategy_bfecc.h:217
virtual void InitializeBFECCForwardSubstep()
Initialize the BFECC initial forward substep This method is intended to implement all the operations ...
Definition: explicit_solving_strategy_bfecc.h:384
BaseType::DofType DofType
The DOF type.
Definition: explicit_solving_strategy_bfecc.h:113
TDenseSpace::VectorType LocalSystemVectorType
The local vector definition.
Definition: explicit_solving_strategy_bfecc.h:116
SolvingStrategy< TSparseSpace, TDenseSpace > SolvingStrategyType
Definition: explicit_solving_strategy_bfecc.h:101
SolvingStrategyType::Pointer Create(ModelPart &rModelPart, Parameters ThisParameters) const override
Create method.
Definition: explicit_solving_strategy_bfecc.h:197
Explicit solving strategy base class.
Definition: explicit_solving_strategy.h:58
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: explicit_solving_strategy.h:338
virtual double GetDeltaTime()
Get the Delta Time object This method returns the DELTA_TIME from the ProcessInfo container.
Definition: explicit_solving_strategy.h:410
ExplicitBuilder< TSparseSpace, TDenseSpace > ExplicitBuilderType
Definition: explicit_solving_strategy.h:64
ExplicitBuilderType::DofType DofType
Definition: explicit_solving_strategy.h:70
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: explicit_solving_strategy.h:419
void Initialize() override
Initialization of member variables and prior operations.
Definition: explicit_solving_strategy.h:171
ExplicitBuilderType & GetExplicitBuilder()
Operations to get the explicit builder and solver.
Definition: explicit_solving_strategy.h:295
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
std::size_t SizeType
Definition: model_part.h:107
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
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
Solving strategy base class This is the base class from which we will derive all the strategies (impl...
Definition: solving_strategy.h:64
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
virtual Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const
This method validate and assign default parameters.
Definition: solving_strategy.h:507
bool MoveMeshFlag()
This function returns the flag that says if the mesh is moved.
Definition: solving_strategy.h:290
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
dt
Definition: DEM_benchmarks.py:173
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
float error
Definition: PecletTest.py:102
residual
Definition: hinsberg_optimization_4.py:433
tuple const
Definition: ode_solve.py:403
Definition: explicit_solving_strategy_bfecc.h:123
LocalSystemVectorType u_fixed
Definition: explicit_solving_strategy_bfecc.h:134
double theta
Definition: explicit_solving_strategy_bfecc.h:132
SubstepData(const double Theta, const Direction Dir)
Definition: explicit_solving_strategy_bfecc.h:126
int TimeDirection() const noexcept
Definition: explicit_solving_strategy_bfecc.h:130
Direction direction
Definition: explicit_solving_strategy_bfecc.h:133
Direction
Definition: explicit_solving_strategy_bfecc.h:124
@ BACK
Definition: explicit_solving_strategy_bfecc.h:124
@ FORTH
Definition: explicit_solving_strategy_bfecc.h:124