MendesPavlisModel.java

  1. /* Copyright 2002-2019 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.models.earth.troposphere;

  18. import java.util.Collections;
  19. import java.util.List;

  20. import org.hipparchus.Field;
  21. import org.hipparchus.RealFieldElement;
  22. import org.hipparchus.util.FastMath;
  23. import org.hipparchus.util.MathArrays;
  24. import org.orekit.time.AbsoluteDate;
  25. import org.orekit.time.FieldAbsoluteDate;
  26. import org.orekit.utils.ParameterDriver;

  27. /** The Mendes - Pavlis tropospheric delay model for optical techniques.
  28. * It is valid for a wide range of wavelengths from 0.355µm to 1.064µm (Mendes and Pavlis, 2003)
  29. *
  30. * @see "Mendes, V. B., & Pavlis, E. C. (2004). High‐accuracy zenith delay prediction at
  31. *      optical wavelengths. Geophysical Research Letters, 31(14)."
  32. *
  33. * @see "Petit, G. and Luzum, B. (eds.), IERS Conventions (2010),
  34. *      IERS Technical Note No. 36, BKG (2010)"
  35. *
  36. * @author Bryan Cazabonne
  37. */
  38. public class MendesPavlisModel implements DiscreteTroposphericModel {

  39.     /** Coefficients for the dispertion equation for the hydrostatic component [µm<sup>-2</sup>]. */
  40.     private static final double[] K_COEFFICIENTS = {
  41.         238.0185, 19990.975, 57.362, 579.55174
  42.     };

  43.     /** Coefficients for the dispertion equation for the non-hydrostatic component. */
  44.     private static final double[] W_COEFFICIENTS = {
  45.         295.235, 2.6422, -0.032380, 0.004028
  46.     };

  47.     /** Coefficients for the mapping function. */
  48.     private static final double[][] A_COEFFICIENTS = {
  49.         {12100.8e-7, 1729.5e-9, 319.1e-7, -1847.8e-11},
  50.         {30496.5e-7, 234.4e-8, -103.5e-6, -185.6e-10},
  51.         {6877.7e-5, 197.2e-7, -345.8e-5, 106.0e-9}
  52.     };

  53.     /** Carbon dioxyde content (IAG recommendations). */
  54.     private static final double C02 = 0.99995995;

  55.     /** Geodetic site latitude [rad]. */
  56.     private double latitude;

  57.     /** Laser wavelength [µm]. */
  58.     private double lambda;

  59.     /** The atmospheric pressure [hPa]. */
  60.     private double P0;

  61.     /** The temperature at the station [K]. */
  62.     private double T0;

  63.     /** Water vapor pressure at the laser site [hPa]. */
  64.     private double e0;

  65.     /** Create a new Mendes-Pavlis model for the troposphere.
  66.      * This initialisation will compute the water vapor pressure
  67.      * thanks to the values of the pressure, the temperature and the humidity
  68.      * @param t0 the temperature at the station, K
  69.      * @param p0 the atmospheric pressure at the station, hPa
  70.      * @param rh the humidity at the station, percent (50% → 0.5)
  71.      * @param latitude geodetic latitude of the station, radians
  72.      * @param lambda laser wavelength, µm
  73.      * */
  74.     public MendesPavlisModel(final double t0, final double p0, final double rh,
  75.                              final double latitude, final double lambda) {
  76.         this.P0 = p0;
  77.         this.T0 = t0;
  78.         this.e0 = getWaterVapor(rh);
  79.         this.latitude = latitude;
  80.         this.lambda   = lambda;
  81.     }

  82.     /** Create a new Mendes-Pavlis model using a standard atmosphere model.
  83.     *
  84.     * <ul>
  85.     * <li>temperature: 18 degree Celsius
  86.     * <li>pressure: 1013.25 hPa
  87.     * <li>humidity: 50%
  88.     * </ul>
  89.     *
  90.     * @param latitude site latitude, radians
  91.     * @param lambda laser wavelength, µm
  92.     *
  93.     * @return a Mendes-Pavlis model with standard environmental values
  94.     */
  95.     public static MendesPavlisModel getStandardModel(final double latitude, final double lambda) {
  96.         return new MendesPavlisModel(273.15 + 18, 1013.25, 0.5, latitude, lambda);
  97.     }

  98.     /** {@inheritDoc} */
  99.     @Override
  100.     public double pathDelay(final double elevation, final double height,
  101.                             final double[] parameters, final AbsoluteDate date) {
  102.         // Zenith delay
  103.         final double[] zenithDelay = computeZenithDelay(height, parameters, date);
  104.         // Mapping function
  105.         final double[] mappingFunction = mappingFactors(elevation, height, parameters, date);
  106.         // Tropospheric path delay
  107.         return zenithDelay[0] * mappingFunction[0] + zenithDelay[1] * mappingFunction[1];
  108.     }

  109.     /** {@inheritDoc} */
  110.     @Override
  111.     public <T extends RealFieldElement<T>> T pathDelay(final T elevation, final T height,
  112.                                                        final T[] parameters, final FieldAbsoluteDate<T> date) {
  113.         // Zenith delay
  114.         final T[] delays = computeZenithDelay(height, parameters, date);
  115.         // Mapping function
  116.         final T[] mappingFunction = mappingFactors(elevation, height, parameters, date);
  117.         // Tropospheric path delay
  118.         return delays[0].multiply(mappingFunction[0]).add(delays[1].multiply(mappingFunction[1]));
  119.     }

  120.     /** {@inheritDoc} */
  121.     @Override
  122.     public double[] computeZenithDelay(final double height, final double[] parameters, final AbsoluteDate date) {
  123.         final double fsite   = getSiteFunctionValue(height);

  124.         // Array for zenith delay
  125.         final double[] delay = new double[2];

  126.         // Dispertion Equation for the Hydrostatic component
  127.         final double sigma  = 1 / lambda;
  128.         final double sigma2 = sigma * sigma;
  129.         final double coef1  = K_COEFFICIENTS[0] + sigma2;
  130.         final double coef2  = K_COEFFICIENTS[0] - sigma2;
  131.         final double coef3  = K_COEFFICIENTS[2] + sigma2;
  132.         final double coef4  = K_COEFFICIENTS[2] - sigma2;

  133.         final double frac1 = coef1 / (coef2 * coef2);
  134.         final double frac2 = coef3 / (coef4 * coef4);

  135.         final double fLambdaH = 0.01 * (K_COEFFICIENTS[1] * frac1 + K_COEFFICIENTS[3] * frac2) * C02;

  136.         // Zenith delay for the hydrostatic component
  137.         delay[0] = 0.002416579 * (fLambdaH / fsite) * P0;

  138.         // Dispertion Equation for the Non-Hydrostatic component
  139.         final double sigma4 = sigma2 * sigma2;
  140.         final double sigma6 = sigma4 * sigma2;
  141.         final double w1s2  = 3 * W_COEFFICIENTS[1] * sigma2;
  142.         final double w2s4  = 5 * W_COEFFICIENTS[2] * sigma4;
  143.         final double w3s6  = 7 * W_COEFFICIENTS[3] * sigma6;

  144.         final double fLambdaNH = 0.003101 * (W_COEFFICIENTS[0] + w1s2 + w2s4 + w3s6);

  145.         // Zenith delay for the non-hydrostatic component
  146.         delay[1] = 0.0001 * (5.316 * fLambdaNH - 3.759 * fLambdaH) * (e0 / fsite);

  147.         return delay;
  148.     }

  149.     /** {@inheritDoc} */
  150.     @Override
  151.     public <T extends RealFieldElement<T>> T[] computeZenithDelay(final T height, final T[] parameters,
  152.                                                                   final FieldAbsoluteDate<T> date) {
  153.         final Field<T> field = height.getField();
  154.         final T zero = field.getZero();

  155.         final T fsite   = getSiteFunctionValue(height);

  156.         // Array for zenith delay
  157.         final T[] delay = MathArrays.buildArray(field, 2);

  158.         // Dispertion Equation for the Hydrostatic component
  159.         final T sigma  = zero.add(1 / lambda);
  160.         final T sigma2 = sigma.multiply(sigma);
  161.         final T coef1  = sigma2.add(K_COEFFICIENTS[0]);
  162.         final T coef2  = sigma2.negate().add(K_COEFFICIENTS[0]);
  163.         final T coef3  = sigma2.add(K_COEFFICIENTS[2]);
  164.         final T coef4  = sigma2.negate().add(K_COEFFICIENTS[2]);

  165.         final T frac1 = coef1.divide(coef2.multiply(coef2));
  166.         final T frac2 = coef3.divide(coef4.multiply(coef4));

  167.         final T fLambdaH = frac1.multiply(K_COEFFICIENTS[1]).add(frac2.multiply(K_COEFFICIENTS[3])).multiply(0.01 * C02);

  168.         // Zenith delay for the hydrostatic component
  169.         delay[0] =  fLambdaH.divide(fsite).multiply(P0).multiply(0.002416579);

  170.         // Dispertion Equation for the Non-Hydrostatic component
  171.         final T sigma4 = sigma2.multiply(sigma2);
  172.         final T sigma6 = sigma4.multiply(sigma2);
  173.         final T w1s2   = sigma2.multiply(3 * W_COEFFICIENTS[1]);
  174.         final T w2s4   = sigma4.multiply(5 * W_COEFFICIENTS[2]);
  175.         final T w3s6   = sigma6.multiply(7 * W_COEFFICIENTS[3]);

  176.         final T fLambdaNH = w1s2.add(w2s4).add(w3s6).add(W_COEFFICIENTS[0]).multiply(0.003101);

  177.         // Zenith delay for the non-hydrostatic component
  178.         delay[1] = fLambdaNH.multiply(5.316).subtract(fLambdaH.multiply(3.759)).multiply(fsite.divide(e0).reciprocal()).multiply(0.0001);

  179.         return delay;
  180.     }

  181.     /** With the Mendes Pavlis tropospheric model, the mapping
  182.      * function is not split into hydrostatic and wet component.
  183.      * <p>
  184.      * Therefore, the two components of the resulting array are equals.
  185.      * <ul>
  186.      * <li>double[0] = m(e) → total mapping function
  187.      * <li>double[1] = m(e) → total mapping function
  188.      * </ul>
  189.      * <p>
  190.      * The total delay will thus be computed as:<br>
  191.      * δ = D<sub>hz</sub> * m(e) + D<sub>wz</sub> * m(e)<br>
  192.      * δ = (D<sub>hz</sub> + D<sub>wz</sub>) * m(e) = δ<sub>z</sub> * m(e)
  193.      */
  194.     @Override
  195.     public double[] mappingFactors(final double elevation, final double height,
  196.                                    final double[] parameters, final AbsoluteDate date) {
  197.         final double sinE = FastMath.sin(elevation);

  198.         final double T2degree = T0 - 273.15;

  199.         // Mapping function coefficients
  200.         final double a1 = computeMFCoeffient(A_COEFFICIENTS[0][0], A_COEFFICIENTS[0][1],
  201.                                              A_COEFFICIENTS[0][2], A_COEFFICIENTS[0][3],
  202.                                              T2degree, height);
  203.         final double a2 = computeMFCoeffient(A_COEFFICIENTS[1][0], A_COEFFICIENTS[1][1],
  204.                                              A_COEFFICIENTS[1][2], A_COEFFICIENTS[1][3],
  205.                                              T2degree, height);
  206.         final double a3 = computeMFCoeffient(A_COEFFICIENTS[2][0], A_COEFFICIENTS[2][1],
  207.                                              A_COEFFICIENTS[2][2], A_COEFFICIENTS[2][3],
  208.                                              T2degree, height);

  209.         // Numerator
  210.         final double numMP = 1 + a1 / (1 + a2 / (1 + a3));
  211.         // Denominator
  212.         final double denMP = sinE + a1 / (sinE + a2 / (sinE + a3));

  213.         final double factor = numMP / denMP;

  214.         return new double[] {
  215.             factor,
  216.             factor
  217.         };
  218.     }

  219.     /** {@inheritDoc} */
  220.     @Override
  221.     public <T extends RealFieldElement<T>> T[] mappingFactors(final T elevation, final T height,
  222.                                                               final T[] parameters, final FieldAbsoluteDate<T> date) {
  223.         final Field<T> field = date.getField();

  224.         final T sinE = FastMath.sin(elevation);

  225.         final double T2degree = T0 - 273.15;

  226.         // Mapping function coefficients
  227.         final T a1 = computeMFCoeffient(A_COEFFICIENTS[0][0], A_COEFFICIENTS[0][1],
  228.                                         A_COEFFICIENTS[0][2], A_COEFFICIENTS[0][3],
  229.                                         T2degree, height);
  230.         final T a2 = computeMFCoeffient(A_COEFFICIENTS[1][0], A_COEFFICIENTS[1][1],
  231.                                         A_COEFFICIENTS[1][2], A_COEFFICIENTS[1][3],
  232.                                         T2degree, height);
  233.         final T a3 = computeMFCoeffient(A_COEFFICIENTS[2][0], A_COEFFICIENTS[2][1],
  234.                                         A_COEFFICIENTS[2][2], A_COEFFICIENTS[2][3],
  235.                                         T2degree, height);

  236.         // Numerator
  237.         final T numMP = a1.divide(a2.divide(a3.add(1.0)).add(1.0)).add(1.0);
  238.         // Denominator
  239.         final T denMP = a1.divide(a2.divide(a3.add(sinE)).add(sinE)).add(sinE);

  240.         final T factor = numMP.divide(denMP);

  241.         final T[] mapping = MathArrays.buildArray(field, 2);
  242.         mapping[0] = factor;
  243.         mapping[1] = factor;

  244.         return mapping;
  245.     }

  246.     /** {@inheritDoc} */
  247.     @Override
  248.     public List<ParameterDriver> getParametersDrivers() {
  249.         return Collections.emptyList();
  250.     }

  251.     /** Get the laser frequency parameter f(lambda).
  252.     *
  253.     * @param height height above the geoid, m
  254.     * @return the laser frequency parameter f(lambda).
  255.     */
  256.     private double getSiteFunctionValue(final double height) {
  257.         return 1. - 0.00266 * FastMath.cos(2 * latitude) - 0.00000028 * height;
  258.     }

  259.     /** Get the laser frequency parameter f(lambda).
  260.     *
  261.     * @param <T> type of the elements
  262.     * @param height height above the geoid, m
  263.     * @return the laser frequency parameter f(lambda).
  264.     */
  265.     private <T extends RealFieldElement<T>> T getSiteFunctionValue(final T height) {
  266.         return height.multiply(0.00000028).negate().add(1. - 0.00266 * FastMath.cos(2 * latitude));
  267.     }

  268.     /** Compute the coefficients of the Mapping Function.
  269.     *
  270.     * @param T the temperature at the station site, °C
  271.     * @param a0 first coefficient
  272.     * @param a1 second coefficient
  273.     * @param a2 third coefficient
  274.     * @param a3 fourth coefficient
  275.     * @param height the height of the station in m above sea level
  276.     * @return the value of the coefficient
  277.     */
  278.     private double computeMFCoeffient(final double a0, final double a1, final double a2, final double a3,
  279.                                       final double T, final double height) {
  280.         return a0 + a1 * T + a2 * FastMath.cos(latitude) + a3 * height;
  281.     }

  282.    /** Compute the coefficients of the Mapping Function.
  283.    *
  284.    * @param <T> type of the elements
  285.    * @param temp the temperature at the station site, °C
  286.    * @param a0 first coefficient
  287.    * @param a1 second coefficient
  288.    * @param a2 third coefficient
  289.    * @param a3 fourth coefficient
  290.    * @param height the height of the station in m above sea level
  291.    * @return the value of the coefficient
  292.    */
  293.     private <T extends RealFieldElement<T>> T computeMFCoeffient(final double a0, final double a1, final double a2, final double a3,
  294.                                                                  final double temp, final T height) {
  295.         return height.multiply(a3).add(a0 + a1 * temp + a2 * FastMath.cos(latitude));
  296.     }

  297.     /** Get the water vapor.
  298.      * The water vapor model is the one of Giacomo and Davis as indicated in IERS TN 32, chap. 9.
  299.      *
  300.      * See: Giacomo, P., Equation for the dertermination of the density of moist air, Metrologia, V. 18, 1982
  301.      *
  302.      * @param rh relative humidity, in percent (50% → 0.5).
  303.      * @return the water vapor, in mbar (1 mbar = 1 hPa).
  304.      */
  305.     private double getWaterVapor(final double rh) {

  306.         // saturation water vapor, equation (3) of reference paper, in mbar
  307.         // with amended 1991 values (see reference paper)
  308.         final double es = 0.01 * FastMath.exp((1.2378847 * 1e-5) * T0 * T0 -
  309.                                               (1.9121316 * 1e-2) * T0 +
  310.                                               33.93711047 -
  311.                                               (6.3431645 * 1e3) * 1. / T0);

  312.         // enhancement factor, equation (4) of reference paper
  313.         final double fw = 1.00062 + (3.14 * 1e-6) * P0 + (5.6 * 1e-7) * FastMath.pow(T0 - 273.15, 2);

  314.         final double e = rh * fw * es;
  315.         return e;
  316.     }
  317. }