13 #ifndef KRATOS_SHALLOW_WATER_RESIDUAL_BASED_BDF_SCHEME_H_INCLUDED
14 #define KRATOS_SHALLOW_WATER_RESIDUAL_BASED_BDF_SCHEME_H_INCLUDED
54 template<
class TSparseSpace,
class TDenseSpace>
94 mVariables = {&MOMENTUM_X, &MOMENTUM_Y, &HEIGHT};
100 :
BDFBaseType(ThisParameters[
"integration_order"].GetDouble())
120 typename BaseType::Pointer
Clone()
override
164 KRATOS_CATCH(
"ShallowWaterResidualBasedBDFScheme.Update");
188 const int num_nodes =
static_cast<int>( rModelPart.
Nodes().size() );
189 const auto it_node_begin = rModelPart.
Nodes().begin();
192 auto it_node = it_node_begin +
i;
194 for (std::size_t
j = 0;
j < 3; ++
j)
197 double& un0 = it_node->FastGetSolutionStepValue(*mVariables[j]);
198 double un1 = it_node->FastGetSolutionStepValue(*mVariables[j], 1);
199 double dot_un1 = it_node->FastGetSolutionStepValue(*mDerivativeVariables[j], 1);
200 un0 = un1 + delta_time * dot_un1;
207 KRATOS_CATCH(
"ShallowWaterResidualBasedBDFScheme.Predict");
231 rCurrentProcessInfo);
255 rCurrentProcessInfo);
282 rCurrentProcessInfo);
306 rCurrentProcessInfo);
342 rNode.FastGetSolutionStepValue(DISPERSION_H) = ZeroVector(3);
343 rNode.FastGetSolutionStepValue(DISPERSION_V) = ZeroVector(3);
346 rElement.InitializeNonLinearIteration(r_process_info);
349 rCondition.InitializeNonLinearIteration(r_process_info);
352 const double nodal_area = rNode.FastGetSolutionStepValue(NODAL_AREA);
353 rNode.FastGetSolutionStepValue(DISPERSION_H) /= nodal_area;
354 rNode.FastGetSolutionStepValue(DISPERSION_V) /= nodal_area;
375 "name" : "shallow_water_residual_based_bdf_scheme",
376 "integration_order" : 2,
377 "update_velocities" : false,
378 "project_dispersive_field" : false,
379 "solution_variables" : ["MOMENTUM","HEIGHT"]
385 return default_parameters;
401 std::string
Info()
const override
403 return "ShallowWaterResidualBasedBDFScheme";
427 return ThisParameters;
439 const auto variable_names = ThisParameters[
"solution_variables"].
GetStringArray();
440 for (std::string variable_name : variable_names)
455 KRATOS_ERROR <<
"Only double and component variables are allowed in the solution variables list." ;
467 typename TSparseSpace::DofUpdaterPointerType
mpDofUpdater = TSparseSpace::CreateDofUpdater();
491 for (std::size_t i_var = 0; i_var < 3; ++i_var)
516 auto& vel = r_node.FastGetSolutionStepValue(VELOCITY);
517 const auto& q = r_node.FastGetSolutionStepValue(MOMENTUM);
518 const auto& h = r_node.FastGetSolutionStepValue(HEIGHT);
538 if (rM.size1() != 0) {
562 if (rM.size1() != 0) {
587 if (rM.size1() != 0) {
597 if (rNode.IsFixed(VELOCITY_X)) {
598 rNode.FastGetSolutionStepValue(DISPERSION_H_X) = 0.0;
599 rNode.FastGetSolutionStepValue(DISPERSION_V_X) = 0.0;
601 if (rNode.
IsFixed(VELOCITY_Y)) {
602 rNode.FastGetSolutionStepValue(DISPERSION_H_Y) = 0.0;
603 rNode.FastGetSolutionStepValue(DISPERSION_V_Y) = 0.0;
Computes NODAL_AREA.
Definition: calculate_nodal_area_process.h:67
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: calculate_nodal_area_process.cpp:27
Base class for all Conditions.
Definition: condition.h:59
virtual void GetFirstDerivativesVector(Vector &values, int Step=0) const
Definition: condition.h:313
Base class for all Elements.
Definition: element.h:60
virtual void GetFirstDerivativesVector(Vector &values, int Step=0) const
Definition: element.h:310
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
virtual void RotateVelocities(ModelPart &rModelPart) const override
Transform nodal velocities to the rotated coordinates (aligned with each node's normal)
Definition: flow_rate_slip_utility.h:170
virtual void ApplySlipCondition(TLocalMatrixType &rLocalMatrix, TLocalVectorType &rLocalVector, GeometryType &rGeometry) const override
Apply slip boundary conditions to the rotated local contributions. @detail This function takes the lo...
Definition: flow_rate_slip_utility.h:99
virtual void RecoverVelocities(ModelPart &rModelPart) const override
Definition: flow_rate_slip_utility.h:204
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
This class is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
bool IsFixed(const VariableData &rDofVariable) const
Definition: node.h:897
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
std::vector< std::string > GetStringArray() const
This method returns the array of strings in the current Parameter.
Definition: kratos_parameters.cpp:693
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
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
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
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
BDF integration scheme (for dynamic problems)
Definition: residual_based_bdf_scheme.h:83
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: residual_based_bdf_scheme.h:304
GeneralVectors mVector
The BDF coefficients.
Definition: residual_based_bdf_scheme.h:357
ImplicitBaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residual_based_bdf_scheme.h:105
ImplicitBaseType::TSystemVectorType TSystemVectorType
Definition: residual_based_bdf_scheme.h:103
Vector mBDF
The integration order.
Definition: residual_based_bdf_scheme.h:356
void UpdateDerivatives(ModelPart &rModelPart, DofsArrayType &rDofSet, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb)
Performing the update of the derivatives.
Definition: residual_based_bdf_scheme.h:377
ImplicitBaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residual_based_bdf_scheme.h:107
const std::size_t mOrder
Definition: residual_based_bdf_scheme.h:355
ImplicitBaseType::TSystemMatrixType TSystemMatrixType
Definition: residual_based_bdf_scheme.h:101
void CalculateRHSContribution(Element &rCurrentElement, LocalSystemVectorType &rRHSContribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to calculate just the RHS contribution.
Definition: residual_based_implicit_time_scheme.h:180
void CalculateSystemContributions(Element &rCurrentElement, LocalSystemMatrixType &rLHSContribution, LocalSystemVectorType &rRHSContribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to be called in the builder and solver to introduce the selected time integ...
Definition: residual_based_implicit_time_scheme.h:158
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
virtual void Initialize(ModelPart &rModelPart)
This is the place to initialize the Scheme.
Definition: scheme.h:168
BDF integration scheme (for dynamic problems)
Definition: shallow_water_residual_based_bdf_scheme.h:57
Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const override
This method validate and assign default parameters.
Definition: shallow_water_residual_based_bdf_scheme.h:421
void Initialize(ModelPart &rModelPart) override
Initialize the nodal area and the derivatives recovery.
Definition: shallow_water_residual_based_bdf_scheme.h:317
ModelPart::NodesContainerType NodesArrayType
Definition: shallow_water_residual_based_bdf_scheme.h:77
BDFBaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: shallow_water_residual_based_bdf_scheme.h:75
FlowRateSlipUtility< LocalSystemMatrixType, LocalSystemVectorType, double > FlowRateSlipToolType
Definition: shallow_water_residual_based_bdf_scheme.h:81
void UpdateVelocities(ModelPart &rModelPart)
Updating the velocities.
Definition: shallow_water_residual_based_bdf_scheme.h:513
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: shallow_water_residual_based_bdf_scheme.h:434
ShallowWaterResidualBasedBDFScheme(const std::size_t Order=2, bool UpdateVelocities=false)
Definition: shallow_water_residual_based_bdf_scheme.h:88
BDFBaseType::TSystemMatrixType TSystemMatrixType
Definition: shallow_water_residual_based_bdf_scheme.h:69
void UpdateSecondDerivative(NodesArrayType::iterator itNode) override
Updating second time derivative.
Definition: shallow_water_residual_based_bdf_scheme.h:507
BaseType::Pointer Clone() override
Definition: shallow_water_residual_based_bdf_scheme.h:120
FlowRateSlipToolType mRotationTool
Definition: shallow_water_residual_based_bdf_scheme.h:469
BDFBaseType::LocalSystemVectorType LocalSystemVectorType
Definition: shallow_water_residual_based_bdf_scheme.h:73
std::string Info() const override
Turn back information as a string.
Definition: shallow_water_residual_based_bdf_scheme.h:401
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: shallow_water_residual_based_bdf_scheme.h:371
void AddDynamicsToRHS(Condition &rCondition, LocalSystemVectorType &rRHS_Contribution, LocalSystemMatrixType &rD, LocalSystemMatrixType &rM, const ProcessInfo &rCurrentProcessInfo) override
It adds the dynamic RHS contribution of the condition.
Definition: shallow_water_residual_based_bdf_scheme.h:576
ShallowWaterResidualBasedBDFScheme(Parameters ThisParameters)
Definition: shallow_water_residual_based_bdf_scheme.h:99
void CalculateRHSContribution(Element &rCurrentElement, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to calculate just the RHS contribution.
Definition: shallow_water_residual_based_bdf_scheme.h:244
bool mProjectDispersiveField
Definition: shallow_water_residual_based_bdf_scheme.h:472
~ShallowWaterResidualBasedBDFScheme() override
Definition: shallow_water_residual_based_bdf_scheme.h:126
void UpdateFirstDerivative(NodesArrayType::iterator itNode) override
Updating first time derivative.
Definition: shallow_water_residual_based_bdf_scheme.h:489
std::vector< const Variable< double > * > mVariables
Definition: shallow_water_residual_based_bdf_scheme.h:474
void Clear() override
Free memory allocated by this class.
Definition: shallow_water_residual_based_bdf_scheme.h:363
void AddDynamicsToLHS(LocalSystemMatrixType &rLHS_Contribution, LocalSystemMatrixType &rD, LocalSystemMatrixType &rM, const ProcessInfo &rCurrentProcessInfo) override
It adds the dynamic LHS contribution of the elements.
Definition: shallow_water_residual_based_bdf_scheme.h:530
void CalculateSystemContributions(Condition &rCurrentCondition, LocalSystemMatrixType &rLHS_Contribution, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to be called in the builder and solver to introduce the selected time integ...
Definition: shallow_water_residual_based_bdf_scheme.h:269
void ApplyLaplacianBoundaryConditions(ModelPart &rModelPart)
Definition: shallow_water_residual_based_bdf_scheme.h:594
std::vector< const Variable< double > * > mDerivativeVariables
Definition: shallow_water_residual_based_bdf_scheme.h:475
ModelPart::NodeType NodeType
Definition: shallow_water_residual_based_bdf_scheme.h:79
BDFBaseType::TSystemVectorType TSystemVectorType
Definition: shallow_water_residual_based_bdf_scheme.h:71
BDFBaseType::DofsArrayType DofsArrayType
Definition: shallow_water_residual_based_bdf_scheme.h:67
void InitializeNonLinIteration(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Calculate the global projection of the dispersive field.
Definition: shallow_water_residual_based_bdf_scheme.h:332
ResidualBasedBDFScheme< TSparseSpace, TDenseSpace > BDFBaseType
Definition: shallow_water_residual_based_bdf_scheme.h:65
TSparseSpace::DofUpdaterPointerType mpDofUpdater
Definition: shallow_water_residual_based_bdf_scheme.h:467
ShallowWaterResidualBasedBDFScheme(ShallowWaterResidualBasedBDFScheme &rOther)
Definition: shallow_water_residual_based_bdf_scheme.h:108
void CalculateSystemContributions(Element &rCurrentElement, LocalSystemMatrixType &rLHS_Contribution, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to be called in the builder and solver to introduce the selected time integ...
Definition: shallow_water_residual_based_bdf_scheme.h:218
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: shallow_water_residual_based_bdf_scheme.h:63
bool mUpdateVelocities
Definition: shallow_water_residual_based_bdf_scheme.h:471
void CalculateRHSContribution(Condition &rCurrentCondition, LocalSystemVectorType &rRHS_Contribution, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to calculate just the RHS contribution.
Definition: shallow_water_residual_based_bdf_scheme.h:295
KRATOS_CLASS_POINTER_DEFINITION(ShallowWaterResidualBasedBDFScheme)
void Predict(ModelPart &rModelPart, DofsArrayType &rDofSet, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Performing the prediction of the solution.
Definition: shallow_water_residual_based_bdf_scheme.h:176
void AddDynamicsToRHS(Element &rElement, LocalSystemVectorType &rRHS_Contribution, LocalSystemMatrixType &rD, LocalSystemMatrixType &rM, const ProcessInfo &rCurrentProcessInfo) override
It adds the dynamic RHS contribution of the elements.
Definition: shallow_water_residual_based_bdf_scheme.h:551
void Update(ModelPart &rModelPart, DofsArrayType &rDofSet, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Performing the update of the solution within newton iteration.
Definition: shallow_water_residual_based_bdf_scheme.h:144
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
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
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 j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17