diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-08-14 10:08:27 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-08-14 10:08:27 -0500 |
commit | 24c8bcfe7f76b20124e2862ea050f815c0f768e7 (patch) | |
tree | e5bdbd638a2c7f38f1c094cc9e95cbdfe05b9481 /src/optics.c | |
parent | 0b7f199c0d93074484ea580504485a32dc29f5e2 (diff) | |
download | sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.tar.gz sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.tar.bz2 sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.zip |
move everything to src directory
Diffstat (limited to 'src/optics.c')
-rw-r--r-- | src/optics.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/optics.c b/src/optics.c new file mode 100644 index 0000000..23e043d --- /dev/null +++ b/src/optics.c @@ -0,0 +1,33 @@ +#include <math.h> +#include "optics.h" + +/* From Table 4 in the paper. */ +static double A0 = 0.243905091; +static double A1 = 9.53518094e-3; +static double A2 = -3.64358110e-3; +static double A3 = 2.65666426e-4; +static double A4 = 1.59189325e-3; +static double A5 = 2.45733798e-3; +static double A6 = 0.897478251; +static double A7 = -1.63066183e-2; +static double UV = 0.2292020; +static double IR = 5.432937; + +double get_index(double p, double wavelength, double T) +{ + /* Returns the index of refraction of pure water for a given density, + * wavelength, and temperature. The density should be in units of g/cm^3, + * the wavelength in nm, and the temperature in Celsius. + * + * See "Refractive Index of Water and Steam as a function of Wavelength, + * Temperature, and Density" by Schiebener et al. 1990. */ + /* normalize the temperature and pressure */ + wavelength = wavelength/589.0; + T = (T+273.15)/273.15; + + /* first we compute the right hand side of Equation 7 */ + double c = A0 + A1*p + A2*T + A3*pow(wavelength,2)*T + A4/pow(wavelength,2) + A5/(pow(wavelength,2)-pow(UV,2)) + A6/(pow(wavelength,2)-pow(IR,2)) + A7*pow(p,2); + c *= p; + + return sqrt((2*c+1)/(1-c)); +} |