Stabilized Mean Curvature performance

Hi,

I was trying to implement the computation of the mean curvature vector as done in this article for meshed surfaces. It employs a CIP type stabilization that penalizes the gradient jump across facets and I am dealing with it introducing an additional facet variable in an HDG manner. I know I am here using NgSolve in a not so standard way but the stabilized algorithm execution time is quite slower than I expected with respect to the non-stabilized one.

I was thus wondering if you had any suggestion on how to speed up the code. I attach here a script where I compute both and compare the execution times
mc_performance.py (3.0 KB)

Thanks a lot for any tip!

the JacobianMatrix only provides scalar evaluation, it is not simd-vectorized. This is the main reason for lower performance of the second method.
If you want a good speedup, implement a vectorized version of it.

Second, you define a J and a F matrix - both are Jacobians on the surface mesh - what do you expect these matrices to be ?

Joachim

1 Like

Hi Joachim,

thanks a lot for the help! Yes so I am defining that h_f since I was trying to define something like specialcf.meshsize but for surfaces. I have read on the forum that specialcf.meshsize takes the ratio between the element area and the edge length, which is the correct h to use for anisotropic meshes (see here). The reason I tried a different one in that the convergence study on the second method, which is supposed to converge with first order, seemed to have a scaling problem on the h parameter that was solved by using that h_f.
In case NgSolve automatically does that already for surfaces then I fear there must be a bug in my code.

Alessandro