示例#1
0
 public static void PrintSystemInfo(FESystem sys)
 {
     Console.Write(sys.Model.ModelInfo());
     Console.Write(sys.MatrixInfo());
     Console.Write(sys.SolvingInfo());
     Console.WriteLine();
 }
示例#2
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();
        }
示例#3
0
        public static void TestHexahedron()
        {
            List <Node> nodes = new List <Node>()
            {
                new Node(0.0, 0.0, 0.0),
                new Node(0.25, 0.0, 0.0),
                new Node(0.25, 0.25, 0.0),
                new Node(0.0, 0.25, 0.0),

                new Node(0.0, 0.0, 0.25),
                new Node(0.25, 0.0, 0.25),
                new Node(0.25, 0.25, 0.25),
                new Node(0.0, 0.25, 0.25),


                new Node(0.5, 0.0, 0.0),
                new Node(0.5, 0.0, 0.25),
                new Node(0.5, 0.25, 0.25),
                new Node(0.5, 0.25, 0.0)
            };

            var element0 = new Hexahedron(new List <Node>(8)
            {
                nodes[0], nodes[1], nodes[2], nodes[3], nodes[4], nodes[5], nodes[6], nodes[7]
            }, new Material(1, 0.3));
            //var element1 = new Hexahedron(new List<Node>(8) { nodes[4], nodes[5], nodes[6], nodes[7], nodes[8], nodes[9], nodes[10], nodes[11] }, new Material(1, 0.3));

            var elements = new List <Element>(1)
            {
                element0
            };

            //var loads = new List<Load>(4)
            //{
            //    new Load(8, 4.6875, 0.0,0.0),
            //    new Load(9, 4.6875, 0.0,0.0),
            //    new Load(10,4.6875, 0.0,0.0),
            //    new Load(11, 4.6875, 0.0,0.0)
            //};

            //var supports = new List<Support>(4)
            //{
            //    new Support(0, SupportType.Fixed),
            //    new Support(1, SupportType.Fixed),
            //    new Support(2, SupportType.Fixed),
            //    new Support(3, SupportType.Fixed)
            //};

            var model = new Model(3, nodes, elements);

            FESystem sys = new FESystem(model, Solver.SimplicialLLT);

            sys.Initialize();
            Console.WriteLine(model.Elements[0].Ke);
            Console.WriteLine(model.Elements[0].B);
            Console.WriteLine(model.Elements[0].D);
            //sys.Solve();
            Console.Write(sys.Model.ModelInfo());
            Console.Write(sys.MatrixInfo());
            Console.WriteLine("Solver: " + sys._Solver.ToString());
            Console.WriteLine("Solving: " + sys.TimeCost[3].ToString() + " ms");
            Console.WriteLine(sys.DisplacementInfo());
            FEIO.WriteKG(sys.GetKG(), "E:\\ALCoding\\ALFE\\topoptTest", false);
            Console.WriteLine();
        }