10 #if !defined(KRATOS_COMPUTE_AVERAGE_PFEM_MESH_PARAMETERS_PROCESS_H_INCLUDED)
11 #define KRATOS_COMPUTE_AVERAGE_PFEM_MESH_PARAMETERS_PROCESS_H_INCLUDED
70 : mrModelPart(rModelPart),
71 mrRemesh(rRemeshingParameters)
73 KRATOS_INFO(
"ComputeAveragePfemMeshParametersProcess") <<
" activated " << std::endl;
101 std::cout <<
" COMPUTE AVERAGE PFEM MESH PARAMETERS PROCESS ]; " << std::endl;
104 const unsigned int numberOfRefiningBoxes = mrRemesh.
UseRefiningBox.size();
105 Vector inBoxesNodes(numberOfRefiningBoxes);
107 Vector inBoxesMeanNodalSize(numberOfRefiningBoxes);
109 double preliminaryOutOfBoxesFluidNodes = 0;
110 double preliminaryOutOfBoxesMeanNodalSize = 0;
111 bool homogeneousMesh =
true;
112 for (ModelPart::NodesContainerType::iterator i_node = mrModelPart.
NodesBegin(); i_node != mrModelPart.
NodesEnd(); i_node++)
114 if (i_node->Is(FLUID))
116 if (numberOfRefiningBoxes == 0 || (numberOfRefiningBoxes == 1 && mrRemesh.
UseRefiningBox[0] ==
false))
118 preliminaryOutOfBoxesFluidNodes += 1.0;
119 preliminaryOutOfBoxesMeanNodalSize += i_node->FastGetSolutionStepValue(NODAL_H);
123 unsigned outOfRefiningBoxes =
true;
124 for (
unsigned int index = 0; index < numberOfRefiningBoxes; index++)
130 homogeneousMesh =
false;
133 if (i_node->X() > RefiningBoxMinimumPoint[0] && i_node->Y() > RefiningBoxMinimumPoint[1] &&
134 i_node->X() < RefiningBoxMaximumPoint[0] && i_node->Y() < RefiningBoxMaximumPoint[1])
136 outOfRefiningBoxes =
false;
137 inBoxesNodes[index] += 1.0;
138 inBoxesMeanNodalSize[index] += i_node->FastGetSolutionStepValue(NODAL_H);
143 if (i_node->X() > RefiningBoxMinimumPoint[0] && i_node->Y() > RefiningBoxMinimumPoint[1] && i_node->Z() > RefiningBoxMinimumPoint[2] &&
144 i_node->X() < RefiningBoxMaximumPoint[0] && i_node->Y() < RefiningBoxMaximumPoint[1] && i_node->Z() < RefiningBoxMaximumPoint[2])
146 outOfRefiningBoxes =
false;
147 inBoxesNodes[index] += 1.0;
148 inBoxesMeanNodalSize[index] += i_node->FastGetSolutionStepValue(NODAL_H);
154 if (outOfRefiningBoxes ==
true)
156 preliminaryOutOfBoxesFluidNodes += 1.0;
157 preliminaryOutOfBoxesMeanNodalSize += i_node->FastGetSolutionStepValue(NODAL_H);
162 preliminaryOutOfBoxesMeanNodalSize *= 1.0 / preliminaryOutOfBoxesFluidNodes;
164 mrRemesh.
Refine->CriticalRadius = preliminaryOutOfBoxesMeanNodalSize;
165 mrRemesh.
Refine->InitialRadius = preliminaryOutOfBoxesMeanNodalSize;
167 if (homogeneousMesh ==
false)
169 double outOfBoxesFluidNodes = 0;
170 double outOfBoxesMeanNodalSize = 0;
171 for (ModelPart::NodesContainerType::iterator i_node = mrModelPart.
NodesBegin(); i_node != mrModelPart.
NodesEnd(); i_node++)
173 if (i_node->Is(FLUID))
175 unsigned outOfRefiningBoxes =
true;
176 for (
unsigned int index = 0; index < numberOfRefiningBoxes; index++)
185 if (i_node->X() > (RefiningBoxMinimumPoint[0] - transitionDistanceInInputMesh) && i_node->Y() > (RefiningBoxMinimumPoint[1] - transitionDistanceInInputMesh) &&
186 i_node->X() < (RefiningBoxMaximumPoint[0] + transitionDistanceInInputMesh) && i_node->Y() < (RefiningBoxMaximumPoint[1] + transitionDistanceInInputMesh))
188 outOfRefiningBoxes =
false;
193 if (i_node->X() > (RefiningBoxMinimumPoint[0] - transitionDistanceInInputMesh) && i_node->Y() > (RefiningBoxMinimumPoint[1] - transitionDistanceInInputMesh) && i_node->Z() > (RefiningBoxMinimumPoint[2] - transitionDistanceInInputMesh) &&
194 i_node->X() < (RefiningBoxMaximumPoint[0] + transitionDistanceInInputMesh) && i_node->Y() < (RefiningBoxMaximumPoint[1] + transitionDistanceInInputMesh) && i_node->Z() < (RefiningBoxMaximumPoint[2] + transitionDistanceInInputMesh))
196 outOfRefiningBoxes =
false;
202 if (outOfRefiningBoxes ==
true)
204 outOfBoxesFluidNodes += 1.0;
205 outOfBoxesMeanNodalSize += i_node->FastGetSolutionStepValue(NODAL_H);
209 if (outOfBoxesFluidNodes == 0)
211 mrRemesh.
Refine->CriticalRadius = preliminaryOutOfBoxesMeanNodalSize;
212 mrRemesh.
Refine->InitialRadius = preliminaryOutOfBoxesMeanNodalSize;
213 std::cout <<
"the coarse zone is too thin, I'll take the preliminary mesh size estimation: " << preliminaryOutOfBoxesMeanNodalSize << std::endl;
217 outOfBoxesMeanNodalSize *= 1.0 / outOfBoxesFluidNodes;
218 mrRemesh.
Refine->CriticalRadius = outOfBoxesMeanNodalSize;
219 mrRemesh.
Refine->InitialRadius = outOfBoxesMeanNodalSize;
222 std::cout <<
"Mesh size outside the refining boxes is: " << outOfBoxesMeanNodalSize << std::endl;
223 for (
unsigned int index = 0; index < numberOfRefiningBoxes; index++)
225 double localMeshSize = inBoxesMeanNodalSize[index] / inBoxesNodes[index];
226 std::cout <<
"Mesh size inside refining box n." << index <<
" is: " << localMeshSize << std::endl;
230 const double differenceOfSize = outOfBoxesMeanNodalSize - mrRemesh.
RefiningBoxMeshSize[index];
268 std::string
Info()
const override
270 return "ComputeAveragePfemMeshParametersProcess";
276 rOStream <<
"ComputeAveragePfemMeshParametersProcess";
350 rOStream << std::endl;
Refine Mesh Elements Process 2D and 3D.
Definition: compute_average_pfem_mesh_parameters_process.hpp:49
ModelPart::ConditionType ConditionType
Definition: compute_average_pfem_mesh_parameters_process.hpp:58
ModelPart::NodeType NodeType
Definition: compute_average_pfem_mesh_parameters_process.hpp:57
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: compute_average_pfem_mesh_parameters_process.hpp:274
void operator()()
This operator is provided to call the process as a function and simply calls the Execute method.
Definition: compute_average_pfem_mesh_parameters_process.hpp:86
ModelPart::PropertiesType PropertiesType
Definition: compute_average_pfem_mesh_parameters_process.hpp:59
ComputeAveragePfemMeshParametersProcess(ModelPart &rModelPart, MesherUtilities::MeshingParameters &rRemeshingParameters, int EchoLevel)
Default constructor.
Definition: compute_average_pfem_mesh_parameters_process.hpp:67
std::string Info() const override
Turn back information as a string.
Definition: compute_average_pfem_mesh_parameters_process.hpp:268
ConditionType::GeometryType GeometryType
Definition: compute_average_pfem_mesh_parameters_process.hpp:60
KRATOS_CLASS_POINTER_DEFINITION(ComputeAveragePfemMeshParametersProcess)
Pointer definition of Process.
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: compute_average_pfem_mesh_parameters_process.hpp:96
virtual ~ComputeAveragePfemMeshParametersProcess()
Destructor.
Definition: compute_average_pfem_mesh_parameters_process.hpp:79
Base class for all Conditions.
Definition: condition.h:59
Geometry base class.
Definition: geometry.h:71
The base class for processes passed to the solution scheme.
Definition: mesher_process.hpp:37
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: mesher_process.hpp:157
Short class definition.
Definition: mesher_utilities.hpp:49
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
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
This class defines the node.
Definition: node.h:65
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO(label)
Definition: logger.h:250
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
Definition: mesher_utilities.hpp:631
RefiningParameters::Pointer Refine
Definition: mesher_utilities.hpp:684
std::vector< unsigned int > RefiningBoxElementsInTransitionZone
Definition: mesher_utilities.hpp:708
std::vector< array_1d< double, 3 > > RefiningBoxShiftedMaximumPoint
Definition: mesher_utilities.hpp:713
std::vector< double > RefiningBoxMeshSize
Definition: mesher_utilities.hpp:707
void SetRefiningBoxMeshSize(unsigned int index, double rRefiningBoxMeshSize)
Definition: mesher_utilities.hpp:969
std::vector< bool > UseRefiningBox
Definition: mesher_utilities.hpp:704
std::vector< array_1d< double, 3 > > RefiningBoxMinimumPoint
Definition: mesher_utilities.hpp:709
std::vector< array_1d< double, 3 > > RefiningBoxMaximumPoint
Definition: mesher_utilities.hpp:710
std::vector< array_1d< double, 3 > > RefiningBoxShiftedMinimumPoint
Definition: mesher_utilities.hpp:712