aboutsummaryrefslogtreecommitdiff
path: root/src/optics.c
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2018-09-17 15:32:27 -0500
committertlatorre <tlatorre@uchicago.edu>2018-09-17 15:32:27 -0500
commitd642dc8b8e154d80a7b8e029d989ae9a3115df31 (patch)
tree3f0586724c01e2db6ca7aee9a22b396d5f27b744 /src/optics.c
parent4a51642c7707d42c3072325cfe3e2b25fc182f76 (diff)
downloadsddm-d642dc8b8e154d80a7b8e029d989ae9a3115df31.tar.gz
sddm-d642dc8b8e154d80a7b8e029d989ae9a3115df31.tar.bz2
sddm-d642dc8b8e154d80a7b8e029d989ae9a3115df31.zip
add absorption length data from SNOMAN
This commit updates get_absorption_length_snoman_d2o() and get_absorption_length_h2o() to use absorption lengths from SNOMAN. Currently I'm just using the values from prod/media.dat but there are other media files in that directory that have values that seem to be actually measured using in-situ measurements (for example media_qoca_*.dat). I'm not 100% sure which ones to use so I am adding the default ones for now.
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)