source: trunk/examples/app-fermi/fortran/fermi.f @ 665

Last change on this file since 665 was 665, checked in by dkearney, 17 years ago

Updates to Rappture::Utils::progress for all languages
removed the dependancy on Rappture.Units from within number.py, it should only depend on Rappture which will include Rappture.Units
added Rappture.Units as a module to load when people import Rappture in python.
added -V pbs variable to queue.py to include qsub environment variables in the submitted job.
updated setup.py.in to install Rappture.Utils
added progress bar to all app-fermi examples showing how to use the Rappture::Utils::progress function in all languages.
added destructor definitions to Node classes in src2/core

File size: 2.2 KB
Line 
1c ----------------------------------------------------------------------
2c  EXAMPLE: Fermi-Dirac function in Fortran.
3c
4c  This simple example shows how to use Rappture within a simulator
5c  written in Fortran.
6c
7c ======================================================================
8c  AUTHOR:  Michael McLennan, Purdue University
9c  AUTHOR:  Derrick Kearney, Purdue University
10c  Copyright (c) 2004-2005  Purdue Research Foundation
11c
12c  See the file "license.terms" for information on usage and
13c  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14c ======================================================================
15
16      program fermi
17        IMPLICIT NONE
18
19        integer rp_lib, rp_units_convert_dbl
20
21        integer driver, ok, progress
22        double precision T, Ef, kT, Emin, Emax, dE, f, E
23        CHARACTER*100 inFile, strVal
24        character*40 xy
25
26        call getarg(1,inFile)
27        driver = rp_lib(inFile)
28
29        call rp_lib_get(driver,
30     +        "input.number(temperature).current", strVal)
31        ok = rp_units_convert_dbl(strVal,"K",T)
32
33        call rp_lib_get(driver,
34     +        "input.number(Ef).current", strVal)
35        ok = rp_units_convert_dbl(strVal,"K",Ef)
36
37        kT = 8.61734e-5 * T
38        Emin = Ef - 10*kT
39        Emax = Ef + 10*kT
40
41        dE = 0.005*(Emax - Emin)
42
43c       Label out graph with a title, x-axis label,
44c       y-axis label and y-axis units
45
46        call rp_lib_put_str (driver,"output.curve(f12).about.label",
47     +          "Fermi-Dirac Factor",0)
48        call rp_lib_put_str (driver,"output.curve(f12).xaxis.label",
49     +          "Fermi-Dirac Factor",0)
50        call rp_lib_put_str (driver,"output.curve(f12).yaxis.label",
51     +          "Energy",0)
52        call rp_lib_put_str (driver,"output.curve(f12).yaxis.units",
53     +          "eV",0)
54
55        do 10 E=Emin,Emax,dE
56          f = 1.0/(1.0+exp((E-Ef)/kT))
57          progress = nint((E-Emin)/(Emax-Emin)*100)
58          call rp_utils_progress (progress,"Iterating")
59          write(xy,'(E20.12,F13.9,A)') f, E, char(10)
60          call rp_lib_put_str (driver,
61     +          "output.curve(f12).component.xy", xy, 1)
62 10     continue
63
64        call rp_result(driver)
65      end program fermi
Note: See TracBrowser for help on using the repository browser.