rainbow_project

# Modelling the rainbow

## Introduction

Feel free to expand and contribute

### Observations

Rainbow can be observed when…

#### Local observations by authors

In the Portland, OR area, rainbows are bright and quite frequent. This spring, Prof. Kuzma observed a double rainbow three times in south-west Portland, all between the hours of 2pm and 6pm.

### History

… Scientific research on rainbow goes back to Aristotle, Shen Kuo (China, 1031–1095), Kamāl al-Dīn al-Fārisī (Persia, 1267–1319) and Rene Descartes (Europe, 1596-1650)…

### Cultural and cinematographic references

Rainbow is mentioned in … In some cultures, it can be a symbol of

• Good luck

## Theory

### Assumptions

A simple, most commonly observed single or double rainbow can be explained by assuming the following:

1. Rainbow is formed by sun rays scattered by the water droplets of the rain
2. The droplets are much larger than the wavelengths of visible light, so diffraction effects can be mostly neglected
3. The droplets are perfect spheres (most cases can be explained this way)
4. The light enters each sphere, refracts, has multiple internal reflections, and exits via another refraction
• Important: The light enters the sphere not at a specific point, but at all the points, from hitting head-on to barely grazing it
• In our model, we calculate what happens to each point of entry, then do the analysis of how much power is associated with each point
• We parametrize the point of entry by the variable $d$, the distance from the path of the incident ray to the path of the central ray
5. Each ray of light will remain within a two-dimensional plane formed by that ray and the center of the droplet.
6. The droplets are sparse enough that the scattering of the same ray by multiple droplets can be neglected
7. The droplets are falling much slower than the speed of light, and their motion can be ignored
8. It can be shown, that most light intensity will exit at a specific angle
9. The refraction index of air can be assumed to be 1 or very close to one
10. The refraction index of water depends on the wavelength $\lambda$ (measured in air) in a known way
11. For each number of internal reflections, the intensity of scattered light as a function of angle can be modeled
12. For each number of internal reflections, there can be a separate rainbow

### Refraction

• Snell's law:
• $n_1\sin\theta_i=n_2\sin\theta_r$

#### From air into water

The initial incident ray satisfies the equation:

• $\arcsin\left(\frac{n_\text{air}\sin\theta_i}{n}\right)=\theta_r$
• Here $n_\text{air}=1.000283$ is the refraction index of air at 10$\,^\circ$C (Ref. [3])
• $n$ is the refraction index of water that depends on the vacuum wavelength of light, $\lambda$

#### From water into air

The final emerging ray satisfies the equation:…

### Internal reflections

• The law of reflection:
• $\theta_1=\theta_2$

## Methods

### Computational goals

The main goal of this project is to predict, for each color, the intensity distribution of the scattered light as a function of the scattering angle. In addition, the following observable parameters can be elucidated:

1. The overall angles of the primary and secondary rainbows
2. The ordering of colors for each rainbow
3. The angular spread between the dark-red and violet colors in each rainbow
4. The relative brightness of the sky “background” inside and outside the rainbow
5. feel free to suggest more

### Software

Microsoft Excel software will be used. The following functions are needed:

