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

dazza simplythebest sayosale at hotmail.com
Mon Sep 2 02:33:20 CDT 2024


Dear Jose,
                Many thanks for your speedy response ... and of course for creating this great software. The
VecDuplicateVecs does seem to be the routine I was looking for!
     Best wishes,
                        Dan.

________________________________
From: Jose E. Roman <jroman at dsic.upv.es>
Sent: Monday, September 2, 2024 7:06 AM
To: dazza simplythebest <sayosale at hotmail.com>
Cc: petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] How to create an array of vectors of type Vec (for use with slepc EPSGetInvariantSubspace)

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.


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


More information about the petsc-users mailing list