Exporting vector-space Eigenvectors

I’d like to export the results of an Eigenanalysis that produces Eigenvectors with three components at each DoF location. I designate these Eigenvectors [eVec1,eVec2,eVec3] (see attached .edp).

I tried to export them using ffSaveData3, and found unexpected behaviour: the output file has three identical columns (see also screen output in the .edp). Also, the number of rows in the output file is 3813, the same as the ‘dimension of the system’ reported by the eigensolver, i.e. 3x the expected dimension of each Eigenvector component.

On the other hand, if I define FE arrays uxr, uyr and uzr as the real parts of eVec1, eVec2 and eVec3 (for one given eigensolution), I obtain entities with the expected dimension (1271 here; screen output again). Their entries correspond to the real parts of rows 3k (uxr), 3k+1 (uyr), 3k+2 (uzr) in the eVec1 output.

Finally, if I directly extract the corresponding normal arrays vxr, vyr and vzr from eVec1, eVec2 and eVec3, they have 3813 entries.

My immediate problem is how best to export the Eigenvectors. However, I’d also like to understand better how the variables are stored, and what the rules are for manipulating them.

mwe.edp (2.7 KB)

ffmatlib.idp (2.4 KB)

You have to understand how the fespace functions are stored in terms of degrees of freedom.

When you consider fespace functions with several components, as in

fespace Vh(Th, [P2, P2, P2]);
Vh [u1, u2, u3];

you have that the fespace function [u1, u2, u3] has 3*ndof degrees of freedom, with ndof the numbers of degrees of freedom of P2. To it corresponds a vector of dofs with this dimension, that can be obtained by u1[], u2[] or u3[]. It is important to understand that each of these three calls gives the same full vector of 3*ndof values.If you want to access to only the first component, you have to write

fespace Vh1(Th,P2);

Vh1 w1,w2,w3;

w1=u1;w2=u2;w3=u3;

Then w1[] gives the vector of ndof values corresponding to the first component,

w2[] gives the vector of ndof values for the second component, etc.

In your case you have overall the index corresponding to each eigenvector, but the principle is the same.

Thank you; that’s very helpful. I looked quite carefully in the documentation, but didn’t find this stated explicitly.

You can see it at

at the last line (but written quite shortly !)