TideTerm.java

  1. /* Copyright 2002-2025 CS GROUP
  2.  * Licensed to CS GROUP (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.CalculusFieldElement;

  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.  * @author Luc Maisonobe
  34.  */
  35. class TideTerm extends SeriesTerm {

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

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

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

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

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

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

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

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

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

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

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

  95. }