Function solargeneration(x1,x2,eg)

出自 DDCC TCAD TOOL Manual
前往: 導覽搜尋

Function solargeneration(x1,x2,eg) is a command to generate the electron-hole generation. The program will give the program to x1 and x2 section as well as the bandgap Eg. Then the user needs to return the generation value.


For example:


function solargeneration(x1,x2,eg)
 use global 
 implicit none
 real*8 ,external :: alpha ! call external function to obtained absorption coefficient alpha
 real*8 :: x1,x2,eg   ! x_min, x_max, bandgap
 real*8 :: solargeneration ! returned value
 real*8 ::  i1,i2,i3
 real*8 :: a,b,e
 integer k,l,m,i,j,stat
 stat=0
 solargeneration=0.0d0
 if(x1 < 0 .or. x2 <0) then 
   Print*, "Error, the location of x1 and x2 coordinate in calling solargeneration is smaller than 0"  
   print*, "Set the generation rate to be zero"
   solargeneration=0.0d0 
   return
 end if
  do i=1,solarfilesize
     e=1240.0d0/photonnum(i,1)  ! get the wave number from length to eV
     if(e>eg) then
       i1=photonnum(i,5)*exp(-alpha(e,eg)*abs(x2-x1))
       !i2=photonnum(i,5)*exp(-alpha(e,eg)*x2)
       i3=photonnum(i,5)-i1
       photonnum(i,5)=i1
       if(i3>0.0) solargeneration=solargeneration+i3
     end if
   end do
  solargeneration=solargeneration*1.0d-4/abs(x2-x1)
  !print*, x1,x2,solargeneration
 return 
end


function alpha(e,eg)
 use global , only : materialalpha,  ifuseabsorptiontable, absorptiontablesize, absorbtable,maxlayers , nl  , dz , gen
 implicit none
 real*8 :: a,e,eg
 real*8 ::  alpha
 integer :: i,j 
 if(e> eg )then
      alpha=materialalpha*((e-eg)/eg)**0.5
 else
      alpha=0.0d0
 end if
 return 
end