#!/bin/env gnuplot
# Compute an 'average' index of refraction for a 1 [cm³] volume of ε_k media
# distributed in a vaucuum volume of B³, where refractivity is ε₀.
# Written by Andrew Robinson of Scappoose, 2026
# Copyright 2026; Released under the GNU pubic license GPL3.0.
# https://www.gnu.org/licenses/gpl-3.0.html
#
# 980 [nm], IAPWS calibration
n_k = 1.3266
E_k = n_k**2
# Block model of how permittivity changes with molecule spacing
E_B( B ) = 1/( B**2 - B + B/E_k ) + 1 - 1/B**2
n_d( d ) = E_B( (d/1000.)**-0.3333333333 )**0.5
# IAPWS -- characteristic equation
# l is wavelength in nanometers
# p is density in kg/m³
# T is temperature in kelvin
R997(l,p,T)=(_a0+_a1*(p/p0)+_a2*(T/T0)+_a3*(l/l0)**2*(T/T0)+_a4/((l/l0)**2)+_a5/((l/l0)**2-Luv**2)+_a6/((l/l0)**2-Lir**2) + _a7*(p/p0)**2 )*(p/p0)
_R997(x)=sqrt( (1+2*x)/(1-x) )
# Caution, this inputs temperature in Celsius and converts it to Kelvin.
R997N(l,p,t)=_R997( R997(l,p,t+273.15) )
T=293.15; T0=273.15
l0=589.0
Lir=5.432937; Luv=0.229202
p=997.0 ; p0=1000.0
_a0=0.244257733
_a1=0.00974634476
_a2=-.00373234996
_a3=0.000268678472
_a4=0.00158920570
_a5=0.00245934259
_a6=0.900704920
_a7=-.0166626219
# IAPWS -- density equation for water 0-100C ( <0.02% error )
# https://chem-casts.com/knowledge/density-of-water
p(T) = ( 999.83952 \
+16.945176*T \
-7.9870401e-3*T**2 \
-4.6170461e-5*T**3 \
-2.805425e-10*T**5 )/(1 + 1.6879851e-2*T)
#
set title "Index of refraction at 980 [nm] for freshly distilled water vs. temperature"
set dummy t
set grid
set xlabel "Temperature [ °C ]"
set xrange [ 0 : 100.0 ]
set xtics 5
set yrange [1.307:1.330]
set ytics auto
set mytics 5
set ylabel "Refractive index, n"
plot R997N( 980.0, p(t), t ) lw 3 lc 'grey', n_d( p(t) ) ti 'block dielectric'
|