コード例 #1
0
ファイル: TaskThree.cs プロジェクト: it-demircan/NSharp
        private void ComputeSolutionForUnsteady(IntegrationMode mode)
        {
            Console.WriteLine("Start computation for Unsteady Solution...");
            int[] elementNumber = {50};
            int[] polynomOrders = { 1, 3, 7 };

            Vector CFLMapping = GetCFL(mode);
            Matrix errorList = new Matrix(elementNumber.Length, polynomOrders.Length);
            for (int i = 0; i < polynomOrders.Length; i++)
            {
                int polynomOrder = polynomOrders[i];
                for (int k = 0; k < elementNumber.Length; k++)
                {
                    Console.WriteLine("N = " + polynomOrder + " - N_Q = " + elementNumber[k]);
                    DGController dgController = new DGController();
                    dgController.createDGElements(elementNumber[k], mode, polynomOrder, leftSpaceBorder, rightSpaceBorder);
                    timeStep = dgController.ComputeTimeStep(CFLMapping[polynomOrders[i] - 1]);
                    errorList[k, i] = dgController.computeSolution(endTime, timeStep);

                    Vector space = dgController.getOriginSpace();
                    Vector sol = dgController.getCompleteSolution();
                    string plotString = NSharp.Converter.MatLabConverter.ConvertToMatLabPlotStringWithAxisLabelAndTitle(space, sol, "X-Achse", "u approx", "Approximation mit NQ = " + elementNumber[k] + " N = " + polynomOrder);
                    GeneralHelper.WriteOutputText(Directory.GetCurrentDirectory() + "\\" + mode.ToString() + "_PLOT_N =" + polynomOrder + ".txt", plotString);
                }
            }

            Console.WriteLine("Unsteady Solution finished");
        }
コード例 #2
0
ファイル: TaskThree.cs プロジェクト: it-demircan/NSharp
        private void computeDGLMatrices(IntegrationMode mode)
        {
            int[] elementNumber = {8,16,32,64};
            int[] polynomOrders = {1,2,3,4,5,6,7};

            for (int i = 0; i < polynomOrders.Length; i++)
            {
                int polynomOrder = polynomOrders[i];
                for (int k = 0; k < elementNumber.Length; k++)
                {
                    DGController dgController = new DGController();
                    dgController.createDGElements(elementNumber[k], mode, polynomOrder, leftSpaceBorder, rightSpaceBorder);
                    Matrix A = dgController.ConstructDGLMatrix();
                    string matrixString = NSharp.Converter.MatLabConverter.ConvertMatrixToMatlabReadable(A);
                    GeneralHelper.WriteOutputText(Directory.GetCurrentDirectory() + "\\" + mode.ToString() + "_NQ=" + elementNumber[k] + "_N =" + polynomOrder+".txt", matrixString);
                }
            }
        }