Plotting Examples - new short version

From Flooxs
Revision as of 19:51, 22 March 2010 by Nrowsey (talk | contribs) (added examples of the "layers" cmd)
Jump to navigation Jump to search

Plotting in Flooxs

There are 2 ways to plot in flooxs. The easiest way is to use the plot.?d command. This is useful quickly plotting from the command line as you are debugging. The CreateGraphWindow method is more powerful but requires more lines of code (but not much more).


The plot.?d Method

example 1: plotting the grid in 2d:

plot.2d grid
plot.2d bound !cle
plot.2d contact name=Top !cle
foreach cont_name {Top Bot Source Drain} {plot.2d contact name=$cont_name}

The first line draws your grid lines in a plot window, with different colors for different materials. The second line draws black lines (the boundaries) around your different material regions. The !cle means "don't clear." The 3rd line marks a red symbol on all the grid nodes that have the contact named "Top" defined on it. The 4th line is useful if you have several contacts and don't want to make a line 3 type command for each one; line 4 is a loop that will plot the 4 contacts named Top, Bot, Source and Drain.

Some notes about plotting the grid: the plot.?d grid function uses the grid definition you typed in before your init (the line x loc=... and region Oxide xlo=... section) to draw the grid. If you use struct outf=filename.str to store your grid structure solution values, the grid is stored for the purposes of solving on the grid, and not for plotting. So if you the use init inf=filename.str in another file, your grid will be stored for equation solving, and your solution variables will be stored, but you will not be able to plot the grid. You have to plot the grid in the deck you have typed your line x loc=... etc.

To plot the grid in 1d:

plot.1d line
plot.1d x.v=0.0 symb=1

To plot the grid in 3d: you have to save out a file and use tecplot to view it (check back later)

example 2: plotting Doping and Elec and Hole concentration

You can use the following format to print a line or slice through your structure (depending if your structure is 1, 2, or 3d):

sel z=VAR
plot.1d ;#for a 1d simulation
plot.1d y.v=0 ;#for a 2d simulation
plot.1d y.v=0, z.v=0;# for a 3d simulation

In the above example, VAR can be any variable you have defined in flooxs, or an expression that Alagator can parse. You can also take a slice through any line that goes through your structure. I have chosen the line y=0, (the .v stands for value), but you may choose the line you want to slice through. Here's how to plot the log10 of Doping, Elec, and Hole in a 2d simulation:

sel z=log10(abs(Doping+1.0))
plot.1d y.v=0.0 label=Doping
sel z=log10(abs(Elec+1.0))
plot.1d y.v=0.0 !cle
sel z=log10(abs(Hole+1.0))
plot.1d y.v=0.0 !cle

I wanted to plot the log10 and the absolute value. Also, I added a "+1.0" to my variable in case the variable was zero - you can't take the log of 0. You can write !cle if you don't want to clear the previous plot, and you can write label=some.name if you want the key on the plot window to reflect something other than "val.0" You can also make this plot with a loop

foreach var {Doping Elec Hole} {sel z=$var; plot.1d y.v=0.0 label=$var !cle}

example 3: plotting a band diagram

foreach var {Ec Efn Efp Ev} {sel z=$var; plot.1d y.v=0 label=$var !cle}

The CreateGraphWindow Method

Integrating with the Layers Command

To use the layers command, first you select the variable you want integrated; then you specify the line or plane you want floods to integrates along; floods then integrates along that line, separately in each material, and separately within materials if there is a sign change in the variable you've given it; finally, floods prints a list like this (this example is a 1D moscap structure):

flooxs> sel z=Elec-1e14
sel z=Elec-1e14
Parsing Equation...

flooxs> layers
layers
{         Top          Bottom        Integral    Material}
{-1.20000e+00     0.00000e+00    -1.20000e+10    Oxide}
{ 0.00000e+00     5.00000e+00     5.05845e+11    Silicon}


If I had an inversion layer it would look more like:

{         Top          Bottom        Integral    Material}
{-1.20000e+00     0.00000e+00    -1.20000e+10    Oxide}
{ 0.00000e+00     0.030000e+00     5.05845e+11    Silicon}
{ 0.03000e+00     5.00000e+00     1.05845e+10    Silicon}

and you could tell that the inversion layer thickness was 0.03um in Silicon, and that the total charge in the inversion layer (you can get capacitance if you graph this vs top gate voltage, then take the slope) is 5.05e11 Elec/cm^2.


Below I have 2 procedures that I use for different codes - the first gets the inversion layer depth if you give it the variable and the threshold, e.g. you can do either:

InversionLayer Elec 1.0e14;# to print to screen
set inv_depth [InversionLayer Elec 1.0e15];# to store in inv_depth

The second gets the total electron concentration in the oxide of a mos structure (must have oxide as first material in x):

set totelec [GetTotElec];# in case you wanted to, say, plot this at different time steps

These procs have extra lines that use tcl to search the floods output list and find the number I want in the material I want. Unfortunately they're fairly specific to what I was doing (i.e. it doesn't look for "oxide" or anything like that, it just counts entries and gets the same one every time).

proc InversionLayer {var thresh} {
   sel z=($var-$thresh)
   set percm2 [layers y.v=0.250 z.v=-4.0];#center of the structure
   set percm2 [KillChar $percm2 \{];#kill the brackets
   set percm2 [KillChar $percm2 \}]
   set percm2 [split $percm2 \n];# split into list at newline
   set percm2 [lindex $percm2 3];# return third element of list (Silicon)
   set percm2 [split $percm2 \t]
   #inversion layer depth
   set xinv [KillChar [lindex $percm2 1] \ ]
   puts "xinv, inversion layer depth is $xinv"
   #Electron density /cm2
   set percm2 [KillChar [lindex $percm2 2] \ ]
   puts "inversion layer $var percm2 is $percm2"
   return $percm2
}
#example: set percm2 [InversionLayer Elec 1e15]
proc GetTotElec {} {
   #sel z=log10(abs(Elec)+1.0)
   sel z=Elec
   set totelec [layers]
   set totelec [KillChar $totelec \{]
   set totelec [KillChar $totelec \}]
   set totelec [split $totelec \n];#split into lists at the newline
   set totelec [lindex $totelec 1];#returns the 1st element of the list (line w oxide)
   set totelec [split $totelec \t];#split into new list at tabs
   #inversion layer depth
   set mat [KillChar [lindex $totelec 3] \ ];#get 3rd element (material)
   set totelec [KillChar [lindex $totelec 2] \ ];# get 2nd element (integral)
   set totelec [expr log10(abs($totelec)+1.0)];# take log for better graphing
   puts "totelec in the $mat is $totelec"
   return $totelec
}
#example: set totelec [GetTotElec]