<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 16/05/2022 à 21:54, Barry Smith a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:818FD65F-288C-4442-889F-671A1C9DD939@petsc.dev">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <br class="">
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On May 16, 2022, at 3:50 PM, Loic Gouarin <<a
              href="mailto:loic.gouarin@polytechnique.edu"
              class="moz-txt-link-freetext" moz-do-not-send="true">loic.gouarin@polytechnique.edu</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta http-equiv="Content-Type" content="text/html;
              charset=UTF-8" class="">
            <div text="#000000" bgcolor="#FFFFFF" class="">
              <p class="">Thanks Barry for your quick reply.<br class="">
              </p>
              <div class="moz-cite-prefix">Le 16/05/2022 à 21:41, Barry
                Smith a écrit :<br class="">
              </div>
              <blockquote type="cite"
                cite="mid:A76657E7-8E3E-419E-9831-A94A73E032AD@petsc.dev"
                class="">
                <meta http-equiv="Content-Type" content="text/html;
                  charset=UTF-8" class="">
                <div class=""><br class="">
                </div>
                  Loic,
                <div class=""><br class="">
                </div>
                <div class="">    From your code it looks like you are
                  using a DM. Is it a DMDA or a shell DM? If it is a
                  DMDA then the process is intended to be pretty
                  straightforward. PCTELESCOPE should create a new DMDA
                  that has the same properties as the coarse grid DMDA
                  but lives on a smaller number of ranks. From this you
                  can just provide multiple levels of coarsening of the
                  DMDA to produce the smaller multigrid problems. <br
                    class="">
                </div>
              </blockquote>
              It's a DMDA. So what you mean is to take the KSP of
              PCTELESCOPE, get the DM which is the same of the coarse
              grid and build all the levels as previously for the levels
              of PCTELESCOPE ?<br class="">
            </div>
          </div>
        </blockquote>
        <div><br class="">
        </div>
          Yes, I think you should be able to pull out of the coarse
        level PC (on the subset of ranks) a DM that and then setup
        coarse levels from that. But you need to look at an example that
        that uses telescope and probably even the telescope code itself
        to see all the details. I don't know them anymore.</div>
    </blockquote>
    <p>I looked at the source code but It didn't help. I will try to
      explain more clearly my experiments to understand what I make
      wrong and you can help more easily.</p>
    <p>Thanks,</p>
    <p>Loic<br>
    </p>
    <blockquote type="cite"
      cite="mid:818FD65F-288C-4442-889F-671A1C9DD939@petsc.dev">
      <div><br class="">
      </div>
      <div>  Barry</div>
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">
            <div text="#000000" bgcolor="#FFFFFF" class="">
              <blockquote type="cite"
                cite="mid:A76657E7-8E3E-419E-9831-A94A73E032AD@petsc.dev"
                class="">
                <div class=""><br class="">
                </div>
                <div class="">   Can you let us know more details of
                  what exactly goes wrong with attempts? It is likely
                  straightforward to get things working, perhaps due to
                  our unclear documentation.</div>
              </blockquote>
              <p class="">I essentially have wrong state or NULL
                matrices into the PCTELESCOPE.</p>
              <p class="">Loic<br class="">
              </p>
              <blockquote type="cite"
                cite="mid:A76657E7-8E3E-419E-9831-A94A73E032AD@petsc.dev"
                class="">
                <div class=""><br class="">
                </div>
                <div class="">  Barry</div>
                <div class=""><br class="">
                  <div class=""><br class="">
                    <blockquote type="cite" class="">
                      <div class="">On May 16, 2022, at 3:28 PM, Loic
                        Gouarin <<a
                          href="mailto:loic.gouarin@polytechnique.edu"
                          class="moz-txt-link-freetext"
                          moz-do-not-send="true">loic.gouarin@polytechnique.edu</a>>
                        wrote:</div>
                      <br class="Apple-interchange-newline">
                      <div class="">
                        <meta http-equiv="content-type"
                          content="text/html; charset=UTF-8" class="">
                        <div text="#000000" bgcolor="#FFFFFF" class="">
                          <p class="">Hello,</p>
                          <p class="">I could have posted my message on
                            the user list but it seems to me that it's
                            more in the petsc development part. Don't
                            hesitate to tell me if I'm wrong.<br
                              class="">
                            I am developing a code called cafes that
                            studies fluid-particle interactions in a
                            Stokes fluid. For that, we implemented the
                            whole solver in matrix free on a cartesian
                            grid. The preconditioner is naturally a
                            geometrical multigrid for the velocity. The
                            set of matrix free for each level is set by
                            hand (I worked with Matthew on this a long
                            time ago now!). <br class="">
                            I would have liked to implement telescope on
                            this part. I started it but I didn't get out
                            of it. So I would like to have your help.<br
                              class="">
                            What I tried to do was to describe my
                            classical multigrid up to a level N1 and
                            then take the coarse solver and apply the
                            telescope preconditioner to it up to a level
                            N2. I don't know if this is the best way but
                            it seemed the most intuitive. The problem is
                            that I could not get the coarse matrix
                            because the setup is not done yet (I use a
                            DMKSPSetComputeOperators for the matrices).
                            <br class="">
                          </p>
                          <p class="">The construction of the matrix
                            free for each level is here: <a
                              class="moz-txt-link-freetext"
