Alagator Language Description

From Flooxs
Jump to navigation Jump to search

Language Reference

The alagator language is used to specify partial differential equations and boundary conditions for use with diffusion and device simulation. The equations are expressed in a Newton iteration ready form - all equations are assumed to be equal to zero. Most mathematical operators are supported for use in specifying equations, and a variety of operators for differential terms are also available. Derivatives are taken automatically, so there is no need to specify derivative information.

Basic Expression Types and Operators

The alagator uses a natural arithmetic approach to the specification of the partial differential equations. Normal mathematical expressions are used, so most algebraic quantities can be constructed. Binary operators, functions, and constants and parameters are supported. The addition of expressions is not difficult.

Care has to be used about tcl expansion of variables and strings, as usually, users want variables to be expanded at run time, not when they are read in. Please refer to tcl command documentation for help on string expansion.

Binary Operators

Most common binary algebraic operators are supported. Addition "+", subtraction "-", multiplication "*", and division "/" are all included. Unary negation is also supported with the usual mathematical rules applying. Normal precedence rules apply. Parenthesis "(" ")" are also supported for grouping operations. In addition to the basic four mathematical operators, power "^" is also supported. a^b raises a to the b power.

A large number of comparison operators are also implemented. The operators ">", "<", ">=", "<=", "==", and "!=" are all implemented with their usual meanings. Care must be used with equals and not equals since comparison of floating-point values in this way can be problematic. Logical operators and, "&&", and or, "||", are also provided. All of these are supported for differential equations, however, care has to be used, however, as Newton's method does not guarantee convergence for problems that are not first-order continuous.

Table 1 - Operator Precedence

Operator

Description

Power

-

Unary Minus

*,/

Multiplication, Division

,-

Addition, Subtraction

<. <=, >=, >

Comparison

==, !=

equality, inequality

&&

logical and

||

logical or

?: Arithmetic if then else
, comma operator for lists

Simple Functions

The simple functions all take one argument which must be enclosed in parenthesis. The argument can be any expression. Most common functions are available, including "exp" natural exponentiation, "log" natural log, "log10" log base 10, and "sqrt" square root. Additionally, the complementary error function, "erfc", and error function, "erf", are also provided to help build initial doping profiles. All of these functions have supported derivatives and can be used in the specification of partial differential equations. There is also support for the Fermi 1/2 and 3/2 functions (f12 and f32).

Abs and sign provide an absolute value and sign operation. The sign operation is a positive one if the argument is greater than zero and minus one for less than zero.These functions do provide derivatives and can be used as part of a differential equation.

Differential Functions

The differential functions are for use in PDE's only, and are not evaluated with the select command. There are five operators - three of which are truly differential, and the others are used to return scalar evaluation of vectors parallel and perpendicular to edges of evaluation.

Time derivatives are supported with the ddt operator. It takes a single argument and computes the time derivative of the argument for use in a partial differential equation. Timestep integration is provided automatically using the Bank-Rose TRBDF method.

Spatial derivatives are supported in two ways. A simple gradient is supported by grad. Implied is the evaluation in a discrete sense and the integral around a control volume. For this reason, div is not required. Device simulation can use the Scharfetter-Gummel current discretization, and sgrad is provided for this purpose. Sgrad requires two arguments. The first is the concentration and the second is potential. These are integrated to build a drift-diffusion flux based on a constant electric field along the edge.

The dot, mag, and cross operators provide the dot product, magnitude, and cross product of the gradients of the two scalar fields passed as arguments. These provide the capability of computing the electric field perpendicular to the channel for use in mobility surface scattering as one example.

Resolution of String Names

Strings that are not recognized as real numbers, operators, or functions are handed to the resolution phase of the parser. These strings are compared to three sets of possible matches. The first are valid solution names created with the solution command. Finally, remaining strings are passed to tcl's expression function to see if they can be parsed to a real number constant. This allows placement of parameters from pdb into differential equations.

Solution Names

Solution names must match the string exactly as specified in the [solutions.htm solution] command. These are the most important resolution since they allow linking of the equations to the variables to be solved. Derivatives are automatically taken of all equations with respect to each solution name found in the equation. Solutions can either be defined by the solution of a partial differential equation or an expression of other variables. For example, in solving for device currents using Quasi-Fermi levels, the electron concentration solution could be a Boltzmann expression using the conduction band and the electron Quasi-Fermi level.

Constants and Parameters

Anything that does not match a solution is handed to tcl's expression parser to see if it evaluates as a valid expression. The result is treated as a constant.

Simple Examples

sel z=log10(Boron)

Select the log10 of the Boron solution variable.

sel z = log10(abs(Doping))*sign(Doping)

Select the signed log of the doping field.

set eqn "ddt(Boron) - 9.0e-16 * grad(Boron)"

Set the eqn variable to a string that contains a simple Fickian diffusion with a constant diffusivity.

See Also

language tutorials, complex examples, solution, select