<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Take a look at these posts from last year and see if they will help you at least get a slice:<div class=""><br class=""></div><div class=""><a href="https://lists.mcs.anl.gov/pipermail/petsc-users/2021-January/043037.html" class="">https://lists.mcs.anl.gov/pipermail/petsc-users/2021-January/043037.html</a></div><div class=""><br class=""></div><div class=""><a href="https://lists.mcs.anl.gov/pipermail/petsc-users/2021-January/043043.html" class="">https://lists.mcs.anl.gov/pipermail/petsc-users/2021-January/043043.html</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Good luck,</div><div class=""><br class=""></div><div class="">Randy M.</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 25, 2022, at 2:52 PM, Bastian Löhrer <<a href="mailto:bastian.loehrer@tu-dresden.de" class="">bastian.loehrer@tu-dresden.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  

    <meta http-equiv="content-type" content="text/html; charset=UTF-8" class="">
  
  <div class=""><p class="">Dear PETSc community,</p><p class="">in our CFD code we use a 3D DMDA to organize our data.</p><p class="">Now I need to compute a derived quantity in a subregion of the
      global domain and to write these data to disk for further
      post-processing.</p><p class="">The subregion is actually a planar slice for now, but it could
      also be a boxed-shaped region in future applications.</p><p class="">Hence, I figured I would create a new DMDA for this subregion by
      writing something along the lines of <br class="">
    </p><p class=""><tt class="">call DMDACreate3d(                 & !
<a class="moz-txt-link-freetext" href="https://www.mcs.anl.gov/petsc/petsc-3.8.4/docs/manualpages/DMDA/DMDACreate3d.html">https://www.mcs.anl.gov/petsc/petsc-3.8.4/docs/manualpages/DMDA/DMDACreate3d.html</a><br class="">
           PETSC_COMM_WORLD,               &<br class="">
           DM_BOUNDARY_NONE,  DM_BOUNDARY_NONE,  DM_BOUNDARY_NONE, &<br class="">
           DMDA_STENCIL_BOX,               & ! <= stencil type<br class="">
           sum(lx), sum(ly), sum(lz),      & ! <= global
        dimension (of data) in each direction<br class="">
           px, py, pz,                     & ! <= number of
        processors in each dimension<br class="">
           1, 0,                           & ! <= dof per node,
        stencil width (no ghost cell)<br class="">
           lx, ly, lz,                     & ! <= numbers of
        nodes held by processors<br class="">
           dmobject, ierr )</tt><tt class=""><br class="">
      </tt></p><p class="">where lx, ly and lz could look like<br class="">
    </p><p class=""><tt class="">lx = (/  0,  1,  0 /)<br class="">
        ly = (/ 16, 16 /)<br class="">
        lz = (/ 16, 16 /)<br class="">
      </tt></p><p class="">Unfortunately, this does not work:</p><div class="">
      <br class="webkit-block-placeholder"></div><blockquote type="cite" class=""><tt class="">[0]PETSC ERROR: ---------------------
          Error Message
          --------------------------------------------------------------</tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: Argument out of range</tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: Partition in x direction is too fine! 1
          2</tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: See
          <a class="moz-txt-link-freetext" href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for
          trouble shooting.</tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: Petsc Release Version 3.8.4, Mar, 24,
          2018 </tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: ./prime on a foss_debug named laptwo by
          bastian Tue Jan 25 23:32:30 2022</tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: Configure options PETSC_ARCH=foss_debug
          --with-cc=gcc --with-cxx=g++ --with-fc=gfortran
          --download-mpich --with-large-file-io=1
          --with-shared-libraries=1 COPTFLAGS="   " CXXOPTFLAGS=" "
          FOPTFLAGS="   " --march=native --mtune=native
          --download-hypre=/soft/petsc-3.8.4/foss_debug/hypre-v2.12.0.tar.gz
          --with-debugging=yes</tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: #1 DMSetUp_DA_3D() line 318 in
          /soft/petsc-3.8.4/src/dm/impls/da/da3.c</tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: #2 DMSetUp_DA() line 25 in
          /soft/petsc-3.8.4/src/dm/impls/da/dareg.c</tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: #3 DMSetUp() line 720 in
          /soft/petsc-3.8.4/src/dm/interface/dm.c</tt><tt class=""><br class="">
        </tt><tt class="">[0]PETSC ERROR: #4 User provided function() line 0 in
          User file</tt><tt class=""><br class="">
        </tt><tt class="">application called MPI_Abort(MPI_COMM_WORLD, 63) -
          process 0</tt><br class="">
      </blockquote>
      Apparently, <tt class="">lx</tt>, <tt class="">ly</tt> and <tt class="">lz</tt> cannot
      contain zeros.<br class="">
      (Which would be a useful information in the documentation, too.)<div class=""><br class="webkit-block-placeholder"></div><p class="">Is there any workaround?<br class="">
    </p><p class="">My current understanding is that I need to go the extra mile of
      creating an additional Communicator involving only those ranks
      that will share at least one cell in the subregion DMDA.</p><p class="">If this is the way to go? If so, how can I control which rank
      receives which subdomain in the subregion?  DMDACreate3d does not
      enable me to do so, but I need to make sure that a rank holds only
      those cells of the subregion which are also present in its share
      of the global domain.</p><p class="">Many thanks in advance,<br class="">
      Bastian Löhrer<br class="">
    </p>
    <div class="moz-signature"><br class="">
    </div>
  </div>

</div></blockquote></div><br class=""></div></body></html>