# Apply different solution on the same mesh

Hi to all,

i try to estimate the H1-seminorm error of my solution, but unfortunatly i haven’t the analytical solution.

So i calculate my solution on a very dense mesh “mesh1” (around 170k vertices) to obtain the “real” one and after calculate it on a mesh “mesh2” with the same geometry but less dense (around 2000 vertices).

Now i want to compare the value of the “real” solution and the other solution in EACH VERTICES OF THE “mesh2”.
But seems that the program takes just the first 2000 value of the real solution, and not the ones in the same position. In detail i use this piece of code:

err = sqrt( int2d(Th2)((dx(U2_exact) - dx(u2))^2) + int2d(Th2)((dy(U2_exact) - dx(u2))^2) );

How can i apply my “real” solution on a mesh that have less vertices?

Thanks to everyone

let call u1 is the solution on mesh Th1, u2 is the solution on mesh Th2

You can compute

``````real err2 = sqrt( int2d(Th2)((dx(u1) - dx(u2))^2) + int2d(Th2)((dy(u1) - dx(u2))^2) );
real err1 = sqrt( int2d(Th1)((dx(u1) - dx(u2))^2) + int2d(Th1)((dy(u1) - dx(u2))^2) );

``````

and err1 is better because the mesh Th1 is very fine.

ok but u1 have much more element wrt u2.

when i subtract u2 from u1 in the integral basically i take the value of the solution in each vertex of the mesh and perform the subtraction “one by one”.

My question is: the algorithm takes the value of u1 calculated in the same position “(x_vertex, y_vertex)” of u2 or take just the first 2000 value saved inside the solution (in different position)?

when iyou subtract u2 from u1 in the integral basically to take the value at the quadrature points at the quadrature point of each triangle and this depend of the term `int2d(Th2)` or `int2d(Th1)`

So, performing the error as you have proposed before, accepting the fact that my “real” solution is not strictly the real one but just an approximation, i obtain a reasonable estimate of the H1-seminorm?

Thanks you prof. @frederichecht

Now to be sure you can make test for a solution we a exact solution in compare both erreur.

unfortunatly i don’t have any exact solution for checking the result… for this reason is very important that this error is acceptable

No, to understand try thy technique on same problem with a manufactured solution.

Oh ok now i understand!

I try this method on a very simple problem (2D Poisson problem) in which i know the analitycal solution and the result are more or less the same.

So yes, this method is a good techique to estimate error when exact solution is not available.

Many thanks professor @frederichecht

Ok, good think. I close this discussion.