Esempio n. 1
0
        public MainPage()
        {
            InitializeComponent();

            //An example of Gear method use
            var rk1 = Ode.GearBDF(
                0,                                               // Initial time point
                new Microsoft.Research.Oslo.Vector(1000.0),      //  Initial X vector
                (t, x) => { return(new Vector(-0.01 * x[0])); }, // Right part
                new Options {
                MaxStep = 5.0d, NumberOfIterations = 4
            });

            var eds1 = rk1.AppendStep().SolveFromToStep(0, 2000, 0.1).ToArray();
            var x11  = eds1.Select(p => new Point(p.T, p.X[0])).ToArray();

            linegraph1.Plot(x11.Select(x => x.X).ToArray(), x11.Select(x => x.Y).ToArray());

            //An example of RK method use
            var rk2 = Ode.RK547M(
                0,                                                // Initial time point
                new Microsoft.Research.Oslo.Vector(1000.0),       //  Initial X vector
                (t, x) => { return(new Vector(-0.01 * x[0])); }); // Right part

            var eds2 = rk2.AppendStep().SolveFromToStep(0, 2000, 0.1).ToArray();
            var x12  = eds2.Select(p => new Point(p.T, p.X[0])).ToArray();

            linegraph2.Plot(x12.Select(x => x.X).ToArray(),
                            x12.Select(x => 1000 * Math.Exp(-0.01d * x.X)).ToArray());

            var err = x11.Max(x => Math.Abs(x.Y - 1000 * Math.Exp(-0.01d * x.X)));
        }
Esempio n. 2
0
        private static void solveExternalExample(int option, ref List <double> tsim, ref List <double> xsim)
        {
            // Ode options and initial conditions, then solve
            double onex  = 50.0;
            var    treat = new double[] { 0.0, 0.1, 0.3, 1.0 };
            var    ks    = new double[] { 4.91e-6, 2.22e-6, 1.72e-6 };
            var    ics   = new double[] { 0.12, 0.25 };
            var    bad   = 0.1;

            var opts = new Options {
                MaxStep = 3600.0, RelativeTolerance = 1e-3
            };

            var x0 = initialCondition(ics, onex);

            x0[0] += treat[option] * onex * (1 - bad);


            var sol = Ode.GearBDF(0.0, 20 * 3600.0, x0, (t, x) => derivs(t, x, ks));

            // Write to variables
            foreach (var sp in sol)
            {
                tsim.Add(sp.T);
                xsim.Add(sp.X[3]);
            }
        }
Esempio n. 3
0
        public void JacobianGearTest()
        {
            var A = new Matrix(new double[, ] {
                { -1, 0.5 }, { 0, -1 }
            });

            var sol = new List <double>();

            foreach (var sp in Ode.GearBDF(0,
                                           new Vector(1, 1),
                                           (t, x) => A * x).SolveFromToStep(0, 10, 0.1))
            {
                sol.Add(sp.X[0]);
            }

            var solJ = new List <double>();

            foreach (var sp in Ode.GearBDF(0,
                                           new Vector(1, 1),
                                           (t, x) => A * x).SolveFromToStep(0, 10, 0.1))
            {
                solJ.Add(sp.X[0]);
            }

            for (int i = 0; i < sol.Count; i++)
            {
                Assert.IsTrue(Math.Abs(sol[i] - solJ[i]) < 1e-3);
            }
        }
