victorliu / S4

Stanford Stratified Structure Solver - Electromagnetic simulator for layered periodic structures
http://www.stanford.edu/group/fan/S4/
GNU General Public License v2.0
131 stars 149 forks source link

On entry to ZGEBAL parameter number 3 had an illegal value #88

Closed KappaGO closed 5 years ago

KappaGO commented 5 years ago

Hi! I am running S4 on Centos7, but the program can not completely run and signals an error : "On entry to ZGEBAL parameter number 3 had an illegal value". For example, when I want to simulate transmission of 400 different wavelength points, it may stop at the 200th point. And the point of stopping each time is not the same. I am confused about this issue and look forward to your help. The code is attached below.

---- main program ----

um = 1; -- unit um nm = um*1e-3;

a = 270; nSiO2 = 1.45; lattice = anm; d = 80nm; dSiO2 = 115nm; R = 240nm/2;

dofile("data.lua");

io.output("Blue.txt")

for wLi = 1, #wLength, 1 do wi = wLength[wLi]; wavelength = wi*nm; npolySi = n_polySi[wLi]; kpolySi = k_polySi[wLi]; naSi = n_aSi[wLi]; kaSi = k_aSi[wLi]; ncSi = n_cSi[wLi]; kcSi = k_cSi[wLi];

S = S4.NewSimulation()
S:SetLattice({lattice*1,0}, {lattice*0.5,lattice*0.5*math.sqrt(3)})
S:SetNumG(70)

S:AddMaterial("Vacuum", {1,0})
S:AddMaterial("SiO2", {nSiO2*nSiO2,0})
S:AddMaterial("polySi", {npolySi*npolySi-kpolySi*kpolySi, 2*npolySi*kpolySi})
S:AddMaterial("aSi", {naSi*naSi-kaSi*kaSi, 2*naSi*kaSi})
S:AddMaterial("cSi", {ncSi*ncSi-kcSi*kcSi, 2*ncSi*kcSi})

S:AddLayer('Layer_Above',0,'Vacuum')
S:AddLayer('Slab', d, 'polySi')
S:SetLayerPatternCircle('Slab','Vacuum',{0,0},R)
S:AddLayer('Quartz',dSiO2, 'SiO2')
S:AddLayer('Layer_Below',0, 'polySi')

S:SetExcitationPlanewave({0,0},{1,0},{0,0})    
S:SetFrequency(1/wavelength)

incidence_flux, reflection_flux = S:GetPoyntingFlux('Layer_Above', 0);
transmission_flux = S:GetPoyntingFlux('Layer_Below', 0);
transmission = transmission_flux / incidence_flux;

io.write(wi .. '\t' .. transmission .. '\n')

end
io.output():close()


data.txt

jmllorens commented 5 years ago

Hi!, You can try to set the Simulation:UseDiscretizedEpsilon() It is more stable than the analytical FT.

KappaGO commented 5 years ago

Thank you very much @jmllorens! It can completely run now.