SeasonalModel.java

  1. /* Copyright 2022-2025 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.weather;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.util.SinCos;
  20. import org.hipparchus.util.FieldSinCos;

  21. /** Seasonal model used in Global Pressure Temperature models.
  22.  * @see "Landskron, D. & Böhm, J. J Geod (2018)
  23.  *      VMF3/GPT3: refined discrete and empirical troposphere mapping functions
  24.  *      92: 349. https://doi.org/10.1007/s00190-017-1066-2"
  25.  * @author Luc Maisonobe
  26.  * @since 12.1
  27.  */
  28. class SeasonalModel {

  29.     /** Constant. */
  30.     private final double a0;

  31.     /** Annual cosine amplitude. */
  32.     private final double a1;

  33.     /** Annual sine amplitude. */
  34.     private final double b1;

  35.     /** Semi-annual cosine amplitude. */
  36.     private final double a2;

  37.     /** Semi-annual sine amplitude. */
  38.     private final double b2;

  39.     /** Simple constructor.
  40.      * @param a0 constant
  41.      * @param a1 annual cosine amplitude
  42.      * @param b1 annual sine amplitude
  43.      * @param a2 semi-annual cosine amplitude
  44.      * @param b2 semi-annual sine amplitude
  45.      */
  46.     SeasonalModel(final double a0, final double a1, final double b1, final double a2, final double b2) {
  47.         this.a0 = a0;
  48.         this.a1 = a1;
  49.         this.b1 = b1;
  50.         this.a2 = a2;
  51.         this.b2 = b2;
  52.     }

  53.     /** Evaluate a model for some day.
  54.      * @param sc1 sine and cosine of yearly harmonic term
  55.      * @param sc2 sine and cosine of bi-yearly harmonic term
  56.      * @return model value at specified day
  57.      * @since 13.0
  58.      */
  59.     public double evaluate(final SinCos sc1, final SinCos sc2) {
  60.         return a0 + a1 * sc1.cos() + b1 * sc1.sin() + a2 * sc2.cos() + b2 * sc2.sin();
  61.     }

  62.     /** Evaluate a model for some day.
  63.      * @param <T> type of the field elements
  64.      * @param sc1 sine and cosine of yearly harmonic term
  65.      * @param sc2 sine and cosine of bi-yearly harmonic term
  66.      * @return model value at specified day
  67.      * @since 13.0
  68.      */
  69.     public <T extends CalculusFieldElement<T>> T evaluate(final FieldSinCos<T> sc1, final FieldSinCos<T> sc2) {
  70.         return sc1.cos().multiply(a1).
  71.             add(sc1.sin().multiply(b1)).
  72.             add(sc2.cos().multiply(a2)).
  73.             add(sc2.sin().multiply(b2)).
  74.             add(a0);
  75.     }

  76. }