Ejemplo n.º 1
0
        public void TaskOneStone()
        {
            DGSystemController controller = new DGSystemController();
            controller.createDGElements(4, 3, 0.0, 20.0, 2);
            Matrix Solution = controller.GetSolution();
            Vector startV = ComputeV(Solution);
            string matlabStringStartH = MatLabConverter.ConvertToMatLabPlotStringWithAxisLabelAndTitle(controller.GetOriginNodes(), Solution.GetColumn(0), "Raumvariable x", "h", "Lösung h zum Zeitpunkt t = 0.0");
            string matlabStringStartV = MatLabConverter.ConvertToMatLabPlotStringWithAxisLabelAndTitle(controller.GetOriginNodes(), startV, "Raumvariable x", "v", "Lösung v zum Zeitpunkt t = 0.0");

            controller.ComputeSolution(2.3);
            Solution = controller.GetSolution();

            Vector endV = ComputeV(Solution);
            string matlabStringV = MatLabConverter.ConvertToMatLabPlotStringWithAxisLabelAndTitle(controller.GetOriginNodes(), endV, "Raumvariable x", "v", "Lösung v zum Zeitpunkt t = 2.3");

            string matlabStringH = MatLabConverter.ConvertToMatLabPlotStringWithAxisLabelAndTitle(controller.GetOriginNodes(), Solution.GetColumn(0), "Raumvariable x", "h", "Lösung h zum Zeitpunkt t = 2.3");
        }
Ejemplo n.º 2
0
        private void TaskOneEOC()
        {
            Matrix error = new Matrix(9, 1);
            for (int i = 1; i < 8; i++)
            {
                DGSystemController controller = new DGSystemController();
                controller.createDGElements((int)Math.Pow(2.0, i), 3, 0.0, Math.PI * 2.0, 2);
                controller.ComputeSolution(1.0);
                Matrix approx = controller.GetSolution();
                Matrix exact = controller.ComputeExactSolution(1.0);

                Vector diff = approx.GetColumn(0) - exact.GetColumn(0);
                double err = diff.GetMaxAbsValue();
                Console.WriteLine("Error:" + err + "   i = " + i);
                error[i - 1, 0] = err;
            }

            Matrix eoc = computeEOC(error);
            Console.WriteLine("EOC:");
            Console.WriteLine(eoc.toString(15));
        }