term - define a new subexpression for use in the equation specification of alagator
[add] [list] [delete] [name = <c>] [eqn=<c>] [print] [Material Specification]
This command allows the user to create subexpressions for use with the scripting language. Terms are never required, but can offer substantial computation benefit. Each term is evaluated only once during assembly, and the results are cached. If multiple equations refer to a term, the first equation to use it evaluates the expression and the remainder use the cached values. Terms are usually employed for expressions that need to appear in several partial differential equations. For example, a recombination term between vacancies and interstitials needs to appear in both the vacancy and interstitial equation A term can be employed for the recombination, and then placed in both partial differential equations. The recombination will then be evaluated only once during the assembly process.
Terms can be created, searched, and printed. That allows inquiries about terms to be made in the various call back procedures. This allows fairly intelligent decisions to be made. For example, the charge term in Poisson's equation can be accumulated by getting the current charge and adding new pieces to the term.
term name=Charge add silicon eqn="Arsenic-Boron"
This command creates a term named "Charge" in silicon only. The Charge keyword will be replaced with the subexpression "Arsenic-Boron"
term name=Noni add silicon eqn = exp(Potential*$Vti)
This command creates a term named "Noni" in silicon only. The equation will be the exponential of Potential times $Vti. The normal rules for tcl string variable and execution apply, so that Vti must be a currently defined variable. The value will be replaced when the term command is excuted.
term name=Noni add silicon eqn = {exp(Potential*$Vti)}
This is the same as the prior command. The difference is the curly braces around the equation - this delays variable expansion. The variable will not get expanded until the diffusion command executes. This is the more normal form. We would the Vti variable to be replaced with the value of the current temperature of the diffusion command, not the temperature at the time of the term command execution.
term list
Return a list of all the current term names defined.
term name=Charge print
Return the currently defined equation corresponding to the name Charge.
Using terms around interfaces can be confusing. Please see both the language and callback sections for more information.
Terms are not built to work around missing variables. In the example of Charge above, if either Arsenic or Boron are not in the mesh, an error will occur. Terms like this can't be predefined, they need to be built from the current solution process. This is usually done during the callback procedures.
language tutorials, language definition, callback procedures, eqn, solution, Alagator Examples