Exemplo n.º 1
0
        public static void TestQuads(int x = 7, int y = 5)
        {
            Model model2d = new Cantilever2D(ElementType.QuadElement, x, y).Model;

            model2d.Elements[0].ComputeKe();
            Console.WriteLine(model2d.Elements[0].B);
        }
Exemplo n.º 2
0
        public static void TestTriangles(int x = 7, int y = 5)
        {
            Model    model2d = new Cantilever2D(ElementType.TriangleElement, x, y).Model;
            FESystem sys     = new FESystem(model2d);

            sys.Solve();
            FEPrint.PrintSystemInfo(sys);
            FEPrint.PrintDisplacement(sys);
            FEIO.WriteCOOMatrix(sys.GetKG().ToCOO(), "C:/Users/alber/Desktop/matA.mtx");
        }
Exemplo n.º 3
0
        public static void TestPixels(int x = 7, int y = 5)
        {
            Model model2d = new Cantilever2D(ElementType.PixelElement, x + 1, y + 1).Model;
            var   _Filter = new ALFE.TopOpt.Filter(model2d.Elements, 2.0, 2);

            _Filter.PreFlt();

            FESystem sys = new FESystem(model2d);

            sys.Solve();
            FEPrint.PrintSystemInfo(sys);

            ////FEPrint.PrintDisplacement(sys);
            ////var disp = sys.GetDisplacement();
            ////FEPrint.PrintCSR(KG);
            ////FEIO.WriteCOOMatrix(KG.ToCOO(), "C:/Users/alber/Desktop/matA.mtx");
            Console.WriteLine("------------------- Result Info -------------------");
            Console.WriteLine("Displacement[2].Y = " + sys.GetDisplacement()[2, 1].ToString());
            //FEPrint.PrintDisplacement(sys);
        }
Exemplo n.º 4
0
        //public static void TestRollerSupport()
        //{
        //    List<Node> nds = new List<Node>();
        //    List<Element> elems = new List<Element>();

        //    nds.Add(new Node(3, 1));
        //    nds.Add(new Node(3, 0));
        //    nds.Add(new Node(2, 1));
        //    nds.Add(new Node(2, 0));
        //    nds.Add(new Node(0, 1));
        //    nds.Add(new Node(1, 1));
        //    nds.Add(new Node(1, 0));
        //    nds.Add(new Node(0, 0));
        //    nds.Add(new Node(3, 2));
        //    nds.Add(new Node(2, 2));
        //    nds.Add(new Node(0, 2));
        //    nds.Add(new Node(1, 2));

        //    elems.Add(new Quadrilateral(new List<Node>(4) { nds[2], nds[0], nds[1], nds[3] }, new Material(1.0, 0.3)));
        //    elems.Add(new Quadrilateral(new List<Node>(4) { nds[5], nds[2], nds[3], nds[6] }, new Material(1.0, 0.3)));
        //    elems.Add(new Quadrilateral(new List<Node>(4) { nds[4], nds[5], nds[6], nds[7] }, new Material(1.0, 0.3)));
        //    elems.Add(new Quadrilateral(new List<Node>(4) { nds[9], nds[8], nds[0], nds[2] }, new Material(1.0, 0.3)));
        //    elems.Add(new Quadrilateral(new List<Node>(4) { nds[11], nds[9], nds[2], nds[5] }, new Material(1.0, 0.3)));
        //    elems.Add(new Quadrilateral(new List<Node>(4) { nds[10], nds[11], nds[5], nds[4] }, new Material(1.0, 0.3)));

        //    Model model = new Model(2, nds, elems,
        //        new List<Load>(1) { new Load(11, new Vector2D(0.0, -1.0)) },
        //        new List<Support>(2) { new Support(7, SupportType.Fixed), new Support(1, SupportType.Fixed) });
        //    FESystem sys = new FESystem(model, Solver.SimplicialLLT, false, false);
        //    Console.Write(sys.Model.ModelInfo());
        //    sys.Initialize();
        //    Console.Write(sys.MatrixInfo());

        //    var KG = sys.GetKG();
        //    sys.Solve();
        //    //FEIO.WriteKG(KG, "E:\\testKG.mtx", false);
        //    Console.Write(sys.SolvingInfo());
        //    Console.Write(sys.DisplacementInfo());
        //}
        public static void Test()
        {
            Model model2d = new Cantilever2D(ElementType.PixelElement, 1000, 1000).Model;

            Console.WriteLine("Read Model Successfully!");
            FESystem sys0 = new FESystem(model2d, Solver.PARDISO);

            sys0.Initialize();
            Console.WriteLine("Start to solve");
            sys0.Solve();

            //FEIO.WriteKG(sys0.GetKG(), "E:/test/test.mtx", true);

            Console.Write(sys0.Model.ModelInfo());
            Console.Write(sys0.MatrixInfo());


            Console.Write(sys0.SolvingInfo());
            //Console.WriteLine("Node Displacement 0: "+ sys0.Model.Nodes[0].Displacement);
            //Console.WriteLine("Node Displacement 9999: "+ sys0.Model.Nodes[9999].Displacement);
            //Console.Write(sys0.DisplacementInfo());
            //FEIO.WriteKG(sys0.GetKG(), "E:\\ALCoding\\ALFE\\topoptTest");
            Console.ReadLine();
        }
