KratosMultiphysics / GiDInterface

The graphical user interface of Kratos for GiD. Featuring CFD, CSM, DEM, PFEM, etc
Other
33 stars 16 forks source link

Free surface writes geometries #990

Closed jginternational closed 1 month ago

jginternational commented 4 months ago

Free surface fails running because of this:

In the first picture we can see the the group Fluid: image

In the second picture we can see the group Surface bottom: image

They do share elements

In the MDPA, both groups are written as Begin Geometries Triangle2D3 So there are elements declared 2 times, with the same id and the same connectivities. This should not be a problem, but it is.

You can see the log:


  File "C:\Users\garat\Desktop\Deploy_Kratos\Deploy_Kratos\KratosMultiphysics\analysis_stage.py", line 80, in Initialize
    self._ModelersSetupModelPart()
  File "C:\Users\garat\Desktop\Deploy_Kratos\Deploy_Kratos\KratosMultiphysics\analysis_stage.py", line 285, in _ModelersSetupModelPart
    modeler.SetupModelPart()
  File "C:\Users\garat\Desktop\Deploy_Kratos\Deploy_Kratos\KratosMultiphysics\modelers\import_mdpa_modeler.py", line 36, in SetupModelPart
    KratosMultiphysics.SingleImportModelPart.Import(
RuntimeError: Error: Attempting to add a new geometry with Id :892, unfortunately a (different) element with the same Id already exists

in kratos/includes/model_part.h:1538: ModelPart::AddGeometries
   kratos/includes/model_part.h:1560: ModelPart::AddGeometries
   kratos/sources/model_part_io.cpp:1771: ModelPartIO::ReadGeometriesBlock
   kratos/sources/model_part_io.cpp:618: ModelPartIO::ReadModelPart

Then in the submodelparts definition, each group references it's triangles.

jginternational commented 4 months ago

Example attached freesurface_geom.gid.zip

rubenzorrilla commented 4 months ago

After having discussed this with @jginternational we concluded that the issue here is having something similar to

Begin Geometries Triangle2D3
    1 10 20 30
    1 10 20 30
    2 20 30 40
    ....
End Geometries

that is having the same entity repeated. Note that this is to happen in many cases (for instance having a shell with surface load conditions). Right now, we throw an error if the same geometry id is present, but the error should in our opinion be thrown if the same id with different connectivities is present. If the same id with same connectivities is only repeated information which should be simply skipped. @KratosMultiphysics/technical-committee

rubenzorrilla commented 4 months ago

Note that checking for the repeated information in the writing of the pre (regardless this is GiD or another one) leads to custom and potentially inefficient writing implementations.

rubenzorrilla commented 2 months ago

Should be fixed by https://github.com/KratosMultiphysics/Kratos/pull/12703.

rubenzorrilla commented 1 month ago

@jginternational did you have the time to give it a try?