<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=""><div class=""><br class=""></div>It made some progress :-)<div class=""><br class=""><div>It would be quickest if you just sent me your code (you can use <a href="mailto:petsc-maint@mcs.anl.gov" class="">petsc-maint@mcs.anl.gov</a> if you don't want it public).</div><div><br class=""></div><div><blockquote type="cite" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="">Somehow I thought that setting ComputeOperators and ComputeRHS will be enough..</div></div></div></blockquote><div><br class=""></div>I think it is failing because though you provide code to fill up the matrices you never provide the matrices; it may be implicit in the use of KSPSetComputeOperators</div><div> that you provide a DM that can create the matrices for each of the levels automatically inside the PCSetUp_MG.</div><div><br class=""></div><div>Barry</div><div><br class=""></div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 12, 2022, at 1:26 PM, Oleg Shatrov <<a href="mailto:shatrov.oleg.a@gmail.com" class="">shatrov.oleg.a@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">Unfortunately it still failed.<div class=""><br class=""></div><div class="">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br class="">[0]PETSC ERROR: Must call DMShellSetGlobalVector() or DMShellSetCreateGlobalVector()<br class="">[0]PETSC ERROR: See <a href="https://petsc.org/release/faq/" class="">https://petsc.org/release/faq/</a> for trouble shooting.<br class="">[0]PETSC ERROR: Petsc Development GIT revision: v3.17.3-770-gceb9926454c GIT Date: 2022-07-15 21:35:25 +0000<br class="">[0]PETSC ERROR: ./a.out on a named MacBook-Pro-Oleg.local by olegshatrov Mon Sep 12 19:59:34 2022<br class="">[0]PETSC ERROR: Configure options --prefix=/usr/local CFLAGS="-m64 -O0 -g" CXXFLAGS="-m64 -O0 -g" FCFLAGS="-m64 -O0 -g -ffree-line-length-none" --with-mem-debug=1 --with-debugging=1 --with-mpi-dir=/usr/local/ --with-moab=true<br class="">[0]PETSC ERROR: #1 DMCreateGlobalVector_Shell() at /Users/olegshatrov/Documents/GitHub/petsc/src/dm/impls/shell/dmshell.c:206<br class="">[0]PETSC ERROR: #2 DMCreateGlobalVector() at /Users/olegshatrov/Documents/GitHub/petsc/src/dm/interface/dm.c:998<br class="">[0]PETSC ERROR: #3 DMGetGlobalVector() at /Users/olegshatrov/Documents/GitHub/petsc/src/dm/interface/dmget.c:161<br class="">[0]PETSC ERROR: #4 KSPCreateVecs() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/ksp/interface/iterativ.c:1616<br class="">[0]PETSC ERROR: #5 KSPSetWorkVecs() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/ksp/interface/iterativ.c:1684<br class="">[0]PETSC ERROR: #6 KSPSetUp_Chebyshev() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/ksp/impls/cheby/cheby.c:46<br class="">[0]PETSC ERROR: #7 KSPSetUp() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/ksp/interface/itfunc.c:362<br class="">[0]PETSC ERROR: #8 PCSetUp_MG() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/pc/impls/mg/mg.c:1189<br class="">[0]PETSC ERROR: #9 PCSetUp() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/pc/interface/precon.c:991<br class="">[0]PETSC ERROR: #10 KSPSetUp() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/ksp/interface/itfunc.c:401<br class="">[0]PETSC ERROR: #11 main() at ex28.c:67<br class="">[0]PETSC ERROR: No PETSc Option Table entries<br class="">[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to <a href="mailto:petsc-maint@mcs.anl.gov" class="">petsc-maint@mcs.anl.gov</a>----------<br class="">--------------------------------------------------------------------------</div><div class=""><br class=""></div><div class="">Somehow I thought that setting ComputeOperators and ComputeRHS will be enough..</div><div class=""><br class=""></div><div class="">Oleg.<br class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пн, 12 сент. 2022 г. в 19:23, Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>>:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class=""><div class=""><br class=""></div> In PCSetUp_MG() it is creating needed vectors for each level. In order to create the vectors it needs to have a "template" of the vectors. It tries<div class="">several ways to get such a template. </div><div class=""><br class=""></div><div class="">If you have provided an vector for each level with PCMGSetRhs() it uses VecDuplicate for the needed vectors.</div><div class=""><br class=""></div><div class="">If you provided a matrix for each level with PCMGSetOperators() it uses the MatCreateVectors() using that matrix</div><div class=""><br class=""></div><div class="">If you have not provided either of those it tries DMCreateGlobalVector() for the DM associated with that level, if there is no DM it defaults to DMShell and then errors.</div><div class=""><br class=""></div><div class="">Since it errors this seems to indicate you did not provide an operator for each level, nor a right hand side vector. </div><div class=""><br class=""></div><div class="">Please find attached a patch that may resolve the issue for.</div><div class=""><br class=""></div><div class="">In the petsc directory do</div><div class="">patch -p1 < mg.patch</div><div class="">make libs</div><div class=""><br class=""></div><div class="">then rerun your example. Please let us know if it resolves the problem and if not send the complete error message</div><div class=""><br class=""></div><div class="">Barry</div><div class=""></div></div><div style="overflow-wrap: break-word;" class=""><div class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Sep 12, 2022, at 11:02 AM, Oleg Shatrov <<a href="mailto:shatrov.oleg.a@gmail.com" target="_blank" class="">shatrov.oleg.a@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hello!<div class=""><br class=""></div><div class="">Can somebody explain to me what I am doing wrong here?</div><div class="">I took tutorial 28 from KSP folder and modified it a little in order to create manual DM interpolations and set them to PC.</div><div class="">When i run the application I receive an error:</div><div class=""><br class=""></div><div class="">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br class="">[0]PETSC ERROR: Must call DMShellSetGlobalVector() or DMShellSetCreateGlobalVector()<br class="">[0]PETSC ERROR: See <a href="https://petsc.org/release/faq/" target="_blank" class="">https://petsc.org/release/faq/</a> for trouble shooting.<br class="">[0]PETSC ERROR: Petsc Development GIT revision: v3.17.3-770-gceb9926454c GIT Date: 2022-07-15 21:35:25 +0000<br class="">[0]PETSC ERROR: ./a.out on a named MacBook-Pro-Oleg.local by olegshatrov Mon Sep 12 17:53:13 2022<br class="">[0]PETSC ERROR: Configure options --prefix=/usr/local CFLAGS="-m64 -O0 -g" CXXFLAGS="-m64 -O0 -g" FCFLAGS="-m64 -O0 -g -ffree-line-length-none" --with-mem-debug=1 --with-debugging=1 --with-mpi-dir=/usr/local/ --with-moab=true<br class="">[0]PETSC ERROR: #1 DMCreateGlobalVector_Shell() at /Users/olegshatrov/Documents/GitHub/petsc/src/dm/impls/shell/dmshell.c:206<br class="">[0]PETSC ERROR: #2 DMCreateGlobalVector() at /Users/olegshatrov/Documents/GitHub/petsc/src/dm/interface/dm.c:998<br class="">[0]PETSC ERROR: #3 DMGetGlobalVector() at /Users/olegshatrov/Documents/GitHub/petsc/src/dm/interface/dmget.c:161<br class="">[0]PETSC ERROR: #4 KSPCreateVecs() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/ksp/interface/iterativ.c:1616<br class="">[0]PETSC ERROR: #5 PCSetUp_MG() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/pc/impls/mg/mg.c:1129<br class="">[0]PETSC ERROR: #6 PCSetUp() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/pc/interface/precon.c:991<br class="">[0]PETSC ERROR: #7 KSPSetUp() at /Users/olegshatrov/Documents/GitHub/petsc/src/ksp/ksp/interface/itfunc.c:401<br class="">[0]PETSC ERROR: #8 main() at ex28.c:67<br class="">[0]PETSC ERROR: No PETSc Option Table entries<br class="">[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to <a href="mailto:petsc-maint@mcs.anl.gov" target="_blank" class="">petsc-maint@mcs.anl.gov</a>----------<br class="">--------------------------------------------------------------------------<br class=""></div><div class=""><br class=""></div><div class="">And this is strange, since I did not provide any Shell DM.</div><div class="">When i comment out lines with setting interpolation matrix to PCMG everything works fine:</div><div class=""><span id="gmail-m_-2164865562598820225cid:ii_l7yw1xca0" class=""><image.png></span><br class=""></div><div class=""><br class=""></div><div class="">I am testing on MacOS 12.3.</div><div class="">MPI: Open MPI: 4.1.4</div><div class="">gcc version 12.1.0</div><div class="">Program is compiled with mpicc ex28.c -I /usr/local/include/ -L /usr/local/lib -lpetsc</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks in advance,</div><div class="">Oleg</div></div>
<span id="gmail-m_-2164865562598820225cid:f_l7yw5f8f1" class=""><ex28.c></span></div></blockquote></div><br class=""></div></div></blockquote></div></div>
</div></blockquote></div><br class=""></div></body></html>