<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="ltr">
<div>Alex,</div>
<div>DMNetwork is under active development, thus our manual might not be updated. I'll check it.</div>
<div>I'm attaching a paper which might be used as a manual for the latest DMNetwork.</div>
<div><br>
</div>
<div>For your case, Nsubnet = 1, which is determined by application, not number of processes.</div>
<div>There are several examples using DMNetwork in petsc, e.g., under ~petsc,</div>
<div>$ git grep DMNetworkCreate *<br>
</div>
<div>...</div>
<div>src/ksp/ksp/examples/tutorials/network/ex1.c: ierr = DMNetworkCreate(PETSC_COMM_WORLD,&dmnetwork);CHKERRQ(ierr);<br>
src/ksp/ksp/examples/tutorials/network/ex1_nest.c: ierr = DMNetworkCreate(PETSC_COMM_WORLD,&networkdm);CHKERRQ(ierr);<br>
src/ksp/ksp/examples/tutorials/network/ex2.c: ierr = DMNetworkCreate(PETSC_COMM_WORLD,&networkdm);CHKERRQ(ierr);<br>
src/snes/examples/tutorials/network/ex1.c: ierr = DMNetworkCreate(PETSC_COMM_WORLD,&networkdm);CHKERRQ(ierr);<br>
src/snes/examples/tutorials/network/power/power.c: ierr = DMNetworkCreate(PETSC_COMM_WORLD,&networkdm);CHKERRQ(ierr);<br>
src/snes/examples/tutorials/network/power/power2.c: ierr = DMNetworkCreate(PETSC_COMM_WORLD,&networkdm);CHKERRQ(ierr);<br>
src/snes/examples/tutorials/network/water/water.c: ierr = DMNetworkCreate(PETSC_COMM_WORLD,&networkdm);CHKERRQ(ierr);<br>
src/ts/examples/tutorials/network/wash/pipes1.c: ierr = DMNetworkCreate(PETSC_COMM_WORLD,&networkdm);CHKERRQ(ierr);<br>
src/ts/examples/tutorials/power_grid/stability_9bus/ex9busdmnetwork.c: ierr = DMNetworkCreate(PETSC_COMM_WORLD,&networkdm);CHKERRQ(ierr);<br>
</div>
<div><br>
</div>
<div>Hong</div>
<div><br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Nov 7, 2019 at 11:12 AM von Ramm, Alexander via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hello together, <br>
I'm trying to figure out how to create a DMNetwork, but the proper way to set the parameters eludes me (also there is some discrepancy between the manual
<a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manual.pdf" rel="noreferrer" target="_blank">
https://www.mcs.anl.gov/petsc/petsc-current/docs/manual.pdf</a> (page 166) and the online documenation
<a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMNetwork/DMNetworkSetSizes.html" rel="noreferrer" target="_blank">
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMNetwork/DMNetworkSetSizes.html</a> ).<br>
Currently I'm trying to set a up a simple Network with 8 nodes and 7 edges and distribute it over 2 processors. In the call DMNetworkSetSizes does Nsubnet need to be 1 (one global network, without any further subnetworks) or 2 (one subnetwork per processor)
(my guess would be the former). <br>
My current attempt looks like the following: <br>
<br>
int main( int argc, char *argv[]) {<br>
PetscInitialize(&argc, &argv, NULL, NULL);<br>
<br>
DM dm;<br>
PetscInt NSubnet = 1;<br>
PetscInt nV[1] = {8};<br>
PetscInt nE[1] = {7};<br>
PetscInt NsubnetCouple = 0;<br>
PetscInt nec[0];<br>
<br>
DMNetworkCreate(PETSC_COMM_WORLD, &dm);<br>
<br>
DMNetworkSetSizes(dm, NSubnet, nV, nE, NsubnetCouple, nec);<br>
<br>
PetscInt *edgeList;<br>
PetscMalloc1(14, &edgeList);<br>
edgeList[0] = 0;<br>
edgeList[1] = 4;<br>
<br>
edgeList[2] = 1;<br>
edgeList[3] = 4;<br>
<br>
edgeList[4] = 2;<br>
edgeList[5] = 5;<br>
<br>
edgeList[6] = 3;<br>
edgeList[7] = 5;<br>
<br>
edgeList[8] = 4;<br>
edgeList[9] = 6;<br>
<br>
edgeList[10] = 5;<br>
edgeList[11] = 6;<br>
<br>
edgeList[12] = 6;<br>
edgeList[13] = 7;<br>
<br>
PetscInt *edges[1];<br>
edges[0] = edgeList;<br>
DMNetworkSetEdgeList(dm, edges, NULL);<br>
<br>
DMNetworkLayoutSetUp(dm);<br>
<br>
return 0;<br>
}<br>
<br>
Except from the Online Documenation I wasn't able to find any information/example where newest version Petsc was used when setting up a DMNetwork. (I found a few examples using older versions, however I could not figure out how these could solved using the
newest version). If some could explain to me the the correct interpretation of the parameters of DMNetworkSetSizes ? Any pointers to examples using the newest API would also be much appreciated.
<br>
<br>
Thanks and best Regards, <br>
Alex <br>
<br>
<br>
</blockquote>
</div>
</div>
</body>
</html>