aboutsummaryrefslogtreecommitdiff
path: root/src/optics.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/optics.c')
-rw-r--r--src/optics.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/optics.c b/src/optics.c
index 9569865..af89802 100644
--- a/src/optics.c
+++ b/src/optics.c
@@ -1,5 +1,18 @@
#include <math.h>
#include "optics.h"
+#include "misc.h"
+
+/* Absorption coefficients for H2O and D2O as a function of wavelength from
+ * SNOMAN.
+ *
+ * Note: These numbers come from prod/media.dat.
+ *
+ * FIXME: Should I be using the values from media_2_09.dat or media_qoca_*.cmd? */
+static double absorption_coefficient_h2o_wavelengths[7] = {250.0, 350.0, 400.0, 450.0, 500.0, 548.0, 578.0};
+static double absorption_coefficient_h2o[7] = {1e-5, 1e-5, 1.3e-5, 6.0e-5, 2.0e-4, 5.8e-4, 9.2e-4};
+
+static double absorption_coefficient_d2o_wavelengths[7] = {254.0, 313.0, 366.0, 406.0, 436.0, 548.0, 578.0};
+static double absorption_coefficient_d2o[7] = {1e-5, 1e-5, 1e-5, 1e-5, 1e-5, 1e-5, 1e-5};
/* From Table 4 in the paper. */
static double A0 = 0.243905091;
@@ -29,13 +42,13 @@ static double HC = 1.239841973976e3;
double get_absorption_length_snoman_h2o(double wavelength)
{
/* Returns the absorption length in H2O in cm. */
- return 1e4;
+ return 1.0/interp1d(wavelength, absorption_coefficient_h2o_wavelengths, absorption_coefficient_h2o, sizeof(absorption_coefficient_h2o_wavelengths)/sizeof(absorption_coefficient_h2o_wavelengths[0]));
}
double get_absorption_length_snoman_d2o(double wavelength)
{
/* Returns the absorption length in D2O in cm. */
- return 1e4;
+ return 1.0/interp1d(wavelength, absorption_coefficient_d2o_wavelengths, absorption_coefficient_d2o, sizeof(absorption_coefficient_d2o_wavelengths)/sizeof(absorption_coefficient_d2o_wavelengths[0]));
}
double get_index(double p, double wavelength, double T)