Hello,
I ran into an apparent accuracy problem with NGSolve, I wonder if there is some mistake in the way I am using NGSolve or else if there is a workaround for this.
To debug this, I made a simple test case with a known analytic solution: capacitance calculation of a parallel plate capacitor. The attached .py file creates two parallel plates 1 distance unit apart with an area 1x1 unit^2 each. The solution of the Laplace equation is a simple linear potential distribution, the field (-grad u) is a constant 1 between the plates and 0 outside.
The potential distribution calculated by NGSolve looks ok, the field defined as gfE.Set( -grad(gfu)) is less clean (a bit noisy) but otherwise doesn't look wrong. However, when I calculate surface integrals of normal field at the two electrodes I get ~0.5 instead of 1. This is how I calculate the integrals in the attached .py:
charge = (Integrate(sqrt((gfE*normals)**2), mesh, definedon=mesh.Boundaries(electrodes
)))
Any idea what is going on and how to improve the accuracy of this calculation?
Thanks and regards,
Valery