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

Problem of using scuff-neq to calculate the infinite half-space #196

Open huabanxuyan opened 5 years ago

huabanxuyan commented 5 years ago

Hi Homer,

I want to calculate the heat transfer between two semi-infinite parallel planes. I understand that two large cylinders can be set to approximate the semi-infinite case, but this will result in the required huge computation time and memory, and I also have some concerns about precision. So I want to set the .scuffgeo structure file such as the example of the infinite-area thin film as follows: image

Similarily, the configuration of my structure file is based on the setting of the multi-layer structure as follows: image

However, there is an error when running scuff-neq with this structure settings. The prompt is: Segmentation fault 11. image

And here is the .log file:

QQ图片20190423200424

Could you tell me where the problem is? I have been troubled by this problem for several days. It would be very helpful if you give any feedback. Thank you very much for your help!

Best wishes, Frank

jmllorens commented 5 years ago

Hi Frank,

A Segmentation Fault is related to a memory problem, therefore the origin of such a problem is difficult to guess. Perhaps is the compilation of your code or a problem with the input. If you share your input files, I could test whether I get a segfault as well.

As an alternative, you could compile a debug version and try to debug the program to find out where the problem happens. To do that, you should run configure with the flag --enable-debug. Later run

gdb scuff-neq
run
backtrace

backtrace will show you the chain of function calls to identify what had happened before the segfault. Hope this helps.

José.

huabanxuyan commented 5 years ago

Hi José,

Thanks for your suggestion. Since I am not so quite familiar with this, it would be very helpful if you can do the test for me. Here is the command line:

Scuff-neq --geometry doubleplate.scuffgeo --OmegaFile OmegaFile –EPFile EPFile

And the input files are in the attached ZIP. InputFile.zip

Thank you for your kind help!

Frank

jmllorens commented 5 years ago

Hi Frank, I also get the segfault. From gdb you can see that the problem is in the kBloch call. It is passed as a null pointer (0x0), therefore the calculation of BPF trigers a segfault.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6cbda78 in scuff::StampInNeighborBlock (B=0x555555792820, GradB=0x0, NR=96, NC=96, M=0x5555557925e0, GradM=0x0, 
    RowOffset=0, ColOffset=0, L=0x7fffffffc3e0, kBloch=0x0, UseSymmetry=true) at AssembleBEMMatrix.cc:82
82        cdouble BPF=exp( II*(kBloch[0]*L[0] + kBloch[1]*L[1]) );

This is a copy of the backtrace:

(gdb) backtrace
#0  0x00007ffff6cbda78 in scuff::StampInNeighborBlock (B=0x555555792820, GradB=0x0, NR=96, NC=96, M=0x5555557925e0, GradM=0x0, 
    RowOffset=0, ColOffset=0, L=0x7fffffffc3e0, kBloch=0x0, UseSymmetry=true) at AssembleBEMMatrix.cc:82
#1  0x00007ffff6cbfaaa in scuff::RWGGeometry::AssembleBEMMatrixBlock (this=0x555555776b50, nsa=0, nsb=0, Omega=..., kBloch=0x0, 
    M=0x5555557925e0, GradM=0x0, RowOffset=0, ColOffset=0, Accelerator=0x0, TransposeAccelerator=false, NumTorqueAxes=0, dMdT=0x0, 
    GammaMatrix=0x0) at AssembleBEMMatrix.cc:505
#2  0x000055555555a095 in WriteFlux (SNEQD=0x5555557769d0, Omega=..., kBloch=0x0) at WriteFlux.cc:244
#3  0x0000555555558bc1 in main (argc=7, argv=0x7fffffffcf38) at scuff-neq.cc:279

From the very beginning (read bottom to top) kBloch is 0x0 (see #2). I don't have much experience wih scuff, but it seems that the input file has a problem, because the extended geometry is not handled properly.

José.

CCherqui commented 5 years ago

What version of gmsh do you have installed?

huabanxuyan commented 5 years ago

@jmllorens Hi José,

I found that it is because the command "scuff-neq" does not support the integration in Brillouin zone like other commands, such as "scuff-cas3d" and "scuff-ldos". That's why when I import the geometry file with a periodic geometry, it will returns the "Segmentation fault 11".

So I have no idea what we can do if we want to calculate the extended geometries with the "scuff-neq". Actually it's a very basic and important situation in calculating the near-field heat transfer. I have tried to use a huge structure to approximate the semi-infinite case, but the time and memory consuming is so horrible. If you have any idea to solve this problem, it will be very very helpful for me!

Thanks a lot for your help!

Frank

huabanxuyan commented 5 years ago

@CCherqui

Hi,

My gmsh version is 3.0.9. Actually I have met trouble when using the newest version of gmsh, so I changed it to a old version. And after that it works well.

Frank