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.Test;
21  
22  
23  public 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      public void testBackward() {
39          doTestBackward(8.1e-8, 1.1e-7, 1.0e-12, "Dormand-Prince 8 (5, 3)");
40      }
41  
42      @Override
43      public void testKepler() {
44          doTestKepler(4.4e-11);
45      }
46  
47      @Override
48      public void testTorqueFreeMotionOmegaOnly() {
49          doTestTorqueFreeMotionOmegaOnly(4.0e-16);
50      }
51  
52      @Override
53      public void testTorqueFreeMotion() {
54          doTestTorqueFreeMotion(1.3e-12, 9.0e-12);
55      }
56  
57      @Override
58      public void testTorqueFreeMotionIssue230() {
59          doTestTorqueFreeMotionIssue230(2.9e-14, 7.8e-14);
60      }
61  
62      @Override
63      public void testForwardBackwardExceptions() {
64          doTestForwardBackwardExceptions();
65      }
66  
67      @Override
68      public void testIncreasingTolerance() {
69          // the 1.3 factor is only valid for this test
70          // and has been obtained from trial and error
71          // there is no general relation between local and global errors
72          doTestIncreasingTolerance(1.3, 1.0e-12);
73      }
74  
75      @Override
76      public void testEvents() {
77          doTestEvents(2.1e-7, "Dormand-Prince 8 (5, 3)");
78      }
79  
80      @Override
81      public void testStepEnd() {
82          doTestStepEnd(20, "Dormand-Prince 8 (5, 3)");
83      }
84  
85      @Override
86      public void testStopAfterStep() {
87          doTestStopAfterStep(12, 6.842171);
88      }
89  
90      @Override
91      public void testResetAfterStep() {
92          doTestResetAfterStep(12, 13);
93      }
94  
95      @Test
96      public void testMissedEndEvent() {
97          doTestMissedEndEvent(1.0e-15, 1.0e-15);
98      }
99  
100     @Test
101     public void testVariableSteps() {
102         doTestVariableSteps(0.00763, 0.836);
103     }
104 
105     @Test
106     public void testUnstableDerivative() {
107      doTestUnstableDerivative(1.0e-12);
108     }
109 
110     @Override
111     public void testPartialDerivatives() {
112         doTestPartialDerivatives(2.6e-12, 2.0e-11);
113     }
114 
115     @Test
116     public void testSecondaryEquations() {
117         doTestSecondaryEquations(3.3e-12, 8.9e-15);
118     }
119 
120 }