On Tue, Apr 5, 2011 at 8:38 AM, Thomas Witkowski <span dir="ltr"><<a href="mailto:thomas.witkowski@tu-dresden.de">thomas.witkowski@tu-dresden.de</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Matthew Knepley wrote:<div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Tue, Apr 5, 2011 at 4:28 AM, Thomas Witkowski <<a href="mailto:thomas.witkowski@tu-dresden.de" target="_blank">thomas.witkowski@tu-dresden.de</a> <mailto:<a href="mailto:thomas.witkowski@tu-dresden.de" target="_blank">thomas.witkowski@tu-dresden.de</a>>> wrote:<br>

<br>
    Jed Brown wrote:<br>
<br>
        On Tue, Mar 29, 2011 at 15:29, Thomas Witkowski<br>
        <<a href="mailto:thomas.witkowski@tu-dresden.de" target="_blank">thomas.witkowski@tu-dresden.de</a><br>
        <mailto:<a href="mailto:thomas.witkowski@tu-dresden.de" target="_blank">thomas.witkowski@tu-dresden.de</a>><br>
        <mailto:<a href="mailto:thomas.witkowski@tu-dresden.de" target="_blank">thomas.witkowski@tu-dresden.de</a><br>
        <mailto:<a href="mailto:thomas.witkowski@tu-dresden.de" target="_blank">thomas.witkowski@tu-dresden.de</a>>>> wrote:<br>
<br>
           Is there any example which makes use of it?<br>
<br>
<br>
        src/snes/examples/tutorials/ex28.c is a (contrived)<br>
        multi-physics prototype that uses MatNest tranparently if you<br>
        run with -pack_dm_mat_type nest (currently, you should add<br>
        -pc_type fieldsplit -pc_fieldsplit_type additive because<br>
        off-diagonal blocks are not automatically preallocated).<br>
<br>
        There are also two tests that use the low-level API:<br>
<br>
        $ grep -l MatNest src/**/tests/*.c<br>
        src/ksp/ksp/examples/tests/ex22.c<br>
        src/snes/examples/tests/ex17.c<br>
<br>
    So, I reimplemented my code to assemble the matrices to a MatNest<br>
    matrix. This seems to work fine. But how to define the<br>
    FieldSplits? I did it in the following way:<br>
<br>
      KSP solver;<br>
      PC pc;<br>
      KSPCreate(PETSC_COMM_WORLD, &solver);<br>
      KSPGetPC(solver, &pc);<br>
      const PetscInt interiorField[1] = {0};<br>
      const PetscInt boundaryField[1] = {1};<br>
      PCFieldSplitSetFields(pc, "interior", 1, interiorField);<br>
      PCFieldSplitSetFields(pc, "boundary", 1, boundaryField);<br>
<br>
    When I run my code with the options "-ksp_type preonly -pc_type<br>
    fieldsplit -pc_fieldsplit_type schur", I get the following errors<br>
    in KSPSolve:<br>
<br>
    [0]PETSC ERROR: --------------------- Error Message<br>
    ------------------------------------<br>
    [0]PETSC ERROR: Petsc has generated inconsistent data!<br>
    [0]PETSC ERROR: Unhandled case, must have at least two fields!<br>
<br>
    Is the creation of the split wrong? If not, what is a good way to<br>
    figure out the problem?<br>
<br>
<br>
This is almost certainly a problem with the setup order. In this code, the PC type is not yet set<br>
so the FieldSplit calls are ignored. When it finally is set, there are no fields defined. I would call<br>
KSPSetFromOptions() before retrieving the PC.<br>
</blockquote></div></div>
This generates exactly the same error message.</blockquote><div><br></div><div>Then there is no choice but to use the debugger to see what is going on.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888"><br>
Thomas</font><div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
   Matt<br>
 <br>
<br>
    Thomas<br>
<br>
<br>
<br>
<br>
-- <br>
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>
</blockquote>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>