Skip to content

Zoltan partitioning with transmissibility coarsened graph - #1050

Open
andrthu wants to merge 5 commits into
OPM:masterfrom
andrthu:zoltan-coarse-graph
Open

Zoltan partitioning with transmissibility coarsened graph#1050
andrthu wants to merge 5 commits into
OPM:masterfrom
andrthu:zoltan-coarse-graph

Conversation

@andrthu

@andrthu andrthu commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Implementation of the Zoltan coarse graph partitioning method presented at the OPM summit.

Adds another option for doing partitioning, zoltanCG. The new method coarsens the partitioning graph by merging nodes that are connected with a transmissibilty larger than a given threshold. The threshold is calculated in opm-simulators. There is also a limit to how many nodes that can be merged set by another parameter in opm-simulators. Coarsening is done by performing a depth first search of the partitioning graph.

zoltanCG supports distributed-wells=true/false and serial-partitioning=true/false.

@blattms blattms added the manual:enhancement This is an enhancement/improvent that needs to be documented in the manual label Jul 8, 2026
@blattms

blattms commented Jul 8, 2026

Copy link
Copy Markdown
Member

jenkins build this opm-simulators=7216 please

@michal-toth

Copy link
Copy Markdown
Member

I am reviewing the PR and I will need more time to digest the algorithm but here are two little things that could be improved:

  • The year in the license/preamble of the new files should be updated to 2026
  • Check the input and output arguments. Many vectors are passed by a copy and constant reference would be better.

@michal-toth michal-toth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding code:
There is also a lots of copy-pasting, so the code looks more like a draft with a pending refactorization. (Being a draft can make this review sound harsher, I am sorry.) I would also welcome more comments in the code. (E.g. method dfsq was fine but createCoarseGraph is completely commentless.)

For now, unit tests cover only uniform edge weights. Since the vertex grouping is done based on the greatest transmissibility (and all transmissibilities are equal), the priority queue q (in dfsq) is never filled and a big part of the code is not tested.

Regarding the algorithm:
I am looking forward to the new partitioning option. I did not test it yet but for now my feeling is that picking the right seed nodes for the cell grouping can make a big difference. I would welcome an option to use edge weights rescaled to the node instead of using transmissibilities. (E.g. by dividing each node's edge weights by its lowest edge weight. Big edge weight would then mean that two cells are coupled more strongly to themself than to their neighbors. The edge weights would not be symmetric anymore but it would be more fair in the graphs where one area has higher transmissibilities than other.)

Comment thread opm/grid/CoarseGraphOfGrid.cpp Outdated
Comment thread opm/grid/CoarseGraphOfGrid.cpp Outdated
}
// Call dfsq reflexively on strongest connection in queue
if (!visited[nab])
dfsq((*transGraph)[nab],q,nab,master,w,maxNode,visited,cnode,edges);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try rewriting the recursion into an iterative algorithm. It seems like the recursion can run quite deep, and it manipulates the same objects. The hierarchy of recursion is not necessary so the iterative form can save a lot.

Comment thread opm/grid/CoarseGraphOfGrid.cpp Outdated
Comment thread opm/grid/CoarseGraphOfGrid.cpp Outdated
Comment thread opm/grid/CoarseGraphOfGrid.cpp Outdated
Comment thread opm/grid/GraphOfGridWrappers.cpp Outdated
}

template<typename Zoltan_Struct>
void setCoarseGraphZoltanGraphFunctions(Zoltan_Struct *zz,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical to setGraphOfGridZoltanGraphFunctions. Template it instead of copy-paste.

Comment thread opm/grid/GraphOfGridWrappers.cpp Outdated
Comment thread opm/grid/GraphOfGridWrappers.cpp
Comment thread opm/grid/GraphOfGridWrappers.cpp Outdated
Comment thread opm/grid/CoarseGraphOfGrid.cpp Outdated
@andrthu

andrthu commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

I believe I have implemented most of the suggestions. The exceptions are logarithmic edge weights and rewriting the recursion to an iterative algorithm.

For now, unit tests cover only uniform edge weights. Since the vertex grouping is done based on the greatest transmissibility (and all transmissibilities are equal), the priority queue q (in dfsq) is never filled and a big part of the code is not tested.

I am a bit confused about this. You are correct that all tests use uniform edge weights, but this is only relevant for setting the edge weights in the coarse graph. For creating the coarse graph by merging nodes, transmissibility is always used to determine strong connections.

@michal-toth

Copy link
Copy Markdown
Member

You are correct that all tests use uniform edge weights, but this is only relevant for setting the edge weights in the coarse graph. For creating the coarse graph by merging nodes, transmissibility is always used to determine strong connections.

I assumed that the edge weights and transmissibilities are the same thing in this case, i.e. using uniform edge weights is equivalent to set all transmissibilities to 1. Consequently, the queue q in dfsq would never get longer because it could not find a stronger connection.

@atgeirr

atgeirr commented Aug 3, 2026

Copy link
Copy Markdown
Member

I assumed that the edge weights and transmissibilities are the same thing in this case

It is very easy to make that assumption! When discussing weights please make sure to distinguish between the two stages: coarsening (always transmissibility based) and subsequent partitioning (uniform or transmissibility based, weights between nodes are in all cases the sum of weights of connecting fine-level weights).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:enhancement This is an enhancement/improvent that needs to be documented in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants