<div dir="ltr"><div>I am moving my code to have the DM create the matrix and am hitting this error in DMGetLocalToGlobalMapping:</div><div><br></div><div>if (!dm->ops->getlocaltoglobalmapping) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"DM can not create LocalToGlobalMapping");</div>
<div><br></div><div>This happens when I create the matrix like this:</div><div><br></div><div><div> call DMCompositeCreate(comm,solver%da,ierr) </div><div> call DMSetOptionsPrefix(solver%da,'fsa_',ierr)</div><div>
call DMCompositeAddDM(solver%da,solver%daphi,ierr)</div><div> call DMCompositeAddDM(solver%da,solver%dalam,ierr)</div><div> call DMSetFromOptions(solver%da,ierr)</div><div> call DMCreateMatrix(solver%da,solver%KKTmat,ierr)<br>
</div></div><div><br></div><div>I am using DMShell and create them like so:</div><div><br></div><div><div> ! phi DM</div><div> call VecCreate(comm,x1Vec,ierr)</div><div> call VecSetSizes(x1Vec,N1loc,N1Glob,ierr)</div><div>
call VecSetFromOptions(x1Vec,ierr)</div><div><br></div><div> call DMShellCreate(comm,solver%daphi,ierr)</div><div> call DMShellSetGlobalVector(solver%daphi,x1Vec,ierr)</div><div> call DMShellSetMatrix(solver%daphi,solver%A0Mat,ierr)</div>
<div> call VecDestroy(x1Vec,ierr)</div><div> call DMSetOptionsPrefix(solver%daphi,'phi_',ierr)</div><div> call DMSetFromOptions(solver%daphi,ierr)</div><div><br></div><div> call VecCreate(PETSC_COMM_SELF,x1Vecloc,ierr)</div>
<div> call VecSetSizes(x1Vecloc,N1loc,N1loc,ierr)</div><div> call VecSetFromOptions(x1Vecloc,ierr)</div><div> call DMShellSetLocalVector(solver%daphi,x1Vecloc,ierr)</div><div> call VecDestroy(x1Vecloc,ierr)</div></div>
<div><br></div><div>All the examples that I see use DMDAs. I am able to create a global vector with this DM.</div><div><br></div><div>Any ideas? </div></div>