Last change
on this file since 66 was
66,
checked in by mmc, 19 years ago
|
Cleaned up the app-fermi example so that it works the same way
across all of the various languages.
Added rpResult() function for reporting results. All programs
should all this to save out the XML before they exit. Also added
the fortran version rp_result().
|
-
Property svn:executable set to
*
|
File size:
1.2 KB
|
Line | |
---|
1 | # ---------------------------------------------------------------------- |
---|
2 | # EXAMPLE: Fermi-Dirac function in Tcl. |
---|
3 | # |
---|
4 | # This simple example shows how to use Rappture within a simulator |
---|
5 | # written in Tcl. |
---|
6 | # ====================================================================== |
---|
7 | # AUTHOR: Michael McLennan, Purdue University |
---|
8 | # Copyright (c) 2004-2005 |
---|
9 | # Purdue Research Foundation, West Lafayette, IN |
---|
10 | # ====================================================================== |
---|
11 | package require Rappture |
---|
12 | |
---|
13 | # open the XML file containing the run parameters |
---|
14 | set driver [Rappture::library [lindex $argv 0]] |
---|
15 | |
---|
16 | set T [$driver get input.(temperature).current] |
---|
17 | set T [Rappture::Units::convert $T -to K -units off] |
---|
18 | set Ef [$driver get input.(Ef).current] |
---|
19 | set Ef [Rappture::Units::convert $Ef -to eV -units off] |
---|
20 | |
---|
21 | set kT [expr {8.61734e-5 * $T}] |
---|
22 | set Emin [expr {$Ef - 10*$kT}] |
---|
23 | set Emax [expr {$Ef + 10*$kT}] |
---|
24 | |
---|
25 | set E $Emin |
---|
26 | set dE [expr {0.005*($Emax-$Emin)}] |
---|
27 | while {$E < $Emax} { |
---|
28 | set f [expr {1.0/(1.0 + exp(($E - $Ef)/$kT))}] |
---|
29 | $driver put -append yes output.curve(f12).component.xy "$f $E\n" |
---|
30 | set E [expr {$E + $dE}] |
---|
31 | } |
---|
32 | |
---|
33 | # save the updated XML describing the run... |
---|
34 | Rappture::result $driver |
---|
35 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.