<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font size="+1"><font face="Times New Roman, Times, serif">Hi,<br>
        <br>
        I try to run this code<br>
        <br>
        #include <petsc.h><br>
        <br>
        int main(int argc, char **argv)<br>
        {<br>
            PetscErrorCode ierr;<br>
            DM DApressure, DAvel;<br>
            <br>
            ierr = PetscInitialize(&argc, &argv,  (char *)0,
        (char *)0);CHKERRQ(ierr);<br>
        <br>
            ierr = DMDACreate2d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE,
        DM_BOUNDARY_NONE, DMDA_STENCIL_BOX,<br>
                                5, 5, PETSC_DECIDE, PETSC_DECIDE,<br>
                                1, 1, 0, 0,
        &DApressure);CHKERRQ(ierr);<br>
        <br>
            ierr = DMRefine(DApressure, PETSC_COMM_WORLD, &DAvel);<br>
            ierr = DMSetFromOptions(DAvel);CHKERRQ(ierr);<br>
            ierr = DMSetUp(DAvel);CHKERRQ(ierr);<br>
            ierr = DMDASetDof(DAvel, 2);CHKERRQ(ierr);<br>
            ierr = PetscFinalize();CHKERRQ(ierr);<br>
        <br>
            return 0;<br>
        }<br>
        <br>
        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 ?<br>
        <br>
        Thanks, <br>
        Loic<br>
      </font></font>
    <pre class="moz-signature" cols="72">-- 
Tel: 01 69 15 60 14 
<a class="moz-txt-link-freetext" href="http://www.math.u-psud.fr/~gouarin">http://www.math.u-psud.fr/~gouarin</a>
<a class="moz-txt-link-freetext" href="https://github.com/gouarin">https://github.com/gouarin</a></pre>
  </body>
</html>