href="https://github.com/gouarin/cafes/blob/master/cafes/problem/stokes.hpp#L59-L88"
                              moz-do-not-send="true">https://github.com/gouarin/cafes/blob/master/cafes/problem/stokes.hpp#L59-L88</a></p>
                          <p class="">The description of the Stokes
                            preconditioner is described here : <a
                              class="moz-txt-link-freetext"
href="https://github.com/gouarin/cafes/blob/master/cafes/problem/stokes.hpp#L109-L162"
                              moz-do-not-send="true">https://github.com/gouarin/cafes/blob/master/cafes/problem/stokes.hpp#L109-L162</a></p>
                          <p class="">I have tried multiple
                            implementations without success. For me, the
                            start is to add at line 105 something like</p>
                          <div style="color: #d4d4d4;background-color: #1e1e1e;font-family: Menlo, Monaco, 'Courier New', monospace;font-weight: normal;font-size: 12px;line-height: 18px;white-space: pre;" class=""><div class=""><span style="color: #57a64a;" class="">KSP coarse;</span></div><div class=""><span style="color: #57a64a;" class="">ierr = PCMGGetCoarseSolve(pc_i, &coarse);CHKERRQ(ierr);</span></div><span style="color: #57a64a;" class="">
</span></div>
                          <div style="color: #d4d4d4;background-color: #1e1e1e;font-family: Menlo, Monaco, 'Courier New', monospace;font-weight: normal;font-size: 12px;line-height: 18px;white-space: pre;" class=""><span style="color: #57a64a;" class="">PC pc_coarse;</span><div class=""><span style="color: #57a64a;" class="">ierr = KSPGetPC(coarse, &pc_coarse);CHKERRQ(ierr);</span></div><div class=""><span style="color: #57a64a;" class="">ierr = PCSetType(pc_coarse, PCTELESCOPE);CHKERRQ(ierr);</span></div></div>
                          <div class=""><span style="color: #57a64a;"
                              class=""><br class="">
                            </span></div>
                          <div class="">Then, to create the several
                            matrices of the levels of TELESCOPE, I
                            thought using the same process as before
                            with DMKSPSetComputeOperators. But it
                            doesn't work...<br class="">
                          </div>
                          <div class="">Could you tell me how I can make
                            it work ?</div>
                          <div class=""><br class="">
                          </div>
                          <div class="">Thanks,</div>
                          <div class="">Loic<br class="">
                          </div>
                          <div class=""><br class="">
                          </div>
                          <div class=""><span style="color: #57a64a;"
                              class=""></span></div>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br class="">
                </div>
              </blockquote>
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
    </blockquote>
  </body>
</html>