[petsc-users] Using VecGetType() and VecNest

Barry Smith bsmith at petsc.dev
Fri Aug 19 22:29:59 CDT 2022


  I am not sure why the code works this way creating these sequential work vectors. Since VecNest needs some information about the subvectors I don't think just setting these work vectors to nest vectors will work properly. 

  I am cc:ing Stefano who wrote the code and can likely say immediately what the solution is.

  Barry


> On Aug 19, 2022, at 5:21 PM, Wells, David <drwells at email.unc.edu> wrote:
> 
> 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 <https://petsc.org/release/install/install/#external-packages>
> [0]PETSC ERROR: Unknown vector type: nest
> [0]PETSC ERROR: See https://petsc.org/release/faq/ <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 <http://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 <http://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 <http://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 <http://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 <http://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/863aea23/attachment.html>


More information about the petsc-users mailing list