diff --git a/framework/include/meshgenerators/FillBetweenCurvesGenerator.h b/framework/include/meshgenerators/FillBetweenCurvesGenerator.h index 4b27bf57d999..b9e0ff2fb04a 100644 --- a/framework/include/meshgenerators/FillBetweenCurvesGenerator.h +++ b/framework/include/meshgenerators/FillBetweenCurvesGenerator.h @@ -54,4 +54,11 @@ class FillBetweenCurvesGenerator : public MeshGenerator std::unique_ptr & _input_1; /// The mesh which contains the second input boundary std::unique_ptr & _input_2; + + /** + * Calculates the centroid of a curve mesh. + * @param curve input mesh that contains the curve whose centroid needs to be calculated + * @return a Point data containing the curve centroid + */ + Point curveCentroidPoint(const ReplicatedMesh & curve); }; diff --git a/framework/src/meshgenerators/FillBetweenCurvesGenerator.C b/framework/src/meshgenerators/FillBetweenCurvesGenerator.C index b030fcf23307..f675b11b08bf 100644 --- a/framework/src/meshgenerators/FillBetweenCurvesGenerator.C +++ b/framework/src/meshgenerators/FillBetweenCurvesGenerator.C @@ -10,7 +10,6 @@ #include "FillBetweenCurvesGenerator.h" #include "FillBetweenPointVectorsTools.h" -#include "MooseMeshUtils.h" #include "CastUniquePointer.h" #include "libmesh/node.h" @@ -113,11 +112,10 @@ FillBetweenCurvesGenerator::generate() try { - FillBetweenPointVectorsTools::isCurveOpenSingleSegment( - *input_mesh_1, - max_input_mesh_1_node_radius, - curve_1_ordered_nodes, - MooseMeshUtils::meshCentroidCalculator(*input_mesh_1)); + FillBetweenPointVectorsTools::isCurveOpenSingleSegment(*input_mesh_1, + max_input_mesh_1_node_radius, + curve_1_ordered_nodes, + curveCentroidPoint(*input_mesh_1)); } catch (MooseException & e) { @@ -125,11 +123,10 @@ FillBetweenCurvesGenerator::generate() } try { - FillBetweenPointVectorsTools::isCurveOpenSingleSegment( - *input_mesh_2, - max_input_mesh_2_node_radius, - curve_2_ordered_nodes, - MooseMeshUtils::meshCentroidCalculator(*input_mesh_2)); + FillBetweenPointVectorsTools::isCurveOpenSingleSegment(*input_mesh_2, + max_input_mesh_2_node_radius, + curve_2_ordered_nodes, + curveCentroidPoint(*input_mesh_2)); } catch (MooseException & e) { @@ -165,3 +162,17 @@ FillBetweenCurvesGenerator::generate() return dynamic_pointer_cast(mesh); } + +Point +FillBetweenCurvesGenerator::curveCentroidPoint(const ReplicatedMesh & curve) +{ + Point pt_tmp = Point(0.0, 0.0, 0.0); + Real length_tmp = 0.0; + for (const auto elem : curve.element_ptr_range()) + { + Real elem_length = elem->hmax(); + pt_tmp += (elem->vertex_average()) * elem_length; + length_tmp += elem_length; + } + return pt_tmp / length_tmp; +}