Esempio n. 4
0
        public MainPage()
        {
            InitializeComponent();

            var rk = Ode.GearBDF(
                0,                     // Initial time point
                new Vector(1, Math.E), // Initial X vector
                Felberg,               // Right part
                new Options {
                RelativeTolerance = 1e-5
            });                                            // Set relative tolerance

            // Append time step as extra vector component and solve from t = 0 to 5
            //and output points with step 0.01
            var ed = rk.AppendStep().SolveFromToStep(0, 5, 0.01).ToArray();

            // Draw numeric solution
            x1 = (LineGraph)plotter.FindName("x1");
            x1.Plot(ed.Select(sp => sp.T), ed.Select(sp => sp.X[0]));

            x2 = (LineGraph)plotter.FindName("x2");
            x2.Plot(ed.Select(sp => sp.T), ed.Select(sp => sp.X[1]));

            x1_1 = (LineGraph)plotter.FindName("x1_1");
            x1_1.Plot(ed.Select(sp => sp.T), ed.Select(sp => Math.Exp(Math.Sin(sp.T * sp.T))));

            x2_1 = (LineGraph)plotter.FindName("x2_1");
            x2_1.Plot(ed.Select(sp => sp.T), ed.Select(sp => Math.Exp(Math.Cos(sp.T * sp.T))));
        }
Esempio n. 5
0
        public void solve(ref List <double> tsim, ref List <double>[] xsim)
        {
            var plotLocs = new List <List <int> >();

            plotLocs.Add(new List <int> {
                76, 128, 143
            });
            plotLocs.Add(new List <int> {
                44, 82, 97
            });
            plotLocs.Add(new List <int> {
                40, 50, 56
            });

            double tfinal = 500000.0;

            // Ode options and initial conditions, then solve
            var opts = new Options {
                RelativeTolerance = 1e-4
            };
            var x0 = oscillating_ics();

            IEnumerable <SolPoint> sol;

            sol = Ode.GearBDF(0.0, tfinal, x0, (t, x) => derivs(t, x), opts);



            double dt;

            // Write to variables
            foreach (var sp in sol)
            {
                if (tsim.Count > 0)
                {
                    dt = sp.T - tsim.Last();
                }
                else
                {
                    dt = sp.T;
                }

                if (Double.IsNaN(sp.X[0]))
                {
                    return;
                }

                //xsim[plotLocs.Count].Add(dt);
                tsim.Add(sp.T);
                for (int i = 0; i < plotLocs.Count; i++)
                {
                    double x = 0.0;
                    foreach (int j in plotLocs[i])
                    {
                        x += sp.X[j];
                    }
                    xsim[i].Add(x);
                }
            }
        }
Esempio n. 6
0
        public MainPage()
        {
            InitializeComponent();

            var gear = Ode.GearBDF(
                0,                    // Initial time point
                new Vector(2.0, 0.0), //  Initial X vector
                VanDerPol, new Options {
                MinStep = 1e-6, MaxStep = 1e-1
            });                                                             // Right part

            var rk = Ode.RK547M(
                0,                    // Initial time point
                new Vector(2.0, 0.0), //  Initial X vector
                VanDerPol, new Options {
                MinStep = 1e-6, MaxStep = 1e-1
            });                                                             // Right part

            // Append time step as extra vector component and solve from t = 0 to 20 and output points with step 0.01
            var edg  = gear.AppendStep().SolveFromTo(0.0, 20.0).ToArray();
            var edrk = rk.AppendStep().SolveFromTo(0.0, 20.0).ToArray();

            // Draw numeric solution
            x1 = (LineGraph)plotter.FindName("x1");
            x1.PlotY(edrk.Select(sp => sp.X[0]));

            x2 = (LineGraph)plotter.FindName("x2");
            x2.PlotY(edrk.Select(sp => sp.X[1]));

            x1_1 = (LineGraph)plotter.FindName("x1_1");
            x1_1.PlotY(edg.Select(sp => sp.X[0]));

            x2_1 = (LineGraph)plotter.FindName("x2_1");
            x2_1.PlotY(edg.Select(sp => sp.X[1]));
        }
Esempio n. 7
0
 public void ExponentSolveToGEarTest()
 {
     foreach (var sp in Ode.GearBDF(0,
                                    1,
                                    (t, x) => - x,
                                    new Options {
         RelativeTolerance = 1e-4
     }).SolveTo(10))
     {
         Assert.IsTrue(Math.Abs(sp.X[0] - Math.Exp(-sp.T)) < 1e-3);
     }
 }
