HomerReid / scuff-em

A comprehensive and full-featured computational physics suite for boundary-element analysis of electromagnetic scattering, fluctuation-induced phenomena (Casimir forces and radiative heat transfer), nanophotonics, RF device engineering, electrostatics, and more. Includes a core library with C++ and python APIs as well as many command-line applications.
http://www.homerreid.com/scuff-em
GNU General Public License v2.0
126 stars 50 forks source link

Problems using scuff-static to compute potentials #120

Open winger opened 8 years ago

winger commented 8 years ago

Hi Homer,

I'm trying to use scuff-static for electric field computation, but getting unexpected potential values even in simple setups.

For instance, here is a parallel plate capacitor model with two 1x1 unit plates 1 unit apart, 0V potential on the left plate and 1V on the right one. When I'm running scuff-static on this setup, I'm getting 1.000120V on the left plate, 2.020082V on the right plate and 1.428543V on the point exactly between them.

Any ideas what am I doing wrong? Thank you.

HomerReid commented 8 years ago

Fixed in d74fdb4. Thanks for discovering this bug and especially for taking the time to prepare a helpful bug report that allowed me to find and fix the problem quickly. (Thanks also for the pull request with the various fixes.)

winger commented 8 years ago

Thank you for fixing the problem so quickly. Now the potentials on the plates match those in the input. However, the potential between the plates is still off. By symmetry, it should be the average of the plates' potentials. Currently I'm getting the following results:

V(Left plate) V(Right plate) V(Point in the middle)
-1 1 0
0 1 0.4196420
1 0 0.4196420
100 101 84.35357
101 100 84.35357

Also, somewhat unrelated question: is there some internal metric for solution accuracy and if yes, how to see it? I did't find anything like that in the logs.

HomerReid commented 8 years ago

Your symmetry argument applies only to the case of infinite-width plates, neglecting the fringing-field effects associated with the finite plate size in this case. As an extreme example, suppose I took your finite-area plates (charged to voltages 100 and 101 V respectively) and separated them by 1 million miles. Then the potential in the vicinity of either plate would fall off like 1/(distance from plate) and would attain a value very close to 0 at the midpoint, not 100.5 volts.

I would encourage you to repeat your calculations using a series of progressively larger and larger plates at fixed plate-plate separation (or shorter and shorter plate-plate separation for fixed-area plates). You should see the results converging (slowly) toward what you expect for the infinite-area case.

Note that you can speed up your calculation by using infinitely thin sheets, not the finite-thickness slabs you are currently using. The finite-thickness slabs not only increase the computational cost by more than 2x (all the panels on the front surface are duplicated on the back surface) but also introduce inaccuracies due to the sharp corners and the triangles with bad aspect ratios on the sides.

Also, somewhat unrelated question: is there some internal metric for solution accuracy and if yes, how to see it? I did't find anything like that in the logs.

No, there is no internal metric. The standard procedure is to repeat calculations with increasingly finer meshes until the results converge.

winger commented 8 years ago

I see, it looks like you have an implicit boundary condition for potential being zero at infinity. Is there a way to compute the potentials without this boundary condition?

HomerReid commented 8 years ago

What alternative boundary condition did you have in mind? The conventional boundary condition used in integral-equation solvers is that the fields radiated by induced sources vanish at spatial infinity.