7 #ifndef EFFECTIVE_STRESSES_COMMUNICATOR_UTILITY_H
8 #define EFFECTIVE_STRESSES_COMMUNICATOR_UTILITY_H
23 #include "../../PoromechanicsApplication/poromechanics_application_variables.h"
24 #include "../../DEMApplication/DEM_application_variables.h"
43 delete mpSearchStructure;
49 InitializeVariablesToZero();
56 #pragma omp parallel for
57 for (
int i=0;
i<(
int)mrDestinationModelPart.
Nodes().size();
i++) {
58 auto node_it = mrDestinationModelPart.
NodesBegin() +
i;
59 node_it->SetValue(OLD_RADIAL_NORMAL_STRESS_COMPONENT, node_it->GetValue(RADIAL_NORMAL_STRESS_COMPONENT));
68 const int max_results = 10000;
78 for (
int i = 0;
i < (
int)mrDestinationModelPart.
Nodes().size();
i++) {
79 auto node_it = mrDestinationModelPart.
NodesBegin() +
i;
80 auto& particle_coordinates = node_it->Coordinates();
82 if (norm > std::numeric_limits<double>::epsilon()) {
83 const double inv_norm = 1.0 / norm;
84 unitary_radial_vector[0] = particle_coordinates[0] * inv_norm;
85 unitary_radial_vector[1] = particle_coordinates[1] * inv_norm;
86 unitary_radial_vector[2] = particle_coordinates[2] * inv_norm;
93 bool is_found =
false;
94 Element::Pointer shared_p_element;
95 is_found = mpSearchStructure->FindPointOnMesh(particle_coordinates,
N, shared_p_element, results_begin, max_results, 0.0);
98 const auto& geom = shared_p_element->GetGeometry();
99 for (
size_t j = 0;
j < geom.size();
j++) {
100 const Matrix& tempM = geom[
j].FastGetSolutionStepValue(NODAL_EFFECTIVE_STRESS_TENSOR);
101 noalias(interpolated_effective_stress_tensor) +=
N[
j] * tempM;
103 Vector tempV =
prod(interpolated_effective_stress_tensor, unitary_radial_vector);
105 node_it->SetValue(RADIAL_NORMAL_STRESS_COMPONENT, radial_stress);
122 for (
int i=0;
i<(
int)mrDestinationModelPart.
Nodes().size();
i++) {
123 auto node_it = mrDestinationModelPart.
NodesBegin() +
i;
124 auto& particle_coordinates = node_it->Coordinates();
126 if (norm > std::numeric_limits<double>::epsilon()) {
127 const double inv_norm = 1.0 / norm;
128 unitary_radial_vector[0] = particle_coordinates[0] * inv_norm;
129 unitary_radial_vector[1] = particle_coordinates[1] * inv_norm;
136 Vector tempV =
prod(stress_tensor, unitary_radial_vector);
138 node_it->SetValue(RADIAL_NORMAL_STRESS_COMPONENT, radial_stress);
145 virtual std::string
Info()
const {
return "";}
163 void InitializeVariablesToZero() {
166 #pragma omp parallel for
167 for (
int i=0;
i<(
int)mrDestinationModelPart.
Nodes().size();
i++) {
168 auto node_it = mrDestinationModelPart.
NodesBegin() +
i;
169 node_it->SetValue(OLD_RADIAL_NORMAL_STRESS_COMPONENT, 0.0);
170 node_it->SetValue(RADIAL_NORMAL_STRESS_COMPONENT, 0.0);
void UpdateSearchDatabase()
Function to construct or update the search database.
Definition: binbased_fast_point_locator.h:139
Definition: effective_stresses_communicator_utility.hpp:30
void CopyWallCurrentEffectiveStressesToOldEffectiveStresses()
Definition: effective_stresses_communicator_utility.hpp:52
void CommunicateCurrentRadialEffectiveStressesToDemWalls()
Definition: effective_stresses_communicator_utility.hpp:65
EffectiveStressesCommunicatorUtility(ModelPart &r_source_model_part, ModelPart &destination_model_part)
Definition: effective_stresses_communicator_utility.hpp:38
virtual ~EffectiveStressesCommunicatorUtility()
Definition: effective_stresses_communicator_utility.hpp:42
void CommunicateGivenRadialEffectiveStressesToDemWalls(const Matrix stress_tensor)
Definition: effective_stresses_communicator_utility.hpp:113
virtual void PrintData(std::ostream &rOStream) const
Definition: effective_stresses_communicator_utility.hpp:149
ModelPart::NodesContainerType::ContainerType::iterator NodesIteratorType
Definition: effective_stresses_communicator_utility.hpp:34
void Initialize()
Definition: effective_stresses_communicator_utility.hpp:46
KRATOS_CLASS_POINTER_DEFINITION(EffectiveStressesCommunicatorUtility)
virtual std::string Info() const
Definition: effective_stresses_communicator_utility.hpp:145
virtual void PrintInfo(std::ostream &rOStream) const
Definition: effective_stresses_communicator_utility.hpp:147
static double Norm(const Vector &a)
Calculates the norm of vector "a".
Definition: math_utils.h:703
static double Dot(const Vector &rFirstVector, const Vector &rSecondVector)
Performs the dot product of two vectors of arbitrary size.
Definition: math_utils.h:669
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
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
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
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
int j
Definition: quadrature.py:648
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17