1. Creating a “grid” of numbers, e.g. a row or column of 400,410,420,…800 for the model wavelength (typing such an array is tedious, but it's quite easy using a “drag the corner” trick)
2. Creating a formula in the neighboring column, taking the preceding column as an input, and dragging it all the way to the end of the input column
3. Plotting (using scatter chart) the output column versus the input column
• with main title
• and with axis labels (called “axis titles” in Excel)
4. Automatically counting the number of cells in a certain range in an array, using COUNTIF() functions

This is the detailed list of tasks to be accomplished:

1. Find and import the data on the refraction index of water as a function of wavelength measured in air
• Create two columns:
1. one titled $\lambda$, for the input (from 400 nm to 800 nm in steps of 10 or 5 nm)
2. the other, titled n, for the refraction index values corresponding to the wavelengths to the left
3. create a scatter-plot of $n(\lambda)$ (choose “smooth lines” option)
2. Define the ray offset parameter
1. $\delta=\frac{d}{R}$ where d is the shortest distance from the line of the incident ray to the parallel line that passes through the droplet's center, and R is the radius of the droplet
2. Find the incident angle $\theta_i$ for the first refraction in terms of the parameter $\delta$
• Use the appropriate right-angled triangle in the drawing above (it must include $\theta_i$, $d$, and $R$)
3. From the diagram in Fig. 4 above, figure out by what angle the light deviates from the original direction during
1. refraction from air into the droplet (angle $\beta_1$)
• calculate $\theta_r$ from Snell's law, then substitute everything in terms of $d/R$
• express $\beta_1$ in terms of $\theta_i$ and $\theta_r$
• substitute your expressions of these thetas as a function of $d/R$
2. internal reflection (angles $\beta_2$, $\beta_3$, etc.). Hint: are these angles different or the same?
3. refraction from the water into the air (angles $\beta_2'$, $\beta_3'$, $\beta_4'$, etc.). See hint above.
4. Pick several rainbow colors and look up their wavelengths. For example, these classic seven:
1. Red
2. Orange
3. Yellow
4. Green
5. Blue
6. Indigo
7. Violet
5. For each color, create a column of offset parameters from $\delta\!=\!0$ (central ray) to $\delta\!=\!1$ (grazing ray) with a fine step of 0.005 or even 0.001
1. For each number of reflections N (0,1,2, and maybe 3?), calculate the total scattering angle $\gamma$ due to two refractions and N reflections.
• Note that the total scattering angle is the sum of individual deviations in each process:
• For N = 0, the total scattering angle is $\gamma_0$ $=\beta_1+\beta_2'$
• For N = 1, the total scattering angle is $\gamma_1$ $=\beta_1+\beta_2+\beta_3'$
• For N = 2, the total scattering angle is $\gamma_2$ $=\beta_1+\beta_2+\beta_3+\beta_4'$
2. For N = 1 and 2, plot the scattering angles $\gamma_1$ and $\gamma_2$ as a function of $\delta$
3. Calculate the relative scattered intensity for each color, each N, and each offset $\delta$
• Referring to Fig. 5 below, we can assume that the output power is some fixed fraction $s$ of the input power (since some light is lost to scattering corresponding to other values of N, and to initial reflection):
• $P_\text{inp}$ $\,=\,I_\text{inp}\!\cdot\!{\text{Area}}_\text{inp}$ $\,\approx\,I_\text{inp}\!\cdot\!2\pi d\,\Delta d$
• $P_\text{sc}$ $\,=\,I_\text{sc}\!\cdot\!{\text{Area}}_\text{sc}$ $\,\approx\,I_\text{sc}\!\cdot\!2\pi\,(D\sin\gamma)\,D\Delta \gamma\;$, where $\,D$ is the distance from the droplet to the observer.
• $P_\text{sc}$ $=s\!\cdot\!P_\text{inp}$
• $I_\text{sc}$ $=s\!\cdot\!I_\text{inp}\frac{d}{D^2\sin\gamma}\left|\frac{\Delta d}{\Delta\gamma}\right|$ $=s \cdot I_\text{inp}\frac{R^2\delta}{D^2\sin\gamma}\left|\frac{\Delta \delta}{\Delta\gamma}\right|$ $\sim I_\text{inp}\frac{\delta}{\sin\gamma}\left|\frac{\Delta \delta}{\Delta\gamma}\right|\;$: here the factors s, R, and D are pretty constant (or too complicated to calculate) and do not contribute to the relative intensity at various angles and wavelengths

### Questions about theory and coding

1. I was wondering if the relative scattered intensity was suppose to be calculated with the Rayleigh forumula?
• Answer: No, Rayleigh formula refers to scattering of light off of objects whose size is much smaller than the wavelength of light (see Wikipedia article on Rayleigh scattering). The rain droplets are 3 mm on average (as somebody posted in the data section below), much larger than the wavelengths of light. Instead, you should use the ray diagrams and Snell's law and the law of reflection, see the Figures above. You need to figure out the angles in Fig. 4 using these laws, then put the formulas into excel.
2. I figured out the trigonometry/geometry of the raindrop and light rays. I am having trouble with Excel, however. Please view the attached spreadsheet (highlighted cells). The value that Excel is calculating for Sin(-4….) (CELL AJ06) is different from what I get on my calculator, Wolframalpha, and Google. This is preventing me from formatting any further as I continue to get an ERROR message (CELL AP06).
• Answer: I think I know what your problem is. Excel always used radians for all trig functions. That's why you have to use DEGREES() to convert angles to degrees. But then, in columns X:AC, you use SIN(R5) and so on, but cells like R5 contain the angle in degrees. The SIN() always expects the radians though, and calculates the wrong value. Then it is all corrupt after that.
• Remember, radians and degrees are related through the factor of $\frac{\pi}{180}$. You can either keep everything in degrees up to the last final plot, or use a conversion factor every time you take a SIN() or TAN().
3. I think my problem is that I am apparently not understanding what needs to be done…
• Answer: You've done the first step – got your hands on the actual data for $n(\lambda)$ dependence for pure water. Now you need to do the rest of the analysis. It is all explained on this wiki. Briefly, you need to
1. Look at Fig. 4 above and, using the parameter $d$ as a given, as well as the index of refraction $n$, calculate $\beta_1+\beta_2+\beta_3'$ (this is the total deflection angle for the 1st rainbow), and, optionally, $\beta_1+\beta_2+\beta_3+\beta_4'$ (this is the total deflection angle for the 2nd rainbow). Basically, you need to obtain these two formulas (a bunch of sin() functions, really) that depend on $n$ and on $d/R$ ratio.
2. Set up a grid of possible $d/R$ ratios from 0 (normal incidence) to 1 (grazing beam), with some small step, e.g. 0.001
3. On that grid, for a particular $\lambda$, calculate the total deflection angle as a function of $d/R$ (i.e. your grid)
4. Then, on the same grid, calculate the intensity of the deflected light, assuming some (any, really) intensity of the sunlight
5. (optional, for maximum grade) - convert this intensity as a function of the $d/R$ grid to the total deflection angle grid. That would be the model of what you observe when you look at the actual rainbow, for each color.
4. I am having difficulty substituting $\beta_1$ into Snell's law. Is it possible I could have a hint based on the geometry of the diagram for the rainbow project to lead me in the right direction?
• Answer: If you look at a point where the beam enters the droplet, and notice that $\theta_i$ is equal to $\theta_i$ immediately on the other side of the water surface, then you can just see that $\beta_1$ is the difference $\theta_i-\theta_r$. See that on the drawing (Fig. 4)? The next reflection point is symmetric with this one, but the meaning of angles is different. Also, if you spot a right-angled triangle with $R$ (radius of the sphere) and $d$ as its sides, and the angle $\theta_i$ as one of its angles, that will allow you to relate $\sin\theta_i$ to the $d/R$ ratio. The flow of math is:
1. from $\;d/R\;$ find $\;\sin\theta_i$
2. from that find $\theta_i$
3. from that, using Snell's law, find $\theta_r$
4. from that, find $\beta_1$
5. How would I start solving for beta $\beta_2$, $\beta_3$, and $\beta_4$?
• Answer: If you look at the next reflection (Fig. 4), you can see that $\beta_2+\theta_r+\theta_r$ add up to 180$^\circ$ (or, $\pi$ radians). There, from symmetry, $\theta_r$ is the same as $\theta_r$ in the first refraction. All the other points are also symmetric to the original, so same logic applies. $\beta_3'$ is the difference between two thetas already found earlier. And so on.

## Data

Give yourself 20 minutes to google or search the literature for the index of refraction of water as a function of wavelength. Paste references and data (formulas and raw numbers if compact) below.

1. Index of refraction for water = 1.33. This is the average value. We need its dependence on the wavelength $\lambda$!
2. Average radius of water droplet = 3 mm (Ref. [4])
3. Average Sunlight Intensity on Earth = 1367 $\frac{W}{m^2}$

 $\lambda$ (nm) $(n^2−1)/(n^2\!+2)$ $\text{at}$ $10\,^\circ{\text C}$ $n\big(10\,^\circ{\text C}\big)$ $n\big(20\,^\circ{\text C}\big)$ $n\big(25\,^\circ{\text C}\big)$ Table 1. Refraction index of pure water. at $T=10\,^\circ$C, $\rho=999.7\,\frac{\text{kg}}{ {\text m}^3}$ Calculated by N.K. from Ref. 2… … … … … … … … at $T=20\,^\circ$C, adapted from Refs. 1, 5 by B.V. at $T=25\,^\circ$C, adapted from Refs. 1, 6 by B.V. 400 0.211798 1.343924521 1.34356 1.339 410 0.211276 1.342985396 1.34264 1.3386 420 0.210789 1.342112754 1.3418 1.3382 430 0.210336 1.341300053 1.34102 1.3378 440 0.209913 1.340541623 1.34029 1.3374 450 0.209518 1.339832528 1.33961 1.337 460 0.209147 1.339168446 1.33897 1.3366 470 0.208799 1.338545577 1.33838 1.3362 480 0.208472 1.337960559 1.33782 1.3358 490 0.208165 1.337410411 1.33729 1.3354 500 0.207875 1.336892472 1.3368 1.335 510 0.207602 1.33640436 1.33633 1.3346 520 0.207344 1.335943933 1.33588 1.3342 530 0.207101 1.335509257 1.33546 1.3338 540 0.206871 1.33509858 1.33506 1.3334 550 0.206654 1.334710307 1.33468 1.333 560 0.206448 1.334342982 1.33432 1.333 570 0.206253 1.33399527 1.33397 1.333 580 0.206069 1.333665945 1.33364 1.3328 590 0.205894 1.333353873 1.33333 1.3324 600 0.205728 1.333058007 1.33302 1.332 610 0.205571 1.332777373 1.33273 1.332 620 0.205421 1.332511064 1.33245 1.332 630 0.205279 1.332258233 1.33218 1.3318 640 0.205145 1.332018084 1.33192 1.3314 650 0.205017 1.331789872 1.33167 1.331 660 0.204895 1.331572894 1.33142 1.331 670 0.204779 1.331366485 1.33119 1.331 680 0.204669 1.331170018 1.33096 1.331 690 0.204564 1.330982896 1.33073 1.331 700 0.204464 1.330804551 1.33052 1.331 710 0.204368 1.330634445 1.33031 1.3306 720 0.204277 1.33047206 1.3301 1.3302 730 0.20419 1.330316905 1.3299 1.33 740 0.204106 1.330168507 1.3297 1.33 750 0.204027 1.330026414 1.32951 1.33 760 0.20395 1.329890191 1.32933 1.33 770 0.203877 1.32975942 1.32914 1.33 780 0.203806 1.3296337 1.32896 1.3298 790 0.203738 1.329512641 1.32878 1.3294 800 0.203672 1.329395872 1.32861 1.329

## References

1. I. Thormählen, J. Straub, and U. Grigull,
"Refractive Index of Water and Its Dependence on Wavelength, Temperature, and Density",
J. Phys. Chem. Ref. Data 14, 933 (1985)
Note, that Eq.(5) contains a typo: the left-hand side, typeset as $\frac{n^2-1}{n^2+1}\!\cdot\!\frac{1}{\rho^*}=$, should read $\frac{n^2-1}{n^2+2}\!\cdot\!\frac{1}{\rho^*}=$ instead.
2. “Handbook of Optical Metrology: Principles and Applications”, edited by Toru Yoshizawa,
Ch. 16: “Displacement”, A. Hirai et al., p. 409. CRC Press, 2009.
ISBN: 978-0-8493-3760-4
3. Emmanuel Villermaux, Benjamin Bossa.
Single-drop fragmentation distribution of raindrops.
Nature Physics 5 (9): 697-702 (September 2009).
doi:10.1038/NPHYS1340. Lay summary
4. M. Daimon and A. Masumura,
Measurement of the refractive index of distilled water from the near-infrared region to the ultraviolet region,
Appl. Opt. 46, 3811-3820 (2007)
doi:10.1364/AO.46.003811
5. G. M. Hale and M. R. Querry,
Optical Constants of Water in the 200-nm to 200-$\mu$m Wavelength Region,
Appl. Opt. 12, 555-563 (1973)
doi:10.1364/AO.12.000555
rainbow_project.txt · Last modified: 2014/06/03 19:18 by delakins