8 #ifndef INTERPOLATE_STRUCTURAL_SOLUTION_FOR_DEM_UTILITY_H
9 #define INTERPOLATE_STRUCTURAL_SOLUTION_FOR_DEM_UTILITY_H
43 const int NNodes =
static_cast<int>(r_structural_model_part.
Nodes().size());
44 ModelPart::NodesContainerType::iterator node_begin = r_structural_model_part.
NodesBegin();
46 #pragma omp parallel for
47 for (
int i = 0;
i < NNodes;
i++) {
49 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
51 array_1d<double,3>& r_current_velocity = itNode->FastGetSolutionStepValue(BACKUP_LAST_STRUCTURAL_VELOCITY);
52 noalias(r_current_velocity) = itNode->FastGetSolutionStepValue(VELOCITY);
54 array_1d<double,3>& r_current_displacement = itNode->FastGetSolutionStepValue(BACKUP_LAST_STRUCTURAL_DISPLACEMENT);
55 noalias(r_current_displacement) = itNode->FastGetSolutionStepValue(DISPLACEMENT);
57 array_1d<double,3>& r_smoothed_velocity = itNode->FastGetSolutionStepValue(SMOOTHED_STRUCTURAL_VELOCITY);
58 noalias(r_smoothed_velocity) = 1.0/3.0 * (itNode->FastGetSolutionStepValue(VELOCITY) + 2.0 * itNode->FastGetSolutionStepValue(SMOOTHED_STRUCTURAL_VELOCITY, 1));
69 const double previous_fem_time = fem_time - fem_delta_time;
70 const double time_factor = (dem_time - previous_fem_time) / fem_delta_time;
71 const double previous_time_factor = (dem_time - dem_delta_time - previous_fem_time) / fem_delta_time;
73 const int NNodes =
static_cast<int>(r_structural_model_part.
Nodes().size());
74 ModelPart::NodesContainerType::iterator node_begin = r_structural_model_part.
NodesBegin();
77 #pragma omp parallel for
78 for (
int i = 0;
i < NNodes;
i++) {
80 ModelPart::NodesContainerType::iterator it_node = node_begin +
i;
82 noalias(it_node->Coordinates()) = it_node->GetInitialPosition().Coordinates()
83 + it_node->FastGetSolutionStepValue(DISPLACEMENT,1)
84 + (it_node->FastGetSolutionStepValue(BACKUP_LAST_STRUCTURAL_DISPLACEMENT) - it_node->FastGetSolutionStepValue(DISPLACEMENT,1)) * time_factor;
87 const array_1d<double,3>& previous_velocity = it_node->FastGetSolutionStepValue(SMOOTHED_STRUCTURAL_VELOCITY,1);
88 noalias(r_velocity) = previous_velocity + (it_node->FastGetSolutionStepValue(SMOOTHED_STRUCTURAL_VELOCITY) - previous_velocity) * time_factor;
91 noalias(r_displacement) = it_node->Coordinates() - it_node->GetInitialPosition().Coordinates();
94 noalias(previous_coordinates) = it_node->GetInitialPosition().Coordinates()
95 + it_node->FastGetSolutionStepValue(DISPLACEMENT,1)
96 + (it_node->FastGetSolutionStepValue(BACKUP_LAST_STRUCTURAL_DISPLACEMENT) - it_node->FastGetSolutionStepValue(DISPLACEMENT,1)) * previous_time_factor;
98 array_1d<double,3>& delta_displacement = it_node->FastGetSolutionStepValue(DELTA_DISPLACEMENT);
99 noalias(delta_displacement) = it_node->Coordinates() - previous_coordinates;
109 const int NNodes =
static_cast<int>(r_structural_model_part.
Nodes().size());
110 ModelPart::NodesContainerType::iterator node_begin = r_structural_model_part.
NodesBegin();
112 #pragma omp parallel for
113 for (
int i = 0;
i < NNodes;
i++) {
115 ModelPart::NodesContainerType::iterator it_node = node_begin +
i;
118 noalias(r_velocity) = it_node->FastGetSolutionStepValue(BACKUP_LAST_STRUCTURAL_VELOCITY);
121 noalias(r_displacement) = it_node->FastGetSolutionStepValue(BACKUP_LAST_STRUCTURAL_DISPLACEMENT);
123 noalias(it_node->Coordinates()) = it_node->GetInitialPosition().Coordinates() + it_node->FastGetSolutionStepValue(DISPLACEMENT);
219 virtual std::string
Info()
const {
return "";}
Definition: interpolate_structural_solution_for_dem_utility.h:27
ModelPart::NodesContainerType::ContainerType::iterator NodesIteratorType
Definition: interpolate_structural_solution_for_dem_utility.h:31
virtual void PrintData(std::ostream &rOStream) const
Definition: interpolate_structural_solution_for_dem_utility.h:223
void SaveStructuralSolution(ModelPart &r_structural_model_part)
Definition: interpolate_structural_solution_for_dem_utility.h:39
void RestoreStructuralSolution(ModelPart &r_structural_model_part)
Definition: interpolate_structural_solution_for_dem_utility.h:105
virtual std::string Info() const
Definition: interpolate_structural_solution_for_dem_utility.h:219
InterpolateStructuralSolutionForDEM()
Definition: interpolate_structural_solution_for_dem_utility.h:35
virtual void PrintInfo(std::ostream &rOStream) const
Definition: interpolate_structural_solution_for_dem_utility.h:221
void InterpolateStructuralSolution(ModelPart &r_structural_model_part, const double fem_delta_time, const double fem_time, const double dem_delta_time, const double dem_time)
Definition: interpolate_structural_solution_for_dem_utility.h:65
KRATOS_CLASS_POINTER_DEFINITION(InterpolateStructuralSolutionForDEM)
virtual ~InterpolateStructuralSolutionForDEM()
Definition: interpolate_structural_solution_for_dem_utility.h:37
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
#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
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
integer i
Definition: TensorModule.f:17