Esempio n. 8
0
        public MainPage()
        {
            InitializeComponent();
            var gear = Ode.GearBDF(
                0,                                        // Initial time point
                new Vector(1, 0, 0, 0, 0, 0, 0, 0.0057d), //  Initial X vector
                FloralMaterial,                           // Right part
                new Options()
            {
                RelativeTolerance = 1e-4, AbsoluteTolerance = 1e-6, MaxStep = 0.7d
            });

            // Append time step as extra vector component and solve from t = 0 to 200 and output points with step 0.05
            var ed = gear.AppendStep().SolveFromToStep(0, 200, 0.05).ToArray();


            // Draw numeric solution
            var x1data = ed.Select(p => new Point(p.T, p.X[0])).ToArray();

            x1.Plot(x1data.Select(x => x.X).ToArray(), x1data.Select(x => x.Y).ToArray());

            var x2data = ed.Select(p => new Point(p.T, p.X[1])).ToArray();

            x2.Plot(x2data.Select(x => x.X).ToArray(), x2data.Select(x => x.Y).ToArray());

            var x3data = ed.Select(p => new Point(p.T, p.X[2])).ToArray();

            x3.Plot(x3data.Select(x => x.X).ToArray(), x3data.Select(x => x.Y).ToArray());

            var x4data = ed.Select(p => new Point(p.T, p.X[3])).ToArray();

            x4.Plot(x4data.Select(x => x.X).ToArray(), x4data.Select(x => x.Y).ToArray());

            var x5data = ed.Select(p => new Point(p.T, p.X[4])).ToArray();

            x5.Plot(x5data.Select(x => x.X).ToArray(), x5data.Select(x => x.Y).ToArray());

            var x6data = ed.Select(p => new Point(p.T, p.X[5])).ToArray();

            x6.Plot(x1data.Select(x => x.X).ToArray(), x6data.Select(x => x.Y).ToArray());

            var x7data = ed.Select(p => new Point(p.T, p.X[6])).ToArray();

            x7.Plot(x7data.Select(x => x.X).ToArray(), x7data.Select(x => x.Y).ToArray());

            var x8data = ed.Select(p => new Point(p.T, p.X[7])).ToArray();

            x8.Plot(x8data.Select(x => x.X).ToArray(), x8data.Select(x => x.Y).ToArray());
        }
