diff --git a/DiffractionGratings/grating3D.pro b/DiffractionGratings/grating3D.pro index 3dee265d5f3fb82071eb12e1eb31c14ec346dd4a..7908e3c0ce49031e2e2ffa649999f1fe070a7253 100644 --- a/DiffractionGratings/grating3D.pro +++ b/DiffractionGratings/grating3D.pro @@ -335,7 +335,8 @@ PostProcessing { { Name epsr_xx; Value { Local { [ CompXX[epsr[]] ]; In Omega; Jacobian JVol; } } } { Name Damp_pml_top; Value { Local { [Damp_pml_top[] ]; In Omega; Jacobian JVol; } } } { Name Poy_tot; Value { Local { [ 0.5*Re[Cross[{u}+E1[] , Conj[ H1[]-I[]/(mur[]*mu0*om0)*{Curl u}]]] ]; In Omega; Jacobian JVol; } } } - + { Name lambda_step ; Value { Local { [ lambda0/nm ]; In Omega ; Jacobian JVol; } } } + For k In {2:6} { Name Abs_L~{k} ; Value { Integral { [ ep0*om0 * 0.5*Im[CompXX[epsr[]]]*(SquNorm[{u}+E1[]]) / (Pinc*period_x*period_y) ] ; In L~{k} ; Integration I1 ; Jacobian JVol ; } } } EndFor @@ -439,6 +440,7 @@ PostOperation { Print[ numbering_ij~{i}~{j}[SurfIntBot], OnRegion SurfIntBot, File > StrCat[myDir,"numbering_ij.txt"], Format Table ]; EndFor EndFor + Print[ lambda_step, OnPoint{0,0,0}, Format Table, File > StrCat[myDir, "temp_lambda_step.txt"], SendToServer "GetDP/Lambda_step" ] ; } } } diff --git a/DiffractionGratings/grating3D_postplot.py b/DiffractionGratings/grating3D_postplot.py index 57c3fa58549dfbaa725399f493677c687bd83158..3abf0c89ee825e5ab8f5913be5e72b330b225d30 100644 --- a/DiffractionGratings/grating3D_postplot.py +++ b/DiffractionGratings/grating3D_postplot.py @@ -1,14 +1,37 @@ import numpy as np +import matplotlib.pyplot as pl import sys myDir = sys.argv[1] # myDir = res3D -Rnm = np.loadtxt(myDir+'eff_r.txt')[:,1] -Tnm = np.loadtxt(myDir+'eff_t.txt')[:,1] -Q = [np.loadtxt(myDir+'temp-Q_L_%g.txt'%k)[1] for k in range(2,7)] -Q.append(np.loadtxt(myDir+'temp-Q_scat.txt')[1]) +Rnm = np.loadtxt(myDir+'/eff_r.txt',ndmin=2)[:,1] + 1j*np.loadtxt(myDir+'/eff_r.txt',ndmin=2)[:,2] +Tnm = np.loadtxt(myDir+'/eff_t.txt',ndmin=2)[:,1] + 1j*np.loadtxt(myDir+'/eff_t.txt',ndmin=2)[:,2] +Q = [np.loadtxt(myDir+'/temp-Q_L_%g.txt'%k,ndmin=2)[:,1] for k in range(2,7)] +Q.append(np.loadtxt(myDir+'/temp-Q_scat.txt',ndmin=2)[:,1]) Q=np.array(Q) -TOT = Rnm.sum()+Tnm.sum()+Q.sum() -print('Rtot',Rnm.sum()) -print('Ttot',Tnm.sum()) +TOT = Rnm.real.sum()+Tnm.real.sum()+Q.sum() +print('Rtot',Rnm.real.sum()) +print('Ttot',Tnm.real.sum()) print('Atot',Q.sum()) -print('TOT ',TOT) \ No newline at end of file +print('TOT ',TOT) + +if myDir[6:]=='solarcell': + Nmax=2 + tab_lambdas=np.loadtxt(myDir+'/temp_lambda_step.txt',ndmin=2)[:,8] + nb_lambdas=len(tab_lambdas) + Rnm = Rnm.reshape((nb_lambdas,2*Nmax+1,2*Nmax+1)) + Tnm = Tnm.reshape((nb_lambdas,2*Nmax+1,2*Nmax+1)) + Rtot = [Rnm[i].real.sum() for i in range(nb_lambdas)] + Ttot = [Tnm[i].real.sum() for i in range(nb_lambdas)] + Abs_rods = Q[-1] + Abs_ITO = Q[0] + Abs_subs = Q[2]+Q[3]+Q[4]+Ttot + pl.figure() + pl.plot(tab_lambdas,Abs_ITO,label='absorption ITO electrode') + pl.plot(tab_lambdas,Abs_rods,label='absorption in Si rods') + pl.plot(tab_lambdas,Abs_subs,label='absorption in Si subs') + pl.plot(tab_lambdas,Rtot,label='reflection') + pl.legend() + pl.xlabel('$\lambda$ [nm]') + pl.ylabel('fraction of incident energy') + pl.savefig('solar_balance.pdf') + pl.show() \ No newline at end of file diff --git a/DiffractionGratings/grating3D_runall.sh b/DiffractionGratings/grating3D_runall.sh index c7ef996eeff15bb7b1fbf1906408e11052580e46..c75dc58ad1f3c823f8decb19cdbd78cfe7c733c8 100644 --- a/DiffractionGratings/grating3D_runall.sh +++ b/DiffractionGratings/grating3D_runall.sh @@ -1,13 +1,13 @@ GMSHDIR="/home/demesy/programs/gmsh-4.4.1-Linux64/bin" -for t in bisin checker halfellipsoid hole pyramid torus 2Dlamellar +for t in bisin checker halfellipsoid hole pyramid torus 2Dlamellar solarcell do $GMSHDIR/gmsh grating3D.pro -setstring test_case $t - mv res3D res3D_$t done -for t in bisin checker halfellipsoid hole pyramid torus 2Dlamellar +for t in bisin checker halfellipsoid hole pyramid torus 2Dlamellar solarcell do $GMSHDIR/gmsh grating3D.geo -setstring test_case $t res3D_$t/*.pos & echo "\n"$t - python grating3D_postplot.py res3D_$t/ + python grating3D_postplot.py res3D_$t done \ No newline at end of file