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.forces.gravity;
18  
19  import org.junit.jupiter.api.Assertions;
20  import org.junit.jupiter.api.Test;
21  import org.orekit.forces.gravity.potential.OceanTidesWave;
22  
23  import java.lang.reflect.Field;
24  
25  public class OceanTidesWaveTest {
26  
27      @Test
28      void testDelaunayParameters()
29          throws SecurityException, NoSuchFieldException,
30                 IllegalArgumentException, IllegalAccessException {
31  
32          Field cGammaField = OceanTidesWave.class.getDeclaredField("cGamma");
33          cGammaField.setAccessible(true);
34          Field cLField = OceanTidesWave.class.getDeclaredField("cL");
35          cLField.setAccessible(true);
36          Field cLPrimeField = OceanTidesWave.class.getDeclaredField("cLPrime");
37          cLPrimeField.setAccessible(true);
38          Field cFField = OceanTidesWave.class.getDeclaredField("cF");
39          cFField.setAccessible(true);
40          Field cDField = OceanTidesWave.class.getDeclaredField("cD");
41          cDField.setAccessible(true);
42          Field cOmegaField = OceanTidesWave.class.getDeclaredField("cOmega");
43          cOmegaField.setAccessible(true);
44  
45          // these reference values have been extract from table 6.5b, 6.5a and 6.5c
46          // in IERS conventions 2010
47          int[][] tab65 = new int[][] {
48  
49              // long period waves from table 6.5b
50              {  55565, 0,  0,  0,  0,  0,  1 },
51              {  55575, 0,  0,  0,  0,  0,  2 },
52              {  56554, 0,  0, -1,  0,  0,  0 },
53              {  57555, 0,  0,  0, -2,  2, -2 },
54              {  57565, 0,  0,  0, -2,  2, -1 },
55              {  58554, 0,  0, -1, -2,  2, -2 },
56              {  63655, 0,  1,  0,  0, -2,  0 },
57              {  65445, 0, -1,  0,  0,  0, -1 },
58              {  65455, 0, -1,  0,  0,  0,  0 },
59              {  65465, 0, -1,  0,  0,  0,  1 },
60              {  65655, 0,  1,  0, -2,  0, -2 },
61              {  73555, 0,  0,  0,  0, -2,  0 },
62              {  75355, 0, -2,  0,  0,  0,  0 },
63              {  75555, 0,  0,  0, -2,  0, -2 },
64              {  75565, 0,  0,  0, -2,  0, -1 },
65              {  75575, 0,  0,  0, -2,  0,  0 },
66              {  83655, 0,  1,  0, -2, -2, -2 },
67              {  85455, 0, -1,  0, -2,  0, -2 },
68              {  85465, 0, -1,  0, -2,  0, -1 },
69              {  93555, 0,  0,  0, -2, -2, -2 },
70              {  95355, 0, -2,  0, -2,  0, -2 },
71  
72              // diurnal waves from table 6.5a
73              { 125755, 1,  2,  0,  2,  0,  2 },
74              { 127555, 1,  0,  0,  2,  2,  2 },
75              { 135645, 1,  1,  0,  2,  0,  1 },
76              { 135655, 1,  1,  0,  2,  0,  2 },
77              { 137455, 1, -1,  0,  2,  2,  2 },
78              { 145545, 1,  0,  0,  2,  0,  1 },
79              { 145555, 1,  0,  0,  2,  0,  2 },
80              { 147555, 1,  0,  0,  0,  2,  0 },
81              { 153655, 1,  1,  0,  2, -2,  2 },
82              { 155445, 1, -1,  0,  2,  0,  1 },
83              { 155455, 1, -1,  0,  2,  0,  2 },
84              { 155655, 1,  1,  0,  0,  0,  0 },
85              { 155665, 1,  1,  0,  0,  0,  1 },
86              { 157455, 1, -1,  0,  0,  2,  0 },
87              { 157465, 1, -1,  0,  0,  2,  1 },
88              { 162556, 1,  0,  1,  2, -2,  2 },
89              { 163545, 1,  0,  0,  2, -2,  1 },
90              { 163555, 1,  0,  0,  2, -2,  2 },
91              { 164554, 1,  0, -1,  2, -2,  2 },
92              { 164556, 1,  0,  1,  0,  0,  0 },
93              { 165345, 1, -2,  0,  2,  0,  1 },
94              { 165535, 1,  0,  0,  0,  0, -2 },
95              { 165545, 1,  0,  0,  0,  0, -1 },
96              { 165555, 1,  0,  0,  0,  0,  0 },
97              { 165565, 1,  0,  0,  0,  0,  1 },
98              { 165575, 1,  0,  0,  0,  0,  2 },
99              { 166455, 1, -1,  0,  0,  1,  0 },
100             { 166544, 1,  0, -1,  0,  0, -1 },
101             { 166554, 1,  0, -1,  0,  0,  0 },
102             { 166556, 1,  0,  1, -2,  2, -2 },
103             { 166564, 1,  0, -1,  0,  0,  1 },
104             { 167355, 1, -2,  0,  0,  2,  0 },
105             { 167365, 1, -2,  0,  0,  2,  1 },
106             { 167555, 1,  0,  0, -2,  2, -2 },
107             { 167565, 1,  0,  0, -2,  2, -1 },
108             { 168554, 1,  0, -1, -2,  2, -2 },
109             { 173655, 1,  1,  0,  0, -2,  0 },
110             { 173665, 1,  1,  0,  0, -2,  1 },
111             { 175445, 1, -1,  0,  0,  0, -1 },
112             { 175455, 1, -1,  0,  0,  0,  0 },
113             { 175465, 1, -1,  0,  0,  0,  1 },
114             { 183555, 1,  0,  0,  0, -2,  0 },
115             { 185355, 1, -2,  0,  0,  0,  0 },
116             { 185555, 1,  0,  0, -2,  0, -2 },
117             { 185565, 1,  0,  0, -2,  0, -1 },
118             { 185575, 1,  0,  0, -2,  0,  0 },
119             { 195455, 1, -1,  0, -2,  0, -2 },
120             { 195465, 1, -1,  0, -2,  0, -1 },
121 
122             // semi-diurnal waves from table 6.5.c
123             { 245655, 2,  1,  0,  2,  0,  2 },
124             { 255555, 2,  0,  0,  2,  0,  2 }
125 
126         };
127 
128         for (int[] row : tab65) {
129             OceanTidesWave wave = new OceanTidesWave(row[0], 0, 0, new double[1][1][4]);
130             Assertions.assertEquals( row[0], wave.getDoodson());
131             Assertions.assertEquals( row[1], ((Integer) cGammaField.get(wave)).intValue());
132             Assertions.assertEquals(-row[2], ((Integer) cLField.get(wave)).intValue());
133             Assertions.assertEquals(-row[3], ((Integer) cLPrimeField.get(wave)).intValue());
134             Assertions.assertEquals(-row[4], ((Integer) cFField.get(wave)).intValue());
135             Assertions.assertEquals(-row[5], ((Integer) cDField.get(wave)).intValue());
136             Assertions.assertEquals(-row[6], ((Integer) cOmegaField.get(wave)).intValue());
137         }
138 
139     }
140 
141 }