KratosMultiphysics / Kratos

Kratos Multiphysics (A.K.A Kratos) is a framework for building parallel multi-disciplinary simulation software. Modularity, extensibility and HPC are the main objectives. Kratos has BSD license and is written in C++ with extensive Python interface.
https://kratosmultiphysics.github.io/Kratos/
Other
993 stars 244 forks source link

[SDEM] CalculateElementalVolume threshold modified #8397

Open jgonzalezusua opened 3 years ago

jgonzalezusua commented 3 years ago

Description The problem came from the modification of the CalculateVolume function in the script SwimmingDEMApplication/custom_functions.h. The threshold to consider the element volume bigger enough to be calculated has been changed making imposible to use meshes with small element sizes (for example, the ones located in the boundary layer). My questions are: Can we change again this threshold? and why are we using this epsilon and not other value?

Scope

Expected behavior Kratos should not throw any error when meshes with boundary layers are used.

Environment

maceligueta commented 3 years ago

Is the error triggered by this if? https://github.com/KratosMultiphysics/Kratos/blob/284902a7f196d4c19df9fda53d7bf273f9914016/applications/SwimmingDEMApplication/custom_utilities/custom_functions.h#L630 It's weird that the volume is below that epsilon, though. Anyways, I have two comments:

jgonzalezusua commented 3 years ago

I didn't aware about these changes in that script until now. Yes, it is in that line. I don't know why it was decided to use independent functions, but it should be considered to remove that threshold. For example, in the mesh I am using, the element has a volume of 1.8e-16 while the threshold is 2.21e-16. Before that change, I ran that mesh without any problem in the solution, so I do not think that it is necessary to use this check.

maceligueta commented 3 years ago

Maybe that check was put there to avoid a division by zero. In that case, the check should be outside the function, right before the division.

jgonzalezusua commented 3 years ago

So it is enough to be different from zero, or at least much smaller than the one introduced

maceligueta commented 3 years ago

I don't really know. Maybe @GuillermoCasas remembers something about it.

GuillermoCasas commented 3 years ago

I do not think it is correct to invoke the stad epsilon here. First, it is a length scale cubed (so lenght scales of the order of the micrometer would already trigger the error), second, there is no mathematical/numerical problem with calculating the volume wth such small values. I would leave it at <=0, since it is non-(strictly)positive numbers that are wrong strickly speaking. Thus, it is necessary to change the error message as well.