TideTerm.java

  1. /* Copyright 2002-2018 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.data;

  18. import org.hipparchus.RealFieldElement;

  19. /** Class for tide terms.
  20.  * <p>
  21.  * BEWARE! For consistency with all the other Poisson series terms,
  22.  * the elements in γ, l, l', F, D and Ω are ADDED together to compute
  23.  * the argument of the term. In classical tides series, the computed
  24.  * argument is cGamma * γ - (cL * l + cLPrime * l' + cF * F + cD * D
  25.  * + cOmega * Ω). So at parsing time, the signs of cL, cLPrime, cF,
  26.  * cD and cOmega must already have been reversed so the addition
  27.  * performed here will work. This is done automatically when the
  28.  * parser has been configured with a call to {@link
  29.  * PoissonSeriesParser#withDoodson(int, int)} as the relationship
  30.  * between the Doodson arguments and the traditional Delaunay
  31.  * arguments ensures the proper sign is known.
  32.  * </p>
  33.  * @param <T> the type of the field elements
  34.  * @author Luc Maisonobe
  35.  */
  36. class TideTerm extends SeriesTerm {

  37.     /** Coefficient for γ = GMST + π tide parameter. */
  38.     private final int cGamma;

  39.     /** Coefficient for mean anomaly of the Moon. */
  40.     private final int cL;

  41.     /** Coefficient for mean anomaly of the Sun. */
  42.     private final int cLPrime;

  43.     /** Coefficient for L - Ω where L is the mean longitude of the Moon. */
  44.     private final int cF;

  45.     /** Coefficient for mean elongation of the Moon from the Sun. */
  46.     private final int cD;

  47.     /** Coefficient for mean longitude of the ascending node of the Moon. */
  48.     private final int cOmega;

  49.     /** Build a tide term for nutation series.
  50.      * @param cGamma coefficient for γ = GMST + π tide parameter
  51.      * @param cL coefficient for mean anomaly of the Moon
  52.      * @param cLPrime coefficient for mean anomaly of the Sun
  53.      * @param cF coefficient for L - Ω where L is the mean longitude of the Moon
  54.      * @param cD coefficient for mean elongation of the Moon from the Sun
  55.      * @param cOmega coefficient for mean longitude of the ascending node of the Moon
  56.      */
  57.     TideTerm(final int cGamma,
  58.              final int cL, final int cLPrime, final int cF, final int cD, final int cOmega) {
  59.         this.cGamma  = cGamma;
  60.         this.cL      = cL;
  61.         this.cLPrime = cLPrime;
  62.         this.cF      = cF;
  63.         this.cD      = cD;
  64.         this.cOmega  = cOmega;
  65.     }

  66.     /** {@inheritDoc} */
  67.     protected double argument(final BodiesElements elements) {
  68.         return cGamma * elements.getGamma() +
  69.                cL * elements.getL() + cLPrime * elements.getLPrime() + cF * elements.getF() +
  70.                cD * elements.getD() + cOmega * elements.getOmega();
  71.     }

  72.     /** {@inheritDoc} */
  73.     protected double argumentDerivative(final BodiesElements elements) {
  74.         return cGamma * elements.getGammaDot() +
  75.                cL * elements.getLDot() + cLPrime * elements.getLPrimeDot() + cF * elements.getFDot() +
  76.                cD * elements.getDDot() + cOmega * elements.getOmegaDot();
  77.     }

  78.     /** {@inheritDoc} */
  79.     protected <T extends RealFieldElement<T>> T argument(final FieldBodiesElements<T> elements) {
  80.         return elements.getGamma().multiply(cGamma).
  81.                add(elements.getL().multiply(cL)).
  82.                add(elements.getLPrime().multiply(cLPrime)).
  83.                add(elements.getF().multiply(cF)).
  84.                add(elements.getD().multiply(cD)).
  85.                add(elements.getOmega().multiply(cOmega));
  86.     }

  87.     /** {@inheritDoc} */
  88.     protected <T extends RealFieldElement<T>> T argumentDerivative(final FieldBodiesElements<T> elements) {
  89.         return elements.getGammaDot().multiply(cGamma).
  90.                add(elements.getLDot().multiply(cL)).
  91.                add(elements.getLPrimeDot().multiply(cLPrime)).
  92.                add(elements.getFDot().multiply(cF)).
  93.                add(elements.getDDot().multiply(cD)).
  94.                add(elements.getOmegaDot().multiply(cOmega));
  95.     }

  96. }