16 #if !defined(KRATOS_CALCULATE_DISCONTINUOUS_DISTANCE_TO_SKIN_PROCESS_H_INCLUDED )
17 #define KRATOS_CALCULATE_DISCONTINUOUS_DISTANCE_TO_SKIN_PROCESS_H_INCLUDED
53 template<std::
size_t TDim = 3>
77 const Flags rOptions);
112 virtual void Initialize();
118 virtual void FindIntersections();
125 virtual std::vector<PointerVector<GeometricalObject>>& GetIntersections();
138 void Clear()
override;
144 void Execute()
override;
152 void CalculateEmbeddedVariableFromSkin(
162 void CalculateEmbeddedVariableFromSkin(
169 const Parameters GetDefaultParameters()
const override;
181 std::string
Info()
const override;
184 void PrintInfo(std::ostream& rOStream)
const override;
187 void PrintData(std::ostream& rOStream)
const override;
214 double CalculateCharacteristicLength();
226 static const std::size_t mNumNodes = TDim + 1;
227 static const std::size_t mNumEdges = (TDim == 2) ? 3 : 6;
229 const double mZeroToleranceMultiplier = 1e3;
230 bool mDetectedZeroDistanceValues =
false;
231 bool mAreNeighboursComputed =
false;
232 bool mCalculateElementalEdgeDistances =
false;
233 bool mCalculateElementalEdgeDistancesExtrapolated =
false;
234 bool mUsePositiveEpsilonForZeroValues =
true;
237 const Variable<Vector>* mpElementalEdgeDistancesVariable = &ELEMENTAL_EDGE_DISTANCES;
238 const Variable<Vector>* mpElementalEdgeDistancesExtrapolatedVariable = &ELEMENTAL_EDGE_DISTANCES_EXTRAPOLATED;
251 void CalculateElementalDistances(
261 void CalculateElementalAndEdgeDistances(
277 unsigned int ComputeEdgesIntersections(
296 int ComputeEdgeIntersection(
300 Point& rIntersectionPoint);
310 bool CheckIfPointIsRepeated(
313 const double& rEdgeTolerance);
322 void ComputeIntersectionNormal(
324 const Vector& rElementalDistances,
336 void ComputeIntersectionPlaneElementalDistances(
352 void ComputePlaneApproximation(
366 void ComputeElementalDistancesFromPlaneApproximation(
368 Vector& rElementalDistances,
377 void ReplaceZeroDistances(
Vector& rElementalDistances);
389 void CorrectDistanceOrientation(
392 Vector& rElementalDistances);
400 void inline ComputeIntersectionNormalFromGeometry(
416 void ComputeExtrapolatedEdgesIntersectionsIfIncised(
419 unsigned int &rNumCutEdges,
436 void ComputeExtrapolatedGeometryIntersections(
439 unsigned int& rNumCutEdges,
454 void ComputeElementalDistancesFromEdgeRatios(
468 void ConvertRatiosToIntersectionPoints(
480 double ConvertIntersectionPointToEdgeRatio(
492 const double& rEdgeRatio);
501 bool CheckIfCutEdgesShareNode(
516 template<
class TVarType>
517 void CalculateEmbeddedVariableFromSkinSpecialization(
521 const auto &r_int_obj_vect= this->GetIntersections();
525 <<
"Skin model part solution step data missing variable: " << rVariable << std::endl;
531 #pragma omp parallel for schedule(dynamic)
532 for (
int i_elem = 0; i_elem < n_elems; ++i_elem) {
534 if (r_int_obj_vect[i_elem].size() != 0) {
536 unsigned int n_int_edges = 0;
538 auto &r_geom = it_elem->GetGeometry();
539 const auto edges = r_geom.GenerateEdges();
542 for (
unsigned int i_edge = 0; i_edge < r_geom.EdgesNumber(); ++i_edge) {
544 unsigned int n_int_obj = 0;
545 TVarType i_edge_val = rEmbeddedVariable.
Zero();
548 for (
auto &r_int_obj : r_int_obj_vect[i_elem]) {
549 Point intersection_point;
550 const int is_intersected = this->ComputeEdgeIntersection(
551 r_int_obj.GetGeometry(),
557 if (is_intersected == 1) {
560 r_int_obj.GetGeometry().PointLocalCoordinates(local_coords, intersection_point);
562 r_int_obj.GetGeometry().ShapeFunctionsValues(int_obj_N, local_coords);
563 for (
unsigned int i_node = 0; i_node < r_int_obj.GetGeometry().PointsNumber(); ++i_node) {
564 i_edge_val += r_int_obj.GetGeometry()[i_node].FastGetSolutionStepValue(rVariable) * int_obj_N[i_node];
570 if (n_int_obj != 0) {
575 it_elem->GetValue(rEmbeddedVariable) += i_edge_val / n_int_obj;
580 if (n_int_edges != 0) {
581 it_elem->GetValue(rEmbeddedVariable) /= n_int_edges;
596 const double ZeroTolerance);
603 void CheckAndCorrectEdgeDistances();
609 GlobalPointerCommunicator<Element>::Pointer CreatePointerCommunicator();
620 std::istream& rIStream,
625 std::ostream& rOStream,
629 rOStream << std::endl;
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition: calculate_discontinuous_distance_to_skin_process.h:42
KRATOS_DEFINE_LOCAL_FLAG(CALCULATE_ELEMENTAL_EDGE_DISTANCES_EXTRAPOLATED)
Local flag to switch on/off the elemental edge distances storage.
KRATOS_DEFINE_LOCAL_FLAG(USE_POSITIVE_EPSILON_FOR_ZERO_VALUES)
Local flag to switch on/off the extrapolated elemental edge distances storage.
KRATOS_DEFINE_LOCAL_FLAG(CALCULATE_ELEMENTAL_EDGE_DISTANCES)
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
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: calculate_discontinuous_distance_to_skin_process.cpp:211
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: calculate_discontinuous_distance_to_skin_process.cpp:218
Plane3D SetIntersectionPlane(const std::vector< array_1d< double, 3 >> &rIntPtsVector)
Set the Intersection Plane object This method returns the plane that defines the element intersection...
CalculateDiscontinuousDistanceToSkinProcess & operator=(CalculateDiscontinuousDistanceToSkinProcess const &rOther)=delete
Assignment operator.
CalculateDiscontinuousDistanceToSkinProcess(CalculateDiscontinuousDistanceToSkinProcess const &rOther)=delete
Copy constructor.
CalculateDiscontinuousDistanceToSkinProcess()=delete
Default constructor.
FindIntersectedGeometricalObjectsProcess mFindIntersectedObjectsProcess
Definition: calculate_discontinuous_distance_to_skin_process.h:101
KRATOS_CLASS_POINTER_DEFINITION(CalculateDiscontinuousDistanceToSkinProcess)
Pointer definition of CalculateDiscontinuousDistanceToSkinProcess.
Base class for all Elements.
Definition: element.h:60
This class takes two modelparts and marks the intersected ones with SELECTED flag.
Definition: find_intersected_geometrical_objects_process.h:321
Geometry base class.
Definition: geometry.h:71
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
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
Definition: plane_3d.h:51
Point class.
Definition: point.h:59
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
const TDataType & Zero() const
This method returns the zero value of the variable type.
Definition: variable.h:346
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
void SetNonHistoricalVariableToZero(const Variable< TType > &rVariable, TContainerType &rContainer)
Sets the nodal value of any variable to zero.
Definition: variable_utils.h:724
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432