Dear Friends,
I want to know how I can save values of a primal variable from a mixed fem formulation, for example:
mesh Th=square(3,3);
fespace Vh(Th, [P1,P1]);
Vh [u, v];
func real initialize() {
real value1 = 1.0, value2 = -1.0;
if( x>=0.25 && x<=0.75 && y>=0.25 && y<=0.75 ) return value1;
else return value2;
}
[u, v] = [initialize(), 0.5];
/* Print results */
for(int i=0; i<Vh.ndof; ++i)
cout << " u = "<< u[][i] << endl;
Result:
Square mesh : nb vertices =16 , nb triangles = 18 , nb boundary edges 12
u = -1
u = 0.5
u = -1
u = 0.5
u = -1
u = 0.5
u = -1
u = 0.5
u = -1
u = 0.5
u = 1
u = 0.5
u = 1
u = 0.5
u = -1
u = 0.5
u = -1
u = 0.5
u = 1
u = 0.5
u = 1
u = 0.5
u = -1
u = 0.5
u = -1
u = 0.5
u = -1
u = 0.5
u = -1
u = 0.5
u = -1
u = 0.5
times: compile 0.026953s, execution 0.003083s, mpirank:0
CodeAlloc : nb ptr 3463, size :466120 mpirank: 0
Ok: Normal End
The result shows the output of the two variables, but how can I save only the variable of interest “u”