Complex Examples

From Flooxs
Jump to navigation Jump to search

Process Examples

All of the main dopant routines are presented. The overall dopant bulk routine is presented in the callback section. It makes calls to these routines to assemble the actual partial differential equations.

Fermi Level Dependent Diffusion

The procedure takes the standard two arguments used by all equation procedures, material and solution name. It then calls pdbName to convert the material name to that used by the pdb system. The routine is called by DopantBulk if the Fermi model has been selected.

proc DopantFermi { Mat Sol } {
    set pdbMat [pdbName $Mat]

Assembling the diffusivity is the next major chore. This is done as a term for convenience, as it is not used elsewhere.

    #build the diffusivity
    set difnam Diff$Sol
    #build the diffusivity term
    set dif [pdbDelayDouble $Mat $Sol D0]
    if {[pdbIsAvailable $Mat $Sol Dn]} {
	  set dif "$dif   [pdbDelayDouble $Mat $Sol Dn] * Noni"
    }
    if {[pdbIsAvailable $Mat $Sol Dnn]} {
	  set dif "$dif   [pdbDelayDouble $Mat $Sol Dnn] * Noni^2"
    }
    if {[pdbIsAvailable $Mat $Sol Dp]} {
	  set dif "$dif   [pdbDelayDouble $Mat $Sol Dp] * Poni"
    }
    if {[pdbIsAvailable $Mat $Sol Dpp]} {
	  set dif "$dif   [pdbDelayDouble $Mat $Sol Dpp] * Poni^2"
    }
    solution add name = $difnam solve const val = $dif $Mat

The name for term is set first, and is made specific to the dopant in question. The diffusivity is accumulated in a tcl variable, component by component. Components are only added if they are present in the pdb (pdbIsAvailable), which simplifies the equation. Noni and Poni are the scaled electron and hole concentrations and are created by the potential equation procedure.

    set ActName ${Sol}Active
    set eqn "ddt($Sol) - $difnam * grad( $ActName )"
    set chgtype [pdbGetSwitch $pdbMat $Sol Charge]
    if {$chgtype == 1} {
	  solution add name = $difnam solve const val = "($dif) / (Poni)" $Mat
	  set eqn "ddt($Sol) - $difnam * grad( $ActName * Poni )"
    } elseif {$chgtype == 2} {
	  solution add name = $difnam solve const val = "($dif) / (Noni)" $Mat
	  set eqn "ddt($Sol) - $difnam * grad( $ActName * Noni )"
    }

The name of the active species is set, which corresponds to a term created in the main dopant bulk routine. A tcl variable is set for the equation which includes a time derivative and the diffusion flux term. The charge type (neutral, acceptor, negative) is fetched, and then appropriate electric field terms are created for the dopants if they are charged.

    pdbSetString $pdbMat $Sol Equation $eqn
    return $ActName
}

Finally, the equation is stored into the pdb. This string will be read immediately after the procedure finishes by the alagator code. The subroutine returns the name of the charged species for use in the DopantBulk routine.

Dopant-Defect Bulk Diffusion

These routines implement the coupled diffusion of most dopants. As per normal, the routine takes the material and solution name as arguments.

proc DopantPair { Mat Sol } {
    set pdbMat [pdbName $Mat]

    #get all of the defects we are working with
    set ld [pdbGetString $pdbMat $Sol Defects]

The routine fetches from the data base a list of all defects that the dopant pairs with. This entry is a tcl list, and can be processed with all the tcl operations for lists.

    #build an expression for the substitutional dopant
    set ActName ${Sol}Active
    set den 1.0
    foreach d $ld {
	  set den "$den   $d * [pdbDelayDouble $pdbMat $Sol $d Binding]"
    }
    solution add name = ${Sol}Sub solve const val = "$ActName / ( $den )" $Mat

This section creates the substitutional dopant term. The substitutional dopant plus the dopant defect pairs has to equal the active concentration. In this model, we assume that the dopant-defect pairs are in equilibrium with the defects and substitutional dopant. The Binding entry in the pdb gives the equilibrium constant of the dopant-defect reaction.

    #create the basic equation and then add
    pdbSetString $pdbMat $Sol Equation "ddt( $Sol )"

The equation is created with the time derivative of the chemical concentration. The fluxes will be summed for each defect in the next loop.

    #for each dopant defect pair, build the flux
    foreach d $ld {
	  DopantDefectPair $pdbMat $Sol $d
    }

This loops over all defects that pair with the dopant, and calls a procedure to assemble their flux.

    return ${Sol}Sub
}

