Пример #1
0
        public void Check()
        {
            var model = new Model();

            var wnd = WpfTraceListener.CreateModelTrace(model);

            PosdefChecker.CheckModel(model, LoadCase.DefaultLoadCase);
            wnd.ShowDialog();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.Title = "BFE tests & temporary codes";

            //Validation.GithubIssues.Issue50.Run1();

            TestGrid();
            return;

            //Validation.GithubIssues.Issue41.Run3();

            //TestHingedInternalForce();
            //TestBinModel();
            //testRrefTime();

            test0();
            //testMultySpan();

            {
                var model = Model.Load(@"C:\Users\epsi1on\Documents\unsolved-model-wcl.bin");

                model.Trace.Listeners.Add(new ConsoleTraceListener());

                PosdefChecker.CheckModel_mpc(model, LoadCase.DefaultLoadCase);

                model.Solve_MPC();

                ModelVisualizerControl.VisualizeInNewWindow(model);
            }


            //var stf = MatrixAssemblerUtil.AssembleFullStiffnessMatrix(model);

            //model.Solve_MPC();

            Guid.NewGuid();
            //TestHingedInternalForce();

            //TestIssue20();
            //SimplySupportedBeamUDL();
            //BeamShapeFunction();
            //BarElementTester.TestEndReleaseStyiffness();

            //TestIssue22();

            //TestGrid();
            //Test_P_Delta_matrix();
            //TestSparseRow();

            /*
             * var pl = new Polynomial(1, 1, 1, 1);
             *
             * var ctrl = new FunctionVisualizer();
             *
             * ctrl.GraphColor = Colors.Black;
             * //ctrl.HorizontalAxisLabel = "X";
             * //ctrl.VerticalAxisLabel = "Y";
             * ctrl.Min = -1;
             * ctrl.Max = 1;
             * ctrl.SamplingCount = 100;
             * ctrl.TargetFunction = new Func<double, double>(i => pl.Evaluate(i));
             *
             * ctrl.UpdateUi();
             * ctrl.InitializeComponent();
             *
             * new Window() { Content = ctrl, Title = "polynomial Visualizer!", Width = 500, Height = 300 }
             *  .ShowDialog();
             */
            //BarElementTester.ValidateConsoleUniformLoad();
            //BarElementTester.TestEndreleaseInternalForce();
            //SingleSpanBeamWithOverhang();
            //SingleSpanBeamWithOverhang();
            //TestTrussShapeFunction();
            //new BriefFiniteElementNet.Tests.BarElementTests().barelement_endrelease();
            //new BarElementTester.Test_Trapezoid_1
            //TestMultinodeBar1();


            //var grd = StructureGenerator.Generate3DTriangleElementGrid(5, 6, 7);
            //ModelVisualizerControl.VisualizeInNewWindow(grd);

            ////QrTest();
            //TstMtx();

            //TestCuda();
            //TestIntelMkl();
            //StiffnessCenterTest();

            //TestWithOpensees();

            //Validation.TriangleElementTester.TestSingleElement();

            //Tst();

            //Console.ReadKey();
        }
