View Javadoc
1   /*
2    * Licensed to the Hipparchus project under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The Hipparchus project 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    *      https://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  
18  package org.hipparchus.ode.nonstiff;
19  
20  
21  import org.hipparchus.CalculusFieldElement;
22  import org.hipparchus.Field;
23  import org.hipparchus.util.Binary64Field;
24  import org.junit.jupiter.api.Test;
25  
26  class HighamHall54FieldIntegratorTest extends EmbeddedRungeKuttaFieldIntegratorAbstractTest {
27  
28      protected <T extends CalculusFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
29      createIntegrator(Field<T> field, final double minStep, final double maxStep,
30                       final double scalAbsoluteTolerance, final double scalRelativeTolerance) {
31          return new HighamHall54FieldIntegrator<T>(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);
32      }
33  
34      protected <T extends CalculusFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
35      createIntegrator(Field<T> field, final double minStep, final double maxStep,
36                       final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) {
37          return new HighamHall54FieldIntegrator<T>(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);
38      }
39  
40      @Override
41      @Test
42      public void testNonFieldIntegratorConsistency() {
43          doTestNonFieldIntegratorConsistency(Binary64Field.getInstance());
44      }
45  
46      @Override
47      @Test
48      public void testSanityChecks() {
49          doTestSanityChecks(Binary64Field.getInstance());
50      }
51  
52      @Override
53      @Test
54      public void testBackward() {
55          doTestBackward(Binary64Field.getInstance(), 5.0e-7, 5.0e-7, 1.0e-12, "Higham-Hall 5(4)");
56      }
57  
58      @Override
59      @Test
60      public void testKepler() {
61          doTestKepler(Binary64Field.getInstance(), 1.5e-4);
62      }
63  
64      @Override
65      @Test
66      public void testTorqueFreeMotionOmegaOnly() {
67          doTestTorqueFreeMotionOmegaOnly(Binary64Field.getInstance(), 3.0e-15);
68      }
69  
70      @Override
71      @Test
72      public void testTorqueFreeMotion() {
73          doTestTorqueFreeMotion(Binary64Field.getInstance(), 1.6e-15, 7.0e-16);
74      }
75  
76      @Override
77      @Test
78      public void testTorqueFreeMotionIssue230() {
79          doTestTorqueFreeMotionIssue230(Binary64Field.getInstance(), 5.4e-15, 1.5e-15);
80      }
81  
82      @Override
83      @Test
84      public void testForwardBackwardExceptions() {
85          doTestForwardBackwardExceptions(Binary64Field.getInstance());
86      }
87  
88      @Override
89      @Test
90      public void testMinStep() {
91          doTestMinStep(Binary64Field.getInstance());
92      }
93  
94      @Override
95      @Test
96      public void testIncreasingTolerance() {
97          // the 1.3 factor is only valid for this test
98          // and has been obtained from trial and error
99          // there is no general relation between local and global errors
100         doTestIncreasingTolerance(Binary64Field.getInstance(), 1.3, 1.0e-12);
101     }
102 
103     @Override
104     @Test
105     public void testEvents() {
106         doTestEvents(Binary64Field.getInstance(), 1.0e-7, "Higham-Hall 5(4)");
107     }
108 
109     @Override
110     @Test
111     public void testStepEnd() {
112         doTestStepEnd(Binary64Field.getInstance(), 119, "Higham-Hall 5(4)");
113     }
114 
115     @Override
116     @Test
117     public void testStopAfterStep() {
118         doTestStopAfterStep(Binary64Field.getInstance(), 12, 1.110791);
119     }
120 
121     @Override
122     @Test
123     public void testResetAfterStep() {
124         doTestResetAfterStep(Binary64Field.getInstance(), 12, 14);
125     }
126 
127     @Override
128     @Test
129     public void testEventsErrors() {
130         doTestEventsErrors(Binary64Field.getInstance());
131     }
132 
133     @Override
134     @Test
135     public void testEventsNoConvergence() {
136         doTestEventsNoConvergence(Binary64Field.getInstance());
137     }
138 
139     @Override
140     @Test
141     public void testPartialDerivatives() {
142         doTestPartialDerivatives(1.2e-11, new double[] { 8.0e-11, 1.8e-11, 2.6e-12, 2.6e-12, 1.8e-11 });
143     }
144 
145     @Test
146     public void testSecondaryEquations() {
147         doTestSecondaryEquations(Binary64Field.getInstance(), 9.7e-12, 1.3e-14);
148     }
149 
150 }