<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear Jose,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Many thanks for the guidance. I haven't yet extensively tested the program, but I will cautiously </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
claim that it seems to be working</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
on the small test problem described below (i.e. a small modification of your ex1f.F program). I am currently</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
using version 3.20, but I will upgrade to 3.22 when it comes out.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
For the Laplace problem with n=50 , using the gd method and seeking to find the two leading eigenmodes (nev=2)</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
using a space of dimension ncv = 30, with default tolerance, <b>on the first solution </b></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>(using a randomized initial subspace) the algorithm requires 91 iterations to converge</b>,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
whereas for the <b>second solution (using the previous solution invariant subspace as an initial subspace)</b></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>it finds the solution in 2 iterations.</b></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Many thanks once again and best wishes,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dan.</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
>The Fortran interface is not fully tested. In particular, this function is not employed in any of the Fortran examples.<br>
<br>
>The Fortran interface has undergone successive improvements in recent times. I have tried the following:<br>
<br>
> Vec, pointer :: subspace_receive(:)<br>
> ...<br>
> PetscCall(EPSGetConverged(eps, nconv, ierr))<br>
> PetscCall(MatCreateVecs(A, PETSC_NULL_VEC, xr, ierr))<br>
> PetscCall(VecDuplicateVecsF90(xr, nconv, subspace_receive, ierr))<br>
> PetscCall(EPSGetInvariantSubspace(eps, subspace_receive, ierr))<br>
> ...<br>
> PetscCall(VecDestroyVecsF90(nconv, subspace_receive, ierr))<br>
> PetscCall(VecDestroy(xr, ierr))<br>
<br>
>I have tested this in the 'main' branch and it works as expected (note that 'main' will become version 3.22 in two weeks). You can try with version 3.21 and it may work, > probably not in older versions.<br>
</div>
<ul style="margin-top: 0px; margin-bottom: 0px;" data-editing-info="{"orderedStyleType":1,"unorderedStyleType":4}">
<li style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); list-style-type: "➢ ";">
Jose<br>
</li></ul>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
<br>
> El 16 sept 2024, a las 11:07, dazza simplythebest <sayosale@hotmail.com> escribió:<br>
><br>
> Dear All and Jose,<br>
> I am now trying to code up the extraction of the invariant subspace, but I seem to be running into<br>
> a compilation problem. I am using the slepc example file ex1f.F as a base, and have added the following lines:<br>
><br>
> !Declaration<br>
> Vec subspace_receive<br>
> .<br>
> .<br>
> .<br>
> ! Executed code (following EPSSolve)<br>
> call EPSGetConverged(eps,nconv,ierr); CHKERRA(ierr)<br>
> call VecDuplicateVecs(xr, nconv, subspace_receive, ierr); CHKERRA(ierr)<br>
> call EPSGetInvariantSubspace(eps, subspace_receive, ierr) ; CHKERRA(ierr).<br>
> .<br>
> .<br>
><br>
> However, I get the following compilation error when I include the call EPSGetInvariantSubspace(eps, subspace_receive, ierr) line:<br>
><br>
><br>
> minitest.F(133): error #8284: If the actual argument is scalar, the dummy argument shall be scalar unless the actual argument is of type character or is an element of an array that is not assumed shape, pointer, or polymorphic. [B]<br>
> call EPSGetInvariantSubspace(eps, subspace_receive, ierr) ; if (ierr .ne. 0) then;call PetscErrorF(ierr,133,"minitest.F");call MPIU_Abort(PETSC_COMM_SELF,ierr);endif<br>
> -----------^<br>
> compilation aborted for minitest.F (code 1)<br>
><br>
><br>
> If I comment out the call EPSGetInvariantSubspace(eps, subspace_receive, ierr) line the code compiles, links and runs successfully.<br>
> I presume that I must be making a silly mistake in the above lines, but I can't quite see what it is. (There is some discussion in the<br>
> manual of there being a different situation if the matrix is real but the eigenvalues are complex, but for this case the eigenvalues<br>
> are real). Can you offer any guidance ?! I can provide the whole code of course if that would help.<br>
> Many thanks and best wishes,<br>
> Dan.<br>
><br>
><br>
><br>
><br>
><br>
> From: Jose E. Roman <jroman@dsic.upv.es><br>
> Sent: Monday, September 2, 2024 7:06 AM<br>
> To: dazza simplythebest <sayosale@hotmail.com><br>
> Cc: petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
> Subject: Re: [petsc-users] How to create an array of vectors of type Vec (for use with slepc EPSGetInvariantSubspace)<br>
> You can use VecDuplicateVecs() to create an array of Vec.<br>
> Yes, you can use VecLoad() to read the data from a binary file.<br>
><br>
> Jose<br>
><br>
><br>
> > El 2 sept 2024, a las 8:56, dazza simplythebest <sayosale@hotmail.com> escribió:<br>
> ><br>
> > Dear All,<br>
> > I am seeking to perform a large number of eigenvalue calculations (related to a fluid dynamics<br>
> > problem) using the slepc framework. I have written the program that calls slepc and validated its solutions against<br>
> > known results for special cases - the Jacobi-Davidson iteration seemed to perform best on this problem.<br>
> > Since in the 'production-level' calculation I will step through a parameter space which should<br>
> > mean only small changes to the eigenproblem between each calculation, it seems to make sense<br>
> > to use the previous solution as the initial guess for the next calculation.<br>
> ><br>
> > The sequence to execute this strategy would seem to be:<br>
> > To write out the current soln subspace:<br>
> ><br>
> > call EPSGetInvariantSubspace<br>
> > [ call VecView -> binary file (if a file storage is required for possible restart)]<br>
> ><br>
> > To then read in this data to use it as the initial subspace for the next run:<br>
> ><br>
> > call EPSSetInitialSpace<br>
> ><br>
> > My question is that EPSGetInvariantSubspace needs an 'array of nconv vectors', how does one create<br>
> > such an array ? My understanding is that the Vec structure is just a one-dimensional array (with contents<br>
> > possibly scattered in non-contiguous memory locations !?) , so do we just need to create a long Vec<br>
> > that stores multiple vectors ? How can we do this (the examples I have seen thus far use a MatCreateVecs to specify the size<br>
> > of the Vec)?<br>
> ><br>
> > If loading such a subspace from a binary file (created maybe by VecView), presumably VecLoad is the<br>
> > best way to load such an array of vectors from the binary file ?<br>
> ><br>
> > Best wishes and many thanks,<br>
> > Dan.<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
</body>
</html>