[petsc-users] How to create an array of vectors of type Vec (for use with slepc EPSGetInvariantSubspace)

Jose E. Roman jroman at dsic.upv.es
Mon Sep 2 02:06:06 CDT 2024


You can use VecDuplicateVecs() to create an array of Vec.
Yes, you can use VecLoad() to read the data from a binary file.

Jose


> El 2 sept 2024, a las 8:56, dazza simplythebest <sayosale at hotmail.com> escribió:
> 
> Dear All,
>            I am seeking to perform a large number of eigenvalue calculations (related to a fluid dynamics
>  problem) using the slepc  framework. I have written the program that calls slepc and validated its solutions against 
>  known results for special cases - the Jacobi-Davidson iteration seemed to perform best on this problem.
>  Since in the 'production-level' calculation I will step through a parameter space which should 
> mean only small changes to the eigenproblem between each calculation, it seems to make sense
>  to use the previous solution as the initial guess for the next calculation.
> 
>  The sequence to execute this strategy would seem to be:
> To write out the current soln subspace:
> 
> call EPSGetInvariantSubspace
> [ call VecView   -> binary file (if a file storage is required for possible restart)]
> 
> To then read in this data to use it as the initial subspace for the next run:
> 
> call  EPSSetInitialSpace
> 
> My question is that EPSGetInvariantSubspace needs an 'array of nconv vectors', how does one create
>  such an array ? My understanding is that the Vec structure is just a one-dimensional array (with contents 
>  possibly scattered in non-contiguous memory locations !?) , so do we just need to create a long Vec 
>  that stores multiple vectors ? How can we do this (the examples I have seen thus far use a MatCreateVecs to specify the size
>  of the Vec)?
> 
> If loading such a subspace from a binary file (created maybe by VecView), presumably VecLoad is the
>  best way to load such an array of vectors from the binary file ?
> 
>  Best wishes and many thanks,
>                                             Dan.




More information about the petsc-users mailing list