Hello,
I want to access a second, and third order derivative of a DG testfunction. Is it supported in ngsolve?
Say, I have a third order derivative in the equation,
-u_xxx
and this leads to the cell-wise bilinear forms
(u_x, v_xx) or (u, v_xxx)
I tried
ux = u.Deriv()
uxx = ux.Deriv(),
but it seems not working…
Best,
Guosheng
Hi Guosheng,
Every finite element space can provide additional differential operators (on top of the evaluation, Deriv() and Trace()). In general there are no higher derivatives, but for H1 we have the DiffOp “hesse” that you can use for second order derivatives with (for v a TestFunction of an H1 FESpace):
hesse_v = CoefficientFunction(v.Operator("hesse"),dims=(mesh.dim,mesh.dim))
The operator gives you a vector of dimension d x d that I wrapped into a matrix.
For L2 it would work the same way, but it wasn’t provided for python so far.
It has just been added to the master. Check out the master branch at https://gitlab.asc.tuwien.ac.at/jschoeberl/ngsolve or wait for the nightly build.
For higher derivatives we don’t have a standard implementation so far. In that case you have to introduce auxiliary variables to represent higher derivatives or implement the DiffOp yourself.
Best,
Christoph
Hello Christoph,
I was wondering if the hessian for L2 has been enabled in python since this post?
If not, could you help me with an example where I can use an auxiliary variable to represent the higher derivatives?
Kind regards,
Yaw
You can find out the native differential operator, and all additional available operators of your NGSolve with:
gf = GridFunction(L2(mesh))
print ("native diffop:", gf.derivname)
print ("additional diffops:", gf.Operators())
Joachim