public static void Test1()
        {
            var model = new Model();

            Node n1, n2;

            model.Nodes.Add(n1 = new Node(0, 0, 0)
            {
                Constraints = Constraints.Fixed
            });
            model.Nodes.Add(n2 = new Node(1, 0, 0)
            {
                Constraints = Constraints.Fixed
            });

            var elm = new BarElement(n1, n2);

            elm.Section  = new BriefFiniteElementNet.Sections.UniformParametric1DSection(a: 0.01, iy: 0.01, iz: 0.01, j: 0.01);
            elm.Material = BriefFiniteElementNet.Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3);

            var load = new Loads.UniformLoad();

            load.Case = LoadCase.DefaultLoadCase;
            load.CoordinationSystem = CoordinationSystem.Global;
            load.Direction          = Vector.K;
            load.Magnitude          = 10;

            elm.Loads.Add(load);
            model.Elements.Add(elm);

            model.Solve_MPC();

            var f1 = elm.GetInternalForceAt(0);
            var f2 = elm.GetExactInternalForceAt(0);
        }
Ejemplo n.º 2
0
        public static void testInternalForce_Console()
        {
            var model = new Model();
            var ndes  = new Node[] { new Node(0, 0, 0), new Node(3, 0, 0) };

            var h = UnitConverter.In2M(4);
            var w = UnitConverter.In2M(4);

            var e = UnitConverter.Psi2Pas(20e4);

            var a  = h * w;
            var iy = h * h * h * w / 12;
            var iz = w * w * w * h / 12;
            var j  = iy + iz;

            var sec = new Sections.UniformParametric1DSection(a = 1, iy = 1, iz = 1, j = 1);
            var mat = UniformIsotropicMaterial.CreateFromYoungPoisson(e = 1, 0.25);

            var elm = new BarElement(ndes[0], ndes[1])
            {
                Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
            };

            //var elm2 = new BarElement(ndes[1], ndes[2]) { Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame };

            model.Elements.Add(elm);
            model.Nodes.Add(ndes);

            ndes[0].Constraints = Constraints.Fixed;

            ndes[1].Loads.Add(new NodalLoad(new Force(1, 0, 1, 0, 0, 0)));

            model.Solve_MPC();

            var tr = elm.GetTransformationManager();

            var d1 = tr.TransformLocalToGlobal(elm.GetInternalDisplacementAt(1 - 1e-10, LoadCase.DefaultLoadCase));
            var d2 = ndes[1].GetNodalDisplacement(LoadCase.DefaultLoadCase);


            var frc = elm.GetInternalForceAt(-1, LoadCase.DefaultLoadCase);

            var gfrc = elm.GetTransformationManager().TransformLocalToGlobal(frc);

            var f0 = ndes[0].GetSupportReaction();
        }
Ejemplo n.º 3
0
        public static void TestEndreleaseInternalForce()
        {
            /**/
            var m1 = new Model();



            var I = (0.1 * 0.1 * 0.1 * 0.1) / 12;
            var A = (0.1 * 0.1 * 0.1);
            var E = 210e9;

            var sec = new Sections.UniformParametric1DSection(A, I, I, I);
            var mat = new Materials.UniformIsotropicMaterial(E, 0.3);
            var p   = 1e3;

            /**/
            //var p0 = new Point(0, 0, 0);
            //var p1 = new Point(3, 4, 5);

            var l = 4.0;

            {//model 1
                var el1 = new BarElement(3);

                el1.Nodes[0] = new Node(0, 0, 0)
                {
                    Constraints = Constraints.Fixed & Constraints.FixedRX, Label = "n0"
                };;
                el1.Nodes[1] = new Node(l, 0, 0)
                {
                    Label = "n1"
                };
                el1.Nodes[2] = new Node(2 * l, 0, 0)
                {
                    Constraints = Constraints.Released, Label = "n2"
                };

                el1.Section  = sec;
                el1.Material = mat;

                m1.Nodes.Add(el1.Nodes);
                m1.Elements.Add(el1);
                m1.Nodes[1].Loads.Add(new NodalLoad(new Force(0, 0, p, 0, 0, 0)));

                var ep = 1e-10;

                m1.Solve_MPC();

                var frc = el1.GetInternalForceAt(1 - ep);

                var fnc = new Func <double, double>(i => el1.GetInternalDisplacementAt(i).DZ);

                Controls.FunctionVisualizer.VisualizeInNewWindow(fnc, -1 + ep, 1 - ep);

                var s2 = m1.Nodes["n2"].GetSupportReaction();
                var s0 = m1.Nodes["n0"].GetSupportReaction();

                var k = (el1 as BarElement).GetLocalStifnessMatrix();
            }



            //m1.Solve_MPC();
            // m2.Solve_MPC();

            // var d1 = m1.Nodes.Last().GetNodalDisplacement();
            // var d2 = m2.Nodes.Last().GetNodalDisplacement();
        }
