[petsc-users] DMDA set dof

Loic Gouarin loic.gouarin at math.u-psud.fr
Wed Nov 2 06:59:17 CDT 2016


Hi,

I try to run this code

#include <petsc.h>

int main(int argc, char **argv)
{
     PetscErrorCode ierr;
     DM DApressure, DAvel;

     ierr = PetscInitialize(&argc, &argv,  (char *)0, (char 
*)0);CHKERRQ(ierr);

     ierr = DMDACreate2d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, 
DM_BOUNDARY_NONE, DMDA_STENCIL_BOX,
                         5, 5, PETSC_DECIDE, PETSC_DECIDE,
                         1, 1, 0, 0, &DApressure);CHKERRQ(ierr);

     ierr = DMRefine(DApressure, PETSC_COMM_WORLD, &DAvel);
     ierr = DMSetFromOptions(DAvel);CHKERRQ(ierr);
     ierr = DMSetUp(DAvel);CHKERRQ(ierr);
     ierr = DMDASetDof(DAvel, 2);CHKERRQ(ierr);
     ierr = PetscFinalize();CHKERRQ(ierr);

     return 0;
}

and I get the error that DAvel is in wrong state whereas I call SetUp as 
mentioned in the error message. It seems that it is not possible to 
redefine the dof number if it is already set. Could you confirm ?

Thanks,
Loic

-- 
Tel: 01 69 15 60 14
http://www.math.u-psud.fr/~gouarin
https://github.com/gouarin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20161102/7720a162/attachment.html>


More information about the petsc-users mailing list