Using equations (1), (2) and (5), verify equations (3) and (4). Taking the unit square geometry of Figure 3(a), assume emission points at the four centerpoints of the surfaces and normal emission. Thus, for the left-hand, vertical surface, take: and . According to equations (3) and (4), attempt to compute the intersection points for surfaces 2-4, etc.
Here, we shall use the Cray random number generator, ranf(), to perform emissions according to Figure 10 and Equations (23) and (24). We will do this by generating vectors (in the computer sense) of random numbers-one vector for and one vector for . Using these, we'll generate one vector of values and one other vector of values. As we generate ``many'' emissions, we should expect the distribution of emissions to approach: (1) a uniform distribution in and (2) in . First, generate 10,000 emissions (requiring 20,000 random numbers - 10,000 to obtain the 10,000 values of , and another 10,000 to obtain the 10,000 values of ). Partition these emissions into groups of 10, 100, 1,000 and 10,000 (you can do this by referencing the first 10, 100, elements in your and arrays).
(a) Consider the distribution function for . Partition the domain into 36 intervals (bins) of each (-, -, ). For each , plot the function of emissions which fall into the bins vs. the bin centerpoint (i.e., plot vs. , , ). Comment on the ``convergence'' of the distributions.
(b) Now perform a similar test for . Divide into 9 bins of each, with , , . Plot vs. for all 5 's. Comment on the ``convergence'' here, too.
1. The exact answers are:
2. Do the above calculations as efficiently as possible (if on the Cray, use hpm to assess MFLOP's).
Hand in: (1) your program, (2) the plots, and (3) discussions.
Obtain the code as specified in section 5.2. Supply the portions of the code ``bleeped'' out-these are detailed in section 5.4. Compile and run the code on a Cray architecture. Make sure your answers are correct (the errors should all be less than ). Hand in the code and the output, together with your comments on how well the Cray did (was it fast?). Use hpm to assess performance, and relate this to the photon flight rate computed and output from the code.
First, finish Exercise 3 above. Then, convert the working code to FORTRAN 90. Run the same example as above, and verify that your answers are the same. (Note: Cray has FORTRAN 90 compilers available now. Many IBM RS 6000's have FORTRAN 90 compilers, and there are a variety available for PC's.) Report the results of this exercise to the author of this chapter (send electronic mail to email@example.com) to receive congratulations and be covered with glory.
Modify the code obtained in Exercise 3 to perform a simulation of daylighting. This modification is accomplished in a series of steps as follows.
(a) First, photons must be emitted from only one surface (choose a vertical surface - say the left side), a ``solar'' surface which simulates photons coming from the sun. They can be emitted in a constant direction, and should be emitted with a positive and a negative . Photons need not be emitted from any other surfaces. Also, if you implement a non-zero reflectance (see part (c), then all photons which get back to the ``solar'' surface should not be reflected (i.e. should be absorbed).
(b) Second, the photons from the ``solar'' surface must be traced and those which pass through the ``work'' surface (corresponding to a typical height of a desk) must be tallied. It is useful to capture the flux of these photons by partitioning the work surface into a grid (10 grids in the direction is a good number). This work surface is a non-interacting surface, used only for tallying photons which pass through it. It is convenient to define this surface to be a plane at in the geometry given.
(c) Finally, you may wish to make the surfaces reflecting. Choosing a diffuse reflectance of 0.7 is typical of a surface painted flat white, yielding an absorptance of 0.3.