Plotting Examples - new short version

From Flooxs
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