PsdCorrection.java

  1. /* Copyright 2002-2024 Thales Alenia Space
  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.displacement;

  18. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  19. import org.hipparchus.util.FastMath;
  20. import org.orekit.bodies.GeodeticPoint;
  21. import org.orekit.time.AbsoluteDate;

  22. /** Model for post-seismic deformation corrections.
  23.  * @since 12.1
  24.  * @author Luc Maisonobe
  25.  */
  26. public class PsdCorrection {

  27.     /** Correction axis. */
  28.     private final Axis axis;

  29.     /** Time evolution. */
  30.     private final TimeEvolution evolution;

  31.     /** Earthquake date. */
  32.     private final AbsoluteDate earthquakeDate;

  33.     /** Amplitude. */
  34.     private final double amplitude;

  35.     /** Relaxation time. */
  36.     private final double relaxationTime;

  37.     /** Simple constructor.
  38.      * @param axis correction axis
  39.      * @param evolution time evolution
  40.      * @param earthquakeDate earthquake date
  41.      * @param amplitude amplitude
  42.      * @param relaxationTime relaxation time
  43.      */
  44.     public PsdCorrection(final Axis axis,
  45.                          final TimeEvolution evolution,
  46.                          final AbsoluteDate earthquakeDate,
  47.                          final double amplitude,
  48.                          final double relaxationTime) {
  49.         this.axis           = axis;
  50.         this.evolution      = evolution;
  51.         this.earthquakeDate = earthquakeDate;
  52.         this.amplitude      = amplitude;
  53.         this.relaxationTime = relaxationTime;
  54.     }

  55.     /** Get correction axis.
  56.      * @return correction axis
  57.      */
  58.     public Axis getAxis() {
  59.         return axis;
  60.     }

  61.     /** Get time evolution.
  62.      * @return time evolution
  63.      */
  64.     public TimeEvolution getEvolution() {
  65.         return evolution;
  66.     }

  67.     /** Get earthquake date.
  68.      * @return earthquake date
  69.      */
  70.     public AbsoluteDate getEarthquakeDate() {
  71.         return earthquakeDate;
  72.     }

  73.     /** Get amplitude.
  74.      * @return amplitude
  75.      */
  76.     public double getAmplitude() {
  77.         return amplitude;
  78.     }

  79.     /** Get relaxation time.
  80.      * @return relaxation time
  81.      */
  82.     public double getRelaxationTime() {
  83.         return relaxationTime;
  84.     }

  85.     /** Compute displacement.
  86.      * @param date date
  87.      * @param base base point
  88.      * @return displacement vector in Earth frame
  89.      */
  90.     public Vector3D displacement(final AbsoluteDate date, final GeodeticPoint base) {
  91.         final double scaledTime = date.durationFrom(earthquakeDate) / relaxationTime;
  92.         final double timeFactor = evolution.timeFactor(scaledTime);
  93.         return new Vector3D(amplitude * timeFactor, axis.vector(base));
  94.     }

  95.     /** Enumerate for correction axis. */
  96.     public enum Axis {
  97.         /** East axis. */
  98.         EAST {
  99.             public Vector3D vector(final GeodeticPoint base) {
  100.                 return base.getEast();
  101.             }
  102.         },

  103.         /** North axis. */
  104.         NORTH {
  105.             public Vector3D vector(final GeodeticPoint base) {
  106.                 return base.getNorth();
  107.             }
  108.         },

  109.         /** Up axis. */
  110.         UP {
  111.             public Vector3D vector(final GeodeticPoint base) {
  112.                 return base.getZenith();
  113.             }
  114.         };

  115.         /** Get axis unit vector.
  116.          * @param base base point
  117.          * @return direction in Earth frame
  118.          */
  119.         public abstract Vector3D vector(GeodeticPoint base);
  120.     }

  121.     /** Enumerate for correction time evolution. */
  122.     public enum TimeEvolution {

  123.         /** Exponential evolution. */
  124.         EXP {
  125.             public double timeFactor(final double scaledTime) {
  126.                 return 1 - FastMath.exp(-scaledTime);
  127.             }
  128.         },

  129.         /** Logarithmic evolution. */
  130.         LOG {
  131.             public double timeFactor(final double scaledTime) {
  132.                 return FastMath.log(1 + scaledTime);
  133.             }
  134.         };

  135.         /** Evaluate correction time factor.
  136.          * @param scaledTime scaled time since earthquake
  137.          * @return correction time factor
  138.          */
  139.         public abstract double timeFactor(double scaledTime);

  140.     }

  141. }