Ejemplo n.º 4
0
        static public void Run3()
        {
            // 2 x 20m spans with elements of 1m length
            // Test of running model with 4 loadcases - 2 with vertical loads and 2 with settlements
            // It can be seen that results for loadCase3 are only correct if it uses the DefaultLoadCase

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

            var model = new BriefFiniteElementNet.Model();

            for (double n = 0; n <= 40; 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;           // Constraints.FixedDX & Constraints.FixedDY & Constraints.FixedDZ & Constraints.FixedRY & Constraints.FixedRZ;
            nodeList[20].Constraints = Constraints.FixedDZ & Constraints.FixedDY;                 // z = vertical
            nodeList[nodeList.Count - 1].Constraints = Constraints.FixedDZ & Constraints.FixedDY; // z = vertical

            model.Nodes.AddRange(nodeList);

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

            List <LoadCase> loadCases = new List <LoadCase>();

            LoadCase loadCase1 = new LoadCase("L1", LoadType.Dead);
            LoadCase loadCase2 = new LoadCase("L2", LoadType.Dead);
            LoadCase loadCase3 = new LoadCase("L3", LoadType.Other);  // using LoadCase.DefaultLoadCase gives correct loadCase3 results
            LoadCase loadCase4 = new LoadCase("L4", LoadType.Other);

            loadCases.Add(loadCase1);
            loadCases.Add(loadCase2);
            loadCases.Add(loadCase3);
            loadCases.Add(loadCase4);

            var load1 = new BriefFiniteElementNet.Loads.UniformLoad(loadCase1, new Vector(0, 0, 1), -6000, CoordinationSystem.Global); // Load in N/m
            var load2 = new BriefFiniteElementNet.Loads.UniformLoad(loadCase2, 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 < 40; m++)
            {
                BarElement el = new BarElement(nodeList[m], nodeList[m + 1]);
                el.Section  = secAA;
                el.Material = mat;
                el.Loads.Add(load1);
                el.Loads.Add(load2);
                elementList.Add(el);
            }

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

            model.Nodes[20].Settlements.Add(new Settlement(loadCase3, new Displacement(0, 0, -0.010, 0, 0, 0)));  // -10mm settlement
            model.Nodes[20].Settlements.Add(new Settlement(loadCase4, new Displacement(0, 0, -0.010, 0, 0, 0)));  // +10mm settlement

            foreach (LoadCase loadCase in loadCases)
            {
                model.Solve_MPC(loadCase);
            }

            //model.Solve_MPC(loadCase1,loadCase2,loadCase3,loadCase4);

            BarElement elem = (BarElement)model.Elements[9];

            for (int load = 0; load < loadCases.Count; load++)
            {
                //BarElement elem = (BarElement)model.Elements[9];
                // For settlement loadcases GetExactInternalForce does not return the correct results

                Force f = (load < 2) ?
                          elem.GetExactInternalForceAt(+0.999999, loadCases[load]) :
                          elem.GetInternalForceAt(+0.999999, loadCases[load]);

                Console.WriteLine("Element 10 BMyy is {0:0.000} kNm at end", f.My / 1000);
            }

            var d = model.Nodes[20].GetNodalDisplacement(loadCase3);


            var c1 = elem.GetInternalForceAt(+0.999999, loadCase3);
            var c2 = elem.GetInternalForceAt(+0.999999, loadCase4);

            // Results: Element 10 BMyy is -149.500 kNm at end (correct)
            //          Element 10 BMyy is -149.500 kNm at end (correct)
            //          Element 10 BMyy is 0.000 kNm at end (incorrect, should be -64.060)
            //          Element 10 BMyy is 64.060 kNm at end (correct)
        }