64 template <
class TSparseSpace,
class TDenseSpace,
class TButcherTableau>
128 typename ExplicitBuilderType::Pointer pExplicitBuilder,
130 int RebuildLevel = 0)
143 int RebuildLevel = 0)
153 typename SolvingStrategyType::Pointer
Create(
158 return Kratos::make_shared<ClassType>(rModelPart, ThisParameters);
177 "name" : "explicit_solving_strategy_runge_kutta"
183 return default_parameters;
212 s <<
"explicit_solving_strategy_runge_kutta_" << TButcherTableau::Name();
217 std::string
Info()
const override
219 std::stringstream ss;
220 ss <<
"ExplicitSolvingStrategyRungeKutta<" <<
mButcherTableau.Info() <<
">";
263 auto& r_dof_set = r_explicit_bs.GetDofSet();
264 const unsigned int dof_size = r_explicit_bs.GetEquationSystemSize();
265 const auto& r_lumped_mass_vector = r_explicit_bs.GetLumpedMassMatrixVector();
273 KRATOS_ERROR_IF(
dt < 1.0e-12) <<
"ProcessInfo DELTA_TIME is close to zero." << std::endl;
280 auto it_dof = r_dof_set.begin() + i_dof;
281 double& r_u_0 = it_dof->GetSolutionStepValue(0);
282 const double& r_u_1 = it_dof->GetSolutionStepValue(1);
283 if (it_dof->IsFixed()) {
291 for(
unsigned int i=1;
i<TButcherTableau::SubstepCount(); ++
i) {
300 auto it_dof = r_dof_set.begin() + i_dof;
302 double& r_u = it_dof->GetSolutionStepValue(0);
303 const double& r_u_old = it_dof->GetSolutionStepValue(1);
304 if (!it_dof->IsFixed()) {
305 const double mass = r_lumped_mass_vector(i_dof);
306 const MatrixRow<LocalSystemMatrixType> substeps_k = row(rk_K, i_dof);
307 r_u = r_u_old + (dt / mass) * std::inner_product(weights.begin(), weights.end(), substeps_k.begin(), 0.0);
358 auto& r_dof_set = r_explicit_bs.GetDofSet();
359 const auto& r_lumped_mass_vector = r_explicit_bs.GetLumpedMassMatrixVector();
363 KRATOS_ERROR_IF(
dt < 1.0e-12) <<
"ProcessInfo DELTA_TIME is close to zero." << std::endl;
365 auto& r_process_info = r_model_part.GetProcessInfo();
368 const double integration_theta =
mButcherTableau.GetIntegrationTheta(SubStepIndex);
369 const auto alphas_begin =
mButcherTableau.GetMatrixRowBegin(SubStepIndex);
373 r_process_info.GetValue(RUNGE_KUTTA_STEP) = SubStepIndex;
374 r_process_info.GetValue(TIME_INTEGRATION_THETA) = integration_theta;
378 r_explicit_bs.BuildRHS(r_model_part);
382 auto it_dof = r_dof_set.begin() + i_dof;
384 const double& r_res = it_dof->GetSolutionStepReactionValue();
385 rIntermediateStepResidualVectors(i_dof, SubStepIndex-1) = r_res;
387 double& r_u = it_dof->GetSolutionStepValue(0);
388 const double& r_u_old = it_dof->GetSolutionStepValue(1);
389 if (!it_dof->IsFixed()) {
390 const double mass = r_lumped_mass_vector(i_dof);
391 const auto k =
row(rIntermediateStepResidualVectors, i_dof);
392 r_u = r_u_old + (
dt / mass) * std::inner_product(alphas_begin, alphas_end,
k.begin(), 0.0);
401 const double delta_u = rFixedDofsValues(i_dof) - r_u_old;
402 r_u = r_u_old + integration_theta * delta_u;
409 KRATOS_CATCH(
"SubstepIndex = " + std::to_string(SubStepIndex));
423 auto& r_dof_set = r_explicit_bs.GetDofSet();
427 auto& r_process_info = r_model_part.GetProcessInfo();
428 constexpr
unsigned int substep_index = TButcherTableau::SubstepCount();
431 r_process_info.GetValue(RUNGE_KUTTA_STEP) = TButcherTableau::SubstepCount();
432 r_process_info.GetValue(TIME_INTEGRATION_THETA) =
mButcherTableau.GetIntegrationTheta(substep_index);
436 r_explicit_bs.BuildRHS(r_model_part);
440 const auto it_dof = r_dof_set.begin() + i_dof;
442 const double& r_res = it_dof->GetSolutionStepReactionValue();
443 rLastStepResidualVector(i_dof, substep_index - 1) = r_res;
511 template <
class TSparseSpace,
class TDenseSpace>
514 template <
class TSparseSpace,
class TDenseSpace>
517 template <
class TSparseSpace,
class TDenseSpace>
520 template <
class TSparseSpace,
class TDenseSpace>
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
Current class provides an implementation for the base explicit builder and solving operations.
Definition: explicit_builder.h:68
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
Family of explicit Runge-Kutta schemes.
Definition: explicit_solving_strategy_runge_kutta.h:66
virtual void InitializeRungeKuttaLastSubStep()
Initialize the Runge-Kutta last substep This method is intended to implement all the operations requi...
Definition: explicit_solving_strategy_runge_kutta.h:333
typename TDenseSpace::VectorType LocalSystemVectorType
The local vector definition.
Definition: explicit_solving_strategy_runge_kutta.h:87
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: explicit_solving_strategy_runge_kutta.h:225
virtual void FinalizeRungeKuttaLastSubStep()
Finalize the Runge-Kutta last substep This method is intended to implement all the operations require...
Definition: explicit_solving_strategy_runge_kutta.h:339
KRATOS_CLASS_POINTER_DEFINITION(ExplicitSolvingStrategyRungeKutta)
std::string Info() const override
Return information as a string.
Definition: explicit_solving_strategy_runge_kutta.h:217
virtual void PerformRungeKuttaIntermediateSubStep(const IndexType SubStepIndex, const LocalSystemVectorType &rFixedDofsValues, LocalSystemMatrixType &rIntermediateStepResidualVectors)
Performs an intermediate RK4 step This functions performs all the operations required in an intermedi...
Definition: explicit_solving_strategy_runge_kutta.h:349
void SolveWithLumpedMassMatrix() override
Calculate the explicit update This method is intended to implement the explicit update calculation No...
Definition: explicit_solving_strategy_runge_kutta.h:257
const TButcherTableau mButcherTableau
Definition: explicit_solving_strategy_runge_kutta.h:241
ExplicitSolvingStrategyRungeKutta()
Default constructor. (empty)
Definition: explicit_solving_strategy_runge_kutta.h:100
ExplicitSolvingStrategyRungeKutta(ModelPart &rModelPart, typename ExplicitBuilderType::Pointer pExplicitBuilder, bool MoveMeshFlag=false, int RebuildLevel=0)
Default constructor.
Definition: explicit_solving_strategy_runge_kutta.h:126
ExplicitSolvingStrategyRungeKutta(ModelPart &rModelPart, bool MoveMeshFlag=false, int RebuildLevel=0)
Default constructor.
Definition: explicit_solving_strategy_runge_kutta.h:140
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: explicit_solving_strategy_runge_kutta.h:231
virtual void FinalizeRungeKuttaIntermediateSubStep()
Finalize the Runge-Kutta intermediate substep This method is intended to implement all the operations...
Definition: explicit_solving_strategy_runge_kutta.h:327
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: explicit_solving_strategy_runge_kutta.h:173
SolvingStrategyType::Pointer Create(ModelPart &rModelPart, Parameters ThisParameters) const override
Create method.
Definition: explicit_solving_strategy_runge_kutta.h:153
~ExplicitSolvingStrategyRungeKutta() override=default
ExplicitSolvingStrategyRungeKutta(const ExplicitSolvingStrategyRungeKutta &Other)=delete
void Initialize() override
Initialization of member variables and prior operations.
Definition: explicit_solving_strategy_runge_kutta.h:195
ExplicitSolvingStrategyRungeKutta(ModelPart &rModelPart, Parameters ThisParameters)
Default constructor. (with parameters)
Definition: explicit_solving_strategy_runge_kutta.h:110
virtual void InitializeRungeKuttaIntermediateSubStep()
Initialize the Runge-Kutta intermediate substep This method is intended to implement all the operatio...
Definition: explicit_solving_strategy_runge_kutta.h:321
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: explicit_solving_strategy_runge_kutta.h:209
typename TDenseSpace::MatrixType LocalSystemMatrixType
Definition: explicit_solving_strategy_runge_kutta.h:88
virtual void PerformRungeKuttaLastSubStep(LocalSystemMatrixType &rLastStepResidualVector)
Performs the last RK4 step This functions performs all the operations required in the last RK4 sub st...
Definition: explicit_solving_strategy_runge_kutta.h:417
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
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
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#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
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
int k
Definition: quadrature.py:595
integer i
Definition: TensorModule.f:17