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
125 stars 50 forks source link

issue running CasimirSpheres under TestSuite #147

Closed cyhng closed 6 years ago

cyhng commented 7 years ago

Dear Homer, Suppose I want to calculate the long range Casimir force between two sphere at room temperature, what can I do to improve my results? I used the folder CasimirSpheres under TestSuite at main branch as example.

I ran your code with following arguments. CODE=${DIRBASE}/scuff-cas3D

ARGS="" ARGS="${ARGS} --geometry PECSpheres_327.scuffgeo" ARGS="${ARGS} --TransFile Spheres.trans" ARGS="${ARGS} --Energy" ARGS="${ARGS} --Temperature 300" ARGS="${ARGS} --RelTol 1.0e-5"

${CODE} ${ARGS}

I obtained a plot like this casimirspheresexample

The magnitude of force at long range doesn't decrease at all. Any tips for us?

Best regards, Henry Ng

cyhng commented 7 years ago

wrong energy unit, it should be hbar c / micron

HomerReid commented 7 years ago

At very large separations the --energy calculation is inherently inaccurate for numerical reasons---it is subtracting two large numbers that are nearly equal to each other (namely, the total energy of the spheres at the given separation, minus the total energy at infinite separation) and beyond a certain distance the signal will be swamped by numerical noise coming from numerical cancellation.

There is a command-line option called --NewEnergyMethod that tries to reorganize the calculation in such a way as to reduce these errors. You might consider giving that option a try and seeing if it works better for you. However, my experience is that it doesn't make much of a difference.

The correct thing to do here is simply to compute --zforce instead of --energy. The force calculation uses a different algorithm that avoids the catastrophic loss of numerical precision in the energy. If you really need energy data, you can always just integrate the force data starting from 0 at infinite separation.

Feel free to ask more questions, or close the issue if satisfied.

cyhng commented 6 years ago

thanks for the help