SCOREC / pumi-pic

support libraries for unstructured mesh particle in cell simulations on GPUs and CPUs
BSD 3-Clause "New" or "Revised" License
36 stars 14 forks source link

Help on workflow of creating a partitioned mesh in PUMIPic #111

Closed zhangchonglin closed 9 months ago

zhangchonglin commented 10 months ago

@dhyan1272 @Angelyr: I would like to know the proper workflow and the documentations of creating a partitioned mesh for PUMIPic. Could you please help me with this? Thanks!

The mesh does not need to be field aligned, for example similar to the one below: xgcm_picpart_lettered

Say I am starting from the GMSH created mesh, what are the processes to do that. Since I will not be using Simmetrix tools, the procedure might be different from the workflow you are using.

Angelyr commented 9 months ago

I am not sure of how to do this. @cwsmith can you help with this?

cwsmith commented 9 months ago

@dhyan1272 do you have a document that describes the process you use?

dhyan1272 commented 9 months ago

Sorry I had missed this as I was on travel at that time. I use the print_pumpic_partition tool to create a partition file outlined here. https://github.com/SCOREC/gitrm/wiki/Running-GITRm

dhyan1272 commented 9 months ago

Once the partition file is done, a partitioned mesh can be created as https://github.com/SCOREC/gitrm/blob/MultiSpecies/src/GITRm.cpp#L141C33-L152 where owners is the partition file created above

zhangchonglin commented 9 months ago

Thank you Dhyan, @dhyan1272!

I am using gmsh to generate mesh, so the initial procedures to generate MDS .smb mesh file and .dmg discrete model file are a little different compared to above procedures.

Below are the procedures to start from gmsh .msh file to final partition file .ptn. Just document it here for future reference.

  1. Use the following command to generate dmg and smb file. The input is gmsh mesh file .msh:

    from_gmsh none <in .msh> <out .smb> <out .dmg>
  2. Create partition as mentioned above:

    print_pumipic_partition <model> <mesh> <number of output parts> <partition file prefix>

    Once I have heard back from Cameron and resolved the gmshToPumi issue, I can then close this issue.

It's not clear how would gmodel library fit into the overall procedure. According to from_gmsh arguments, we will need input .dmg file, which then could be generated from gmodel.

zhangchonglin commented 9 months ago

@cwsmith, @dhyan1272: what does bridge_dim do?

pp_input.bridge_dim = full_mesh->dim()-1;

https://github.com/SCOREC/gitrm/blob/f6b758cbdd53606428c1265f85b258d8db7be2a3/src/GITRm.cpp#L142

I did not get much useful information from here: https://github.com/SCOREC/pumi-pic/blob/575141418d9833f48feb04bc946b3e85e67fc873/src/pumipic_input.hpp#L61

cwsmith commented 9 months ago

The term bridge here is likely (I haven't read into the procedure) defining how elements traversed by the breadth first search (BFS) procedure are connected to each other. For example, if the bridge is vertices (0) then the next set of elements added to the BFS queue are those that are share vertices with the element currently being visited. For complex geometric models changing the bridge entity can result in significant differences in the traversal order.

https://github.com/SCOREC/pumi-pic/blob/575141418d9833f48feb04bc946b3e85e67fc873/src/pumipic_part_construct.cpp#L424

zhangchonglin commented 9 months ago

I see. This makes sense now. Do you see where this would affect the performance if setting bridge_dim to either 0 or 1 (vertex or edge)?

cwsmith commented 9 months ago

I wouldn't expect it to make a meaningful difference in a simple geometric model.

zhangchonglin commented 9 months ago

Thanks. I think the mesh partition issue has been resolved. I am able to create partitioned mesh following the procedures outlined here, starting from gmsh generated mesh. mesh_all_parts