Пример #3
0
        static public void test1()
        {
            // Two span beam of 20m overall length with elements of 1m length

            List <Node>       nodeList    = new List <Node>();
            List <BarElement> elementList = new List <BarElement>();

            var model = new BriefFiniteElementNet.Model();

            for (double n = 0; n <= 20; n = n + 1)
            {
                nodeList.Add(new Node(x: n, y: 0.0, z: 0.0)
                {
                    Label = "N" + n
                });
            }

            nodeList[0].Constraints  = Constraints.MovementFixed & Constraints.FixedRX;
            nodeList[10].Constraints = Constraints.FixedDZ & Constraints.FixedDY;                 // z = vertical
            nodeList[nodeList.Count - 1].Constraints = Constraints.FixedDZ & Constraints.FixedDY; // z = vertical

            model.Nodes.AddRange(nodeList);

            model.Nodes[10].Settlements.Add(new Settlement(LoadCase.DefaultLoadCase, new Displacement(0, 0, -0.0000000000010, 0, 0, 0)));             // This does not seem to be working correctly based on the reported displacement at Node 10

            var load1 = new BriefFiniteElementNet.Loads.UniformLoad(LoadCase.DefaultLoadCase, new Vector(0, 0, 1), -6000, CoordinationSystem.Global); // Load in N/m

            var a     = 0.1;                                                                                                                          // m²
            var iy    = 0.008333;                                                                                                                     // m4
            var iz    = 8.333e-5;                                                                                                                     // m4
            var j     = 0.1 * 0.1 * 0.1 * 1 / 12.0;                                                                                                   // m4
            var e     = 205e9;                                                                                                                        // N/m²
            var nu    = 0.3;                                                                                                                          // Poisson's ratio
            var secAA = new BriefFiniteElementNet.Sections.UniformParametric1DSection(a, iy, iz, j);

            var mat = BriefFiniteElementNet.Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(e, nu);

            for (int m = 0; m <= 19; m++)
            {
                BarElement el = new BarElement(nodeList[m], nodeList[m + 1]);
                el.Section  = secAA;
                el.Material = mat;
                el.Loads.Add(load1);
                elementList.Add(el);
            }

            model.Elements.Add(elementList.ToArray());

            model.Solve_MPC();//or model.Solve();

            model.Trace.Listeners.Add(new ConsoleTraceListener());

            PosdefChecker.CheckModel_mpc(model, LoadCase.DefaultLoadCase);


            var nde  = nodeList[10];
            var disp = nde.GetNodalDisplacement();

            Console.WriteLine("Node 10 displacement in Z direction is {0:0.000} m", disp.DZ);
            Console.WriteLine("Node 10 rotation in YY direction is {0:0.000} rads\n", disp.RY);

            foreach (BarElement elem in elementList)
            {
                Force f1 = elem.GetExactInternalForceAt(-0.999999);  // -1 = start, 0 = mid, 1 = end, exact solver takes UDL on member into account, doesn't then accept -1 or 1
                Console.WriteLine("Element BMyy is {0:0.000} kNm", f1.My / 1000);
            }


            var str = new MemoryStream();

            Model.Save(str, model);

            str.Position = 0;
            var m2 = Model.Load(str);

            Console.WriteLine("Element BMyy is {0:0.000} kNm", elementList[19].GetExactInternalForceAt(0.999999).My / 1000);
        }
        private static void PI(double canteleverDist)
        {
            var model = new Model();

            Node Leg1Base = null;
            Node Leg1Tip  = null;
            Node Leg2Base = null;
            Node Leg2Tip  = null;

            for (int l = 1; l < 3; l++)
            {
                int  x       = -100 + (l - 1) * 200;
                Node LegBase = new Node(x, 0, 0)
                {
                    Label = "Leg" + l.ToString() + "Base"
                };
                LegBase.Constraints = Constraints.Fixed;
                model.Nodes.Add(LegBase);
                var LegTip = new Node(x, 0, 400)
                {
                    Label = "Leg" + l.ToString() + "Tip"
                };
                model.Nodes.Add(LegTip);
                var beam = MakeBeam(LegBase, LegTip, "Leg" + l.ToString());
                model.Elements.Add(beam);

                var n = new Node(x, canteleverDist, 400)
                {
                    Label = "T" + l.ToString()
                };
                model.Nodes.Add(n);
                var offsetArm = MakeBeam(LegTip, n, "Offset" + l.ToString());
                model.Elements.Add(offsetArm);

                offsetArm.HingedAtEnd = true;

                LegTip = n;

                if (l < 2)
                {
                    Leg1Base = LegBase;
                    Leg1Tip  = LegTip;
                }
                else
                {
                    Leg2Base = LegBase;
                    Leg2Tip  = LegTip;
                }
            }


            var TopOverhangL = new Node(-150, 5, 350)
            {
                Label = "TopOverhang1"
            };
            var TopOverhangR = new Node(150, 5, 350)
            {
                Label = "TopOverhang2"
            };

            model.Nodes.Add(TopOverhangL);
            model.Nodes.Add(TopOverhangR);

            var TopCant1       = MakeBeam(TopOverhangL, Leg1Tip, "TopCant1");
            var TopBetweenLegs = MakeBeam(Leg1Tip, Leg2Tip, "TopBetweenLegs");
            var TopCant2       = MakeBeam(Leg2Tip, TopOverhangR, "TopCant2");

            model.Elements.Add(TopCant1);
            model.Elements.Add(TopBetweenLegs);
            model.Elements.Add(TopCant2);

            var force = new Force(100, 10, 10, 0, 0, 0);

            TopOverhangL.Loads.Add(new NodalLoad(force));

            force = new Force(-100, -10, -10, 0, 0, 0);
            TopOverhangR.Loads.Add(new NodalLoad(force));

            model.Trace.Listeners.Add(new ConsoleTraceListener());

            PosdefChecker.CheckModel(model, LoadCase.DefaultLoadCase);

            model.Solve();

            //var wnd = new Window();
            //var ctrl = new ModelVisualizerControl();
            //ctrl.ModelToVisualize = model;
            //wnd.Content = ctrl;
            //wnd.ShowDialog();



            var d = Leg1Tip.GetNodalDisplacement();

            Console.WriteLine("displacement on leg1 X: " + d.DX.ToString() + " Y: " + d.DY.ToString() + " Z: " + d.DZ.ToString());
            d = Leg2Tip.GetNodalDisplacement();
            Console.WriteLine("displacement on leg2 X: " + d.DX.ToString() + " Y: " + d.DY.ToString() + " Z: " + d.DZ.ToString());
        }