aboutsummaryrefslogtreecommitdiff
path: root/src/optics.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/optics.c')
-rw-r--r--src/optics.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/optics.c b/src/optics.c
index 23e043d..dd9b82d 100644
--- a/src/optics.c
+++ b/src/optics.c
@@ -13,6 +13,19 @@ static double A7 = -1.63066183e-2;
static double UV = 0.2292020;
static double IR = 5.432937;
+static double RIND_H2O_C1 = 1.302;
+static double RIND_H2O_C2 = 0.01562;
+static double RIND_H2O_C3 = 0.32;
+
+static double RIND_D2O_C1 = 1.302;
+static double RIND_D2O_C2 = 0.01333;
+static double RIND_D2O_C3 = 0.32;
+
+/* Wavelength of 1 eV particle in nm.
+ *
+ * From http://pdg.lbl.gov/2018/reviews/rpp2018-rev-phys-constants.pdf. */
+static double HC = 1.239841973976e3;
+
double get_index(double p, double wavelength, double T)
{
/* Returns the index of refraction of pure water for a given density,
@@ -31,3 +44,35 @@ double get_index(double p, double wavelength, double T)
return sqrt((2*c+1)/(1-c));
}
+
+double get_index_snoman_h2o(double wavelength)
+{
+ /* Returns the index of refraction of light water that SNOMAN uses for a
+ * given wavelength. The wavelength should be in units of nm.
+ *
+ * The coefficients come from media.dat in SNOMAN version 5.0294 and the
+ * formula used to compute the index of refraction comes from the SNOMAN
+ * companion page for titles MEDA. */
+ double E;
+
+ /* Calculate the energy of the photon in eV. */
+ E = HC/wavelength;
+
+ return RIND_H2O_C1 + RIND_H2O_C2*exp(RIND_H2O_C3*E);
+}
+
+double get_index_snoman_d2o(double wavelength)
+{
+ /* Returns the index of refraction of heavy water that SNOMAN uses for a
+ * given wavelength. The wavelength should be in units of nm.
+ *
+ * The coefficients come from media.dat in SNOMAN version 5.0294 and the
+ * formula used to compute the index of refraction comes from the SNOMAN
+ * companion page for titles MEDA. */
+ double E;
+
+ /* Calculate the energy of the photon in eV. */
+ E = HC/wavelength;
+
+ return RIND_D2O_C1 + RIND_D2O_C2*exp(RIND_D2O_C3*E);
+}