# Second derivative of numerical solution

Hello
I’m sorry to bother you. How does freeem + + calculate the Second derivative of numerical solution?
Thank you very much.

If the solution is finite element yes in general thought operator dxx, dyy, dxy, … otherwise no.

Assuming that u is the solution calculated by finite element method, I use dxx (u) to calculate all 0 .

It is a bug, so to debug,
can you say the version of freefeM++ and the type of finie element.

The version of freefeM++ is 4.10, the type of finie element is P1.

I just reinstalled freeem + + 4.11, but the calculated dxx (u) is still 0 .

I think you should use higher order elements - P1 means that the solution consists of first order polynomial basis functions, and the second derivative of a first order polynomial is zero.

When I use P2 or P3,the calculated dxx(u) is still 0.

I have tested of “P3” on mesh,MeshL,mshS,mesh3 dxx is ok,
and
I have tested of “P2” on mesh,MeshL,mesh3 dxx is ok,

on meshS you get assert not

``````  current line = 5
Assertion fail : (0)
line :248, in file ../femlib/P012_3dSurf.cpp
Assertion fail : (0)
line :248, in file ../femlib/P012_3dSurf.cpp
err code 6 ,  mpirank 0
logout

``````

the code :
testP2-P3.edp (222 Bytes)

func ue=-y^2exp(b1(x-1)/epsilon)-xexp(b2(y-1)/epsilon)-zexp(b3(z-1)/epsilon)+exp((b1*(x-1)+b2*(y-1)+b3*(z-1))/epsilon)+xy^2z^3;
fespace Vh (Th,P1);
Vh u,v;
problem Lap3d (u, v)
= int3d(Th)(
epsilon*(dx(u)dx(v)+dy(u)dy(v)+dz(u)dz(v))
)
+int3d(Th)(
(b1
dx(u)+b2
dy(u)+b3
dz(u))*v
)
- int3d(Th)(
f * v
)
+ on(0, 1, u=ue)
;

I’m sorry，I didn’t make it clear before,I want to caculate the second derivative of u，not of ue.

You want to compute the Hessian of u for doing mesh adaptation with mmg3.

It is not so simple because u is P1 , so de Hessian is just Dirac mass on edge of the mesh.
this is why we use real[int] met=mshmet(Th,u,hmin=1e-8,hmax=0.2,err=lerr,aniso=1);
`

Ok,thank you very much.