Composite finite element spaces with SLEPc

Dear FreeFEM community,

I have been trying the new feature composite finite element space, which seems quite powerful. However, when I attempted use a composite FE space together with EPSSolve, a problem arose: how to correctly create a finite element function to store the eigenvectors.

In previous examples, this is typically done with something like:

Wh<complex>[int] def(vec)(nev); // array to store eigenvectors

My question is: how should I create vec in the composite FE framework?
I tried to imitate the example examples/hpddm/navier-stokes-2d-SLEPc-complex.edp, but failed.

Here is my code attached, it reports an error:

   67 : complex[int]     val(nev);      // array to store eigenvalues
   68 : Xh<complex>
 Error line number 68, in file convection-FSI-composite-SLEPc.edp, before  token >
syntax error
  current line = 68 mpirank 0 / 1
Compile error : syntax error
	line number :68, >
error Compile error : syntax error
	line number :68, >
 code = 1 mpirank: 0

convection-FSI-composite-SLEPc.edp (1.8 KB)

Best regards,
H. Weng

This question has nothing to do with SLEPc, it’s a composite issue. This doesn’t work:

func PF = [P2, P2, P1];
func PT = P2;

mesh ThT = square(100,100);
mesh ThF = square(100,50,[x*0.5,y]);
fespace VhF(ThF, PF);
fespace VhT(ThT, PT);

fespace Xh(<VhF,VhT>);
Xh<complex>[int] vec;

Yes, maybe declaration of such type is not supported in the current FF version.
In my problem, is it possible to use an array like complex[int, int] vec(Xh.ndof, nev) to save the eigenvector?

Yes, that is enough.

I tried to create an array complex[int,int] to store eigenvector, then I got:

   73 : int nev = 2;
   74 : complex[int]     val(nev);      // array to store eigenvalues
   75 : //Xh<complex>[int] [[u1,u2,p],T](nev); // array to store eigenvectors
   76 : complex[int,int]   vec(Xh.ndof,nev);
   77 : 
   78 : 
   79 : complex s = getARGV("-shift_real", 1.0e0) + getARGV("-shift_imag", 1e-15) * 1i;
   80 : string params = "-eps_tol 1.0e-15 -eps_nev " + nev + " " +
   81 :     "-eps_ncv 40 -eps_type krylovschur -st_type sinver
  ... : t -eps_monitor_all " +
   82 :     "-eps_target_magniude -eps_target "+ real(s) + "+" + imag(s) + "i";
   83 : 
   84 : int k = EPSSolve(J, M, vectors = vec, values  = val, sparams = params)Impossible to cast <P3KNMISt7complexIdEE> in <13FEbaseArrayKnISt7complexIdEE>
	 (	  <13FEbaseArrayKnISt7complexIdEE> :   <11FEbaseArrayISt7complexIdE5v_fesE> )
	 (	  <13FEbaseArrayKnISt7complexIdEE> :   <St4pairIP11FEbaseArrayISt7complexIdE6v_fes3EiE> )
	 (	  <13FEbaseArrayKnISt7complexIdEE> :   <11FEbaseArrayISt7complexIdE6v_fes3E> )
	 (	  <13FEbaseArrayKnISt7complexIdEE> :   <St4pairIP11FEbaseArrayISt7complexIdE6v_fesLEiE> )
	 (	  <13FEbaseArrayKnISt7complexIdEE> :   <11FEbaseArrayISt7complexIdE6v_fesLE> )
	 (	  <13FEbaseArrayKnISt7complexIdEE> :   <St4pairIP11FEbaseArrayISt7complexIdE6v_fesSEiE> )
	 (	  <13FEbaseArrayKnISt7complexIdEE> :   <11FEbaseArrayISt7complexIdE6v_fesSE> )
	 (	  <13FEbaseArrayKnISt7complexIdEE> :   <St4pairIP11FEbaseArrayISt7complexIdE5v_fesEiE> )

 Error line number 84, in file FSI-composite.edp, before  token )

If I understand correctly, this suggests that EPSSolve only accepts the FEbaseArray type?
Could you please take another look? I’d really appreciate it!

Just look at SLEPc examples in examples/hpddm. You have to use another named parameter, not vectors.

I’ve reviewed all the SLEPc examples, and they consistently use FE function arrays like Vh[int], Vh<real>[int], or Vh<complex>[int]. As we’ve previously discussed, this type of declaration isn’t implemented for composite spaces yet. Perhaps composite space functionality isn’t fully mature at this stage? :confused:For now, I will go back to use block system.

Use the named parameter array.

For composite spaces involving different meshes, how is domain decomposition implemented? Specifically, when physical domains have overlapping regions, do they share the same decomposition?

The decomposition is done at the algebraic level (the matrix is decomposed into stripes of contiguous rows, like a typical PETSc Mat).