Tetgen PFEM refine
Variables Needed and their meaning
The following 4 variables need to be defined in order to perform the re-meshing using "Trigen PFEM refine":
By default, only the elements of the fluid are re-created. Therefore, you have to mark all the nodes of the elements you are passing to the mesher as "IS_FLUID". All the nodes that might be added during adaptive the refinement (see add_nodes argument of the function ReGenerateMesh) have IS_FLUID=1.0 by default.
IS_STRUCTURE switch is necessary to distinguish such parts of the domain as walls etc. Mesher treats the elements whose nodes have non-zero IS_STRUCTURE flag in a different way. The elements that have all nodes with IS_STRUCTURE=1.0 are automatically removed from the mesh.
IS_BOUNDARY is necessary to determine the boundaries, that include free surfaces, and boundaries between the fluid anb the structure (i.e. between the fluid and the wall).
IS_FREE_SURFACE is a flag that is set on the free-surfaces to 1.0 and 0.0 elsewhere.
if any of these variables are not added in your application, an error will be thrown.
Input needed to the function
Input of the function
For re-meshing using "Trigen PFEM refine" you need to execute one single function ReGenerateMesh. The function is defined as follows:
ReGenerateMesh (ModelPart& ThisModelPart , Element const& rReferenceElement, Condition const& rReferenceBoundaryCondition, NodeEraseProcess& node_erase, bool rem_nodes = true, bool add_nodes=true, double my_alpha = 1.4, double h_factor=0.5)
We shall have a closer look at each argument one has to pass to the function.
1. ModelPart& ThisModelPart:
this is the model part you would like to re-mesh. see (Link to model_part for its meaning)
2. Element const& rReferenceElement:
is the name (of type string) of the element that has to be re-created, e.g. if you are using standard incompressible fluid element of Kratos, you have to pass "Fluid2D" as an argument.
3. Condition const& rReferenceBoundaryCondition:
is the name of condition that is to be re-created. If you are not using any condition (such as Face Pressure, or any of your custom-defined condition), just pass "Condition2D". Otherwise the name of you condition (e.g. "FacePressure2D")
4. NodeEraseProcess& node_erase:
the function re-generate permits one to control the mesh quality. For this reason some nodes that cause mesh distortion (e.g. get too close to one another) can to be removed from the mesh. The "Trigen Mesh refine" identifies those nodes automatically, but to remove those nodes from the database, one needs to use the NodeEraseProcess, which is a standard process of Kratos. Therefore, you should create this process beforehand, and then pass it to the ReGenerateMesh function as an argument. See the example section to undesrtand exactly how to implement this.
5. bool rem_nodes:
is the switch used to allow derefinement, i.e. nodes removal. If you shall like to remove the nodes that come too close (see the h_factor explanation for an exact meaning of "too close"), you have to pass "True" here. If you do not want any node to be removed, pass "False". By default the switch is activated as "True".
6. bool add_nodes :
is a smiliar switch, now permitting refinement, i.e. adding nodes. Pass "True" or "False" depending on weather you would like to refine your mesh or not.
7. double my_alpha = 1.4:
is a alpha shape parameter, that defines a geomertrical criterion for recognition of the free surfaces. Values between 1.4 and 1.7 are usually used. For details see "Alpha Shape Method"
8. double h_factor = 0.5:
if you decide to control the mesh quality, you shouldnt allow nodes to approach each other "too much". This "too much" is defined as the fraction of the original length of the elemental edge e. If you set the h_factor to 0.5 all the nodes that find themselves closer to the given one than 0.5*e will be removed
brief description of the algorithm
Common Usage Errors
- Description of the Validation Example
- File to be looked at to get an example of use