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
1.03k stars 245 forks source link

[Fuid-Core] Issue with periodic boundary conditions #7837

Open jgonzalezusua opened 3 years ago

jgonzalezusua commented 3 years ago

Description I am trying to use periodic boundary conditions using the FluidDynamicsApplication and the process apply_periodic_condition_process. The problem is that I am getting a segmentation fault. After some debugging I detect that the code fails in spatial_containers_configure.h:137, it is the CalculateBoundingBox function. I saw the wiki and other issues related to the periodic bc but I did not get to solve the problem.

Scope

I have attached the case I am using as a benchmark

periodic_bc.gid.zip

Environment

adityaghantasala commented 3 years ago

Hi @jgonzalezusua I checked your gid model setup. There is one detail, The application of periodic conditions requires that there are triangle conditions on the VELOCITY_inlet and VELOCITY_outlet modelparts. Currently, there are only nodes on these sub modelparts.

So I would suggest please make sure that there are also surface conditions on these submodelparts before using them in the apply_periodic_conditions_process .

Looking forward to see your case working.

jgonzalezusua commented 3 years ago

Thanks @adityaghantasala!!! I have set the conditions to the corresponding modelparts and it works!!

Thanks you very much.

jgonzalezusua commented 3 years ago

I will close this issue

adityaghantasala commented 3 years ago

@jgonzalezusua Thank you very much for reporting back. Good luck !

jgonzalezusua commented 3 years ago

Hi again @adityaghantasala, I have reopened the issue because I have run a 3D case using periodic boundary conditions and it does not behave as expected. You can find attached the model I am using. It is just a 3D box.

Prueba_periodic_bc.zip

Thanks in advance!!!

I am not on the master branch but in the one called Redefine-manufactured-solution. Except from the element_type and the presence of permeability in FluidMaterials, the rest of parameters are similar as in master.

adityaghantasala commented 3 years ago

@jgonzalezusua Thank you for the setup. Unfortunately, I cannot run the problem with the branch your mentioned. It terminates with a segfault originating from Kratos::ExplicitSolverStrategy::SearchNeighbours and Kratos/applications/SwimmingDEMApplication/custom_strategies/strategies/adams_bashforth_strategy.cpp:55

Can you may be post the result here ?

jgonzalezusua commented 3 years ago

Hi @adityaghantasala,

I uploaded some changes in the branch to fix that segmentation fault. Anyway, to prevent you from running the case, I will post the result I obtained from the example. In this case, I have set an inlet in z direction at the top part and a pressure outlet at the bottom. The horizontal faces should be periodic.

Prueba_periodic

adityaghantasala commented 3 years ago

Interesting ! Looks like there is little to no periodicity.

I will have a look today.

adityaghantasala commented 3 years ago

Should the simulation setup produce any VTK output ? also the GiD result I see is not how you posted. here is what I see result

adityaghantasala commented 3 years ago

The strange thing is that, there is no VTK output even though it is defined in the input parameters.

jgonzalezusua commented 3 years ago

Mmmmm... in reference to the VTK I do not know why the code is not writing post files because I do not use VTK. However, the thing that is strange to me is the result, I run the case that I uploaded here and I have obtained the result I posted.

Have you made changes to fix the problem?

jgonzalezusua commented 3 years ago

@adityaghantasala, have you found something related to the periodic conditions?

adityaghantasala commented 3 years ago

@jgonzalezusua sorry I did not work on this lately. But I will have time now. The point is I am not able to reproduce the result you posted with the files you provided. I always get the result I posted above which does not give a lot of information to work with.

jgonzalezusua commented 3 years ago

Ok, I updated the branch in which I am working but I am still getting no periodicity in the results. The model I am running is the following:

Prueba_periodic_bc.gid.zip

And the result is:

periodic_condition (1)

Maybe you can reproduce it. By the way, I could not print the results using "vtk_output" process.

Thanks for your attention.

adityaghantasala commented 3 years ago

@jgonzalezusua I know why this is happening. It is related to #7337 , #7401 and #7734 it is caused by the line

https://github.com/KratosMultiphysics/Kratos/blob/0df63d606435921078e0194f7032e6b82d9e04c4/kratos/geometries/triangle_3d_3.h#L953

here the hard coded value 10e-6 is the problem. it is too strong a criterion for this problem. This means none of the points found their host elements and so no periodic conditions (constraints) are formed.

This is the result I got if I set the value to 10e-1, and then the periodic conditions are formulated properly.

animation

jgonzalezusua commented 3 years ago

OK, so do you suggest to change the value of this condition?

adityaghantasala commented 3 years ago

Well that would be a quick fix. But the problem is to be dealt with the mentioned PRs

jgonzalezusua commented 3 years ago

Yes, I think there have to be a better solution to deal with the periodic conditions. This quick fix is only valid to solve this case, the problem is that we would have to change that value every time we want to run a new model.