1   /* Copyright 2022-2025 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  
19  import org.hipparchus.CalculusFieldElement;
20  import org.hipparchus.Field;
21  import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
22  import org.hipparchus.geometry.euclidean.threed.Vector3D;
23  import org.orekit.propagation.FieldSpacecraftState;
24  import org.orekit.propagation.SpacecraftState;
25  import org.orekit.propagation.events.EventDetector;
26  import org.orekit.propagation.events.FieldEventDetector;
27  import org.orekit.time.AbsoluteDate;
28  import org.orekit.time.FieldAbsoluteDate;
29  import org.orekit.utils.ParameterDriver;
30  
31  import java.util.List;
32  import java.util.stream.Stream;
33  
34  /**
35   * Class representing a light-induced radiation pressure force, by leveraging on a given flux model.
36   *
37   * <p>
38   *     This class should not be used in addition to {@link SolarRadiationPressure}, which is another way of
39   *     representing the same orbital perturbation.
40   * </p>
41   *
42   * @author Romain Serra
43   * @see LightFluxModel
44   * @see RadiationSensitive
45   * @since 12.1
46   */
47  public class RadiationPressureModel implements RadiationForceModel {
48  
49      /**
50       * Light flux model (including eclipse conditions).
51       */
52      private final LightFluxModel lightFluxModel;
53  
54      /**
55       * Object defining radiation properties defining the acceleration from the pressure.
56       */
57      private final RadiationSensitive radiationSensitive;
58  
59      /**
60       * Constructor.
61       * @param lightFluxModel model for light flux
62       * @param radiationSensitive object defining radiation properties
63       */
64      public RadiationPressureModel(final LightFluxModel lightFluxModel,
65                                    final RadiationSensitive radiationSensitive) {
66          this.lightFluxModel = lightFluxModel;
67          this.radiationSensitive = radiationSensitive;
68      }
69  
70      /**
71       * Getter for radiation sensitive object.
72       * @return radiation sensitive object
73       */
74      public RadiationSensitive getRadiationSensitive() {
75          return radiationSensitive;
76      }
77  
78      /**
79       * Getter for light flux model.
80       * @return flux model
81       */
82      public LightFluxModel getLightFluxModel() {
83          return lightFluxModel;
84      }
85  
86      /** {@inheritDoc} */
87      @Override
88      public boolean dependsOnPositionOnly() {
89          return radiationSensitive instanceof IsotropicRadiationClassicalConvention || radiationSensitive instanceof IsotropicRadiationCNES95Convention || radiationSensitive instanceof IsotropicRadiationSingleCoefficient;
90      }
91  
92      /** {@inheritDoc} */
93      @Override
94      public void init(final SpacecraftState initialState, final AbsoluteDate target) {
95          RadiationForceModel.super.init(initialState, target);
96          lightFluxModel.init(initialState, target);
97      }
98  
99      /** {@inheritDoc} */
100     @Override
101     public <T extends CalculusFieldElement<T>> void init(final FieldSpacecraftState<T> initialState,
102                                                          final FieldAbsoluteDate<T> target) {
103         RadiationForceModel.super.init(initialState, target);
104         lightFluxModel.init(initialState, target);
105     }
106 
107     /** {@inheritDoc} */
108     @Override
109     public Vector3D acceleration(final SpacecraftState s, final double[] parameters) {
110         final Vector3D fluxVector = lightFluxModel.getLightFluxVector(s);
111         return radiationSensitive.radiationPressureAcceleration(s, fluxVector, parameters);
112     }
113 
114     /** {@inheritDoc} */
115     @Override
116     public <T extends CalculusFieldElement<T>> FieldVector3D<T> acceleration(final FieldSpacecraftState<T> s, final T[] parameters) {
117         final FieldVector3D<T> fluxVector = lightFluxModel.getLightFluxVector(s);
118         return radiationSensitive.radiationPressureAcceleration(s, fluxVector, parameters);
119     }
120 
121     /** {@inheritDoc} */
122     @Override
123     public List<ParameterDriver> getParametersDrivers() {
124         return radiationSensitive.getRadiationParametersDrivers();
125     }
126 
127     /** {@inheritDoc} */
128     @Override
129     public Stream<EventDetector> getEventDetectors() {
130         final List<EventDetector> eventDetectors = lightFluxModel.getEclipseConditionsDetector();
131         return Stream.concat(RadiationForceModel.super.getEventDetectors(), eventDetectors.stream());
132     }
133 
134     /** {@inheritDoc} */
135     @Override
136     public <T extends CalculusFieldElement<T>> Stream<FieldEventDetector<T>> getFieldEventDetectors(final Field<T> field) {
137         final List<FieldEventDetector<T>> eventDetectors = lightFluxModel.getFieldEclipseConditionsDetector(field);
138         return Stream.concat(RadiationForceModel.super.getFieldEventDetectors(field), eventDetectors.stream());
139     }
140 }