Exemplo n.º 5
0
        public static void TestAllSolver()
        {
            Model model2d = new Cantilever2D(ElementType.PixelElement, 500, 500).Model;

            //FESystem sys0 = new FESystem(model2d, Solver.PARDISO);
            //sys0.Initialize();
            //FEIO.WriteKG(sys0.GetKG(), "E:\\KG" + ".mtx");
            //sys0.Solve();

            //Console.Write(sys0.Model.ModelInfo());
            //Console.Write(sys0.MatrixInfo());

            //Console.WriteLine("------------------- Time Cost -------------------");
            //Console.WriteLine("Solver: " + sys0._Solver.ToString());
            //Console.WriteLine("Solving: " + sys0.TimeCost[3].ToString() + " ms");
            //Console.WriteLine();

            FESystem sys1 = new FESystem(model2d, Solver.SimplicialLLT);

            sys1.Initialize();
            sys1.Solve();

            Console.WriteLine("Solver: " + sys1._Solver.ToString());
            Console.WriteLine("Solving: " + sys1.TimeCost[3].ToString() + " ms");
            Console.WriteLine();

            FESystem sys2 = new FESystem(model2d, Solver.PARDISO);

            sys2.Initialize();
            sys2.Solve();


            Console.WriteLine("Solver: " + sys2._Solver.ToString());
            Console.WriteLine("Solving: " + sys2.TimeCost[3].ToString() + " ms");
            Console.WriteLine();

            FESystem sys3 = new FESystem(model2d, Solver.CG);

            sys3.Initialize();
            sys3.Solve();

            Console.WriteLine("Solver: " + sys3._Solver.ToString());
            Console.WriteLine("Solving: " + sys3.TimeCost[3].ToString() + " ms");
            Console.WriteLine();

            //FESystem sys4 = new FESystem(model2d, Solver
            //sys4.Initialize();
            //sys4.Solve();

            //Console.WriteLine("Solver: " + sys4._Solver.ToString());
            //Console.WriteLine("Solving: " + sys4.TimeCost[3].ToString() + " ms");
            //Console.WriteLine();

            //FESystem sys5 = new FESystem(model2d, false, Solver.CG);
            //sys5.Initialize();
            //sys5.Solve();

            //Console.WriteLine("Solver: " + sys5._Solver.ToString());
            //Console.WriteLine("Solving: " + sys5.TimeCost[3].ToString() + " ms");
            //Console.WriteLine();

            //FESystem sys4 = new FESystem(model2d, true, false, Solver.CG);
            //sys4.Initialize();
            //sys4.Solve();

            //Console.WriteLine("Solver: " + sys4._Solver.ToString());
            //Console.WriteLine("Solving: " + sys4.TimeCost[3].ToString() + " ms");
            //Console.WriteLine();

            //FESystem sys5 = new FESystem(model2d, true, false, Solver.AMG_CG);
            //sys5.Initialize();
            //sys5.Solve();

            //Console.WriteLine("Solver: " + sys5._Solver.ToString());
            //Console.WriteLine("Solving: " + sys5.TimeCost[3].ToString() + " ms");
            //Console.WriteLine();


            //FEIO.WriteKG(sys.GetKG(), @"E:\ALCoding\ALFE\topoptTest\KG.mtx");
            //FEPrint.PrintDisplacement(sys);
        }