TermCommand
Term Command
term - define a new subexpression for use in the equation specification of [language.htm alagator]
Synopsis
term
[add] [list] [delete] [name = <c>] [eqn=<c>] [print] [Material Specification]
Description
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 [callback.htm 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.
- add
- Create a new term. A term with that name will be overwritten.
- list
- List all of the names of the current terms. This is returned as a tcl list, so it can be used in conjunction with all of the list functionality.
- delete, clear
- Remove a term from the current set.
- name
- The reference name for the term. This name is defined, and will be compared to strings found in the equation parsing. Capitalization is important, and only exact matches are allowed.
- eqn
- The string defining the equation part of the term. The equation must conform to all the normal constraints of the [language.htm alagator language]. Terms may be nested - the equation specified here can refer to other terms. Parsing of the equation is done during diffusion, so there is no need for everything to be predefined.
- Print the equation for the term matching the name specified. If no term matches, an empty string is returned and a tcl error happens.
- [../Intro.html#Material Material Specification]
- Please see the introduction for information on material specification. If a material is specified, the term becomes specific for this material only. This allows the same name to have different equations in different materials. For example, charge can be defined to have different meaning in silicon than in HgCdTe.
Examples
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.
Bugs and Missing Features
Using terms around interfaces can be confusing. Please see both the [language.htm language] and [callback.htm 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.htm callback procedures].
See Also
[tutorials.htm language tutorials], [language.htm language definition], [callback.htm callback procedures], [eqn.htm eqn], [solutions.htm solution], [examples.htm Alagator Examples]
[../Intro.html FLOOPS/FLOODS Home Page]