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  import org.junit.jupiter.api.Test;
21  
22  
23  class DormandPrince853IntegratorTest extends EmbeddedRungeKuttaIntegratorAbstractTest {
24  
25      protected EmbeddedRungeKuttaIntegrator
26      createIntegrator(final double minStep, final double maxStep,
27                       final double scalAbsoluteTolerance, final double scalRelativeTolerance) {
28          return new DormandPrince853Integrator(minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);
29      }
30  
31      protected EmbeddedRungeKuttaIntegrator
32      createIntegrator(final double minStep, final double maxStep,
33                       final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) {
34          return new DormandPrince853Integrator(minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);
35      }
36  
37      @Override
38      @Test
39      public void testBackward() {
40          doTestBackward(8.1e-8, 1.1e-7, 1.0e-12, "Dormand-Prince 8 (5, 3)");
41      }
42  
43      @Override
44      @Test
45      public void testKepler() {
46          doTestKepler(4.4e-11);
47      }
48  
49      @Override
50      @Test
51      public void testTorqueFreeMotionOmegaOnly() {
52          doTestTorqueFreeMotionOmegaOnly(4.0e-16);
53      }
54  
55      @Override
56      @Test
57      public void testTorqueFreeMotion() {
58          doTestTorqueFreeMotion(1.3e-12, 9.0e-12);
59      }
60  
61      @Override
62      @Test
63      public void testTorqueFreeMotionIssue230() {
64          doTestTorqueFreeMotionIssue230(2.9e-14, 7.8e-14);
65      }
66  
67      @Override
68      @Test
69      public void testForwardBackwardExceptions() {
70          doTestForwardBackwardExceptions();
71      }
72  
73      @Override
74      @Test
75      public void testIncreasingTolerance() {
76          // the 1.3 factor is only valid for this test
77          // and has been obtained from trial and error
78          // there is no general relation between local and global errors
79          doTestIncreasingTolerance(1.3, 1.0e-12);
80      }
81  
82      @Override
83      @Test
84      public void testEvents() {
85          doTestEvents(2.1e-7, "Dormand-Prince 8 (5, 3)");
86      }
87  
88      @Override
89      @Test
90      public void testStepEnd() {
91          doTestStepEnd(20, "Dormand-Prince 8 (5, 3)");
92      }
93  
94      @Override
95      @Test
96      public void testStopAfterStep() {
97          doTestStopAfterStep(12, 6.842171);
98      }
99  
100     @Override
101     @Test
102     public void testResetAfterStep() {
103         doTestResetAfterStep(12, 13);
104     }
105 
106     @Test
107     public void testMissedEndEvent() {
108         doTestMissedEndEvent(1.0e-15, 1.0e-15);
109     }
110 
111     @Test
112     public void testVariableSteps() {
113         doTestVariableSteps(0.00763, 0.836);
114     }
115 
116     @Test
117     public void testUnstableDerivative() {
118      doTestUnstableDerivative(1.0e-12);
119     }
120 
121     @Override
122     @Test
123     public void testPartialDerivatives() {
124         doTestPartialDerivatives(2.6e-12, 2.0e-11);
125     }
126 
127     @Test
128     public void testSecondaryEquations() {
129         doTestSecondaryEquations(3.3e-12, 8.9e-15);
130     }
131 
132 }