AbstractSolarLightFluxModel.java

  1. /* Copyright 2022-2024 Romain Serra
  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.radiation;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  20. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  21. import org.hipparchus.util.FastMath;
  22. import org.orekit.propagation.events.EventDetectionSettings;
  23. import org.orekit.utils.ExtendedPositionProvider;

  24. /**
  25.  * Abstract class for the definition of the solar flux model with a single occulting body of spherical shape.
  26.  *
  27.  * @author Romain Serra
  28.  * @see LightFluxModel
  29.  * @since 12.2
  30.  */
  31. public abstract class AbstractSolarLightFluxModel extends AbstractLightFluxModel {

  32.     /** Radius of central, occulting body (approximated as spherical).
  33.      * Its center is assumed to be at the origin of the frame linked to the state. */
  34.     private final double occultingBodyRadius;

  35.     /** Reference flux normalized for a 1m distance (N). */
  36.     private final double kRef;

  37.     /** Eclipse detection settings. */
  38.     private final EventDetectionSettings eventDetectionSettings;

  39.     /**
  40.      * Constructor.
  41.      * @param kRef reference flux
  42.      * @param occultedBody position provider for light source
  43.      * @param occultingBodyRadius radius of central, occulting body
  44.      * @param eventDetectionSettings user-defined detection settings for eclipses (if ill-tuned, events might be missed or performance might drop)
  45.      */
  46.     protected AbstractSolarLightFluxModel(final double kRef, final ExtendedPositionProvider occultedBody,
  47.                                           final double occultingBodyRadius, final EventDetectionSettings eventDetectionSettings) {
  48.         super(occultedBody);
  49.         this.kRef = kRef;
  50.         this.occultingBodyRadius = occultingBodyRadius;
  51.         this.eventDetectionSettings = eventDetectionSettings;
  52.     }

  53.     /**
  54.      * Constructor with default value for reference flux.
  55.      * @param occultedBody position provider for light source
  56.      * @param occultingBodyRadius radius of central, occulting body
  57.      * @param eventDetectionSettings user-defined detection settings for eclipses (if ill-tuned, events might be missed or performance might drop)
  58.      */
  59.     protected AbstractSolarLightFluxModel(final ExtendedPositionProvider occultedBody, final double occultingBodyRadius,
  60.                                           final EventDetectionSettings eventDetectionSettings) {
  61.         this(4.56e-6 * FastMath.pow(149597870000.0, 2), occultedBody, occultingBodyRadius,
  62.                 eventDetectionSettings);
  63.     }

  64.     /**
  65.      * Getter for occulting body radius.
  66.      * @return radius
  67.      */
  68.     public double getOccultingBodyRadius() {
  69.         return occultingBodyRadius;
  70.     }

  71.     /**
  72.      * Getter for eclipse event detection settings used for eclipses.
  73.      * @return event detection settings
  74.      */
  75.     public EventDetectionSettings getEventDetectionSettings() {
  76.         return eventDetectionSettings;
  77.     }

  78.     /** {@inheritDoc} */
  79.     @Override
  80.     protected Vector3D getUnoccultedFluxVector(final Vector3D relativePosition) {
  81.         final double squaredRadius = relativePosition.getNormSq();
  82.         final double factor = kRef / (squaredRadius * FastMath.sqrt(squaredRadius));
  83.         return relativePosition.scalarMultiply(factor);
  84.     }

  85.     /** {@inheritDoc} */
  86.     @Override
  87.     protected <T extends CalculusFieldElement<T>> FieldVector3D<T> getUnoccultedFluxVector(final FieldVector3D<T> relativePosition) {
  88.         final T squaredRadius = relativePosition.getNormSq();
  89.         final T factor = (squaredRadius.multiply(squaredRadius.sqrt())).reciprocal().multiply(kRef);
  90.         return relativePosition.scalarMultiply(factor);
  91.     }

  92. }