예제 #1
0
파일: Program.cs 프로젝트: wvannoordt/NCAMR
        static void run_presentation_transient(int numframes)
        {
            double              t           = 0;
            double              dt          = 0.1;
            int                 n           = 25;
            double              L           = 10;
            double              H           = 10;
            RBounds2D           domain      = new RBounds2D(0, L, 0, H);
            NCGrid_Distribution soln        = new NCGrid_Distribution(domain, n, n);
            double              max1        = 4;
            double              max2        = 3;
            double              max3        = 5;
            double              max4        = 2;
            double              omega1      = 1;
            double              omega2      = 0.6;
            double              omega3      = 0.2;
            double              omega4      = 1.2;
            double              phi1        = -0.4;
            double              phi2        = -0.9;
            double              phi3        = 1.3;
            double              phi4        = 0.2;
            double              dx          = L / (n - 1);
            double              dy          = H / (n - 1);
            double              refinestep  = 0.1;
            int                 refinecount = 3;

            for (int i = 0; i < numframes; i++)
            {
                BoundaryConditions cond = new BoundaryConditions(soln, BoundaryConditions.BoundaryConditionType.Dirichlet);
                t += dt;
                for (int q = 0; q < n; q++)
                {
                    double x = q * dx;
                    double y = q * dy;
                    cond[q, BoundaryConditions.Direction.Negative_X] = max1 * Math.Sin(4 * Math.PI * x / L) * Math.Sin(omega1 * t - phi1);
                    cond[q, BoundaryConditions.Direction.Negative_Y] = max2 * Math.Sin(2 * Math.PI * y / L) * Math.Sin(omega2 * t - phi2);
                    cond[q, BoundaryConditions.Direction.Positive_X] = max3 * Math.Sin(3 * Math.PI * x / L) * Math.Sin(omega3 * t - phi3);
                    cond[q, BoundaryConditions.Direction.Positive_Y] = max4 * Math.Sin(5 * Math.PI * y / L) * Math.Sin(omega4 * t - phi4);
                }
                BVPLinear2D         problem = new BVPLinear2D(cond, LinearOperatorOrder2.Laplace, soln);
                NCGrid_Distribution sol     = problem.SolveKaczMarzExt(100, 10, 20);
                sol.ApplyMeshMorphGA(refinestep);
                for (int z = 0; z < refinecount - 1; z++)
                {
                    problem = new BVPLinear2D(cond, LinearOperatorOrder2.Laplace, soln);
                    sol     = problem.Solve(Matrix.SystemSolvingScheme.Kaczmarz);
                    sol.ApplyMeshMorphGA(refinestep);
                }
                sol.WriteToFile("longtransient_" + i.ToString());
                sol.QuickSketch("sol_" + bufferint(i, 4));
            }
        }
예제 #2
0
        public NCGrid_Distribution solve_iterative_morph(int max_morph_count, double size)
        {
            NCGrid_Distribution soln = Solve();

            for (int i = 0; i < max_morph_count - 1; i++)
            {
                soln.QuickSketch("soln-" + i.ToString());
                soln.ApplyMeshMorphGA(size);
                discretization = soln.Clone();
                soln           = Solve();
            }
            return(soln);
        }