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

scuff-static Problem------------I already figured it out. Thanks #111

Closed wmkwmkwmk closed 7 years ago

wmkwmkwmk commented 7 years ago

I encounter trouble when I try to simulate a very easy question by using scuff-static. I put the files into the attachment, hope you could help me to figure it out when you are convenient.(I think it is due to I'm not so familiar with scuff's default setting)

The problem is that I try to simulate a 2 by 2 by 0.1(I don't know the unit here) parallel plates capacitor which has 0.1 separations. The mesh file is in "Parallel_C.scuffgeo", where I use LATTICE(periodic condition) to make the field inside uniform.

LATTICE
       VECTOR 2 0
       VECTOR 0 2
ENDLATTICE

OBJECT Upper
     MESHFILE upper_plate.msh
     MATERIAL PEC
ENDOBJECT

OBJECT Lower
     MESHFILE lower_plate.msh
     MATERIAL PEC
ENDOBJECT

First of all, I run "Parallel_C.args" to get capacitance matrix which is in "MyC_Matrix.dat". However, I find elements of (0,0)(1,1) is not 0(I set the two plates to be PEC, so I think the capacitance should be 0). And element of (0,1) is -4.49e+01 instead of the theoretical value 3.5e-10. Is there any mistake or unit is different?

# data file columns: 
#1 transformation label
#2: C_{0,0} 
#3: C_{0,1} 
#4: C_{1,1} 
5.037309e+01 -4.490645e+01 5.039747e+01 

Secondly, I run "Parallel_C_1.args" to add 1V and 0V potential to these two plates. Then I get "MyPlot.pp" for the surface charge density which is from -26.6~25.9. That is also not same with the theoretical prediction.

Finally, I run "Parallel_C_2.args" to get the Potential and E.xyz at the center of the capacitor. The results are in the file "EP_point.out". You can see the potential is 1.5V instead of 0.5V. However, Ez is reasonable, near to -10V/m.

# data file columns: 
#1, 2, 3: x, y, z (evaluation point coordinates)
#4      : Phi      (electrostatic potential)
#5, 6, 7: Ex,Ey,Ez (electrostatic field components)
0.000000e+00 0.000000e+00 1.500000e-01 1.502247e+00 6.550406e-04 -1.250817e-03 -9.564901e+00

I tried to figure it out by myself, but I cannot find a similar example to imitate. (seems example"Self- and mutual-capacitance of irregularly shaped conductors" cannot be opened functionally).

I hope you can tell me what happened here. Thanks a lot.

Parallel capacitor_1.zip

wmkwmkwmk commented 7 years ago

I checked the example "Casimir force in a 1D extended geometry" and the description for geometry setting. Should I remove the surfaces that straddle the unit-cell boundary for using LATTICE in scuff-static?

To make it simple, I removed the LATTICE command(periodic condition) in .scuffgeo and run it again. However the results didn't change a lot.

wmkwmkwmk commented 7 years ago

Inspired by issue #55, I change my "Parallel.scuffgeo" as follow:

SURFACE Upper
        MESHFILE Plate.msh
       DISPLACED 0 0 0.2
ENDSURFACE
SURFACE Lower
        MESHFILE Plate.msh
ENDSURFACE

In this way, I can create two 2 by 2 by 0.1 plates separated by 0.1.

And I try to add "Move.trans" file:

TRANS 0.1 OBJECT Upper DISP 0 0 0
TRANS 0.2 OBJECT Upper DISP 0 0 0.1
TRANS 0.3 OBJECT Upper DISP 0 0 0.2
TRANS 0.4 OBJECT Upper DISP 0 0 0.3
TRANS 0.6 OBJECT Upper DISP 0 0 0.5
TRANS 1.0 OBJECT Upper DISP 0 0 0.9

In this way, the two 2 by 2 by 0.1 plates will be separated from 0.1 to 1.0;

Then I run "Parallel_trans.args" file:

geometry Parallel.scuffgeo
TransFile Move.trans
CapFile CapacitanceMatrix_trans.dat

The results "CapacitanceMatrix_trans.dat" are strange:

data file columns: 
1 transformation label
2: C_{0,0} 
3: C_{0,1} 
4: C_{1,1} 
5.136731e+01 -4.588777e+01 5.135342e+01 
5.136731e+01 -4.588777e+01 5.135342e+01 
5.136731e+01 -4.588777e+01 5.135342e+01 
5.136731e+01 -4.588777e+01 5.135342e+01 
5.136731e+01 -4.588777e+01 5.135342e+01 
5.136731e+01 -4.588777e+01 5.135342e+01 

It dosen't have label column and every result is same.

Hope this information is helpful for solving my problem. BTW, I add all of the related files in the attachment. Parallel capacitor_Trans.zip

HomerReid commented 7 years ago

Thanks for your bug report. The problems you pointed out were minor but real, and certainly the output you were getting didn't make much sense.

In d27e992 I have fixed the issues you were experiencing, so capacitance vs. distance output makes sense now.

Also, I have finished the tutorial example on capacitance calculation:

http://homerreid.github.io/scuff-em-documentation/examples/TwoBodyCapacitor/TwoBodyCapacitor/

This should make clear how to do what you want.

Note: One issue with your original geometry is that the SCUFF-EM electrostatics module doesn't support periodic geometries. I have added an error message to the code so that it now barfs when given periodic geometries.