[petsc-users] Using VecGetType() and VecNest

Wells, David drwells at email.unc.edu
Fri Aug 19 16:21:32 CDT 2022


Hello PETSc experts,

I am using VecNest to solve a Stokes problem and I ran into an issue using the POD KSPGuess routines:

[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Unknown type. Check for miss-spelling or missing package: https://petsc.org/release/install/install/#external-packages
[0]PETSC ERROR: Unknown vector type: nest
[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.17.0, Mar 30, 2022
[0]PETSC ERROR: /[...]/step-32/step-32 on a  named mitral by drwells Fri Aug 19 16:33:08 2022
[0]PETSC ERROR: Configure options [...]
[0]PETSC ERROR: #1 VecSetType() at /afs/cas.unc.edu/users/d/r/drwells/Documents/Code/C/petsc-3.17.0/src/vec/vec/interface/vecreg.c:80
[0]PETSC ERROR: #2 KSPGuessSetUp_POD() at /afs/cas.unc.edu/users/d/r/drwells/Documents/Code/C/petsc-3.17.0/src/ksp/ksp/guess/impls/pod/pod.c:118
[0]PETSC ERROR: #3 KSPGuessSetUp() at /afs/cas.unc.edu/users/d/r/drwells/Documents/Code/C/petsc-3.17.0/src/ksp/ksp/interface/iguess.c:352
[0]PETSC ERROR: #4 KSPSolve_Private() at /afs/cas.unc.edu/users/d/r/drwells/Documents/Code/C/petsc-3.17.0/src/ksp/ksp/interface/itfunc.c:830
[0]PETSC ERROR: #5 KSPSolve() at /afs/cas.unc.edu/users/d/r/drwells/Documents/Code/C/petsc-3.17.0/src/ksp/ksp/interface/itfunc.c:1078


It looks like VecGetType() works with VecNest while VecSetType() does not. I also noticed that VecNest isn't listed in VecRegisterAll().

I think I can write a patch to make the POD KSPGuess work with VecNest, but: should VecSetType() work with VecNest? It seems like this is an oversight but I'd like to know if there is some fundamental reason why the sequence used there

    PetscCall(KSPCreateVecs(guess->ksp,1,&v,0,NULL));
    PetscCall(VecCreate(PETSC_COMM_SELF,&vseq));
    PetscCall(VecGetLocalSize(v[0],&n));
    PetscCall(VecSetSizes(vseq,n,n));
    PetscCall(VecGetType(v[0],&type));
    PetscCall(VecSetType(vseq,type));
    PetscCall(VecDestroyVecs(1,&v));
    PetscCall(VecDuplicateVecs(vseq,pod->maxn,&pod->xsnap));
    PetscCall(VecDestroy(&vseq));
    PetscCall(PetscLogObjectParents(guess,pod->maxn,pod->xsnap));

can't work.

Best,
David Wells

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220819/aff88d79/attachment.html>


More information about the petsc-users mailing list