16 #if !defined(KRATOS_CALCULATE_EMBEDDED_SIGNED_DISTANCE_TO_3D_SKIN_PROCESS_H_INCLUDED )
17 #define KRATOS_CALCULATE_EMBEDDED_SIGNED_DISTANCE_TO_3D_SKIN_PROCESS_H_INCLUDED
76 : mrSkinModelPart(rThisModelPartStruc), mrFluidModelPart(rThisModelPartFluid), mDiscontinuousDistance(DiscontinuousDistance)
102 if(mDiscontinuousDistance)
127 pdistance_calculator->
Clear();
147 std::string
Info()
const override
149 return "CalculateEmbeddedSignedDistanceTo3DSkinProcess";
155 rOStream <<
"CalculateEmbeddedSignedDistanceTo3DSkinProcess";
193 ModelPart::ElementsContainerType::iterator itFluidElement = mrFluidModelPart.
ElementsBegin() +
k;
197 itFluidElement->SetValue(EMBEDDED_VELOCITY, aux_zero);
200 unsigned int intersection_counter = 0;
202 for(
auto itSkinElement : intersected_skin_elems)
208 itFluidElement->GetValue(EMBEDDED_VELOCITY) += emb_vel/3;
209 intersection_counter++;
213 if (intersection_counter!=0)
215 itFluidElement->GetValue(EMBEDDED_VELOCITY) /= intersection_counter;
223 double max_distance, min_distance;
228 if(rNode.IsNot(TO_SPLIT))
230 double& rnode_distance = rNode.FastGetSolutionStepValue(DISTANCE);
231 rnode_distance = (rnode_distance > 0.0) ? max_distance : min_distance;
239 for (
int k = 0; k < static_cast<int>(mrFluidModelPart.NumberOfElements()); ++
k)
241 ModelPart::ElementsContainerType::iterator itFluidElement = mrFluidModelPart.ElementsBegin() +
k;
243 if(itFluidElement->Is(TO_SPLIT))
246 for (
unsigned int i=0;
i<rGeom.
size(); ++
i)
248 rGeom[
i].Set(TO_SPLIT,
true);
258 std::vector<double> max_distance_vect(
num_threads, 1.0);
259 std::vector<double> min_distance_vect(
num_threads, 1.0);
261 #pragma omp parallel shared(max_distance_vect, min_distance_vect)
267 double max_local_distance = 1.0;
268 double min_local_distance = 1.0;
272 if(itFluidNode->Is(TO_SPLIT))
274 const double node_distance = itFluidNode->FastGetSolutionStepValue(DISTANCE);
275 max_local_distance = (node_distance>max_local_distance) ? node_distance : max_local_distance;
276 min_local_distance = (node_distance<min_local_distance) ? node_distance : min_local_distance;
280 max_distance_vect[
k] = max_local_distance;
281 min_distance_vect[
k] = min_local_distance;
286 max_distance = max_distance_vect[0];
287 min_distance = min_distance_vect[0];
290 max_distance = (max_distance > max_distance_vect[
k]) ? max_distance : max_distance_vect[
k];
291 min_distance = (min_distance < min_distance_vect[
k]) ? min_distance : min_distance_vect[
k];
320 bool mDiscontinuousDistance;
370 rOStream << std::endl;
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
This only calculates the distance. Calculating the inside outside should be done by a derived class o...
Definition: calculate_discontinuous_distance_to_skin_process.h:55
virtual void FindIntersections()
Calls the FindIntersectedObjectsProcess to find the intersections This method calls the FindIntersect...
Definition: calculate_discontinuous_distance_to_skin_process.cpp:155
virtual std::vector< PointerVector< GeometricalObject > > & GetIntersections()
Get the array containing the intersecting objects This method returns an array containing pointers to...
Definition: calculate_discontinuous_distance_to_skin_process.cpp:161
virtual void CalculateDistances(std::vector< PointerVector< GeometricalObject >> &rIntersectedObjects)
Computes the elemental distance values Given an intersecting objects vector, this method computes the...
Definition: calculate_discontinuous_distance_to_skin_process.cpp:167
virtual void Initialize()
Initializes discontinuous distance computation process This method initializes the TO_SPLIT flag,...
Definition: calculate_discontinuous_distance_to_skin_process.cpp:105
void Clear() override
Calls the FindIntersectedObjects Clear() method This method calls the FindIntersectedObjects Clear() ...
Definition: calculate_discontinuous_distance_to_skin_process.cpp:189
Calculates the nodal distances using elemental discontinuous distances.
Definition: calculate_distance_to_skin_process.h:40
Short class definition.
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:60
void PeakValuesCorrection()
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:220
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:153
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:98
std::string Info() const override
Turn back information as a string.
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:147
void Clear() override
This method clears the assignation of the conditions.
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:130
KRATOS_CLASS_POINTER_DEFINITION(CalculateEmbeddedSignedDistanceTo3DSkinProcess)
CalculateEmbeddedSignedDistanceTo3DSkinProcess(ModelPart &rThisModelPartStruc, ModelPart &rThisModelPartFluid, bool DiscontinuousDistance=false)
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:75
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:159
~CalculateEmbeddedSignedDistanceTo3DSkinProcess() override
Destructor.
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:81
void CalculateEmbeddedVelocity(std::vector< PointerVector< GeometricalObject >> &rIntersectedObjects)
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:186
void operator()()
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:89
void SetMaximumAndMinimumDistanceValues(double &max_distance, double &min_distance)
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:236
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
static void DivideInPartitions(const int NumTerms, const int NumThreads, PartitionVector &Partitions)
Divide an array of length NumTerms between NumThreads threads.
Definition: openmp_utils.h:158
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
std::vector< int > PartitionVector
Vector type for the output of DivideInPartitions method.
Definition: openmp_utils.h:53
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
The base class for all processes in Kratos.
Definition: process.h:49
std::ostream & operator<<(std::ostream &rOStream, const CalculateEmbeddedSignedDistanceTo3DSkinProcess &rThis)
output stream function
Definition: calculate_embedded_signed_distance_to_3d_skin_process.h:366
std::istream & operator>>(std::istream &rIStream, CalculateEmbeddedSignedDistanceTo3DSkinProcess &rThis)
input stream function
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
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
def GetSolutionStepValue(entity, variable, solution_step_index)
Definition: coupling_interface_data.py:253
int k
Definition: quadrature.py:595
def num_threads
Definition: script.py:75
integer i
Definition: TensorModule.f:17