General Equation Builder
You can add and use this procedure to create continuity equations for your species. You must tell it:
- the name (Name) of your species (e.g. Hole)
- the material (Mat) you wish to add the continuity equation in (e.g. Silicon)
- what type of species you are adding, and therefore what type of constant (Const) the equation should have
- choose 0 for fixed species (e.g. a non-mobile oxide trap)
- choose D for mobile species that will diffuse but are not charged (e.g. hydrogen or H2)
- choose MOB for species that are mobile AND charged (e.g. Elec or Hole)
- the value (Val) of the constant specified in 3. (e.g. 150.0) (note, Val does not have to be a number)
- the charge (Charge) on the species (choose 0, -, or +)
proc AddSpecies {Name Mat Const Val Charge} {
set eqn "ddt($Name)"
if {$Const == "D"} {append eqn "-$Val*grad($Name)"}
if {$Const == "MOB"} {
if {$Charge == "-"} {append eqn "-$Val*Vt*sgrad(($Name), +DevPsi/Vt-log(Gamma_n))"}
if {$Charge == "+"} {append eqn "-$Val*Vt*sgrad(($Name), -DevPsi/Vt+log(Gamma_p))"}
}
#Add dharged terms to Poisson Equation
if {$Charge != "0"} {
if {[pdbIsAvailable $Mat DevPsi Equation]} {
set eqnP [pdbGetString $Mat DevPsi Equation]
set eqnP [append eqnP " $Charge $Name"]
pdbSetString $Mat DevPsi Equation $eqnP
puts "Amending Poisson Eqn in $Mat to: $eqnP"
}
}
#Store the transport equation in the pdb
puts "Adding $Name Equation in $Mat: $eqn"
pdbSetString $Mat $Name Equation $eqn
}
#Example:
#Procedure Name Mat Const Val Charge
#--------------------------------------------------------------
AddSpecies H2 Oxide D 1.7e-15 0
AddSpecies Elec Silicon MOB 300.0 -
AddSpecies Hole Silicon MOB "(300.0/2.0)" +