The subroutine returns the name of the charged species for use in the [callback.htm#DopantBulk dopant bulk routine]. The procedure for each dopant pair defect follows and takes three arguments - material, dopant solution, defect solution.

proc DopantDefectPair { Mat Sol Def } {
    puts "DopantDefectPair $Mat $Sol $Def"

    #build the diffusivity
    set difnam Diff${Sol}${Def}

We need to build a term for each of the diffusivities, so it is given a name that is unique to the dopant and defect

    #build the diffusivity term
    set dif [pdbDelayDouble $Mat $Sol $Def D0]
    if {[pdbIsAvailable $Mat $Sol $Def Dn]} {
	  set dif "$dif   [pdbDelayDouble $Mat $Sol $Def Dn] * Noni"
    }
    if {[pdbIsAvailable $Mat $Sol Dnn]} {
	  set dif "$dif   [pdbDelayDouble $Mat $Sol $Def Dnn] * Noni^2"
    }
    if {[pdbIsAvailable $Mat $Sol Dp]} {
	  set dif "$dif   [pdbDelayDouble $Mat $Sol $Def Dp] * Poni"
    }
    if {[pdbIsAvailable $Mat $Sol Dpp]} {
	  set dif "$dif   [pdbDelayDouble $Mat $Sol $Def Dpp] * Poni^2"
    }
    set SubName ${Sol}Sub
    set chgtype [pdbGetSwitch $Mat $Sol Charge]
    set chg 1.0
    if {$chgtype == 1} {
	  set chg Poni
    } elseif {$chgtype == 2} {
	  set chg Noni
    }
    solution add name = $difnam solve const val = "( $dif ) / $chg" $Mat

This section is very similar to the section for the diffusivity used in DopantFermi. The diffusivity with the defect is summed up to a single tcl variable. The charge type is also obtained, and appropriate electric field is initialized in the tcl variable chg.

    set eqn "$difnam * grad( $SubName * Scale${Def} * $chg )"
    solution add name = Flux${Sol}${Def} solve const val = $eqn $Mat

The equation is assembled which includes the driving forces of dopant concentration, defect concentration, and electric field. The flux is put into a term with a unique name for the dopant and defect.

    set de [pdbGetString $Mat $Sol Equation]
    pdbSetString $Mat $Sol Equation "$de - Flux${Sol}${Def}"
    set de [pdbGetString $Mat $Def Equation]
    set bind [pdbDelayDouble $Mat $Sol $Def Binding]
    pdbSetString $Mat $Def Equation "$de   ddt($bind * $SubName * $Def) - Flux${Sol}${Def}"
}

The current equation for the dopant is obtained, and then set to the current equation minus the dopant defect flux. Next, the modifications to the defect equation are prepared by fetching the current defect equation. The equilibrium constant is obtained so that the time derivative of the dopant-defect pairs can be added to the defect equation. In addition, the dopant-defect flux needs to be added to the defect equation.

Dopant Boundary Condition

Boundary condition routines are a little bit more difficult, because you have to be careful about which side of the interface is being specified in the equation.

Segregation

This routine implements a basic material to material segregation.

proc Segregation { Mat Sol } {
    set pdbMat [pdbName $Mat]

    #get the names of the sides
    set s1 [FirstMat $pdbMat]
    set s2 [SecondMat $pdbMat]

Like routines for bulk materials, this takes the material name and solution name. It also, however, needs to know the names of the materials on either side of the interface. FirstMat and SecondMat return those names.

    set ss1 [pdbIsAvailable $s1 $Sol DiffModel]
    set ss2 [pdbIsAvailable $s2 $Sol DiffModel]

This determines if a DiffModel has been selected for the dopants on both sides of the interface. If a DiffModel isn't available, then the dopant is not being solved in that material and segregation is inappropriate.

    if { $ss1 && $ss2 } {
	  set seg [pdbDelayDouble $pdbMat $Sol Segregation]
	  set trn [pdbDelayDouble $pdbMat $Sol Transfer]

This checks the diffmodel, and then obtains the segregation constant and transfer rate for this interface.

	  set sm1 ${Sol}_$s1
	  set sm2 ${Sol}_$s2
	  set eq "$trn * ($sm1 - $sm2 / $seg)"
	  pdbSetString $pdbMat $Sol Equation_$s1 "- $eq"
	  pdbSetString $pdbMat $Sol Equation_$s2 "$eq"
    }
}

The first two lines construct the names of the solutions on the first and second side of the material. The string eq is set to the segregation flux for the material, and then the equation is added to the both sides of the interface. This insures dose will be conserved in this operation.

Device Examples

See Also

language tutorials, callbacks, equation, term, solution, select