WaBis

walter.bislins.ch

Calculator for Refractivity based on Ciddor Equation

Move the first 5 sliders or enter the corresponding number into the field left of the slider. You can only enter values in the range the Ciddor equation is valid to a certain accuracy. To see the valid range move the slider full left and full right and read the number in the text field of the slider. The results are displayed in the last 2 fields. The Refractivity slider gives only an optical clue of the calculated value and can not be moved by hand.

This calculator is a port of the Python script [1] from Mikhail Polyanskiy [2] to JavaScript by the author of this page, based on the Ciddor equation [3].

JavaScipt of the Ciddor Equation

// Calculating refractive index n according to Ciddor equation
//
// Author: Mikhail Polyanskiy
// Last modified: 2017-11-23
// Original data: Ciddor 1996, https://doi.org/10.1364/AO.35.001566
// Port to JavaScript: Walter Bislin, August 2019

var Ciddor = {

  Compressibility: function( T, p, xw ) {
    // T = temperature in K
    // p = pressure in Pa
    // xw = molar fraction of water vapor in moist air

    var t = T - 273.15;
    var a0 = 1.58123e-6; // K·Pa^-1
    var a1 = -2.9331e-8; // Pa^-1
    var a2 = 1.1043e-10; // K^-1·Pa^-1
    var b0 = 5.707e-6;   // K·Pa^-1
    var b1 = -2.051e-8;  // Pa^-1
    var c0 = 1.9898e-4;  // K·Pa^-1
    var c1 = -2.376e-6;  // Pa^-1
    var d  = 1.83e-11;   // K^2·Pa^-2
    var e  = -0.765e-8;  // K^2·Pa^-2
    var pt  = p / T;
    var pt2 = pt * pt;
    var t2  = t * t;
    var xw2 = xw * xw;
    return 1 -
           pt  * (a0 + a1*t + a2*t2 + (b0 + b1 * t) * xw + (c0 + c1 * t) * xw2) +
           pt2 * (d + e * xw2);

  },

  RefractiveIndex: function( lambda, t, p, h, xc ) {
    // lambda = wavelength, 0.3 to 1.69 µm
    // t      = temperature, -40 to +100 °C
    // p      = pressure, 80000 to 120000 Pa
    // h      = fractional humidity, 0 to 1
    // xc     = CO2 concentration, 0 to 2000 ppm

    var sigma = 1 / lambda;  // µm^-1
    var sigma2 = sigma * sigma;
    var sigma4 = sigma2 * sigma2;
    var sigma6 = sigma4 * sigma2;

    var T  = t + 273.15;      // Temperature °C -> K
    var T2 = T * T;
    var t2 = t * t;

    var R = 8.314463;        // gas constant, J/(mol·K)

    var k0 = 238.0185;       // µm^-2
    var k1 = 5792105;        // µm^-2
    var k2 = 57.362;         // µm^-2
    var k3 = 167917;         // µm^-2

    var w0 = 295.235;        // µm^-2
    var w1 = 2.6422;         // µm^-2
    var w2 = -0.032380;      // µm^-4
    var w3 = 0.004028;       // µm^-6

    var A = 1.2378847e-5;    // K^-2
    var B = -1.9121316e-2;   // K^-1
    var C = 33.93711047;
    var D = -6.3431645e3;    // K

    var alpha = 1.00062;
    var beta = 3.14e-8;      // Pa^-1,
    var gamma = 5.6e-7;      // °C^-2

    // saturation vapor pressure of water vapor in air at temperature T
    var svp;
    if (t >= 0) {
      svp = Math.exp( A * T2 + B * T + C + D / T ); // Pa
    } else {
      svp = Math.pow( 10, -2663.5 / T + 12.537 );
    }

    // enhancement factor of water vapor in air
    var f = alpha + beta * p + gamma * t2;

    // molar fraction of water vapor in moist air
    var xw = f * h * svp / p;

    // refractive index of standard air at 15 °C, 101325 Pa, 0% humidity, 450 ppm CO2
    var nas = 1 + (k1 / (k0 - sigma2) + k3 / (k2 - sigma2)) * 1e-8;

    // refractive index of standard air at 15 °C, 101325 Pa, 0% humidity, xc ppm CO2
    var naxs = 1 + (nas - 1) * (1 + 0.534e-6 * (xc - 450));

    // refractive index of water vapor at standard conditions (20 °C, 1333 Pa)
    var nws = 1 + 1.022 * (w0 + w1 * sigma2 + w2 * sigma4 + w3 * sigma6) * 1e-8;

    var Ma = 1e-3 * (28.9635 + 12.011e-6 * (xc - 400)); // molar mass of dry air, kg/mol
    var Mw = 0.018015;                                  // molar mass of water vapor, kg/mol

    var Za = this.Compressibility( 288.15, 101325, 0 ); // compressibility of dry air
    var Zw = this.Compressibility( 293.15, 1333, 1);    // compressibility of pure water vapor

    // Eq.4 with (T,P,xw) = (288.15, 101325, 0)
    var rho_axs = 101325 * Ma / (Za * R * 288.15);      // density of standard air

    // Eq 4 with (T,P,xw) = (293.15, 1333, 1)
    var rho_ws  = 1333 * Mw / (Zw * R * 293.15);        // density of standard water vapor

    //  two parts of Eq.4: rho = rho_a + rho_w
    var Z = this.Compressibility( T, p, xw );
    var rho_a   = p * Ma / (Z * R * T) * (1 - xw);   // rho_a: density of the dry component of the moist air
    var rho_w   = p * Mw / (Z * R * T) * xw;         // rhow_w: density of the water vapor component

    var nprop = 1 + (rho_a / rho_axs) * (naxs - 1) + (rho_w / rho_ws) * (nws - 1);

    return nprop;

  },

};

References

Python script for Ciddor equation from Mikhail Polyanskiy
https://github.com/polyanskiy/refractiveindex.info-scripts/blob/master/scripts/Ciddor%201996%20-%20air.py
Mikhail Polyanskiy on github
https://github.com/polyanskiy
More Page Infos / Sitemap
Created Tuesday, August 20, 2019
Scroll to Top of Page
Changed Wednesday, July 15, 2020