Esempio n. 9
0
        public static void lotkaExample()
        {
            var tfinal = 200000.0;                                                                                                                                                                                                             // Final time for simulation
            // Species names map to UnaryRx |-> [y2]{t^*}, UnaryLxLL_1 |-> {x^*}[i]:[y1l t^]<y1 x^>:[y1l t^]<y1 x^>, UnaryLxLL |-> {t^*}[y1 x^]<i y1l t^ y1l t^>, SpeciesR |-> <y2 t^ y2r>, sp_1 |-> [y2 t^]<y2r>, sp_0 |-> <y2>, SpeciesL |-> <y1l t^ y1 x^>, sp_3 |-> <y1l>[t^ y1 x^], sp_2 |-> <y1 x^ i y1l t^ y1l t^>, sp_5 |-> <y1>[x^ i y1l t^ y1l t^], sp_4 |-> <i>, BinaryLRxRR_1 |-> {x^*}[y2 i.1]:<y2>[t^ y2r]:<y2>[t^ y2r], BinaryLRxRR |-> {t^*}[y1 x^ y2]<i.1 t^ y2r t^ y2r>{t^*}, sp_7 |-> {t^*}[y1 x^ y2]<i.1 t^ y2r t^ y2r>:<y2>[t^]<y2r>, sp_9 |-> <y1l>[t^ y1 x^]:[y2 t^]<y2r>, sp_8 |-> <y1 x^ y2 i.1 t^ y2r t^ y2r>, sp_11 |-> <y1>[x^ y2 i.1 t^ y2r t^ y2r], sp_10 |-> <y2 i.1>, sp_6 |-> <y1l>[t^ y1 x^]:<y1 x^>[y2]<i.1 t^ y2r t^ y2r>{t^*}
            var    species = new string[] { "UnaryRx", "UnaryLxLL_1", "UnaryLxLL", "SpeciesR", "sp_1", "sp_0", "SpeciesL", "sp_3", "sp_2", "sp_5", "sp_4", "BinaryLRxRR_1", "BinaryLRxRR", "sp_7", "sp_9", "sp_8", "sp_11", "sp_10", "sp_6" }; //% The list of all species
            int    n       = species.Length;
            Vector x0      = Vector.Zeros(n);

            // Assign initial conditions
            var UnaryRx       = x0[0] = 1000.0;
            var UnaryLxLL_1   = x0[1] = 100000.0;
            var UnaryLxLL     = x0[2] = 1000.0;
            var SpeciesR      = x0[3] = 1000.0;
            var SpeciesL      = x0[6] = 1000.0;
            var BinaryLRxRR_1 = x0[11] = 3000000.0;
            var BinaryLRxRR   = x0[12] = 30000.0;

            var maxstep = 1.0;
            var opts    = new Options {
                MaxStep = maxstep
            };

            // Solve the ODEs
            Console.WriteLine("Time,SpeciesL,SpecieR");
            var dataset = DataSet.OpenShared("msds:memory2");

            // define variables
            dataset.Add <double[]>("t", "t");
            dataset.Add <double[]>("SpecieL", "t");
            dataset.Add <double[]>("SpecieR", "t");
            dataset.SpawnViewer("SpecieR(Time) Style:Polyline; Thickness:1; Visible:-6565.19579745115,21.3352279262563,219999.15388962,1004.11943342034;;SpecieL(Time) Style:Polyline; Thickness:1; Visible:-6565.19579745115,21.3352279262563,219999.15388962,1004.11943342034");

            foreach (var sp in Ode.GearBDF(0.0, x0, f, opts).SolveTo(tfinal))
            {
                Console.WriteLine("Time={0}, SpeciesL={1}, SpecieR={2}",
                                  sp.T.ToString(CultureInfo.InvariantCulture),
                                  sp.X[3].ToString(CultureInfo.InvariantCulture),
                                  sp.X[6].ToString(CultureInfo.InvariantCulture));
                dataset.Append("t", sp.T);
                dataset.Append("SpecieL", sp.X[3]);
                dataset.Append("SpecieR", sp.X[6]);
            }

            Console.WriteLine("Waiting for the DataSet Viewer...");
        }
Esempio n. 10
0
        public MainPage()
        {
            InitializeComponent();

            //Try to solve ODE dx / dt = Sin(t), x(0) = 0
            //An example of RK547M method use
            var rk1 = Ode.RK547M(0, 20, new Microsoft.Research.Oslo.Vector(0),
                                 (t, x) => { return(new Vector(Math.Cos(t))); }// Right part
                                 );
            //An example of Gear method use
            var rk2 = Ode.GearBDF(0, 20, new Microsoft.Research.Oslo.Vector(0),
                                  (t, x) => { return(new Vector(Math.Cos(t))); }// Right part
                                  );

            SinT.Plot(rk2.Select(x => x.T).ToArray(), rk2.Select(x => Math.Sin(x.T)).ToArray());
            SinRK.Plot(rk1.Select(x => x.T).ToArray(), rk1.Select(x => x.X[0]).ToArray());
            SinGear.Plot(rk2.Select(x => x.T).ToArray(), rk2.Select(x => x.X[0]).ToArray());
        }
