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.models.earth.atmosphere;
18
19 import org.hipparchus.CalculusFieldElement;
20 import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
21 import org.hipparchus.geometry.euclidean.threed.Vector3D;
22 import org.hipparchus.util.FastMath;
23 import org.orekit.bodies.BodyShape;
24 import org.orekit.bodies.FieldGeodeticPoint;
25 import org.orekit.bodies.GeodeticPoint;
26 import org.orekit.frames.Frame;
27 import org.orekit.time.AbsoluteDate;
28 import org.orekit.time.FieldAbsoluteDate;
29
30
31 /** Simple exponential atmospheric model.
32 * <p>This model represents a simple atmosphere with an exponential
33 * density and rigidly bound to the underlying rotating body.</p>
34 * @author Fabien Maussion
35 * @author Luc Maisonobe
36 */
37 public class SimpleExponentialAtmosphere implements Atmosphere {
38
39 /** Earth shape model. */
40 private BodyShape shape;
41
42 /** Reference density. */
43 private double rho0;
44
45 /** Reference altitude. */
46 private double h0;
47
48 /** Reference altitude scale. */
49 private double hscale;
50
51 /** Create an exponential atmosphere.
52 * @param shape body shape model
53 * @param rho0 Density at the altitude h0
54 * @param h0 Altitude of reference (m)
55 * @param hscale Scale factor
56 */
57 public SimpleExponentialAtmosphere(final BodyShape shape, final double rho0,
58 final double h0, final double hscale) {
59 this.shape = shape;
60 this.rho0 = rho0;
61 this.h0 = h0;
62 this.hscale = hscale;
63 }
64
65 /** {@inheritDoc} */
66 public Frame getFrame() {
67 return shape.getBodyFrame();
68 }
69
70 /** {@inheritDoc} */
71 public double getDensity(final AbsoluteDate date, final Vector3D position, final Frame frame) {
72 final GeodeticPoint gp = shape.transform(position, frame, date);
73 return rho0 * FastMath.exp((h0 - gp.getAltitude()) / hscale);
74 }
75
76 @Override
77 public <T extends CalculusFieldElement<T>> T
78 getDensity(final FieldAbsoluteDate<T> date, final FieldVector3D<T> position,
79 final Frame frame) {
80 final FieldGeodeticPoint<T> gp = shape.transform(position, frame, date);
81 return gp.getAltitude().subtract(h0).divide(-hscale).exp().multiply(rho0);
82 }
83
84 }