14 #if !defined(KRATOS_AITKEN_RELAXATION_UTILITY)
15 #define KRATOS_AITKEN_RELAXATION_UTILITY
117 const Vector& rResidualVector,
131 const double denominator =
TSpace::Dot(Aux1minus0, Aux1minus0);
182 auto &r_interface_sub_model = rSolidModelPart.
GetSubModelPart(
"fsi_interface_model_part");
183 r_interface_sub_model.
Nodes().clear();
185 auto &r_interface_sub_model = rSolidModelPart.
CreateSubModelPart(
"fsi_interface_model_part");
188 auto &r_interface_sub_model = rSolidModelPart.
GetSubModelPart(
"fsi_interface_model_part");
189 auto &r_solid_skin_sub_model = rSolidModelPart.
GetSubModelPart(
"SkinDEMModelPart");
191 const auto it_node_begin = r_solid_skin_sub_model.
NodesBegin();
193 for (
int i = 0; i < static_cast<int>(r_solid_skin_sub_model.Nodes().size());
i++) {
194 auto it_node = it_node_begin +
i;
195 if (it_node->FastGetSolutionStepValue(PRESSURE) != 0.0) {
196 r_interface_sub_model.AddNode(*(it_node.base()));
208 auto &r_interface_sub_model = rSolidModelPart.
GetSubModelPart(
"fsi_interface_model_part");
211 const auto it_node_begin = r_interface_sub_model.NodesBegin();
212 #pragma omp parallel for
213 for (
int i = 0; i < static_cast<int>(r_interface_sub_model.Nodes().size());
i++) {
214 auto it_node = it_node_begin +
i;
215 auto &r_var_1 = it_node->FastGetSolutionStepValue(RELAXED_VELOCITY);
216 auto &r_var_2 = it_node->FastGetSolutionStepValue(OLD_RELAXED_VELOCITY);
217 auto &r_var_3 = it_node->FastGetSolutionStepValue(FSI_INTERFACE_RESIDUAL);
218 r_var_1 = r_zero_vector;
219 r_var_2 = r_zero_vector;
220 r_var_3 = r_zero_vector;
232 auto &r_interface_sub_model = rSolidModelPart.
GetSubModelPart(
"fsi_interface_model_part");
233 const auto it_node_begin = r_interface_sub_model.
NodesBegin();
235 #pragma omp parallel for
236 for (
int i = 0; i < static_cast<int>(r_interface_sub_model.Nodes().size());
i++) {
237 auto it_node = it_node_begin +
i;
238 const auto &r_relaxed_velocity = it_node->FastGetSolutionStepValue(RELAXED_VELOCITY);
239 auto &r_old_relaxed_velocity = it_node->GetSolutionStepValue(OLD_RELAXED_VELOCITY);
240 noalias(r_old_relaxed_velocity) = r_relaxed_velocity;
257 Vector& rIterationValueVector
260 auto &r_interface_sub_model = rSolidModelPart.
GetSubModelPart(
"fsi_interface_model_part");
261 const auto it_node_begin = r_interface_sub_model.
NodesBegin();
268 #pragma omp parallel for firstprivate(it_node_begin)
269 for (
int i = 0; i < static_cast<int>(r_interface_sub_model.Nodes().size());
i++) {
270 auto it_node = it_node_begin +
i;
271 const auto &r_value = it_node->FastGetSolutionStepValue(OLD_RELAXED_VELOCITY);
275 for (
unsigned int jj = 0; jj <
Dimension; ++jj) {
276 rIterationValueVector[base_i + jj] = r_value[jj];
287 Vector& rInterfaceResidualVector
290 if (rInterfaceResidualVector.size() !=
mVectorSize) {
295 auto &r_interface_sub_model = rSolidModelPart.
GetSubModelPart(
"fsi_interface_model_part");
296 const auto it_node_begin = r_interface_sub_model.
NodesBegin();
300 #pragma omp parallel for firstprivate(it_node_begin)
301 for (
int i = 0; i < static_cast<int>(r_interface_sub_model.Nodes().size());
i++) {
302 auto it_node = it_node_begin +
i;
304 const auto &r_origin_value = it_node->FastGetSolutionStepValue(VELOCITY);
305 const auto &r_modified_value = it_node->FastGetSolutionStepValue(OLD_RELAXED_VELOCITY);
306 auto& r_interface_residual = it_node->FastGetSolutionStepValue(FSI_INTERFACE_RESIDUAL);
307 noalias(r_interface_residual) = r_origin_value - r_modified_value;
311 for (
unsigned int jj = 0; jj <
Dimension; ++jj)
312 rInterfaceResidualVector[base_i + jj] = r_interface_residual[jj];
322 const Vector& rRelaxedValuesVector
325 auto &r_interface_sub_model = rSolidModelPart.
GetSubModelPart(
"fsi_interface_model_part");
326 const auto it_node_begin = r_interface_sub_model.
NodesBegin();
328 #pragma omp parallel for firstprivate(it_node_begin)
329 for (
int i = 0; i < static_cast<int>(r_interface_sub_model.Nodes().size());
i++) {
330 auto it_node = it_node_begin +
i;
331 auto &r_value = it_node->FastGetSolutionStepValue(VELOCITY);
332 auto &r_value_relaxed = it_node->FastGetSolutionStepValue(RELAXED_VELOCITY);
335 for (
unsigned int jj = 0; jj <
Dimension; ++jj) {
336 r_value[jj] = rRelaxedValuesVector[base_i + jj];
337 r_value_relaxed[jj] = rRelaxedValuesVector[base_i + jj];
349 const auto it_node_begin = rFluidModelPart.
NodesBegin();
351 #pragma omp parallel for
352 for (
int i = 0; i < static_cast<int>(rFluidModelPart.
Nodes().size()); ++
i) {
353 auto it_node = it_node_begin +
i;
355 if (it_node->IsNot(SOLID)) {
356 auto &r_current_displ = it_node->FastGetSolutionStepValue(DISPLACEMENT, 0);
357 auto &r_current_vel = it_node->FastGetSolutionStepValue(VELOCITY, 0);
358 auto &r_current_acc = it_node->FastGetSolutionStepValue(ACCELERATION, 0);
360 auto &r_old_displ = it_node->FastGetSolutionStepValue(DISPLACEMENT, 1);
361 auto &r_old_vel = it_node->FastGetSolutionStepValue(VELOCITY, 1);
362 auto &r_old_acc = it_node->FastGetSolutionStepValue(ACCELERATION, 1);
364 auto copy_old_displ = r_old_displ;
365 auto copy_old_vel = r_old_vel;
366 auto copy_old_acc = r_old_acc;
368 auto& r_coordinates = it_node->Coordinates();
369 const auto& r_initial_coordinates = it_node->GetInitialPosition();
370 noalias(r_coordinates) = r_initial_coordinates + copy_old_displ;
372 noalias(r_current_displ) = copy_old_displ;
373 noalias(r_current_vel) = copy_old_vel;
374 noalias(r_current_acc) = copy_old_acc;
Aitken relaxation technique for FSI PFEM-FEM-DEM coupling.
Definition: aitken_relaxation_femdem_utility.hpp:48
void ResetPFEMkinematicValues(ModelPart &rFluidModelPart)
Definition: aitken_relaxation_femdem_utility.hpp:345
double mOmegaMin
Definition: aitken_relaxation_femdem_utility.hpp:412
UblasSpace< double, Matrix, Vector > TSpace
Definition: aitken_relaxation_femdem_utility.hpp:55
void InitializeSolutionStep()
Definition: aitken_relaxation_femdem_utility.hpp:102
double ComputeNorm(const Vector &rVector)
Definition: aitken_relaxation_femdem_utility.hpp:170
void FillOldRelaxedValuesVector(ModelPart &rSolidModelPart, Vector &rIterationValueVector)
Definition: aitken_relaxation_femdem_utility.hpp:255
TSpace::VectorPointerType VectorPointerType
Definition: aitken_relaxation_femdem_utility.hpp:59
double mOmegaNew
Definition: aitken_relaxation_femdem_utility.hpp:409
double mOmegaOld
Definition: aitken_relaxation_femdem_utility.hpp:408
void FinalizeSolutionStep()
Definition: aitken_relaxation_femdem_utility.hpp:159
TSpace::VectorType VectorType
Definition: aitken_relaxation_femdem_utility.hpp:57
void InitializeInterfaceSubModelPart(ModelPart &rSolidModelPart)
Definition: aitken_relaxation_femdem_utility.hpp:178
VectorPointerType mpResidualVectorNew
Definition: aitken_relaxation_femdem_utility.hpp:415
void SavePreviousRelaxedValues(ModelPart &rSolidModelPart)
Definition: aitken_relaxation_femdem_utility.hpp:230
AitkenRelaxationFEMDEMUtility(const AitkenRelaxationFEMDEMUtility &rOther)
Definition: aitken_relaxation_femdem_utility.hpp:81
VectorPointerType mpResidualVectorOld
Definition: aitken_relaxation_femdem_utility.hpp:414
void UpdateInterfaceValues(ModelPart &rSolidModelPart, const Vector &rRelaxedValuesVector)
Definition: aitken_relaxation_femdem_utility.hpp:320
void ResetNodalValues(ModelPart &rSolidModelPart)
Definition: aitken_relaxation_femdem_utility.hpp:206
double ComputeInterfaceResidualVector(ModelPart &rSolidModelPart, Vector &rInterfaceResidualVector)
Definition: aitken_relaxation_femdem_utility.hpp:285
virtual ~AitkenRelaxationFEMDEMUtility()
Definition: aitken_relaxation_femdem_utility.hpp:89
void FinalizeNonLinearIteration()
Definition: aitken_relaxation_femdem_utility.hpp:148
unsigned int GetVectorSize()
Definition: aitken_relaxation_femdem_utility.hpp:247
void UpdateSolution(const Vector &rResidualVector, Vector &rIterationGuess)
Definition: aitken_relaxation_femdem_utility.hpp:116
static constexpr unsigned int Dimension
Definition: aitken_relaxation_femdem_utility.hpp:61
AitkenRelaxationFEMDEMUtility(const double OmegaOld=0.825, const double MaximumOmega=0.825, const double MinimumOmega=0.825)
Definition: aitken_relaxation_femdem_utility.hpp:71
double mOmegaMax
Definition: aitken_relaxation_femdem_utility.hpp:411
unsigned int mVectorSize
Definition: aitken_relaxation_femdem_utility.hpp:417
unsigned int mConvergenceAcceleratorIteration
Definition: aitken_relaxation_femdem_utility.hpp:406
KRATOS_CLASS_POINTER_DEFINITION(AitkenRelaxationFEMDEMUtility)
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
static double Norm(const Vector &a)
Calculates the norm of vector "a".
Definition: math_utils.h:703
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
bool HasSubModelPart(std::string const &ThisSubModelPartName) const
Definition: model_part.cpp:2142
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ModelPart & CreateSubModelPart(std::string const &NewSubModelPartName)
Definition: model_part.cpp:2000
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
A class template for handling data types, matrices, and vectors in a Ublas space.
Definition: ublas_space.h:121
typename Kratos::shared_ptr< TVectorType > VectorPointerType
The pointer to the vector type.
Definition: ublas_space.h:148
static void UnaliasedAdd(VectorType &rX, const double A, const VectorType &rY)
Definition: ublas_space.h:485
static void SetToZero(TOtherMatrixType &rA)
Definition: ublas_space.h:632
static TDataType Dot(VectorType const &rX, VectorType const &rY)
rX * rY
Definition: ublas_space.h:259
TVectorType VectorType
The vector type considered.
Definition: ublas_space.h:136
#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
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
integer i
Definition: TensorModule.f:17