Esempio n. 11
0
        public static void lotkaExample()
        {
            var tfinal = 200000.0;                                                                                                                                                                                                             // Final time for simulation
            // Species names map to UnaryRx |-> [y2]{t^*}, UnaryLxLL_1 |-> {x^*}[i]:[y1l t^]<y1 x^>:[y1l t^]<y1 x^>, UnaryLxLL |-> {t^*}[y1 x^]<i y1l t^ y1l t^>, SpeciesR |-> <y2 t^ y2r>, sp_1 |-> [y2 t^]<y2r>, sp_0 |-> <y2>, SpeciesL |-> <y1l t^ y1 x^>, sp_3 |-> <y1l>[t^ y1 x^], sp_2 |-> <y1 x^ i y1l t^ y1l t^>, sp_5 |-> <y1>[x^ i y1l t^ y1l t^], sp_4 |-> <i>, BinaryLRxRR_1 |-> {x^*}[y2 i.1]:<y2>[t^ y2r]:<y2>[t^ y2r], BinaryLRxRR |-> {t^*}[y1 x^ y2]<i.1 t^ y2r t^ y2r>{t^*}, sp_7 |-> {t^*}[y1 x^ y2]<i.1 t^ y2r t^ y2r>:<y2>[t^]<y2r>, sp_9 |-> <y1l>[t^ y1 x^]:[y2 t^]<y2r>, sp_8 |-> <y1 x^ y2 i.1 t^ y2r t^ y2r>, sp_11 |-> <y1>[x^ y2 i.1 t^ y2r t^ y2r], sp_10 |-> <y2 i.1>, sp_6 |-> <y1l>[t^ y1 x^]:<y1 x^>[y2]<i.1 t^ y2r t^ y2r>{t^*}
            var    species = new string[] { "UnaryRx", "UnaryLxLL_1", "UnaryLxLL", "SpeciesR", "sp_1", "sp_0", "SpeciesL", "sp_3", "sp_2", "sp_5", "sp_4", "BinaryLRxRR_1", "BinaryLRxRR", "sp_7", "sp_9", "sp_8", "sp_11", "sp_10", "sp_6" }; //% The list of all species
            int    n       = species.Length;
            Vector x0      = Vector.Zeros(n);

            // Assign initial conditions
            var UnaryRx       = x0[0] = 1000.0;
            var UnaryLxLL_1   = x0[1] = 100000.0;
            var UnaryLxLL     = x0[2] = 1000.0;
            var SpeciesR      = x0[3] = 1000.0;
            var SpeciesL      = x0[6] = 1000.0;
            var BinaryLRxRR_1 = x0[11] = 3000000.0;
            var BinaryLRxRR   = x0[12] = 30000.0;

            var maxstep = 1.0;
            var opts    = new Options {
                MaxStep = maxstep
            };

            // Solve the ODEs
            var sw = new StreamWriter("lotka" + ((int)maxstep).ToString() + ".csv");

            sw.WriteLine("Time,SpeciesL,SpecieR");
            Console.WriteLine("Time,SpeciesL,SpecieR");

            foreach (var sp in Ode.GearBDF(0.0, x0, f, opts).SolveTo(tfinal))
            {
                sw.WriteLine("{0},{1},{2}", sp.T.ToString(CultureInfo.InvariantCulture),
                             sp.X[3].ToString(CultureInfo.InvariantCulture),
                             sp.X[6].ToString(CultureInfo.InvariantCulture));
                Console.WriteLine("Time={0}, SpeciesL={1}, SpecieR={2}",
                                  sp.T.ToString(CultureInfo.InvariantCulture),
                                  sp.X[3].ToString(CultureInfo.InvariantCulture),
                                  sp.X[6].ToString(CultureInfo.InvariantCulture));
            }

            Console.WriteLine("Numerical solution has been saved in " + "lotka" + ((int)maxstep).ToString() + ".csv");
            sw.Close();
        }
Esempio n. 12
0
        public MainPage()
        {
            InitializeComponent();
            var gear = Ode.GearBDF(
                0,                                   // Initial time point
                new Vector(0.001d, 0.004d, 0.0002d), //  Initial X vector
                Oregonator                           // Right part
                );

            var ed = gear.SolveFromToStep(0.0d, 1000.0, 0.1d).ToArray();

            // Draw numeric solution
            x1 = (LineGraph)plotter.FindName("x1");
            x1.Plot(ed.Select(sp => sp.T), ed.Select(sp => sp.X[0]));

            x2 = (LineGraph)plotter.FindName("x2");
            x2.Plot(ed.Select(sp => sp.T), ed.Select(sp => sp.X[1]));

            x3 = (LineGraph)plotter.FindName("x3");
            x3.Plot(ed.Select(sp => sp.T), ed.Select(sp => sp.X[2]));
        }
