SolidTides.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.forces.gravity;

  18. import org.orekit.bodies.CelestialBody;
  19. import org.orekit.forces.ForceModel;
  20. import org.orekit.forces.ForceModelModifier;
  21. import org.orekit.forces.gravity.potential.CachedNormalizedSphericalHarmonicsProvider;
  22. import org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider;
  23. import org.orekit.forces.gravity.potential.TideSystem;
  24. import org.orekit.frames.Frame;
  25. import org.orekit.time.TimeScales;
  26. import org.orekit.time.UT1Scale;
  27. import org.orekit.utils.Constants;
  28. import org.orekit.utils.IERSConventions;
  29. import org.orekit.utils.OrekitConfiguration;

  30. /** Solid tides force model.
  31.  * @since 6.1
  32.  * @author Luc Maisonobe
  33.  */
  34. public class SolidTides implements ForceModelModifier {

  35.     /**
  36.      * Default step for tides field sampling (seconds).
  37.      */
  38.     public static final double DEFAULT_STEP = 600.0;

  39.     /**
  40.      * Default number of points tides field sampling.
  41.      */
  42.     public static final int DEFAULT_POINTS = 12;

  43.     /**
  44.      * Underlying attraction model.
  45.      */
  46.     private final ForceModel attractionModel;

  47.     /**
  48.      * Simple constructor.
  49.      * <p>
  50.      * This constructor uses pole tides, the default {@link #DEFAULT_STEP step} and default
  51.      * {@link #DEFAULT_POINTS number of points} for the tides field interpolation.
  52.      * </p>
  53.      *
  54.      * @param centralBodyFrame  rotating body frame
  55.      * @param ae                central body reference radius
  56.      * @param mu                central body attraction coefficient
  57.      * @param centralTideSystem tide system used in the central attraction model
  58.      * @param conventions       IERS conventions used for loading Love numbers
  59.      * @param ut1               UT1 time scale
  60.      * @param bodies            tide generating bodies (typically Sun and Moon)
  61.      * @see #DEFAULT_STEP
  62.      * @see #DEFAULT_POINTS
  63.      * @see #SolidTides(Frame, double, double, TideSystem, boolean, double, int, IERSConventions, UT1Scale, CelestialBody...)
  64.      */
  65.     public SolidTides(final Frame centralBodyFrame, final double ae, final double mu,
  66.                       final TideSystem centralTideSystem,
  67.                       final IERSConventions conventions, final UT1Scale ut1,
  68.                       final CelestialBody... bodies) {
  69.         this(centralBodyFrame, ae, mu, centralTideSystem, true,
  70.                 DEFAULT_STEP, DEFAULT_POINTS, conventions, ut1, bodies);
  71.     }

  72.     /**
  73.      * Simple constructor.
  74.      *
  75.      * @param centralBodyFrame  rotating body frame
  76.      * @param ae                central body reference radius
  77.      * @param mu                central body attraction coefficient
  78.      * @param centralTideSystem tide system used in the central attraction model
  79.      * @param poleTide          if true, pole tide is computed
  80.      * @param step              time step between sample points for interpolation
  81.      * @param nbPoints          number of points to use for interpolation, if less than 2
  82.      *                          then no interpolation is performed (thus greatly increasing computation cost)
  83.      * @param conventions       IERS conventions used for loading Love numbers
  84.      * @param ut1               UT1 time scale
  85.      * @param bodies            tide generating bodies (typically Sun and Moon)
  86.      */
  87.     public SolidTides(final Frame centralBodyFrame, final double ae, final double mu,
  88.                       final TideSystem centralTideSystem, final boolean poleTide,
  89.                       final double step, final int nbPoints,
  90.                       final IERSConventions conventions, final UT1Scale ut1,
  91.                       final CelestialBody... bodies) {
  92.         final TimeScales timeScales = ut1.getEOPHistory().getTimeScales();
  93.         final SolidTidesField raw =
  94.                 new SolidTidesField(conventions.getLoveNumbers(),
  95.                         conventions.getTideFrequencyDependenceFunction(ut1, timeScales),
  96.                         conventions.getPermanentTide(),
  97.                         poleTide ? conventions.getSolidPoleTide(ut1.getEOPHistory()) : null,
  98.                         centralBodyFrame, ae, mu, centralTideSystem, bodies);
  99.         final NormalizedSphericalHarmonicsProvider provider;
  100.         if (nbPoints < 2) {
  101.             provider = raw;
  102.         } else {
  103.             provider =
  104.                     new CachedNormalizedSphericalHarmonicsProvider(raw, step, nbPoints,
  105.                             OrekitConfiguration.getCacheSlotsNumber(),
  106.                             7 * Constants.JULIAN_DAY,
  107.                             0.5 * Constants.JULIAN_DAY);
  108.         }
  109.         attractionModel = new HolmesFeatherstoneAttractionModel(centralBodyFrame, provider);
  110.     }

  111.     @Override
  112.     public ForceModel getUnderlyingModel() {
  113.         return attractionModel;
  114.     }
  115. }