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.Test;
25  
26  public 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      public void testNonFieldIntegratorConsistency() {
42          doTestNonFieldIntegratorConsistency(Binary64Field.getInstance());
43      }
44  
45      @Override
46      public void testSanityChecks() {
47          doTestSanityChecks(Binary64Field.getInstance());
48      }
49  
50      @Override
51      public void testBackward() {
52          doTestBackward(Binary64Field.getInstance(), 5.0e-7, 5.0e-7, 1.0e-12, "Higham-Hall 5(4)");
53      }
54  
55      @Override
56      public void testKepler() {
57          doTestKepler(Binary64Field.getInstance(), 1.5e-4);
58      }
59  
60      @Override
61      public void testTorqueFreeMotionOmegaOnly() {
62          doTestTorqueFreeMotionOmegaOnly(Binary64Field.getInstance(), 3.0e-15);
63      }
64  
65      @Override
66      public void testTorqueFreeMotion() {
67          doTestTorqueFreeMotion(Binary64Field.getInstance(), 1.6e-15, 7.0e-16);
68      }
69  
70      @Override
71      public void testTorqueFreeMotionIssue230() {
72          doTestTorqueFreeMotionIssue230(Binary64Field.getInstance(), 5.4e-15, 1.5e-15);
73      }
74  
75      @Override
76      public void testForwardBackwardExceptions() {
77          doTestForwardBackwardExceptions(Binary64Field.getInstance());
78      }
79  
80      @Override
81      public void testMinStep() {
82          doTestMinStep(Binary64Field.getInstance());
83      }
84  
85      @Override
86      public void testIncreasingTolerance() {
87          // the 1.3 factor is only valid for this test
88          // and has been obtained from trial and error
89          // there is no general relation between local and global errors
90          doTestIncreasingTolerance(Binary64Field.getInstance(), 1.3, 1.0e-12);
91      }
92  
93      @Override
94      public void testEvents() {
95          doTestEvents(Binary64Field.getInstance(), 1.0e-7, "Higham-Hall 5(4)");
96      }
97  
98      @Override
99      public void testStepEnd() {
100         doTestStepEnd(Binary64Field.getInstance(), 119, "Higham-Hall 5(4)");
101     }
102 
103     @Override
104     public void testStopAfterStep() {
105         doTestStopAfterStep(Binary64Field.getInstance(), 12, 1.110791);
106     }
107 
108     @Override
109     public void testResetAfterStep() {
110         doTestResetAfterStep(Binary64Field.getInstance(), 12, 14);
111     }
112 
113     @Override
114     public void testEventsErrors() {
115         doTestEventsErrors(Binary64Field.getInstance());
116     }
117 
118     @Override
119     public void testEventsNoConvergence() {
120         doTestEventsNoConvergence(Binary64Field.getInstance());
121     }
122 
123     @Override
124     public void testPartialDerivatives() {
125         doTestPartialDerivatives(1.2e-11, new double[] { 8.0e-11, 1.8e-11, 2.6e-12, 2.6e-12, 1.8e-11 });
126     }
127 
128     @Test
129     public void testSecondaryEquations() {
130         doTestSecondaryEquations(Binary64Field.getInstance(), 9.7e-12, 1.3e-14);
131     }
132 
133 }