Proc OhmicContact

From Flooxs
Revision as of 20:30, 17 August 2010 by Nrowsey (talk | contribs) (New page: #------------------------------------------------------------------------- # Ohmic Contact - takes NType or PType (MB only. see Reprint proc for FD) #-----------------------------------...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#-------------------------------------------------------------------------
# Ohmic Contact - takes NType or PType (MB only. see Reprint proc for FD)
#-------------------------------------------------------------------------
#Solves Elec, Hole, and DevPsi at boudary
proc OhmicContact {Contact Mat Type} {
    global smaller
    set sm $smaller
    Puts "\nCongratulations! $Contact is making an Ohmic Contact to $Type $Mat!"
   #--------------------------------------------------------------------------------
   # Print All Const Solutions Vars into local Vars - Contact Cannot Expand These
   #--------------------------------------------------------------------------------
	ReprintConsts $Mat
	foreach var {nQFL pQFL Doping elec0 hole0} {
		set $var [pdbGetString $Mat $var]
	}

   #--------------------------------------------------------------------------------
   # Decide if Poisson Only - then you have Elec and Hole as const too...
   #--------------------------------------------------------------------------------
   if {[pdbGetBoolean PoissonOnly]} {
       # Kind of Boundary
	    pdbSetBoolean $Contact DevPsi Flux 1
	    pdbSetBoolean $Contact DevPsi Fixed 1
    	# Contact Equation for DevPsi - charge neutrality
   	if {[string compare $Type "Ntype"] == 0} {
			pdbSetString $Contact DevPsi Equation "$Doping-$elec0"
		}
		if {[string compare $Type "Ptype"] == 0} {
		    pdbSetString $Contact DevPsi Equation "$Doping+$hole0"
		}
   } else {
   #------------------------------------------------------------------------------
   # DevPsi, Elec, and Hole are pde Solution Vars
   #------------------------------------------------------------------------------
	    # Kind of Boundary
		foreach var {Elec Hole DevPsi} {
		    pdbSetBoolean $Contact $var Flux 1
		    pdbSetBoolean $Contact $var Fixed 1
		}

		#scale (multiply) flux by q to get current
		foreach var {Elec Hole} {pdbSetDouble $Contact $var Flux.Scale 1.619e-19}

       #Contact Equations for Elec, Hole and DevPsi
		if {[string compare $Type "Ntype"] == 0} {
		    pdbSetString $Contact Elec Equation "$Doping-Elec";#maj carrier (n=Nd)
		    pdbSetString $Contact Hole Equation "$pQFL + $Contact";#minQFL=-qVapp
		    pdbSetString $Contact DevPsi Equation "$nQFL + $Contact";#majQFL=-qVapp
		}
		if {[string compare $Type "Ptype"] == 0} {
	        pdbSetString $Contact Hole Equation "$Doping+Hole";#Nd-Na+p-n=0
		    pdbSetString $Contact Elec Equation "$nQFL + $Contact"
		    pdbSetString $Contact DevPsi Equation "$pQFL + $Contact"
		}

	    #External Current: not used yet
	    pdbSetString $Contact Equation "(Flux_Hole - Flux_Elec)"
	};# ends Poisson-Only if/else    
}