Kratos: [MappingAplication] Matching meshes

Created on 14 Jul 2020  路  10Comments  路  Source: KratosMultiphysics/Kratos

Description
I need help setting the user-parameters for mapping between matching meshes.

Scope
I need to do a mapping between perfectly matching meshes (they are the same mesh). Using a json like:

mapper_parameters = KratosMultiphysics.Parameters("""{
            "mapper_type": "nearest_neighbor",
            "echo_level" : 0
        }""")

the computed radius is really high (around 37), and the process seems hanging indefinitely. I guess I have a search radius really high since my maximum mesh size is around 15. On the other hand, my minimal mesh size is 0.002. The mesh has around 25k nodes and its dimensions are 275x150.

On the other hand, if I use

mapper_parameters = KratosMultiphysics.Parameters("""{
            "mapper_type": "nearest_neighbor",
            "echo_level" : 0,
            "search_radius" : 1.0
        }""")

the process is quite fast.

I was wondering if, having perfectly matching meshes, it is safe reducing the search radius. Is it possible to reduce it even more? What else can I reduce (approximation_tolerance, search_iterations,etc.)?

I also noted that such parameters (search_radius,search_iterations,etc.) are not present in the new README, and also some flags (that I use in another project) are missing: TO_NON_HISTORICAL,FROM_NON_HISTORICAL. Is there any reason?

Additional info
I have looked in the README and I have not found the answers. Thanks for your help.
I assign @philbucher since I think you are the main developer of the MappingApplication. Please assign someone else if you think it is needed.

Help Wanted

All 10 comments

Hi @riccardotosi ,
Thanks for the input.
first some general info:

  • The current design (especially in the search) is very conservative aka designed to be robust. This means unfortunately that it can be slow sometimes (this only affects the construction phase of the mapper)
    I heard this multiple times already and am currently redesigning it to be faster.
  • By default the mapper is muted completely. I strongly recommend for debugging / setting up cases to increase the echo level, I added quite some warnings / recommendations what to do in what case. (I might enable some severe warnings in the future even with an echo level of zero but for now it is muted)

Let me answer your questions one by one:

  • regarding the search radius: Is it possible that you have only nodes in your mesh? If so then the computed search radius will be much (much!) larger in order to find everything. You would get a warning with higher echo levels
    If you have a matching mesh then you can make the search radius very small, it should still work fine. Again, with an increased echo-level warnings would appear if sth goes wrong
    In general I often experienced that if you know your mesh size and select a search radius accordingly then you can speed it up tremendously
  • the reason that the readme is not complete is that I didn't add the things that I am changing/refactoring atm yet. Once they are improved (e.g. the search) then I will add them.
    e.g. I am also quite sure that mapping the non-historical variables with InverseMap is not working properly :sweat_smile:

I just created #7241 to make it visible for others what I am planning with the app in the near future

please let me know if you have further questions

Hi @philbucher.

Is it possible that you have only nodes in your mesh? If so then the computed search radius will be much (much!) larger in order to find everything. You would get a warning with higher echo levels

Running with echo_level=3 the only output messages are

Mapper: Main ModelPart used for origin-ModelPart
Mapper: Main ModelPart used for destination-ModelPart

If you have a matching mesh then you can make the search radius very small

Thanks, I will reduce the search_radius.

Is there any other parameter you suggest to play with?

Hi @riccardotosi
Ok if you don't get any messages saying that some neighbors were not found then you are good, then the only parameter to play is to reduce the search_radius

I will tag you once I have new developments in this direction for testing :)

Thanks @philbucher!

@riccardotosi could you share your mdpa files?
I would like to take a closer look to see what is hapening

Here you have it.

RectangularCylinder2D_25k.zip

thx!

@riccardotosi which Modelparts did you use for the mapper?

I use the main model part.

I checked now in detail, the relation largest to smallest element edge is 25000! => I.e. it is extremely heterogenous.
I will think of a way to improve the computation of the search radius, but this is in any case not trivial :sweat_smile:

Was this page helpful?
0 / 5 - 0 ratings