Issue of saving txt file


I am working on a steady NS equation (with low Reynolds number and fixed-point method) and trying to save the nodal result as .txt:

ofstream uxfile("sample_u_"+j+".txt");
uxfile << u[] << endl;
ofstream uyfile("sample_v_"+j+".txt");
uyfile << v[] << endl;
ofstream pfile("sample_p_"+j+".txt");
pfile << p[] << endl;

But it turns out to be that all the u.txt, v.txt and p.txt has exactly the same data despite that I assigned different values to them. Could you help me with it? I attach the code here:
try.edp (2.9 KB)

Thank you!

[u,v,p] is a vectorial FE object. I contains all the degrees of freedom. You cannot access it like that. The structure is illustrated by the following:

[u,v,p] = [1,2,3];
for [i, ui : u[]] cout << "i=" << i << ", u[i]=" << ui << endl;