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

HalfSpace Command doesn't work #171

Open WenjieYao opened 6 years ago

WenjieYao commented 6 years ago

I'm having some trouble using --HalfSpace in scuff-ldos. To clarify the problem, my input command is: scuff-ldos --geometry HalfSpace.scuffgeo --EPFile EPFile --OmegaFile OmegaValues.dat --HalfSpace File_Silver.txt --SkipBZIntegration

The HaflSpace.scuffgeo file is just an empty file. The EPFile is 0 0 0.01. The output file I get is a EPFile.File_Silver.txt.DGFs file, but all the values are "nan", does anybody know how to fix this?

stevengj commented 6 years ago

@HomerReid, in this case, with a halfspace and no object, you presumably get a 0x0 matrix internally (because there is no discretized surface — it is just asking for the semi-analytical halfspace Green's function). Probably there is some code missing to handle this corner case.

@WenjieYao, maybe a workaround would be to put in a "dummy object" — just an object made of air (the same as the ambient) medium, located far from the source and the metal halfspace). It shouldn't affect the solutions in principle, but in practice it will let the code run with a nontrivial matrix size.

HomerReid commented 6 years ago

Hi folks---thanks for this bug report, and I regret my long delay in addressing it. The reason for my sluggish response is that I am actually just finishing a major overhaul and upgrade of SCUFF-EM with a key new feature being implicit support for multilayer substrates, which will replace the existing calculation invoked by the --HalfSpace option to scuff-ldos, and significantly extend it as well (it is much faster and supports substrates with any number of layers of arbitrary frequency-dependent lossy materials). So, rather than debug the legacy --HalfSpace implementation which will be removed soon anyway, I would rather spend the time getting the new implementation in place. (Also, the --HalfSpace thing in scuff-ldos was never intended to be a useful calculational tool in its own right, more just a sanity check for comparison with the results of scuff-ldos on actual meshed structures, so getting it working for the case of an empty geometry is not a priority for SCUFF-EM---surely there must be many existing codes already optimized for this well-studied problem. Still, the code should do what it claims without crashing, and I realize you've been inconvenienced by this issue and will do my best to get you a working replacement soon.)

For the time being, what Steven suggested should be a good workaround---you could try a geometry consisting of just a single square (two triangles, one RWG basis function) located at z=+100 or something. Actually, for the --HalfSpace calculation the meshed geometry is barely even referenced, so pretty much any object should work fine.

Meanwhile, I'll keep you updated on the progress of the full-wave substrate release.

WenjieYao commented 6 years ago

I tried the methods as @stevengj suggested, but it doesn't work. To get none "nan" results, the .scuffgeo file must include "LATTICE.. END LATTICE" section, that is, the geometry must be periodic. However, the results in the output .LDOS file after the Brillouin zone integration are not right. image This is completely different from the results in the following paper as the electric LDOS goes to negative: https://arxiv.org/pdf/physics/0307018.pdf

By the way, the figure in the LDOS example is also wrong. image The LDOS values are too large since the vacuum LDOS is usually of the order 10^4(m^-3s)=10^-14(um^-3s). Also, the total LDOS should goes below the vacuum LDOS above the plasmonic frequency as in Fig. 2 in the in the paper: image

@HomerReid Could you please check if there's any typo when you produce the figure here

I repeated the calculation using the Brillouin zone integration method for the Aluminum, and I got the following result: image It looks similar to the Fig. 3 in the paper, but the amplitudes are slightly different.

For example, my electric LDOS is around 10^4 for small frequency, but in the paper, it is around 6*10^3.

stevengj commented 6 years ago

Did you remember the --SkipBZIntegration flag for the non-periodic case?

WenjieYao commented 6 years ago

Yes, adding the --SkipBZIntegration will give "nan" results.

xinchenee commented 4 years ago

just want to follow up. Do we have a solution for this? Anyone can reproduce the plot of Aluminum LDOS in the tutorial?