Thank you for your answer, Matt. In the MWE example attached before,
both Nest vectors (the r.h.s. of the system and the vector of unknowns)
are composed of the same number of blocks (2). Indeed, PETSc is able to
solve the system if KSPSetUp() is not called, so the
system/MatNest/MatVec's must not incompatible at all. Therefore, I
wonder if I have missed to called something before this routine or if
this is a KSPSetUp's bug.
Of course one can always directly define a single matrix and a single
vector, but I find it easier to work with Nest matrices and vectors.
Moreover, I think that the moment to use them is from the beginning...
once all the code is developed, it is very hard to switch matrices types.
Regards,
Manuel
---
On 4/10/19 5:41 PM, Matthew Knepley wrote:
On Wed, Apr 10, 2019 at 11:29 AM Manuel Colera Rico via petsc-users
<[email protected] <mailto:[email protected]>> wrote:
Hello,
I am trying to solve a system whose matrix is of type MatNest. If I
don't use KSPSetUp(), everything is fine. However, if I use that
routine, I get the following error:
0]PETSC ERROR: --------------------- Error Message
--------------------------------------------------------------
[0]PETSC ERROR: Invalid argument
[0]PETSC ERROR: Nest vector arguments 1 and 2 have different
numbers of
blocks.
This seems self-explanatory. Nest vectors must have the same number of
blocks to be compatible.
More broadly, there should be no reason to use Nest vectors or
matrices. It is an optimization to
be used at the very end, only after you have profiled the code and
seen that its important. You can
do everything you want to do without ever touching Nest, and it looks
like the Nest interface is a
problem for your code right now.
Thanks,
Matt
[0]PETSC ERROR: See
http://www.mcs.anl.gov/petsc/documentation/faq.html
for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.11.0, unknown
[0]PETSC ERROR:
/home/manu/Documents/FEM-fluids/C-codes/CLG2-ConvectionDiffusion/Debug/CLG2-ConvectionDiffusion
on a mcr_20190405 named mancolric by Unknown Wed Apr 10 17:20:16 2019
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran COPTFLAGS="-O3 -march=native -mtune=native"
CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3
-march=native -mtune=native" --with-debugging=0
--download-fblaslapack
--download--f2cblaslapack --download-mpich --download--hypre
--download-scalapack --download-mumps --download-suitesparse
--download-ptscotch --download-pastix --with-matlab --with-openmp
[0]PETSC ERROR: #1 VecCopy_Nest() line 68 in
/opt/PETSc_library/petsc-3.11.0/src/vec/vec/impls/nest/vecnest.c
[0]PETSC ERROR: #2 VecCopy() line 1614 in
/opt/PETSc_library/petsc-3.11.0/src/vec/vec/interface/vector.c
[0]PETSC ERROR: #3 KSPInitialResidual() line 63 in
/opt/PETSc_library/petsc-3.11.0/src/ksp/ksp/interface/itres.c
[0]PETSC ERROR: #4 KSPSolve_GMRES() line 236 in
/opt/PETSc_library/petsc-3.11.0/src/ksp/ksp/impls/gmres/gmres.c
[0]PETSC ERROR: #5 KSPSolve() line 782 in
/opt/PETSc_library/petsc-3.11.0/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: #6 mwe() line 55 in ../Tests/tests.c
Please find attached a MWE (it is a slight modification of that of
the
post opened by Ce Qin,
https://lists.mcs.anl.gov/pipermail/petsc-users/2015-February/024230.html,
whose answer I have not found).
By the way, with the newest version of PETSc, Eclipse marks as errors
the commands PetscFree, CHKERRQ, PETSC_COMM_SELF,... although it
compiles and executes well. Perhaps it is a problem related to
Eclipse,
but this did not happen with the older versions of PETSc.
Thanks and regards,
Manuel
---
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/
<http://www.cse.buffalo.edu/~knepley/>