Feedback Mechanisms and Atmospheric Models


Lab 1 - Appendix A

Computer Programs and Resources


Contents


| Return to Feedback Mechanisms and Atmospheric Models |

Spreadsheet Programming:

Sample Results:
 
Row/column 
A
B
C
D
E
F
G
H
I
J
K
10
          delta-t 1     Difference between  
11
Radiative Cooling     Exact Soln     Approx Soln     Approx-Exact  
12
Initial Temp 100  
time
Temp
  
time
Temp
  
time
 
13
Room Temp 20  
0
100.0
  
0
100.0
  
0
0.0
14
a 0.1  
1
92.4
  
1
92.0
  
1
-0.4
15
     
2
85.5
 
2
84.8
  
2
-0.7

Formulas used to calculate the sample results shown above:
 
Row/column
A
B
C
D
E
F
G
H
I
J
K
10
          delta-t 1     Difference between  
11
Radiative Cooling     Exact Soln     Approx Soln     Approx-Exact  
12
Initial Temp 100   time Temp   time Temp   =G12 diff
13
Room Temp 20   0 =$B$13+($B$12-$B$13)*EXP(-$B$14*D13)   0 =$B$12   =G13 =H13-E13
14
a 0.1   =D13+G$10 =$B$13+($B$12-$B$13)*EXP(-$B$14*D14)   =G13+G$10 =H13-$B$14*(H13-$B$13)*G$10   =G14 =H14-E14
15
      =D14+G$10 =$B$13+($B$12-$B$13)*EXP(-$B$14*D15)   =G14+G$10 =H14-$B$14*(H14-$B$13)*G$10   =G15 =H15-E15


| Top of page |

FORTRAN code:

Here's the FORTRAN code if you happen to really want to run this through the compiler, etc.  The spacing is almost certainly going to work out correctly, so take a good look at the code before compiling. (It really did work at one time!)
 

    Program Coffee
c
c
    open(11,file=*’/coffee-approx’, form=’formatted’)
    open(12,file=*’/coffee-exact’, form=’formatted’)
c
    call dummy
c
    nmx=14
    a= .1
c   a=.3
    dt = 1.
    troom = 20.
    tinitial = 100.
c
    ti = 100.
    t = 0.
    do n = 1,nmx
        t = t + dt
        tf = ti – a*(ti-troom)*dt
            write(6,100) t,tf
            write (11,100) t,tf
        ti = tf
    enddo
c
    write (6,101)
c
    ti = 100.
    t = 0.
    do n=l,nmx
        t = t + dt
        tf = troom + (tinitial – troom)*exp(-a*t)
            write (6,100) t,tf
            write (12,100) t,tf
        ti = tf
    enddo
c
 100 format (f7.0,f9.1)
 101 format (/)
    stop
    end


| Top of page | Return to Feedback Mechanisms and Atmospheric Models |
b
The Woodrow Wilson National Fellowship Foundation
CN 5281, Princeton NJ 08543-5281 - Tel:(609)452-7007 - Fax:(609)452-0066
Technical contact: lpt@woodrow.org