Hemt ph.tcl: Difference between revisions

From Flooxs
Jump to navigation Jump to search
(Created page with " #simulation parameters pdbSetDouble Math iterLimit 1000 ;#sets the max number of Newton iterations to 1000 math device dim=2 col umf none scale ...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 52: Line 52:
     region Nitride xlo=NTop xhi=AlGaNTop ylo=Left yhi=Oxleft
     region Nitride xlo=NTop xhi=AlGaNTop ylo=Left yhi=Oxleft
     region Nitride xlo=NTop xhi=AlGaNTop ylo=Oxright yhi=Right
     region Nitride xlo=NTop xhi=AlGaNTop ylo=Oxright yhi=Right
#initialize the grid (this command creates the grid with the specified regions)
    #initialize the grid (this command creates the grid with the specified regions)
     init                 
     init                 
     #Create the contacts  
     #Create the contacts  
Line 65: Line 65:
     Struct2D   
     Struct2D   
     #calls the procedure
     #calls the procedure
 
    #plot the grid and contacts to make sure everything is correct
#plot the grid and contacts to make sure everything is correct
    plot.2d bound grid
plot.2d bound grid
     plot.2d contact=G !cle
     plot.2d contact=G !cle
     plot.2d contact=B !cle
     plot.2d contact=B !cle
Line 73: Line 72:
     plot.2d contact=D !cle
     plot.2d contact=D !cle
      
      
#----------------------------------------------------------------------------------------------------------------------------------------
    #----------------------------------------------------------------------------------------------------------------------------------------
#--------------------------------------------Specify Solution Variables------------------------------------------------------------------
    #--------------------------------------------Specify Solution Variables------------------------------------------------------------------
# we are solving for Qfn , Qfp, and DevPsi (device potential), temp is a constant and set to 300 K
    # we are solving for Qfn , Qfp, and DevPsi (device potential), temp is a constant and set to 300 K
solution add name=DevPsi solve negative damp continuous pde  ;# potential in semiconductor
    solution add name=DevPsi solve negative damp continuous pde  ;# potential in semiconductor
solution add name=Qfp solve negative damp continuous pde
    solution add name=Qfp solve negative damp continuous pde
solution add name=Qfn solve negative damp continuous pde
    solution add name=Qfn solve negative damp continuous pde


solution add name=Cl solve !negative damp pde        ;# Cl ion concentration
    solution add name=Cl solve !negative damp pde        ;# Cl ion concentration
solution add name=H solve !negative damp pde        ;# hydrogen ion concentration
    solution add name=H solve !negative damp pde        ;# hydrogen ion concentration
solution add name=Na solve !negative damp pde        ;# Na ion concentration
    solution add name=Na solve !negative damp pde        ;# Na ion concentration
solution add name=A solve !negative damp pde        ;# acid species concentration
    solution add name=A solve !negative damp pde        ;# acid species concentration
solution add name=SOH2 solve !negative damp pde ;#positive interface charge
    solution add name=SOH2 solve !negative damp pde ;#positive interface charge


solution add name=Temp const val=300.0
    solution add name=Temp const val=300.0
#solution add name=Temp solve pde !negative continuous damp
    #solution add name=Temp solve pde !negative continuous damp


# these are needed if donor or acceptor traps are included
    # these are needed if donor or acceptor traps are included
solution add name=ETemp solve const val = 300.0 continuous
    solution add name=ETemp solve const val = 300.0 continuous
solution add name=HTemp solve const val = 300.0 continuous
    solution add name=HTemp solve const val = 300.0 continuous  
solution add name=Donor solve const val = 10.0
    solution add name=Donor solve const val = 10.0
solution add name=Acceptor solve const val = 10.0
    solution add name=Acceptor solve const val = 10.0


#----------------------------------------------------------------------------------------------------------------------------------------
    #----------------------------------------------------------------------------------------------------------------------------------------
#-------------------------------------------Specify the Doping (this includes static traps)----------------------------------------------
    #-------------------------------------------Specify the Doping (this includes static traps)----------------------------------------------
# the GaN doping is most important when fitting to an experimental IV curve; it is usually p-type
    # the GaN doping is most important when fitting to an experimental IV curve; it is usually p-type
     #GaN Doping units are /cm3, negative sign is p-type,  
     #GaN Doping units are /cm3, negative sign is p-type,  
     sel z= 2.0e14*Mater(GaN) name=GaN_Doping  
     sel z= 2.0e14*Mater(GaN) name=GaN_Doping  
Line 113: Line 112:
     sel z= 1.0e0*Mater(GaN2) name=GaN2_Doping
     sel z= 1.0e0*Mater(GaN2) name=GaN2_Doping


#for new gate lengths
    #for new gate lengths
set SDedge [expr (1.9+$gateLinc)]
    set SDedge [expr (1.9+$gateLinc)]
     #Source and Drain contact doping-from contact to 2DEG to make contacts ohmic (Gaussian profile is used in the expression)
     #Source and Drain contact doping-from contact to 2DEG to make contacts ohmic (Gaussian profile is used in the expression)
Line 123: Line 122:
     sel z=GaN_Doping+AlGaN_Doping+Drain_Doping+Source_Doping+SiC_Doping+AlN_Doping+GaN2_Doping name=Doping  
     sel z=GaN_Doping+AlGaN_Doping+Drain_Doping+Source_Doping+SiC_Doping+AlN_Doping+GaN2_Doping name=Doping  
      
      
#----------------------------------------------------------------------------------------------------------------------------------------   
    #----------------------------------------------------------------------------------------------------------------------------------------   
#------------------------------------------Specify the AlN ratio in the AlGaN------------------------------------------------------------
    #------------------------------------------Specify the AlN ratio in the AlGaN------------------------------------------------------------
# this is used in the modelfile to calculate AlGaN material parameters
    # this is used in the modelfile to calculate AlGaN material parameters
sel z=0.25 name=AlN_Ratio
    sel z=0.25 name=AlN_Ratio
#----------------------------------------------------------------------------------------------------------------------------------------
    #----------------------------------------------------------------------------------------------------------------------------------------
#------------------------------------------Species Concentrations and Mobilities---------------------------------------------------------
    #------------------------------------------Species Concentrations and Mobilities---------------------------------------------------------
#concentrations
    #concentrations
set Av 6.02e23    ;# Avogadro's number, ions/mol
    set Av 6.02e23    ;# Avogadro's number, ions/mol
set cCl  [expr (100.0e-3*$Av)*1e-3]  ;# M*ions/mol*l/cm3 = ions/cm3
    set cCl  [expr (100.0e-3*$Av)*1e-3]  ;# M*ions/mol*l/cm3 = ions/cm3
set cNa  [expr (100.0e-3*$Av)*1e-3]  ;# M*ions/mol*m3/cm3 = ions/cm3
    set cNa  [expr (100.0e-3*$Av)*1e-3]  ;# M*ions/mol*m3/cm3 = ions/cm3
set cH  [expr (1.0e-1*$Av)*1e-3]  ;# ions/cm3
    set cH  [expr (1.0e-1*$Av)*1e-3]  ;# ions/cm3
set cA  [expr (1.0e-1*$Av)*1e-3]  ;# ions/cm3
    set cA  [expr (1.0e-1*$Av)*1e-3]  ;# ions/cm3
set Ns 1.0e15 ;# surface interface site density /cm2
    set Ns 1.0e15 ;# surface interface site density /cm2


#mobilities and diffusivity constants  
    #mobilities and diffusivity constants  
set D_Na 1.96e-5                    ;# cm2/s from Lopreore
    set D_Na 1.96e-5                    ;# cm2/s from Lopreore
set D_Cl 2.03e-5                    ;# cm2/s from Lopreore
    set D_Cl 2.03e-5                    ;# cm2/s from Lopreore
set D_H  8.24e-5                    ;# cm2/s from Lopreore
    set D_H  8.24e-5                    ;# cm2/s from Lopreore
set D_A  2.00e-5                    ;# cm2/s from Lopreore
    set D_A  2.00e-5                    ;# cm2/s from Lopreore
set Namob [expr {$D_Na/$Vt}]
    set Namob [expr {$D_Na/$Vt}]
set Clmob [expr {$D_Cl/$Vt}]
    set Clmob [expr {$D_Cl/$Vt}]
set Hmob [expr {$D_H/$Vt}]
    set Hmob [expr {$D_H/$Vt}]
set Amob [expr {$D_A/$Vt}]
    set Amob [expr {$D_A/$Vt}]


#assign mobility variable for each ion species
    #assign mobility variable for each ion species
pdbSetDouble Electrolyte Cl mob $Clmob
    pdbSetDouble Electrolyte Cl mob $Clmob
pdbSetDouble Electrolyte Na mob $Namob
    pdbSetDouble Electrolyte Na mob $Namob
pdbSetDouble Electrolyte H mob $Hmob  
    pdbSetDouble Electrolyte H mob $Hmob  
pdbSetDouble Electrolyte A mob $Amob  
    pdbSetDouble Electrolyte A mob $Amob  
#-----------------------------------------------------------------------------------------------------------------------------------------
    #-----------------------------------------------------------------------------------------------------------------------------------------
#-------------------------------------------Poisson in Electrolyte------------------------------------------------------------------------
    #-------------------------------------------Poisson in Electrolyte------------------------------------------------------------------------
proc Poisson_Electro {Mat} {   
    proc Poisson_Electro {Mat} {   
     global k q eps0 Vt  
     global k q eps0 Vt  
      
      
pdbSetDouble $Mat DevPsi DampValue 0.025
    pdbSetDouble $Mat DevPsi DampValue 0.025
     pdbSetDouble $Mat DevPsi Abs.Error 0.001
     pdbSetDouble $Mat DevPsi Abs.Error 0.001
     pdbSetDouble $Mat DevPsi Rel.Error 0.01
     pdbSetDouble $Mat DevPsi Rel.Error 0.01
Line 165: Line 164:
     set eqn " ($eps0 * [pdbDelayDouble $Mat DevPsi RelEps] * grad(DevPsi) / $q) + (- Cl + H - A + Na)"
     set eqn " ($eps0 * [pdbDelayDouble $Mat DevPsi RelEps] * grad(DevPsi) / $q) + (- Cl + H - A + Na)"
     pdbSetString $Mat DevPsi Equation $eqn
     pdbSetString $Mat DevPsi Equation $eqn
} ;#end Poisson proc
    } ;#end Poisson proc
#-----------------------------------------------------------------------------------------------------------------------------------------
    #-----------------------------------------------------------------------------------------------------------------------------------------
#------------------------------------------Continuity in Electrolyte----------------------------------------------------------------------
    #------------------------------------------Continuity in Electrolyte----------------------------------------------------------------------
proc Continuity2 {Mat} {
    proc Continuity2 {Mat} {
global Vt Namob Clmob Hmob Amob
    global Vt Namob Clmob Hmob Amob
 
#set eqn "ddt($species) - (([pdbDelayDouble $Mat $species mob]) * sgrad($species, -DevPsi / $Vt))"
 
set eqnNa "ddt(Na) - ($Namob) * sgrad(Na, -DevPsi/$Vt)"
set eqnCl "ddt(Cl) - ($Clmob) * sgrad(Cl, DevPsi/$Vt)"
set eqnH "ddt(H) - ($Hmob) * sgrad(H, -DevPsi/$Vt)"
set eqnA "ddt(A) - ($Amob) * sgrad(A, DevPsi/$Vt)"


    #set eqn "ddt($species) - (([pdbDelayDouble $Mat $species mob]) * sgrad($species, -DevPsi / $Vt))"
    set eqnNa "ddt(Na) - ($Namob) * sgrad(Na, -DevPsi/$Vt)"
    set eqnCl "ddt(Cl) - ($Clmob) * sgrad(Cl, DevPsi/$Vt)"
    set eqnH "ddt(H) - ($Hmob) * sgrad(H, -DevPsi/$Vt)"
    set eqnA "ddt(A) - ($Amob) * sgrad(A, DevPsi/$Vt)"
pdbSetString $Mat Na Equation $eqnNa
    pdbSetString $Mat Na Equation $eqnNa
pdbSetDouble $Mat Na Abs.Error 1.0e-5
    pdbSetDouble $Mat Na Abs.Error 1.0e-5
pdbSetDouble $Mat Na Rel.Error 1.0e-3
    pdbSetDouble $Mat Na Rel.Error 1.0e-3
pdbSetString $Mat Cl Equation $eqnCl
    pdbSetString $Mat Cl Equation $eqnCl
pdbSetDouble $Mat Cl Abs.Error 1.0e-5
    pdbSetDouble $Mat Cl Abs.Error 1.0e-5
pdbSetDouble $Mat Cl Rel.Error 1.0e-3
    pdbSetDouble $Mat Cl Rel.Error 1.0e-3
pdbSetString $Mat H Equation $eqnH
    pdbSetString $Mat H Equation $eqnH
pdbSetDouble $Mat H Abs.Error 1.0e-5
    pdbSetDouble $Mat H Abs.Error 1.0e-5
pdbSetDouble $Mat H Rel.Error 1.0e-3
    pdbSetDouble $Mat H Rel.Error 1.0e-3
pdbSetString $Mat A Equation $eqnA
    pdbSetString $Mat A Equation $eqnA
pdbSetDouble $Mat A Abs.Error 1.0e-5
    pdbSetDouble $Mat A Abs.Error 1.0e-5
pdbSetDouble $Mat A Rel.Error 1.0e-3
    pdbSetDouble $Mat A Rel.Error 1.0e-3
} ;#end Continuity proc
    } ;#end Continuity proc
#-----------------------------------------------------------------------------------------------------------------------------------------
    #-----------------------------------------------------------------------------------------------------------------------------------------
#------------------------------------------Call procedures describing Physics-------------------------------------------------------------
    #------------------------------------------Call procedures describing Physics-------------------------------------------------------------
#Poisson equation and trap ionization
    #Poisson equation and trap ionization
Poisson GaN2
    Poisson GaN2
Poisson AlGaN
    Poisson AlGaN
Poisson_Ins Nitride
    Poisson_Ins Nitride
Poisson_Ins GaO
    Poisson_Ins GaO
Poisson SiC
    Poisson SiC
Poisson AlN
    Poisson AlN
Poisson GaN
    Poisson GaN
Poisson_Electro Electrolyte
    Poisson_Electro Electrolyte
#Continuity equations for electron, hole and transient trap simulation
    #Continuity equations for electron, hole and transient trap simulation
ElecContinuity GaN
    ElecContinuity GaN
ElecContinuity AlGaN
    ElecContinuity AlGaN
ElecContinuity SiC
    ElecContinuity SiC
ElecContinuity AlN
    ElecContinuity AlN
HoleContinuity GaN
    HoleContinuity GaN
HoleContinuity AlGaN
    HoleContinuity AlGaN
HoleContinuity SiC
    HoleContinuity SiC
HoleContinuity AlN
    HoleContinuity AlN
    Continuity2 Electrolyte ;#call proc for electrolyte continuity  
Continuity2 Electrolyte ;#call proc for electrolyte continuity  
    #-----------------------------------------------------------------------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------------------------------------
 
#--------------------------------------------Change in Ion Concentrations at Contact Proc-------------------------------------------------
proc Dir.contact2 {Contact} {
 
global cCl cNa cH cA


pdbSetBoolean $Contact Cl Flux 0
    #--------------------------------------------Change in Ion Concentrations at Contact Proc-------------------------------------------------
pdbSetBoolean $Contact Cl Fixed 1
    proc Dir.contact2 {Contact} {
pdbSetBoolean $Contact Na Flux 0
    global cCl cNa cH cA
pdbSetBoolean $Contact Na Fixed 1
pdbSetBoolean $Contact H Flux 0
pdbSetBoolean $Contact H Fixed 1
pdbSetBoolean $Contact A Flux 0
pdbSetBoolean $Contact A Fixed 1


pdbSetString $Contact Cl Equation "Cl-$cCl"
    pdbSetBoolean $Contact Cl Flux 0
pdbSetString $Contact Na Equation "Na-$cNa"
    pdbSetBoolean $Contact Cl Fixed 1
pdbSetString $Contact H Equation "H-$cH"
    pdbSetBoolean $Contact Na Flux 0
pdbSetString $Contact A Equation "A-$cA"
    pdbSetBoolean $Contact Na Fixed 1
} ;#end electrolyte ion conc proc
    pdbSetBoolean $Contact H Flux 0
    pdbSetBoolean $Contact H Fixed 1
    pdbSetBoolean $Contact A Flux 0
    pdbSetBoolean $Contact A Fixed 1


#-----------------------------------------------------------------------------------------------------------------------------------------
    pdbSetString $Contact Cl Equation "Cl-$cCl"
#---------------------------------------------Initialize all contacts to 0V---------------------------------------------------------------
    pdbSetString $Contact Na Equation "Na-$cNa"
    pdbSetString $Contact H Equation "H-$cH"
    pdbSetString $Contact A Equation "A-$cA"
    } ;#end electrolyte ion conc proc


#contact name=G Electrolyte voltage supply=3.0
    #-----------------------------------------------------------------------------------------------------------------------------------------
    #---------------------------------------------Initialize all contacts to 0V---------------------------------------------------------------
    #contact name=G Electrolyte voltage supply=3.0
     contact name=B SiC voltage supply=0.0
     contact name=B SiC voltage supply=0.0
     contact name=S AlGaN voltage supply=0.0
     contact name=S AlGaN voltage supply=0.0
Line 248: Line 242:
      
      
     pdbSetBoolean B Temp Fixed 0
     pdbSetBoolean B Temp Fixed 0
pdbSetString B Temp Equation "(2.7*(Temp-300.0))/0.00125"
    pdbSetString B Temp Equation "(2.7*(Temp-300.0))/0.00125"
 
#-----------------------------------------------------------------------------------------------------------------------------------------
#----------------------------------------------Run the Initial Guess Procedure------------------------------------------------------------
#Initial guess procedure, call for all materials
 
proc Init {Mat} {
 
newton $Mat eqn=Doping+Donor-Acceptor+Hole-Elec var=DevPsi damp=0.025
}
 
Init GaN
Init AlGaN
Init AlN
Init SiC
 
sel z=$cH*Mater(Electrolyte) name=H1
sel z=0 name=H2
sel z=H1+H2 name=H
sel z=$cNa*Mater(Electrolyte) name=Na
sel z=$cCl*Mater(Electrolyte) name=Cl
sel z=$cA*Mater(Electrolyte) name=A
sel z=6.1 name=DevPsi


Dir.contact2 G ;#call for ion concentration change at contact (electrolyte) proc
    #-----------------------------------------------------------------------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------------------------------------
    #----------------------------------------------Run the Initial Guess Procedure------------------------------------------------------------
#--------------------------------------------Run and Plot---------------------------------------------------------------------------------
    #Initial guess procedure, call for all materials
    proc Init {Mat} {
    newton $Mat eqn=Doping+Donor-Acceptor+Hole-Elec var=DevPsi damp=0.025
    }
    Init GaN
    Init AlGaN
    Init AlN
    Init SiC


set WinA [CreateGraphWindow]  ;# absorbed charge v. pH (H+, A- and total)
    sel z=$cH*Mater(Electrolyte) name=H1
set WinB [CreateGraphWindow] ;# semiconductor potential v. pH
    sel z=0 name=H2
set WinC [CreateGraphWindow] ;# Id-Vds curve (point measurement)
    sel z=H1+H2 name=H
set WinD [CreateGraphWindow] ;# net adsorbed charge v. position (y-direction) across pH range
    sel z=$cNa*Mater(Electrolyte) name=Na
    sel z=$cCl*Mater(Electrolyte) name=Cl
    sel z=$cA*Mater(Electrolyte) name=A
    sel z=6.1 name=DevPsi


    Dir.contact2 G ;#call for ion concentration change at contact (electrolyte) proc
    #-----------------------------------------------------------------------------------------------------------------------------------------
    #--------------------------------------------Run and Plot---------------------------------------------------------------------------------


device ;# multiple device commands to help with convergence
    set WinA [CreateGraphWindow]  ;# absorbed charge v. pH (H+, A- and total)
device
    set WinB [CreateGraphWindow] ;# semiconductor potential v. pH
device  
    set WinC [CreateGraphWindow] ;# Id-Vds curve (point measurement)
device
    set WinD [CreateGraphWindow] ;# net adsorbed charge v. position (y-direction) across pH range
    device ;# multiple device commands to help with convergence
    device
    device  
    device


pdbSetString AlGaN_GaO DevPsi Equation " -3.26e12"  ;# polarization charge for AlGaN-DL
    pdbSetString AlGaN_GaO DevPsi Equation " -3.26e12"  ;# polarization charge for AlGaN-DL
pdbSetString AlN_GaN DevPsi Equation "2.2e13" ;# polarization charge for AlN-GaN
    pdbSetString AlN_GaN DevPsi Equation "2.2e13" ;# polarization charge for AlN-GaN
pdbSetString AlGaN_Nitride DevPsi Equation " -3.26e13"  ;# polarization charge for AlGaN-Nitride
    pdbSetString AlGaN_Nitride DevPsi Equation " -3.26e13"  ;# polarization charge for AlGaN-Nitride
pdbSetString AlGaN_GaN DevPsi Equation  "1.06e13" ;# polarization charge for AlGaN-GaN
    pdbSetString AlGaN_GaN DevPsi Equation  "1.06e13" ;# polarization charge for AlGaN-GaN


device init
    device init
device
    device
device  
    device  
device
    device
#--------------------------------------------Energy Band Diagram v. Position (X-Direction, DL/AlGaN)--------------------------------------------------------------------------
    #--------------------------------------------Energy Band Diagram v. Position (X-Direction, DL/AlGaN)--------------------------------------------------------------------------
sel z=Econd
    sel z=Econd
plot.1d y.v=0.0 plot_name=Band label=Ec !cle
    plot.1d y.v=0.0 plot_name=Band label=Ec !cle
sel z=Eval
    sel z=Eval
plot.1d y.v=0.0 plot_name=Band label=Ev !cle
    plot.1d y.v=0.0 plot_name=Band label=Ev !cle
sel z=Qfp
    sel z=Qfp
plot.1d y.v=0.0 plot_name=Band label=Qfp !cle
    plot.1d y.v=0.0 plot_name=Band label=Qfp !cle
sel z=Qfn
    sel z=Qfn
plot.1d y.v=0.0 plot_name=Band label=Qfn !cle
    plot.1d y.v=0.0 plot_name=Band label=Qfn !cle
sel z=DevPsi
    sel z=DevPsi
plot.1d y.v=0.0 plot_name=Band label=DevPsi !cle
    plot.1d y.v=0.0 plot_name=Band label=DevPsi !cle
    sel z=Doping
    plot.1d x.v=0.0 plot_name=DopingX label=Doping !cle
    sel z=Doping
    plot.1d y.v=0.0 plot_name=DopingY label=Doping !cle
    #specify solution variable for negative oxide surface site SO
    solution add name=SO solve !negative damp pde       


sel z=Doping
    #-------------------------------------------pH increment and adsorbed charge derivation----------------------------------------------------
plot.1d x.v=0.0 plot_name=DopingX label=Doping !cle
    if {1} {
sel z=Doping
    #Kfa is a the forward reaction rate coefficient for the SO equation.  
plot.1d y.v=0.0 plot_name=DopingY label=Doping !cle
    set Kfa 2.58867e-11
    #Kra is a the reverse reaction rate coefficient for the SO equation.
    set Kra 1.0e5
    #Kfb is a the forward reaction rate coefficient for the SOH2 equation.
    set Kfb 2.58867e-11
    #Krb is a the reverse reaction rate coefficient for the SOH2 equation.  
    set Krb 1.0e2
    #Ns is the number of available surface sites
    set Ns 1.0e15


#specify solution variable for negative oxide surface site SO
    # H interface equations for Electrolyte-DL
solution add name=SO solve !negative damp pde       
    pdbSetString Electrolyte_GaO SO Equation "ddt(SO) - $Kra*($Ns-SO-SOH2) + $Kfa*(H(Electrolyte))*(SO)"
    pdbSetString Electrolyte_GaO SOH2 Equation "ddt(SOH2) - $Krb*(SOH2) + $Kfb*(H(Electrolyte))*($Ns-SOH2-SO)"
    pdbSetString Electrolyte_GaO H Electrolyte Equation "+ $Krb*(SOH2) - $Kfb*(H(Electrolyte))*($Ns-SOH2-SO) + $Kra*($Ns-SO-SOH2) - $Kfa*(H(Electrolyte))*(SO)"
    pdbSetString Electrolyte_GaO DevPsi Equation "SOH2 - SO"


#-------------------------------------------pH increment and adsorbed charge derivation----------------------------------------------------
    #ph increment
if {1} {
    for {set inc 0} {$inc<10.5} {set inc [expr $inc+1.0]} {
#Kfa is a the forward reaction rate coefficient for the SO equation.
    set mult [expr pow(10,$inc)]    ;# need to put in expr to evaluate right away to avoid syntax error in pdb equation
set Kfa 2.58867e-11
    pdbSetString G H Equation "H-($cH/$mult)"
#Kra is a the reverse reaction rate coefficient for the SO equation.
    pdbSetString G A Equation "A-($cA/$mult)"
set Kra 1.0e5
#Kfb is a the forward reaction rate coefficient for the SOH2 equation.
set Kfb 2.58867e-11
#Krb is a the reverse reaction rate coefficient for the SOH2 equation.
set Krb 1.0e2
#Ns is the number of available surface sites
set Ns 1.0e15
 
# H interface equations for Electrolyte-DL
pdbSetString Electrolyte_GaO SO Equation "ddt(SO) - $Kra*($Ns-SO-SOH2) + $Kfa*(H(Electrolyte))*(SO)"
pdbSetString Electrolyte_GaO SOH2 Equation "ddt(SOH2) - $Krb*(SOH2) + $Kfb*(H(Electrolyte))*($Ns-SOH2-SO)"
pdbSetString Electrolyte_GaO H Electrolyte Equation "+ $Krb*(SOH2) - $Kfb*(H(Electrolyte))*($Ns-SOH2-SO) + $Kra*($Ns-SO-SOH2) - $Kfa*(H(Electrolyte))*(SO)"
pdbSetString Electrolyte_GaO DevPsi Equation "SOH2 - SO"
 
#ph increment
for {set inc 0} {$inc<10.5} {set inc [expr $inc+1.0]} {
set mult [expr pow(10,$inc)]    ;# need to put in expr to evaluate right away to avoid syntax error in pdb equation
pdbSetString G H Equation "H-($cH/$mult)"
pdbSetString G A Equation "A-($cA/$mult)"
#drain bias ramp
    #drain bias ramp
for {set Vds 0.05} {$Vds<1.1} {set Vds [expr $Vds+0.1]} {
    for {set Vds 0.05} {$Vds<1.1} {set Vds [expr $Vds+0.1]} {
contact name=D supply=$Vds
    contact name=D supply=$Vds
device init
    device init
device
    device
device
    device
set cur [expr (1.0e6*(-[contact name=D sol=Qfn flux] + [contact name=D sol=Qfp flux]))]  ;# plots the current versus time (mA/mm)  
    set cur [expr (1.0e6*(-[contact name=D sol=Qfn flux] + [contact name=D sol=Qfp flux]))]  ;# plots the current versus time (mA/mm)  
AddtoLine $WinC IdVd.$inc $Vds $cur  
    AddtoLine $WinC IdVd.$inc $Vds $cur  
}
    }
 
# ion distribution (X-direction, electrolyte/DL/AlGaN), p[ion] = -log10[ion conc]
sel z=log10(Na+1.0)
plot.1d y.v=0.0 !cle plot_name=electrolyte label=Na
sel z=log10(Cl+1.0)
plot.1d y.v=0.0 !cle plot_name=electrolyte label=Cl
sel z=log10(H+1.0)
plot.1d y.v=0.0 !cle plot_name=electrolyte label=H
sel z=log10(A+1.0)
plot.1d y.v=0.0 !cle plot_name=electrolyte label=A
 
#adsorbed charge derivation for electrolyte-DL
sel z=SOH2
set nit_plus [interface Electrolyte /GaO y.v=0.0 val]
puts $nit_plus
sel z=SO
set nit_minus [interface Electrolyte /GaO y.v=0.0 val]
puts $nit_minus


set int_chrg [expr ($nit_plus-$nit_minus)]
    # ion distribution (X-direction, electrolyte/DL/AlGaN), p[ion] = -log10[ion conc]
set pH 1+$inc
    sel z=log10(Na+1.0)
AddtoLine $WinA Int_chrg $pH $int_chrg
    plot.1d y.v=0.0 !cle plot_name=electrolyte label=Na
AddtoLine $WinA SOH2 $pH $nit_plus
    sel z=log10(Cl+1.0)
AddtoLine $WinA SO $pH $nit_minus 
    plot.1d y.v=0.0 !cle plot_name=electrolyte label=Cl
#-------------------------------------------Electrostatic Potential and pH (Y-Direction)----------------------------------------------------
    sel z=log10(H+1.0)
sel z=DevPsi
    plot.1d y.v=0.0 !cle plot_name=electrolyte label=H
set potential [interface Electrolyte /GaO y.v=0.0 val]
    sel z=log10(A+1.0)
AddtoLine $WinB Potential $pH $potential
    plot.1d y.v=0.0 !cle plot_name=electrolyte label=A
set potential [interface Electrolyte /GaO y.v=-0.25 val]
AddtoLine $WinB Potential2 $pH $potential
set potential [interface Electrolyte /GaO y.v=0.25 val]
AddtoLine $WinB Potential3 $pH $potential


#-------------------------------------------Net Adsorbed Charge v Position (Y-Direction)----------------------------------------------------
    #adsorbed charge derivation for electrolyte-DL
#these points are defined for 1 um gate length. For any other gate length, the y.v values must be changed.  
    sel z=SOH2
if {1} {
    set nit_plus [interface Electrolyte /GaO y.v=0.0 val]
#positive oxide surface sites
    puts $nit_plus
sel z=SOH2
    sel z=SO
    set nit_minus [interface Electrolyte /GaO y.v=0.0 val]
    puts $nit_minus


set t1 [interface Electrolyte /GaO y.v=-0.5 val]
    set int_chrg [expr ($nit_plus-$nit_minus)]
set t2 [interface Electrolyte /GaO y.v=-0.375 val]
    set pH 1+$inc
set t3 [interface Electrolyte /GaO y.v=-0.25 val]
    AddtoLine $WinA Int_chrg $pH $int_chrg
set t4 [interface Electrolyte /GaO y.v=-0.125 val]
    AddtoLine $WinA SOH2 $pH $nit_plus
set t5 [interface Electrolyte /GaO y.v=0.0 val]
    AddtoLine $WinA SO $pH $nit_minus 
set t6 [interface Electrolyte /GaO y.v=0.125 val]
    #-------------------------------------------Electrostatic Potential and pH (Y-Direction)----------------------------------------------------
set t7 [interface Electrolyte /GaO y.v=0.25 val]
    sel z=DevPsi
set t8 [interface Electrolyte /GaO y.v=0.375 val]
    set potential [interface Electrolyte /GaO y.v=0.0 val]
set t9 [interface Electrolyte /GaO y.v=0.4 val]
    AddtoLine $WinB Potential $pH $potential
set t10 [interface Electrolyte /GaO y.v=0.5 val]
    set potential [interface Electrolyte /GaO y.v=-0.25 val]
set t11 [interface Electrolyte /GaO y.v=0.48 val]
    AddtoLine $WinB Potential2 $pH $potential
set t12 [interface Electrolyte /GaO y.v=0.5 val]
    set potential [interface Electrolyte /GaO y.v=0.25 val]
    AddtoLine $WinB Potential3 $pH $potential


sel z=SO ;#negative oxide surface site
    #-------------------------------------------Net Adsorbed Charge v Position (Y-Direction)----------------------------------------------------
    #these points are defined for 1 um gate length. For any other gate length, the y.v values must be changed.
    if {1} {
    #positive oxide surface sites
    sel z=SOH2
    set t1 [interface Electrolyte /GaO y.v=-0.5 val]
    set t2 [interface Electrolyte /GaO y.v=-0.375 val]
    set t3 [interface Electrolyte /GaO y.v=-0.25 val]
    set t4 [interface Electrolyte /GaO y.v=-0.125 val]
    set t5 [interface Electrolyte /GaO y.v=0.0 val]
    set t6 [interface Electrolyte /GaO y.v=0.125 val]
    set t7 [interface Electrolyte /GaO y.v=0.25 val]
    set t8 [interface Electrolyte /GaO y.v=0.375 val]
    set t9 [interface Electrolyte /GaO y.v=0.4 val]
    set t10 [interface Electrolyte /GaO y.v=0.5 val]
    set t11 [interface Electrolyte /GaO y.v=0.48 val]
    set t12 [interface Electrolyte /GaO y.v=0.5 val]


set m1 [interface Electrolyte /GaO y.v=-0.5 val]
    sel z=SO ;#negative oxide surface site
set m2 [interface Electrolyte /GaO y.v=-0.375 val]
    set m1 [interface Electrolyte /GaO y.v=-0.5 val]
set m3 [interface Electrolyte /GaO y.v=-0.25 val]
    set m2 [interface Electrolyte /GaO y.v=-0.375 val]
set m4 [interface Electrolyte /GaO y.v=-0.125 val]
    set m3 [interface Electrolyte /GaO y.v=-0.25 val]
set m5 [interface Electrolyte /GaO y.v=0.0 val]
    set m4 [interface Electrolyte /GaO y.v=-0.125 val]
set m6 [interface Electrolyte /GaO y.v=0.125 val]
    set m5 [interface Electrolyte /GaO y.v=0.0 val]
set m7 [interface Electrolyte /GaO y.v=0.25 val]
    set m6 [interface Electrolyte /GaO y.v=0.125 val]
set m8 [interface Electrolyte /GaO y.v=0.375 val]
    set m7 [interface Electrolyte /GaO y.v=0.25 val]
set m9 [interface Electrolyte /GaO y.v=0.40 val]
    set m8 [interface Electrolyte /GaO y.v=0.375 val]
set m10 [interface Electrolyte /GaO y.v=0.45 val]
    set m9 [interface Electrolyte /GaO y.v=0.40 val]
set m11 [interface Electrolyte /GaO y.v=0.48 val]
    set m10 [interface Electrolyte /GaO y.v=0.45 val]
set m12 [interface Electrolyte /GaO y.v=0.5 val]
    set m11 [interface Electrolyte /GaO y.v=0.48 val]
    set m12 [interface Electrolyte /GaO y.v=0.5 val]


set T1 [expr $t1-$m1]
    set T1 [expr $t1-$m1]
set T2 [expr $t2-$m2]
    set T2 [expr $t2-$m2]
set T3 [expr $t3-$m3]
    set T3 [expr $t3-$m3]
set T4 [expr $t4-$m4]
    set T4 [expr $t4-$m4]
set T5 [expr $t5-$m5]
    set T5 [expr $t5-$m5]
set T6 [expr $t6-$m6]
    set T6 [expr $t6-$m6]
set T7 [expr $t7-$m7]
    set T7 [expr $t7-$m7]
set T8 [expr $t8-$m8]
    set T8 [expr $t8-$m8]
set T9 [expr $t9-$m9]
    set T9 [expr $t9-$m9]
set T10 [expr $t10-$m10]
    set T10 [expr $t10-$m10]
set T11 [expr $t11-$m11]
    set T11 [expr $t11-$m11]
set T12 [expr $t12-$m12]
    set T12 [expr $t12-$m12]


AddtoLine $WinD Intchrg.$inc -0.5 $T1
    AddtoLine $WinD Intchrg.$inc -0.5 $T1
AddtoLine $WinD Intchrg.$inc -0.375 $T2
    AddtoLine $WinD Intchrg.$inc -0.375 $T2
AddtoLine $WinD Intchrg.$inc -0.25 $T3
    AddtoLine $WinD Intchrg.$inc -0.25 $T3
AddtoLine $WinD Intchrg.$inc -0.125 $T4
    AddtoLine $WinD Intchrg.$inc -0.125 $T4
AddtoLine $WinD Intchrg.$inc 0.0 $T5
    AddtoLine $WinD Intchrg.$inc 0.0 $T5
AddtoLine $WinD Intchrg.$inc 0.125 $T6
    AddtoLine $WinD Intchrg.$inc 0.125 $T6
AddtoLine $WinD Intchrg.$inc 0.25 $T7
    AddtoLine $WinD Intchrg.$inc 0.25 $T7
AddtoLine $WinD Intchrg.$inc 0.375 $T8
    AddtoLine $WinD Intchrg.$inc 0.375 $T8
AddtoLine $WinD Intchrg.$inc 0.4 $T9
    AddtoLine $WinD Intchrg.$inc 0.4 $T9
AddtoLine $WinD Intchrg.$inc 0.45 $T10
    AddtoLine $WinD Intchrg.$inc 0.45 $T10
AddtoLine $WinD Intchrg.$inc 0.48 $T11
    AddtoLine $WinD Intchrg.$inc 0.48 $T11
AddtoLine $WinD Intchrg.$inc 0.5 $T12
    AddtoLine $WinD Intchrg.$inc 0.5 $T12
}
    }
#-------------------------------------------SO/DevPsi v. Position Across pH Range----------------------------------------------
    #-------------------------------------------SO/DevPsi v. Position Across pH Range----------------------------------------------
# SO v position (y-direction)  
    # SO v position (y-direction)  
    sel z=SO
    plot.1d x.v=0.0005 plot_name=Intchrg label=SO.$inc !cle
    set nitT_minus [interface Electrolyte /GaO x.v=0.0005 val]
    puts $nitT_minus
    sel z=Econd
    plot.1d y.v=0.0 plot_name=Band2 label=Ec.$inc !cle
    sel z=Eval
    plot.1d y.v=0.0 plot_name=Band2 label=Ev.$inc !cle
    sel z=Qfp
    plot.1d y.v=0.0 plot_name=Band2 label=Qfp.$inc !cle
    sel z=Qfn
    plot.1d y.v=0.0 plot_name=Band2 label=Qn.$inc !cle


sel z=SO
    #DevPsi v position (x-direction, DL/AlGaN)
plot.1d x.v=0.0005 plot_name=Intchrg label=SO.$inc !cle
    sel z=DevPsi
set nitT_minus [interface Electrolyte /GaO x.v=0.0005 val]
    plot.1d y.v=0.0 plot_name=Band2 label=DevPsi.$inc !cle
puts $nitT_minus
    #-------------------------------------------Current v. time and Carrier (E) Conc v. Position (X-Direction, DL/AlGaN)----------------------------------------------------------------------------
sel z=Econd
    plot.1d y.v=0.0 plot_name=elec_conc label=elec.$inc !cle
plot.1d y.v=0.0 plot_name=Band2 label=Ec.$inc !cle
    } ;#end for loop, increment pH
sel z=Eval
    } ;#end if{1}
plot.1d y.v=0.0 plot_name=Band2 label=Ev.$inc !cle
sel z=Qfp
plot.1d y.v=0.0 plot_name=Band2 label=Qfp.$inc !cle
sel z=Qfn
plot.1d y.v=0.0 plot_name=Band2 label=Qn.$inc !cle
 
#DevPsi v position (x-direction, DL/AlGaN)
sel z=DevPsi
plot.1d y.v=0.0 plot_name=Band2 label=DevPsi.$inc !cle
#-------------------------------------------Current v. time and Carrier (E) Conc v. Position (X-Direction, DL/AlGaN)----------------------------------------------------------------------------
plot.1d y.v=0.0 plot_name=elec_conc label=elec.$inc !cle
} ;#end for loop, increment pH
} ;#end if{1}

Latest revision as of 14:37, 15 July 2016

   #simulation parameters
   pdbSetDouble Math iterLimit 1000              ;#sets the max number of Newton iterations to 1000
   math device dim=2 col umf none scale          
   #-----------------------------------------------------------------------------------------------------------------------------------------
   #----------------------------------Include Source Files-----------------------------------------------------------------------------------
   # include files    
   source GaN_modelfile_mo.tcl              ;# this file add the materials in the structure and specifies their material properties and specifies Ohmic contacts for S D B and Schottky for G
   source Poisson.tcl
   source Continuity.tcl
   #-----------------------------------------------------------------------------------------------------------------------------------------
   #----------------------------------Create Structure---------------------------------------------------------------------------------------
   #proc called Struct2D that defines grid (default unit is microns)
   #gate Length increment
   set gateLinc 0.0 ; #a 0.15 increment is a +0.30um growth with gate length of 1.3um. 
  proc Struct2D {} {                            
   if {1} {                                  ;# the [if {1}] tcl statement allows one to comment out the text between the brackets if {1} is set to {0}. This is nice to use if you    want to make multiple structures and easily change between them.
   line x loc=-0.3 spac=0.05 tag=NTop
   line x loc=-0.0005 spac=0.0001 tag=Oxtop
   line x loc=0.0 spac=0.0001 tag=AlGaNTop
   line x loc=0.015 spac=0.0008 tag=AlGaNBottom
   line x loc=1.8 spac=0.2 tag=GaNBottom
   line x loc=2.0 spac=0.02 tag=AlNBottom
   line x loc=3.0 spac=1.5 tag=BBottom
   }
   if {1} {        ;# 1 um gate (no T gate)
   #gate Length increment
   set gateLinc 0.0
   line y loc=(-2.0-$gateLinc) spac=0.1 tag=Left 
   line y loc=(-1.25-$gateLinc) spac=0.5 
   line y loc=(-0.50-$gateLinc) spac=0.01 tag=Oxleft
   line y loc=(-0.15-$gateLinc) spac=0.1
   line y loc=0.0  spac=0.10
   line y loc=(0.15+$gateLinc) spac=0.1
   line y loc=(0.50+$gateLinc) spac=0.01 tag=Oxright
   line y loc=(1.25+$gateLinc) spac=0.5
   line y loc=(2.0+$gateLinc) spac=0.1 tag=Right
   }
    #use the tags above to create the material regions
	#Bulk
   region SiC xlo=AlNBottom xhi=BBottom ylo=Left yhi=Right
   #thin AlN layer
   region AlN xlo=GaNBottom xhi=AlNBottom ylo=Left yhi=Right
   #Buffer
   region GaN xlo=AlGaNBottom xhi=GaNBottom ylo=Left yhi=Right
   #AlGaN under gate
   region AlGaN xlo=AlGaNTop xhi=AlGaNBottom ylo=Left yhi=Right
   #DL
   region GaO xlo=Oxtop xhi=AlGaNTop ylo=Oxleft yhi=Oxright
   #gate metal/electrolyte
   region Electrolyte xlo=NTop xhi=Oxtop ylo=Oxleft yhi=Oxright
   #passivation layers
   region Nitride xlo=NTop xhi=AlGaNTop ylo=Left yhi=Oxleft
   region Nitride xlo=NTop xhi=AlGaNTop ylo=Oxright yhi=Right
   #initialize the grid (this command creates the grid with the specified regions)
   init                 
   #Create the contacts 
   contact name=G Electrolyte xlo=-0.40 xhi=-0.28 ylo=(-0.75-$gateLinc) yhi=(0.75+$gateLinc) add depth=1.0 
   contact name=B SiC xlo=2.9 xhi=7.0 add depth=1.0
   contact name=S AlGaN ylo=(-3.4-$gateLinc) yhi=(-1.99-$gateLinc) xlo=-1.5 xhi=0.0149 add depth=1.0 
   contact name=D AlGaN ylo=(1.99+$gateLinc) yhi=(3.4+$gateLinc) xlo=-1.5 xhi=0.0149 add depth=1.0        
   # the x and y pts need to be a little larger than the grid specifications to capture all of the grid points
   # you can specify the depth of the contact into the page by depth=X. With depth=1.0 the current units are A/um. With the depth specified, the current unit will be in A.
   } 
   #end Struct 2D procedure (remember you still need to call the procedure)
   Struct2D   
   #calls the procedure
   #plot the grid and contacts to make sure everything is correct
   plot.2d bound grid
   plot.2d contact=G !cle
   plot.2d contact=B !cle
   plot.2d contact=S !cle
   plot.2d contact=D !cle
   
   #----------------------------------------------------------------------------------------------------------------------------------------
   #--------------------------------------------Specify Solution Variables------------------------------------------------------------------
   # we are solving for Qfn , Qfp, and DevPsi (device potential), temp is a constant and set to 300 K
   solution add name=DevPsi solve negative damp continuous pde   	;# potential in semiconductor
   solution add name=Qfp solve negative damp continuous pde
   solution add name=Qfn solve negative damp continuous pde
   solution add name=Cl solve !negative damp pde         			;# Cl ion concentration
   solution add name=H solve !negative damp pde         			;# hydrogen ion concentration
   solution add name=Na solve !negative damp pde         			;# Na ion concentration
   solution add name=A solve !negative damp pde         			;# acid species concentration
   solution add name=SOH2 solve !negative damp pde					;#positive interface charge
   solution add name=Temp const val=300.0
   #solution add name=Temp solve pde !negative continuous damp
   # these are needed if donor or acceptor traps are included
   solution add name=ETemp solve const val = 300.0 continuous
   solution add name=HTemp solve const val = 300.0 continuous    
   solution add name=Donor solve const val = 10.0
   solution add name=Acceptor solve const val = 10.0
   #----------------------------------------------------------------------------------------------------------------------------------------
   #-------------------------------------------Specify the Doping (this includes static traps)----------------------------------------------
   # the GaN doping is most important when fitting to an experimental IV curve; it is usually p-type
   #GaN Doping units are /cm3, negative sign is p-type, 
   sel z= 2.0e14*Mater(GaN) name=GaN_Doping 
   
   #AlGaN Doping
   sel z= 1.0e0*Mater(AlGaN) name=AlGaN_Doping
   
   #AlN doping
   sel z= 1.0e12*Mater(AlN) name=AlN_Doping
   #SiC doping
   sel z= 1.0e12*Mater(SiC) name=SiC_Doping
   
   #GaN2 doping, GaN cap layer (no physics included)
   sel z= 1.0e0*Mater(GaN2) name=GaN2_Doping
   #for new gate lengths
   set SDedge [expr (1.9+$gateLinc)]
   #Source and Drain contact doping-from contact to 2DEG to make contacts ohmic (Gaussian profile is used in the expression)
   sel z=(1e19*(y>$SDedge)+(y<=$SDedge)*1.0e19*exp(-(y-$SDedge)*(y-$SDedge)/($SDedge*0.02*0.02)))*(exp(-(x*x)/($SDedge*0.03*0.03))) name=Drain_Doping
   sel z=(1e19*(y<-$SDedge)+(y>=-$SDedge)*1.0e19*exp(-(y+$SDedge)*(y+$SDedge)/($SDedge*0.02*0.02)))*(exp(-(x*x)/($SDedge*0.03*0.03))) name=Source_Doping
   #Total doping
   sel z=GaN_Doping+AlGaN_Doping+Drain_Doping+Source_Doping+SiC_Doping+AlN_Doping+GaN2_Doping name=Doping 
   
   #----------------------------------------------------------------------------------------------------------------------------------------  
   #------------------------------------------Specify the AlN ratio in the AlGaN------------------------------------------------------------
   # this is used in the modelfile to calculate AlGaN material parameters
   sel z=0.25 name=AlN_Ratio
   #----------------------------------------------------------------------------------------------------------------------------------------
   #------------------------------------------Species Concentrations and Mobilities---------------------------------------------------------
   #concentrations
   set Av 6.02e23    						;# Avogadro's number, ions/mol
   set cCl  [expr (100.0e-3*$Av)*1e-3]  	;# M*ions/mol*l/cm3 = ions/cm3
   set cNa  [expr (100.0e-3*$Av)*1e-3]  	;# M*ions/mol*m3/cm3 = ions/cm3
   set cH   [expr (1.0e-1*$Av)*1e-3]  		;# ions/cm3
   set cA   [expr (1.0e-1*$Av)*1e-3]  		;# ions/cm3
   set Ns 	 1.0e15						 	;# surface interface site density /cm2
   #mobilities and diffusivity constants 
   set D_Na 1.96e-5                    	;# cm2/s from Lopreore
   set D_Cl 2.03e-5                    	;# cm2/s from Lopreore
   set D_H  8.24e-5                    	;# cm2/s from Lopreore
   set D_A  2.00e-5                    	;# cm2/s from Lopreore
   set Namob [expr {$D_Na/$Vt}]
   set Clmob [expr {$D_Cl/$Vt}]
   set Hmob [expr {$D_H/$Vt}]
   set Amob [expr {$D_A/$Vt}]
   #assign mobility variable for each ion species
   pdbSetDouble Electrolyte Cl mob $Clmob
   pdbSetDouble Electrolyte Na mob $Namob
   pdbSetDouble Electrolyte H mob $Hmob 
   pdbSetDouble Electrolyte A mob $Amob 
   #-----------------------------------------------------------------------------------------------------------------------------------------	
   #-------------------------------------------Poisson in Electrolyte------------------------------------------------------------------------
   proc Poisson_Electro {Mat} {   
   global k q eps0 Vt 
   
   pdbSetDouble $Mat DevPsi DampValue 0.025
   pdbSetDouble $Mat DevPsi Abs.Error 0.001
   pdbSetDouble $Mat DevPsi Rel.Error 0.01
   
   set eqn " ($eps0 * [pdbDelayDouble $Mat DevPsi RelEps] * grad(DevPsi) / $q) + (- Cl + H - A + Na)"
   pdbSetString $Mat DevPsi Equation $eqn
   } ;#end Poisson proc
   #-----------------------------------------------------------------------------------------------------------------------------------------
   #------------------------------------------Continuity in Electrolyte----------------------------------------------------------------------
   proc Continuity2 {Mat} {
   global Vt Namob Clmob Hmob Amob
   #set eqn "ddt($species) - (([pdbDelayDouble $Mat $species mob]) * sgrad($species, -DevPsi / $Vt))"
   set eqnNa "ddt(Na) - ($Namob) * sgrad(Na, -DevPsi/$Vt)"
   set eqnCl "ddt(Cl) - ($Clmob) * sgrad(Cl, DevPsi/$Vt)"
   set eqnH "ddt(H) - ($Hmob) * sgrad(H, -DevPsi/$Vt)"
   set eqnA "ddt(A) - ($Amob) * sgrad(A, DevPsi/$Vt)"
   pdbSetString $Mat Na Equation $eqnNa
   pdbSetDouble $Mat Na Abs.Error 1.0e-5
   pdbSetDouble $Mat Na Rel.Error 1.0e-3
   pdbSetString $Mat Cl Equation $eqnCl
   pdbSetDouble $Mat Cl Abs.Error 1.0e-5
   pdbSetDouble $Mat Cl Rel.Error 1.0e-3
   pdbSetString $Mat H Equation $eqnH
   pdbSetDouble $Mat H Abs.Error 1.0e-5
   pdbSetDouble $Mat H Rel.Error 1.0e-3
   pdbSetString $Mat A Equation $eqnA
   pdbSetDouble $Mat A Abs.Error 1.0e-5
   pdbSetDouble $Mat A Rel.Error 1.0e-3
   }	;#end Continuity proc
   #-----------------------------------------------------------------------------------------------------------------------------------------
   #------------------------------------------Call procedures describing Physics-------------------------------------------------------------
   #Poisson equation and trap ionization
   Poisson GaN2
   Poisson AlGaN
   Poisson_Ins Nitride
   Poisson_Ins GaO
   Poisson SiC
   Poisson AlN
   Poisson GaN
   Poisson_Electro Electrolyte
   #Continuity equations for electron, hole and transient trap simulation
   ElecContinuity GaN
   ElecContinuity AlGaN
   ElecContinuity SiC
   ElecContinuity AlN
   HoleContinuity GaN
   HoleContinuity AlGaN
   HoleContinuity SiC
   HoleContinuity AlN
   Continuity2 Electrolyte			;#call proc for electrolyte continuity 
   #-----------------------------------------------------------------------------------------------------------------------------------------
   #--------------------------------------------Change in Ion Concentrations at Contact Proc-------------------------------------------------
   proc Dir.contact2 {Contact} {
   global cCl cNa cH cA
   pdbSetBoolean $Contact Cl Flux 0
   pdbSetBoolean $Contact Cl Fixed 1
   pdbSetBoolean $Contact Na Flux 0
   pdbSetBoolean $Contact Na Fixed 1
   pdbSetBoolean $Contact H Flux 0
   pdbSetBoolean $Contact H Fixed 1
   pdbSetBoolean $Contact A Flux 0
   pdbSetBoolean $Contact A Fixed 1
   pdbSetString $Contact Cl Equation "Cl-$cCl"
   pdbSetString $Contact Na Equation "Na-$cNa"
   pdbSetString $Contact H Equation "H-$cH"
   pdbSetString $Contact A Equation "A-$cA"
   }	;#end electrolyte ion conc proc
   #-----------------------------------------------------------------------------------------------------------------------------------------
   #---------------------------------------------Initialize all contacts to 0V---------------------------------------------------------------
   #contact name=G Electrolyte voltage supply=3.0
   contact name=B SiC voltage supply=0.0
   contact name=S AlGaN voltage supply=0.0
   contact name=D AlGaN voltage supply=0.0
   
   pdbSetBoolean B Temp Fixed 0
   pdbSetString B Temp Equation "(2.7*(Temp-300.0))/0.00125"
   #-----------------------------------------------------------------------------------------------------------------------------------------
   #----------------------------------------------Run the Initial Guess Procedure------------------------------------------------------------
   #Initial guess procedure, call for all materials 
   proc Init {Mat} {
   newton $Mat eqn=Doping+Donor-Acceptor+Hole-Elec var=DevPsi damp=0.025
   }
   Init GaN
   Init AlGaN
   Init AlN
   Init SiC
   sel z=$cH*Mater(Electrolyte) name=H1
   sel z=0 name=H2
   sel z=H1+H2 name=H
   sel z=$cNa*Mater(Electrolyte) name=Na
   sel z=$cCl*Mater(Electrolyte) name=Cl
   sel z=$cA*Mater(Electrolyte) name=A
   sel z=6.1 name=DevPsi
   Dir.contact2 G			;#call for ion concentration change at contact (electrolyte) proc
   #-----------------------------------------------------------------------------------------------------------------------------------------
   #--------------------------------------------Run and Plot---------------------------------------------------------------------------------
   set WinA [CreateGraphWindow]   	;# absorbed charge v. pH (H+, A- and total)
   set WinB [CreateGraphWindow]	;# semiconductor potential v. pH
   set WinC [CreateGraphWindow]	;# Id-Vds curve (point measurement)
   set WinD [CreateGraphWindow]	;# net adsorbed charge v. position (y-direction) across pH range 
   device													;# multiple device commands to help with convergence
   device
   device 
   device
   pdbSetString AlGaN_GaO DevPsi Equation " -3.26e12"   	;# polarization charge for AlGaN-DL
   pdbSetString AlN_GaN DevPsi Equation "2.2e13"			;# polarization charge for AlN-GaN
   pdbSetString AlGaN_Nitride DevPsi Equation " -3.26e13"  ;# polarization charge for AlGaN-Nitride
   pdbSetString AlGaN_GaN DevPsi Equation  "1.06e13" 		;# polarization charge for AlGaN-GaN
   device init
   device
   device 
   device
   #--------------------------------------------Energy Band Diagram v. Position (X-Direction, DL/AlGaN)--------------------------------------------------------------------------			
   sel z=Econd
   plot.1d y.v=0.0 plot_name=Band label=Ec !cle
   sel z=Eval
   plot.1d y.v=0.0 plot_name=Band label=Ev !cle
   sel z=Qfp
   plot.1d y.v=0.0 plot_name=Band label=Qfp !cle
   sel z=Qfn
   plot.1d y.v=0.0 plot_name=Band label=Qfn !cle
   sel z=DevPsi
   plot.1d y.v=0.0 plot_name=Band label=DevPsi !cle
   sel z=Doping
   plot.1d x.v=0.0 plot_name=DopingX label=Doping !cle
   sel z=Doping
   plot.1d y.v=0.0 plot_name=DopingY label=Doping !cle
   #specify solution variable for negative oxide surface site SO
   solution add name=SO solve !negative damp pde         
   #-------------------------------------------pH increment and adsorbed charge derivation----------------------------------------------------
   if {1} {
   #Kfa is a the forward reaction rate coefficient for the SO equation. 
   set Kfa 2.58867e-11 											
   #Kra is a the reverse reaction rate coefficient for the SO equation. 
   set Kra 1.0e5										
   #Kfb is a the forward reaction rate coefficient for the SOH2 equation. 
   set Kfb 2.58867e-11									
   #Krb is a the reverse reaction rate coefficient for the SOH2 equation. 
   set Krb 1.0e2											
   #Ns is the number of available surface sites
   set Ns 1.0e15
   # H interface equations for Electrolyte-DL 
   pdbSetString Electrolyte_GaO SO Equation "ddt(SO) - $Kra*($Ns-SO-SOH2) + $Kfa*(H(Electrolyte))*(SO)"
   pdbSetString Electrolyte_GaO SOH2 Equation "ddt(SOH2) - $Krb*(SOH2) + $Kfb*(H(Electrolyte))*($Ns-SOH2-SO)"
   pdbSetString Electrolyte_GaO H Electrolyte Equation "+ $Krb*(SOH2) - $Kfb*(H(Electrolyte))*($Ns-SOH2-SO) + $Kra*($Ns-SO-SOH2) - $Kfa*(H(Electrolyte))*(SO)"
   pdbSetString Electrolyte_GaO DevPsi Equation "SOH2 - SO"
   #ph increment
   for {set inc 0} {$inc<10.5} {set inc [expr $inc+1.0]} {
   set mult [expr pow(10,$inc)]    ;# need to put in expr to evaluate right away to avoid syntax error in pdb equation
   pdbSetString G H Equation "H-($cH/$mult)"
   pdbSetString G A Equation "A-($cA/$mult)"
   #drain bias ramp
   for {set Vds 0.05} {$Vds<1.1} {set Vds [expr $Vds+0.1]} {
   contact name=D supply=$Vds
   device init
   device
   device
   set cur [expr (1.0e6*(-[contact name=D sol=Qfn flux] + [contact name=D sol=Qfp flux]))]  ;# plots the current versus time (mA/mm) 
   AddtoLine $WinC IdVd.$inc $Vds $cur 
   }	
   # ion distribution (X-direction, electrolyte/DL/AlGaN), p[ion] = -log10[ion conc]
   sel z=log10(Na+1.0)
   plot.1d y.v=0.0 !cle plot_name=electrolyte label=Na
   sel z=log10(Cl+1.0)
   plot.1d y.v=0.0 !cle plot_name=electrolyte label=Cl
   sel z=log10(H+1.0)
   plot.1d y.v=0.0 !cle plot_name=electrolyte label=H
   sel z=log10(A+1.0)
   plot.1d y.v=0.0 !cle plot_name=electrolyte label=A
   #adsorbed charge derivation for electrolyte-DL 
   sel z=SOH2
   set nit_plus [interface Electrolyte /GaO y.v=0.0 val]
   puts $nit_plus
   sel z=SO
   set nit_minus [interface Electrolyte /GaO y.v=0.0 val]
   puts $nit_minus
   set int_chrg [expr ($nit_plus-$nit_minus)]
   set pH 1+$inc
   AddtoLine $WinA Int_chrg $pH $int_chrg 
   AddtoLine $WinA SOH2 $pH $nit_plus
   AddtoLine $WinA SO $pH $nit_minus  
   #-------------------------------------------Electrostatic Potential and pH (Y-Direction)----------------------------------------------------
   sel z=DevPsi
   set potential [interface Electrolyte /GaO y.v=0.0 val]
   AddtoLine $WinB Potential $pH $potential
   set potential [interface Electrolyte /GaO y.v=-0.25 val]
   AddtoLine $WinB Potential2 $pH $potential
   set potential [interface Electrolyte /GaO y.v=0.25 val]
   AddtoLine $WinB Potential3 $pH $potential
   #-------------------------------------------Net Adsorbed Charge v Position (Y-Direction)----------------------------------------------------	
   #these points are defined for 1 um gate length. For any other gate length, the y.v values must be changed. 
   if {1} {
   #positive oxide surface sites
   sel z=SOH2 
   set t1 [interface Electrolyte /GaO y.v=-0.5 val]
   set t2 [interface Electrolyte /GaO y.v=-0.375 val]
   set t3 [interface Electrolyte /GaO y.v=-0.25 val]
   set t4 [interface Electrolyte /GaO y.v=-0.125 val]
   set t5 [interface Electrolyte /GaO y.v=0.0 val]
   set t6 [interface Electrolyte /GaO y.v=0.125 val]
   set t7 [interface Electrolyte /GaO y.v=0.25 val]
   set t8 [interface Electrolyte /GaO y.v=0.375 val]
   set t9 [interface Electrolyte /GaO y.v=0.4 val]
   set t10 [interface Electrolyte /GaO y.v=0.5 val]
   set t11 [interface Electrolyte /GaO y.v=0.48 val]
   set t12 [interface Electrolyte /GaO y.v=0.5 val]
   sel z=SO 													;#negative oxide surface site
   set m1 [interface Electrolyte /GaO y.v=-0.5 val]
   set m2 [interface Electrolyte /GaO y.v=-0.375 val]
   set m3 [interface Electrolyte /GaO y.v=-0.25 val]
   set m4 [interface Electrolyte /GaO y.v=-0.125 val]
   set m5 [interface Electrolyte /GaO y.v=0.0 val]
   set m6 [interface Electrolyte /GaO y.v=0.125 val]
   set m7 [interface Electrolyte /GaO y.v=0.25 val]
   set m8 [interface Electrolyte /GaO y.v=0.375 val]
   set m9 [interface Electrolyte /GaO y.v=0.40 val]
   set m10 [interface Electrolyte /GaO y.v=0.45 val]
   set m11 [interface Electrolyte /GaO y.v=0.48 val]
   set m12 [interface Electrolyte /GaO y.v=0.5 val]
   set T1 [expr $t1-$m1]
   set T2 [expr $t2-$m2]
   set T3 [expr $t3-$m3]
   set T4 [expr $t4-$m4]
   set T5 [expr $t5-$m5]
   set T6 [expr $t6-$m6]
   set T7 [expr $t7-$m7]
   set T8 [expr $t8-$m8]
   set T9 [expr $t9-$m9]
   set T10 [expr $t10-$m10]
   set T11 [expr $t11-$m11]
   set T12 [expr $t12-$m12]
   AddtoLine $WinD Intchrg.$inc -0.5 $T1
   AddtoLine $WinD Intchrg.$inc -0.375 $T2
   AddtoLine $WinD Intchrg.$inc -0.25 $T3
   AddtoLine $WinD Intchrg.$inc -0.125 $T4
   AddtoLine $WinD Intchrg.$inc 0.0 $T5
   AddtoLine $WinD Intchrg.$inc 0.125 $T6
   AddtoLine $WinD Intchrg.$inc 0.25 $T7
   AddtoLine $WinD Intchrg.$inc 0.375 $T8
   AddtoLine $WinD Intchrg.$inc 0.4 $T9
   AddtoLine $WinD Intchrg.$inc 0.45 $T10
   AddtoLine $WinD Intchrg.$inc 0.48 $T11
   AddtoLine $WinD Intchrg.$inc 0.5 $T12
   }
   #-------------------------------------------SO/DevPsi v. Position Across pH Range----------------------------------------------
   # SO v position (y-direction) 
   sel z=SO
   plot.1d x.v=0.0005 plot_name=Intchrg label=SO.$inc !cle
   set nitT_minus [interface Electrolyte /GaO x.v=0.0005 val]		
   puts $nitT_minus
   sel z=Econd
   plot.1d y.v=0.0 plot_name=Band2 label=Ec.$inc !cle
   sel z=Eval
   plot.1d y.v=0.0 plot_name=Band2 label=Ev.$inc !cle
   sel z=Qfp
   plot.1d y.v=0.0 plot_name=Band2 label=Qfp.$inc !cle
   sel z=Qfn
   plot.1d y.v=0.0 plot_name=Band2 label=Qn.$inc !cle
   #DevPsi v position (x-direction, DL/AlGaN) 
   sel z=DevPsi
   plot.1d y.v=0.0 plot_name=Band2 label=DevPsi.$inc !cle
   #-------------------------------------------Current v. time and Carrier (E) Conc v. Position (X-Direction, DL/AlGaN)----------------------------------------------------------------------------
   plot.1d y.v=0.0 plot_name=elec_conc label=elec.$inc !cle		
   }	;#end for loop, increment pH
   }	;#end if{1}