1   /* Copyright 2002-2021 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.radiation;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  import org.hipparchus.CalculusFieldElement;
24  import org.hipparchus.geometry.euclidean.threed.FieldRotation;
25  import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
26  import org.hipparchus.geometry.euclidean.threed.Rotation;
27  import org.hipparchus.geometry.euclidean.threed.Vector3D;
28  import org.hipparchus.util.FastMath;
29  import org.orekit.frames.Frame;
30  import org.orekit.time.AbsoluteDate;
31  import org.orekit.time.FieldAbsoluteDate;
32  import org.orekit.utils.ParameterDriver;
33  
34  /** This class represents the features of a simplified spacecraft.
35   * <p>This model uses the classical thermo-optical coefficients
36   * Ca for absorption, Cs for specular reflection and Kd for diffuse
37   * reflection. The equation Ca + Cs + Cd = 1 always holds.
38   * </p>
39   * <p>
40   * A less standard set of coefficients α = Ca for absorption and
41   * τ = Cs/(1-Ca) for specular reflection is implemented in the sister
42   * class {@link IsotropicRadiationCNES95Convention}.
43   * </p>
44   *
45   * @see org.orekit.forces.BoxAndSolarArraySpacecraft
46   * @see org.orekit.forces.drag.IsotropicDrag
47   * @see IsotropicRadiationCNES95Convention
48   * @author Luc Maisonobe
49   * @since 7.1
50   */
51  public class IsotropicRadiationClassicalConvention implements RadiationSensitive {
52  
53      /** Parameters scaling factor.
54       * <p>
55       * We use a power of 2 to avoid numeric noise introduction
56       * in the multiplications/divisions sequences.
57       * </p>
58       */
59      private final double SCALE = FastMath.scalb(1.0, -3);
60  
61      /** Drivers for absorption and reflection coefficients. */
62      private final List<ParameterDriver> parameterDrivers;
63  
64      /** Cross section (m²). */
65      private final double crossSection;
66  
67      /** Simple constructor.
68       * @param crossSection Surface (m²)
69       * @param ca absorption coefficient Ca between 0.0 an 1.0
70       * @param cs specular reflection coefficient Cs between 0.0 an 1.0
71       */
72      public IsotropicRadiationClassicalConvention(final double crossSection, final double ca, final double cs) {
73          this.parameterDrivers = new ArrayList<>(2);
74          parameterDrivers.add(new ParameterDriver(RadiationSensitive.ABSORPTION_COEFFICIENT, ca, SCALE, 0.0, 1.0));
75          parameterDrivers.add(new ParameterDriver(RadiationSensitive.REFLECTION_COEFFICIENT, cs, SCALE, 0.0, 1.0));
76          this.crossSection = crossSection;
77      }
78  
79      /** {@inheritDoc} */
80      @Override
81      public List<ParameterDriver> getRadiationParametersDrivers() {
82          return Collections.unmodifiableList(parameterDrivers);
83      }
84  
85      /** {@inheritDoc} */
86      @Override
87      public Vector3D radiationPressureAcceleration(final AbsoluteDate date, final Frame frame, final Vector3D position,
88                                                    final Rotation rotation, final double mass, final Vector3D flux,
89                                                    final double[] parameters) {
90          final double ca = parameters[0];
91          final double cs = parameters[1];
92          final double kP = crossSection * (1 + 4 * (1.0 - ca - cs) / 9.0);
93          return new Vector3D(kP / mass, flux);
94      }
95  
96      /** {@inheritDoc} */
97      @Override
98      public <T extends CalculusFieldElement<T>> FieldVector3D<T>
99          radiationPressureAcceleration(final FieldAbsoluteDate<T> date, final Frame frame,
100                                       final FieldVector3D<T> position,
101                                       final FieldRotation<T> rotation, final T mass,
102                                       final FieldVector3D<T> flux,
103                                       final T[] parameters) {
104         final T ca = parameters[0];
105         final T cs = parameters[1];
106         final T kP = ca.add(cs).negate().add(1).multiply(4.0 / 9.0).add(1).multiply(crossSection);
107         return new FieldVector3D<>(mass.reciprocal().multiply(kP), flux);
108     }
109 }