Plotting Examples - new short version: Difference between revisions
(added examples of the "layers" cmd) |
No edit summary |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Plotting in Flooxs == | == Plotting in Flooxs == | ||
If you would like a comprehensive explanation of all the flooxs post-processing commands, see the following link: [[Post Processing Commands]] | |||
This section presents examples of the most-common plotting scenarios, including examples of the '''plot?d''', '''Window''', and '''layers''' command. | |||
== The | == The plot2d Method == | ||
This is useful quickly plotting from the command line as you are debugging. | |||
=== plotting the grid === | |||
The plot2d grid function uses the grid definition you typed in before your init to draw the grid, i.e. it uses these lines of your script to plot the grid" | |||
line x loc=... | |||
region Oxide xlo=... | |||
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. | |||
'''example 1: plotting the grid in 2d on a named pane "grid" in the created graphics window:''' | |||
plot | plot2d graph=grid;# draw grid lines in a plot window, with different colors for different materials | ||
plot2d graph=grid bound !cle;# draw black lines to represent the boundaries between different material regions | |||
foreach | plot2d graph=grid contact=Top !cle;# mark a red symbol on grid nodes that have a contact named "Top" on it | ||
foreach nam {Top Left Rigt Bot} {plot2d contact=$nam !cle};# use a loop for all contacts | |||
=== plotting variables and expressions === | |||
'''example 2: plotting Doping, Elec, and Hole concentration''' | |||
First, select what you want to plot, e.g. one of these: | |||
sel z=Elec ;# you can select any variable you have defined in floods | |||
sel z=log10(abs(Elec+1e-10);# you can select any expression Alagator can parse | |||
sel z=sign(Charge)*log10(abs(Charge));# if you want to know the sign of the original variable | |||
Note: I took the absolute value of Elec before I took its log, and I also added a very small number, 1e-10, which is approximately zero, because you can't take the log of a negative number, or of zero. | |||
Then, use the plot1d command, specifying slices where appropriate. | |||
plot1d ;#for a 1d simulation | |||
plot1d yv=0 ;#take 1 slice at y=0 for a 2d simulation | |||
plot1d yv=0 zv=0;# 2 slices for a 3d simulation | |||
Here's a tcl loop that plots Doping, Elec and Hole on the same pane "p1d" in a window, with a label: | |||
foreach var {Doping Elec Hole} {sel z=$var; plot1d graph=p1d yv=0.0 label=$var !cle} | |||
Note: "!cle" means "don't clear the previous plot" | |||
Note: using "label=some.name" makes your key on the plot window decipherable | |||
'''example 3: plotting a band diagram''' | |||
Here's a tcl loop that plots the previously defined variables Ec, Efn, and Efp. | |||
foreach var {Ec Efn Efp Ev} {sel z=$var; plot1d graph=p1d yv=0 label=$var !cle} | |||
== The CreateGraphWindow Method == | |||
Here is an example of how to plot Electron concentration using the CreateGraphWindow method: | |||
set WinElec [CreateGraphWindow] ;# store the plot channel in a variable | |||
sel z=Elec ;# choose the variable for the y-axis | |||
CreateLine $WinElec Elec.per.cm3 [slice Oxide x=0.0];# Elec.per.cm3 is a name for the plot key | |||
CreatGraphWindow is most useful during loops. For example, you can use AddToLine to make Id-Vg plots in a MosFET, or to plot the creation of interface traps vs time: | |||
'''example 4: plot an Id-Vg curve for a MOSFET''' | |||
#Ramp drain voltage up first (changes Fermi level least) | |||
for {set bias 0.0} {$bias <= 1.0} {set bias [expr {$bias + 0.1}]} { | |||
puts \n | |||
contact name=D voltage supply=$bias | |||
puts "Ramping D to $bias" | |||
device | |||
#PlotBands y.v=36.0 z.v=0.0 | |||
#PlotConc_old y.v=0.250 z.v=-1.0 | |||
} | |||
#Ramp gate up | |||
set Win_IdVg [CreateGraphWindow] | |||
set delta 0.01 | |||
for {set bias 0.0} {$bias <= 1.0} {set bias [expr {$bias - $delta}]} { | |||
puts \n | |||
contact name=G voltage supply=$bias | |||
puts "Ramping G to $bias" | |||
device | |||
#get current from the drain (choose regular or log) | |||
set cur [expr abs([contact name=D sol=Elec flux] - [contact name=D sol=Hole flux])] | |||
#set cur log10($cur+1e-10) | |||
AddtoLine $Win_IdVg IdVg $bias $cur;#channel, name, x-val, y-val | |||
#PlotBands y.v=24 z.v=0.0 | |||
#PlotConc_old y.v=0.250 z.v=-1.0 | |||
#if {$VG < -15.0} {set delta 0.05} | |||
#if {$VG < -20.0} {set delta 0.05} | |||
} | |||
== | '''example 5: plot concentration of interface traps (Nit) vs. time''' | ||
set WinNit [CreateGraphWindow];# channel name | |||
device time=420 init=1e-12 movie = { | |||
set t [simGetDouble Device time];#returns t in seconds | |||
sel z=Nit;# select the variable for the y-axis | |||
AddtoLine $WinNit Nit $t [interface value Silicon /Oxide];#Nit here is a name for the plot key | |||
== Saving Plots As Images from the Command Line == | |||
This is a procedure I use for saving .gif images of my plots in a PLOTS directory that I have previously created: | |||
#proc for saving the graph as gif image | |||
proc SnapImage {win_val filename} { | |||
puts $win_val ".graph snap .image" | |||
puts $win_val ".image write PLOTS/$filename.gif -format gif" | |||
flush $win_val | |||
} | |||
If you have called all your plot channel Win$var, where $var is a var name such as Elec, then you use this loop to save each of your plots as a .gif image, or use this example to write your own. | |||
foreach var {Elec Hole Nit Doping} { | |||
eval set win_val "\$Win$var" | |||
SnapImage $win_val $var | |||
} | |||
== Integrating with the Layers Command == | == Integrating with the Layers Command == | ||
You might want to know how much of a certain variable (usually charge) is in a certain layer. For this, you can use the '''layers''' command. This will ask floods to integrate your /cm^3 variable along a certain line, and gives you how much charge is in a layer /cm^2. | |||
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): | 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 | flooxs> sel z=Elec-1e14 |
Latest revision as of 17:58, 15 June 2020
Plotting in Flooxs
If you would like a comprehensive explanation of all the flooxs post-processing commands, see the following link: Post Processing Commands
This section presents examples of the most-common plotting scenarios, including examples of the plot?d, Window, and layers command.
The plot2d Method
This is useful quickly plotting from the command line as you are debugging.
plotting the grid
The plot2d grid function uses the grid definition you typed in before your init to draw the grid, i.e. it uses these lines of your script to plot the grid"
line x loc=... region Oxide xlo=...
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.
example 1: plotting the grid in 2d on a named pane "grid" in the created graphics window:
plot2d graph=grid;# draw grid lines in a plot window, with different colors for different materials plot2d graph=grid bound !cle;# draw black lines to represent the boundaries between different material regions plot2d graph=grid contact=Top !cle;# mark a red symbol on grid nodes that have a contact named "Top" on it foreach nam {Top Left Rigt Bot} {plot2d contact=$nam !cle};# use a loop for all contacts
plotting variables and expressions
example 2: plotting Doping, Elec, and Hole concentration
First, select what you want to plot, e.g. one of these:
sel z=Elec ;# you can select any variable you have defined in floods sel z=log10(abs(Elec+1e-10);# you can select any expression Alagator can parse sel z=sign(Charge)*log10(abs(Charge));# if you want to know the sign of the original variable
Note: I took the absolute value of Elec before I took its log, and I also added a very small number, 1e-10, which is approximately zero, because you can't take the log of a negative number, or of zero.
Then, use the plot1d command, specifying slices where appropriate.
plot1d ;#for a 1d simulation plot1d yv=0 ;#take 1 slice at y=0 for a 2d simulation plot1d yv=0 zv=0;# 2 slices for a 3d simulation
Here's a tcl loop that plots Doping, Elec and Hole on the same pane "p1d" in a window, with a label:
foreach var {Doping Elec Hole} {sel z=$var; plot1d graph=p1d yv=0.0 label=$var !cle}
Note: "!cle" means "don't clear the previous plot" Note: using "label=some.name" makes your key on the plot window decipherable
example 3: plotting a band diagram Here's a tcl loop that plots the previously defined variables Ec, Efn, and Efp.
foreach var {Ec Efn Efp Ev} {sel z=$var; plot1d graph=p1d yv=0 label=$var !cle}
The CreateGraphWindow Method
Here is an example of how to plot Electron concentration using the CreateGraphWindow method:
set WinElec [CreateGraphWindow] ;# store the plot channel in a variable sel z=Elec ;# choose the variable for the y-axis CreateLine $WinElec Elec.per.cm3 [slice Oxide x=0.0];# Elec.per.cm3 is a name for the plot key
CreatGraphWindow is most useful during loops. For example, you can use AddToLine to make Id-Vg plots in a MosFET, or to plot the creation of interface traps vs time:
example 4: plot an Id-Vg curve for a MOSFET
#Ramp drain voltage up first (changes Fermi level least) for {set bias 0.0} {$bias <= 1.0} {set bias [expr {$bias + 0.1}]} { puts \n contact name=D voltage supply=$bias puts "Ramping D to $bias" device #PlotBands y.v=36.0 z.v=0.0 #PlotConc_old y.v=0.250 z.v=-1.0 } #Ramp gate up set Win_IdVg [CreateGraphWindow] set delta 0.01 for {set bias 0.0} {$bias <= 1.0} {set bias [expr {$bias - $delta}]} { puts \n contact name=G voltage supply=$bias puts "Ramping G to $bias" device #get current from the drain (choose regular or log) set cur [expr abs([contact name=D sol=Elec flux] - [contact name=D sol=Hole flux])] #set cur log10($cur+1e-10) AddtoLine $Win_IdVg IdVg $bias $cur;#channel, name, x-val, y-val #PlotBands y.v=24 z.v=0.0 #PlotConc_old y.v=0.250 z.v=-1.0 #if {$VG < -15.0} {set delta 0.05} #if {$VG < -20.0} {set delta 0.05} }
example 5: plot concentration of interface traps (Nit) vs. time
set WinNit [CreateGraphWindow];# channel name device time=420 init=1e-12 movie = { set t [simGetDouble Device time];#returns t in seconds sel z=Nit;# select the variable for the y-axis AddtoLine $WinNit Nit $t [interface value Silicon /Oxide];#Nit here is a name for the plot key
Saving Plots As Images from the Command Line
This is a procedure I use for saving .gif images of my plots in a PLOTS directory that I have previously created:
#proc for saving the graph as gif image proc SnapImage {win_val filename} { puts $win_val ".graph snap .image" puts $win_val ".image write PLOTS/$filename.gif -format gif" flush $win_val }
If you have called all your plot channel Win$var, where $var is a var name such as Elec, then you use this loop to save each of your plots as a .gif image, or use this example to write your own.
foreach var {Elec Hole Nit Doping} { eval set win_val "\$Win$var" SnapImage $win_val $var }
Integrating with the Layers Command
You might want to know how much of a certain variable (usually charge) is in a certain layer. For this, you can use the layers command. This will ask floods to integrate your /cm^3 variable along a certain line, and gives you how much charge is in a layer /cm^2.
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]