Esempio n. 13
0
        public MainPage()
        {
            InitializeComponent();
            var rk = Ode.GearBDF(
                0,                                             // Initial time point
                new Microsoft.Research.Oslo.Vector(0.4, 0.13), //  Initial X vector
                Population);                                   // Right part

            var eds = rk.AppendStep().SolveFromToStep(0, 200, 0.1).ToArray();
            var x1  = eds.Select(p => new Point(p.T, p.X[0])).ToArray();
            var x2  = eds.Select(p => new Point(p.T, p.X[1])).ToArray();

            //Draw 1st population dynamics graph
            linegraph1.Plot(x1.Select(x => x.X).ToArray(), x1.Select(x => x.Y).ToArray());

            //Draw 2nd population dynamics graph
            linegraph2.Plot(x2.Select(x => x.X).ToArray(), x2.Select(x => x.Y).ToArray());

            //Draw phase portrait for system
            Portrait.Plot(x1.Select(x => x.Y).ToArray(), x2.Select(x => x.Y).ToArray());
        }
Esempio n. 14
0
    private void SolveStiff(float c)
    {
        L = (double)c;  //PLEASE FOR THE LOVE OF GOD DONT CHANGE THIS GOD DAMN ROW!
        var sol = Ode.GearBDF(
            0,
            new Vector(Ap, Yp, Bp, m, S),
            (t, x) => new Vector(
                (1 / (1 + Math.Exp(N * (1 - x[3] / 2 + Math.Log((1 + L / Kaoff) / (1 + L / Kaon)))))) * kbar1 * (1 - x[0]) - kbar2 * x[0] * (1 - x[1]) - kbar3 * x[0] * (1 - x[2]), //a
                alpha1 * kbar2 * x[0] * (1 - x[1]) - (kbar4 + kbar6) * x[1],                                                                                                        //y
                alpha2 * kbar3 * x[0] * (1 - x[2]) - kbar5 * x[2],                                                                                                                  //b
                (gammaR * (1 - (1 / (1 + Math.Exp(N * (1 - x[3] / 2 + Math.Log((1 + L / Kaoff) / (1 + L / Kaon))))))) -
                 gammaB * Math.Pow(x[2], 2) * (1 / (1 + Math.Exp(N * (1 - x[3] / 2 + Math.Log((1 + L / Kaoff) / (1 + L / Kaon))))))),                                               //m
                h(x[1]) * (1 - x[4])                                                                                                                                                //S
                )
            );
        var points = sol.SolveFromTo(0, tSpan).ToArray();
        var result = points[points.Length - 1];

        Ap = result.X[0];
        Yp = result.X[1];
        Bp = result.X[2];
        m  = result.X[3];
        S  = result.X[4];
    }
