DSSTAtmosphericDrag.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.propagation.semianalytical.dsst.forces;

  18. import org.hipparchus.util.FastMath;
  19. import org.hipparchus.util.MathUtils;
  20. import org.orekit.errors.OrekitException;
  21. import org.orekit.forces.drag.DragForce;
  22. import org.orekit.forces.drag.DragSensitive;
  23. import org.orekit.forces.drag.IsotropicDrag;
  24. import org.orekit.forces.drag.atmosphere.Atmosphere;
  25. import org.orekit.propagation.SpacecraftState;
  26. import org.orekit.propagation.events.EventDetector;
  27. import org.orekit.utils.Constants;

  28. /** Atmospheric drag contribution to the
  29.  *  {@link org.orekit.propagation.semianalytical.dsst.DSSTPropagator DSSTPropagator}.
  30.  *  <p>
  31.  *  The drag acceleration is computed through the acceleration model of
  32.  *  {@link org.orekit.forces.drag.DragForce DragForce}.
  33.  *  </p>
  34.  *
  35.  * @author Pascal Parraud
  36.  */
  37. public class DSSTAtmosphericDrag extends AbstractGaussianContribution {

  38.     /** Threshold for the choice of the Gauss quadrature order. */
  39.     private static final double GAUSS_THRESHOLD = 6.0e-10;

  40.     /** Upper limit for atmospheric drag (m) . */
  41.     private static final double ATMOSPHERE_ALTITUDE_MAX = 1000000.;

  42.     /** Atmospheric model. */
  43.     private final Atmosphere atmosphere;

  44.     /** Spacecraft shape. */
  45.     private final DragSensitive spacecraft;

  46.     /** Critical distance from the center of the central body for entering/leaving the atmosphere. */
  47.     private final double     rbar;

  48.     /** Simple constructor assuming spherical spacecraft.
  49.      * @param atmosphere atmospheric model
  50.      * @param cd drag coefficient
  51.      * @param area cross sectionnal area of satellite
  52.      */
  53.     public DSSTAtmosphericDrag(final Atmosphere atmosphere, final double cd,
  54.             final double area) {
  55.         this(atmosphere, new IsotropicDrag(area, cd));
  56.     }

  57.     /** Simple constructor with custom spacecraft.
  58.      * @param atmosphere atmospheric model
  59.      * @param spacecraft spacecraft model
  60.      */
  61.     public DSSTAtmosphericDrag(final Atmosphere atmosphere, final DragSensitive spacecraft) {

  62.         //Call to the constructor from superclass using the numerical drag model as ForceModel
  63.         super("DSST-drag-", GAUSS_THRESHOLD, new DragForce(atmosphere, spacecraft));

  64.         this.atmosphere = atmosphere;
  65.         this.spacecraft = spacecraft;
  66.         this.rbar = ATMOSPHERE_ALTITUDE_MAX + Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
  67.     }

  68.     /** Get the atmospheric model.
  69.      * @return atmosphere model
  70.      */
  71.     public Atmosphere getAtmosphere() {
  72.         return atmosphere;
  73.     }

  74.     /** Get the critical distance.
  75.      *  <p>
  76.      *  The critical distance from the center of the central body aims at
  77.      *  defining the atmosphere entry/exit.
  78.      *  </p>
  79.      *  @return the critical distance from the center of the central body (m)
  80.      */
  81.     public double getRbar() {
  82.         return rbar;
  83.     }

  84.     /** {@inheritDoc} */
  85.     public EventDetector[] getEventsDetectors() {
  86.         return null;
  87.     }

  88.     /** {@inheritDoc} */
  89.     protected double[] getLLimits(final SpacecraftState state) throws OrekitException {
  90.         final double perigee = a * (1. - ecc);
  91.         // Trajectory entirely out of the atmosphere
  92.         if (perigee > rbar) {
  93.             return new double[2];
  94.         }
  95.         final double apogee  = a * (1. + ecc);
  96.         // Trajectory entirely within of the atmosphere
  97.         if (apogee < rbar) {
  98.             return new double[]{-FastMath.PI + MathUtils.normalizeAngle(state.getLv(), 0),
  99.                                 FastMath.PI + MathUtils.normalizeAngle(state.getLv(), 0)};
  100.         }
  101.         // Else, trajectory partialy within of the atmosphere
  102.         final double fb = FastMath.acos(((a * (1. - ecc * ecc) / rbar) - 1.) / ecc);
  103.         final double wW = FastMath.atan2(h, k);
  104.         return new double[] {wW - fb, wW + fb};
  105.     }

  106.     /** Get spacecraft shape.
  107.      *
  108.      * @return spacecraft shape
  109.      */
  110.     public DragSensitive getSpacecraft() {
  111.         return spacecraft;
  112.     }
  113. }