Esempio n. 15
0
        public MainPage()
        {
            InitializeComponent();

            var rk = Ode.GearBDF(
                0,                // Initial time point
                Vector.Zeros(16), //  Initial X vector
                MHC,              // Right part
                new Options       // Optional options
            {
                RelativeTolerance = 1e-3, AbsoluteTolerance = 1e-6
            });

            // Solve to t = 2.0 and store results in array
            var ed = rk.SolveFromToStep(0, 1000, 0.05).ToArray();

            // Draw numeric solution
            x1 = (LineGraph)plotter.FindName("x1");
            x1.PlotY(ed.Select(sp => sp.X[0]));

            x2 = (LineGraph)plotter.FindName("x2");
            x2.PlotY(ed.Select(sp => sp.X[1]));

            x3 = (LineGraph)plotter.FindName("x3");
            x3.PlotY(ed.Select(sp => sp.X[2]));

            x4 = (LineGraph)plotter.FindName("x4");
            x4.PlotY(ed.Select(sp => sp.X[3]));

            x5 = (LineGraph)plotter.FindName("x5");
            x5.PlotY(ed.Select(sp => sp.X[4]));

            x6 = (LineGraph)plotter.FindName("x6");
            x6.PlotY(ed.Select(sp => sp.X[5]));

            x7 = (LineGraph)plotter.FindName("x7");
            x7.PlotY(ed.Select(sp => sp.X[6]));

            x8 = (LineGraph)plotter.FindName("x8");
            x8.PlotY(ed.Select(sp => sp.X[7]));

            x9 = (LineGraph)plotter.FindName("x9");
            x9.PlotY(ed.Select(sp => sp.X[8]));

            x10 = (LineGraph)plotter.FindName("x10");
            x10.PlotY(ed.Select(sp => sp.X[9]));

            x11 = (LineGraph)plotter.FindName("x11");
            x11.PlotY(ed.Select(sp => sp.X[10]));

            x12 = (LineGraph)plotter.FindName("x12");
            x12.PlotY(ed.Select(sp => sp.X[11]));

            x13 = (LineGraph)plotter.FindName("x13");
            x13.PlotY(ed.Select(sp => sp.X[12]));

            x14 = (LineGraph)plotter.FindName("x14");
            x14.PlotY(ed.Select(sp => sp.X[13]));

            x15 = (LineGraph)plotter.FindName("x15");
            x15.PlotY(ed.Select(sp => sp.X[14]));

            x16 = (LineGraph)plotter.FindName("x16");
            x16.PlotY(ed.Select(sp => sp.X[15]));
        }
Esempio n. 16
0
        public void SingleExecute(double windVel, double windDir)
        {
            // Generate instance
            Dynamics dy   = new Dynamics();
            Initital init = new Initital();

            // Postprocess setting
            post.InitializePost();
            post.SetListPair();
            postPara.InitializePost();
            postPara.SetListPair();

            // Send rocket specification setting to Dynamics.
            dy.GroupList = allParam;
            dy.SetParam();
            dy.SetWind(windVel, windDir);

            // Define initial vector.
            init.GroupList = allParam;
            init.SetRailParam();
            var initVec = init.GetInitVec();

            // Define computational parameter.
            var tinit   = 0.0;
            var tfinal  = 100;
            var maxStep = 0.01;
            var opts    = new Options {
            };

            opts.MaxStep           = maxStep;
            opts.AbsoluteTolerance = Math.Pow(10, -4);

            // Trajectory calculation
            foreach (var sol in Ode.GearBDF(tinit, initVec, dy.Func, opts).SolveTo(tfinal))
            {
                if (sol.X[2] >= -0.1)
                {
                    post.AddResult(sol);
                }
                else
                {
                    break;
                }
            }

            // Save result of trajectory case
            var mode = "Trajectory";

            post.SaveResultCsv(mode, tempDir, windVel, windDir);

            // Postprocess for Max value
            post.CalcExtra();
            post.CalcMaxValue();

            // Deployment calculation
            IsParaDeploy = true;
            if (IsParaDeploy)
            {
                // Deploy 1st parachute calculation.
                var deployTime    = post.GetDeployInitTime();
                var deployInitVec = post.GetDeployInitVec();

                // Postprocess setting
                postPara.InitializePost();
                postPara.SetListPair();

                foreach (var sol in Ode.GearBDF(deployTime, deployInitVec,
                                                dy.DeployEq, opts).SolveTo(tfinal + deployTime))
                {
                    if (sol.X[2] >= -0.1)
                    {
                        postPara.AddResult(sol);
                    }
                    else
                    {
                        break;
                    }
                }

                // Save result of deployment case
                mode = "DeployPara";
                postPara.SaveResultCsv(mode, tempDir, windVel, windDir);
            }
        }