Ejemplo n.º 1
0
        private static void TestMultinodeBar1()
        {
            var n = 2;

            var bar = new BarElement(n);

            var hlp = new EulerBernoulliBeamHelper(BeamDirection.Y, bar);



            for (var i = 0; i < n; i++)
            {
                bar.Nodes[i] = new Node(i * 3, 0, 0);
            }


            var testXi = -0.66;

            //var n1 = hlp.GetNMatrixBar2Node(bar, testXi);
            var n2 = hlp.GetNMatrixAt(bar, testXi);

            var b = hlp.GetBMatrixAt(bar, testXi);

            //var d = n1 - n2;
        }
Ejemplo n.º 2
0
        public void barelement_endrelease()
        {
            //internal force of 2 node beam beam with uniform load and both ends fixed

            var eI = 210e9 * (0.1 * 0.1 * 0.1 * 0.1) / 12;
            var l  = 2.0;

            var n1 = new Node(0, 0, 0);
            var n2 = new Node(l, 0, 0);

            var e1 = new BarElement(2);

            e1.Nodes[0] = n1;
            e1.Nodes[1] = n2;

            //e1.NodalReleaseConditions[0] = Constraints.Fixed;
            //e1.NodalReleaseConditions[1] = Constraints.MovementFixed;

            e1.Material = new UniformIsotropicMaterial(210e9, 0.3);
            e1.Section  = new UniformParametric1DSection(0.1, 0.01, 0.01, 0.01);

            var hlpr = new EulerBernoulliBeamHelper(BeamDirection.Y, e1);

            var s1 = hlpr.CalcLocalStiffnessMatrix(e1);

            //var d1 = 1.0/s1[3, 3];

            var theoricalK  = 12 * eI / (l * l * l);
            var calculatedK = s1[2, 2];

            var ratio = theoricalK / calculatedK;
        }
Ejemplo n.º 3
0
        /*
         *
         *         3 kN/m
         * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
         * ----------------------------
         * /\           10m             /\
         *
         * n1                         n2
         *
         */


        public static void BeamShapeFunction()
        {
            var fix = Constraints.Fixed;

            var beam1 = new BarElement(3);

            beam1.Nodes[0] = new Node(0, 0, 0)
            {
                Constraints = fix
            };
            beam1.Nodes[1] = new Node(1, 0, 0)
            {
                Constraints = fix
            };
            beam1.Nodes[2] = new Node(2, 0, 0)
            {
                Constraints = fix
            };


            var old = beam1.StartReleaseCondition;//.DZ = DofConstraint.Released;

            old.DZ = DofConstraint.Released;
            //old.RZ = DofConstraint.Released;

            beam1.StartReleaseCondition = old;


            var hlpr = new EulerBernoulliBeamHelper(BeamDirection.Y, beam1);

            SingleVariablePolynomial[] ns, ms;

            hlpr.GetShapeFunctions(beam1, out ns, out ms);
        }
        public void eulerbernoullybeam_dirZ_diff()
        {
            var w = 2.0;
            var a = 4;

            var nodes = new Node[2];

            nodes[0] = (new Node(0, 0, 0)
            {
                Label = "n0"
            });
            nodes[1] = (new Node(5.2355, 0, 0)
            {
                Label = "n1"
            });

            var elm = new BarElement(nodes[0], nodes[1])
            {
                Label = "e0"
            };

            var L = (elm.Nodes[1].Location - elm.Nodes[0].Location).Length;

            var b = L - a;

            var hlpr = new EulerBernoulliBeamHelper(BeamDirection.Z, elm);


            var n0 = hlpr.GetNMatrixAt(elm, -1);
            var n1 = hlpr.GetNMatrixAt(elm, 1);

            var epsilon = 1e-5;

            Assert.IsTrue(Math.Abs(n0[1, 1] - L / 2) < epsilon, "invalid value");
        }
        public void LoadInternalForce_concentratedLLoad_eulerbernoullybeam_dirY_My()
        {
            //internal force of 2 node beam beam with uniform load and both ends fixed

            var w             = 2.0;
            var forceLocation = 2.123; //[m]
            var L             = 4;     //[m]

            //var model = new Model();

            var nodes = new Node[2];

            nodes[0] = (new Node(0, 0, 0)
            {
                Label = "n0"
            });
            nodes[1] = (new Node(4, 0, 0)
            {
                Label = "n1"
            });

            var elm = new BarElement(nodes[0], nodes[1])
            {
                Label = "e0"
            };

            var u1 = new Loads.ConcentratedLoad();

            u1.Case  = LoadCase.DefaultLoadCase;
            u1.Force = new Force(0, 0, 0, 0, w, 0);
            u1.CoordinationSystem = CoordinationSystem.Global;

            u1.ForceIsoLocation = new IsoPoint(elm.LocalCoordsToIsoCoords(forceLocation)[0]);

            var hlpr = new EulerBernoulliBeamHelper(BeamDirection.Y, elm);

            var length = (elm.Nodes[1].Location - elm.Nodes[0].Location).Length;


            //foreach (var x in CalcUtil.Divide(length, 10))
            {
                var x = 2.4;

                var xi = elm.LocalCoordsToIsoCoords(x);

                var mi = 0.0;
                var vi = 0.0;

                {
                    //https://www.amesweb.info/Beam/Fixed-Fixed-Beam-Bending-Moment.aspx

                    var a = forceLocation;
                    var b = L - a;

                    var ma = w / (L * L) * (L * L - 4 * a * L + 3 * a * a);
                    var mb = w / (L * L) * (3 * a * a - 2 * a * L);

                    var ra = -6 * w * a / (L * L * L) * (L - a); //R1
                    var rb = 6 * w * a / (L * L * L) * (L - a);  //R1


                    mi = ma + ra * x - ((x > forceLocation) ? w : 0.0);

                    vi = ra;
                }


                var ends = hlpr.GetLocalEquivalentNodalLoads(elm, u1);

                var testFrc = hlpr.GetLoadInternalForceAt(elm, u1, new double[] { xi[0] * (1 - 1e-9) }).ToForce();

                var exactFrc = new Force(fx: 0, fy: 0, fz: vi, mx: 0, my: -mi, mz: 0);


                var dm = Math.Abs(testFrc.My) - Math.Abs(exactFrc.My); //regarding value
                var df = Math.Abs(testFrc.Fz) - Math.Abs(exactFrc.Fz); //regarding value


                Assert.IsTrue(Math.Abs(dm) < 1e-5, "invalid value");
                Assert.IsTrue(Math.Abs(df) < 1e-5, "invalid value");
            }

            {
                var end1 = hlpr.GetLocalEquivalentNodalLoads(elm, u1);

                var f0 = hlpr.GetLoadInternalForceAt(elm, u1, new double[] { -1 + 1e-9 }).ToForce();;

                var sum = end1[0] + f0;

                Assert.IsTrue(Math.Abs(sum.Forces.Length) < 1e-5, "invalid value");  //regarding sign
                Assert.IsTrue(Math.Abs(sum.Moments.Length) < 1e-5, "invalid value"); //regarding sign
            }
        }
        public void LoadInternalForce_concentratedLLoad_eulerbernoullybeam_dirZ_fy()
        {
            //internal force of 2 node beam beam with uniform load and both ends fixed

            var w             = 2.0;
            var forceLocation = 0.5; //[m]
            var L             = 4;   //[m]

            //var model = new Model();

            var nodes = new Node[2];

            nodes[0] = (new Node(0, 0, 0)
            {
                Label = "n0"
            });
            nodes[1] = (new Node(4, 0, 0)
            {
                Label = "n1"
            });

            var elm = new BarElement(nodes[0], nodes[1])
            {
                Label = "e0"
            };

            var u1 = new Loads.ConcentratedLoad();

            u1.Case  = LoadCase.DefaultLoadCase;
            u1.Force = new Force(0, -w, 0, 0, 0, 0);
            u1.CoordinationSystem = CoordinationSystem.Global;

            u1.ForceIsoLocation = new IsoPoint(elm.LocalCoordsToIsoCoords(forceLocation)[0]);

            var hlpr = new EulerBernoulliBeamHelper(BeamDirection.Z, elm);

            var length = (elm.Nodes[1].Location - elm.Nodes[0].Location).Length;


            foreach (var x in CalcUtil.Divide(length, 10))
            {
                var xi = elm.LocalCoordsToIsoCoords(x);


                //https://www.engineeringtoolbox.com/beams-fixed-both-ends-support-loads-deflection-d_809.html

                var mi = 0.0;
                var vi = 0.0;

                {
                    var a = forceLocation;
                    var b = L - a;

                    var ma = -w * a * b * b / (L * L);
                    var mb = -w * a * a * b / (L * L);
                    var mf = 2 * w * a * a * b * b / (L * L * L);

                    double x0, x1, y0, y1;

                    if (x < forceLocation)
                    {
                        x0 = 0;
                        x1 = forceLocation;

                        y0 = ma;
                        y1 = mf;
                    }
                    else
                    {
                        x0 = forceLocation;
                        x1 = L;

                        y0 = mf;
                        y1 = mb;
                    }


                    var m = (y1 - y0) / (x1 - x0);

                    mi = m * (x - x0) + y0;

                    var ra = w * (3 * a + b) * b * b / (L * L * L); //1f
                    var rb = w * (a + 3 * b) * a * a / (L * L * L); //1g

                    if (x < forceLocation)
                    {
                        vi = ra;
                    }
                    else
                    {
                        vi = -rb;
                    }
                }


                var ends = hlpr.GetLocalEquivalentNodalLoads(elm, u1);

                var testFrc = hlpr.GetLoadInternalForceAt(elm, u1, new double[] { xi[0] * (1 - 1e-9) }).ToForce();

                var exactFrc = new Force(fx: 0, fy: vi, fz: 0, mx: 0, my: 0, mz: +mi);

                var dm = Math.Abs(testFrc.Mz) - Math.Abs(exactFrc.Mz);
                var df = Math.Abs(testFrc.Fy) - Math.Abs(exactFrc.Fy);


                Assert.IsTrue(Math.Abs(dm) < 1e-5, "invalid value");
                Assert.IsTrue(Math.Abs(df) < 1e-5, "invalid value");
            }

            {
                var end1 = hlpr.GetLocalEquivalentNodalLoads(elm, u1);

                var f0 = hlpr.GetLoadInternalForceAt(elm, u1, new double[] { -1 + 1e-9 }).ToForce();;

                var sum = end1[0] + f0;

                Assert.IsTrue(Math.Abs(sum.Forces.Length) < 1e-5, "invalid value");
                Assert.IsTrue(Math.Abs(sum.Moments.Length) < 1e-5, "invalid value");
            }
        }
        public void LoadInternalForce_concentratedLLoad_eulerbernoullybeam_dirY_My()
        {
            //internal force of 2 node beam beam with uniform load and both ends fixed

            var w             = 2.0;
            var forceLocation = 0.5; //[m]
            var L             = 4;   //[m]

            //var model = new Model();

            var nodes = new Node[2];

            nodes[0] = (new Node(0, 0, 0)
            {
                Label = "n0"
            });
            nodes[1] = (new Node(4, 0, 0)
            {
                Label = "n1"
            });

            var elm = new BarElement(nodes[0], nodes[1])
            {
                Label = "e0"
            };

            var u1 = new Loads.ConcentratedLoad();

            u1.Case  = LoadCase.DefaultLoadCase;
            u1.Force = new Force(0, 0, 0, 0, w, 0);
            u1.CoordinationSystem = CoordinationSystem.Global;

            u1.ForceIsoLocation = new IsoPoint(elm.LocalCoordsToIsoCoords(forceLocation)[0]);

            var hlpr = new EulerBernoulliBeamHelper(BeamDirection.Y);

            var length = (elm.Nodes[1].Location - elm.Nodes[0].Location).Length;


            foreach (var x in CalcUtil.Divide(length, 10))
            {
                var xi = elm.LocalCoordsToIsoCoords(x);

                var mi = 0.0;
                var vi = 0.0;

                {
                    //https://www.amesweb.info/Beam/Fixed-Fixed-Beam-Bending-Moment.aspx

                    var a = forceLocation;
                    var b = L - a;

                    var ma = -w / (L * L) * (L * L - 4 * a * L + 3 * a * a);

                    var mb = -w / (L * L) * (3 * a * a - 2 * a * L);

                    //var m = (y1 - y0) / (x1 - x0);



                    var ra = -6 * w * a / (L * L * L) * (L - a); //R1
                    var rb = -ra;                                //R2

                    mi = ma + ra * x + ((x > forceLocation) ? w : 0.0);

                    vi = ra;
                }


                var ends = hlpr.GetLocalEquivalentNodalLoads(elm, u1);

                var testFrc = hlpr.GetLoadInternalForceAt(elm, u1, new double[] { xi[0] * (1 - 1e-9) });

                var exactFrc = new Force(fx: 0, fy: 0, fz: vi, mx: 0, my: -mi, mz: 0);

                var dm = testFrc.FirstOrDefault(i => i.Item1 == DoF.Ry).Item2 - exactFrc.My;
                var df = testFrc.FirstOrDefault(i => i.Item1 == DoF.Dz).Item2 + exactFrc.Fz;


                Assert.IsTrue(Math.Abs(dm) < 1e-5, "invalid value");
                Assert.IsTrue(Math.Abs(df) < 1e-5, "invalid value");
            }
        }
        public void eulerbernoullybeam_dirZ()
        {
            var w = 2.0;
            var a = 4;

            var nodes = new Node[2];

            nodes[0] = (new Node(0, 0, 0)
            {
                Label = "n0"
            });
            nodes[1] = (new Node(4, 0, 0)
            {
                Label = "n1"
            });

            var elm = new BarElement(nodes[0], nodes[1])
            {
                Label = "e0"
            };

            var L = (elm.Nodes[1].Location - elm.Nodes[0].Location).Length;

            var b = L - a;

            var hlpr = new EulerBernoulliBeamHelper(BeamDirection.Z, elm);

            for (var i = 0.0; i <= 1; i += 0.01)
            {
                var x = i * L;

                var iso = elm.LocalCoordsToIsoCoords(x);

                var n = hlpr.GetNMatrixAt(elm, iso);

                var n1 = n[0, 0];
                var m1 = n[0, 1];
                var n2 = n[0, 2];
                var m2 = n[0, 3];

                var n1p = n[1, 0];
                var m1p = n[1, 1];
                var n2p = n[1, 2];
                var m2p = n[1, 3];


                var xi = iso[0];

                var n1e = 0.25 * (2 - 3 * xi + xi * xi * xi);
                var m1e = 0.125 * L * (1 - xi - xi * xi + xi * xi * xi);
                var n2e = 0.25 * (2 + 3 * xi - xi * xi * xi);
                var m2e = 0.125 * L * (-1 - xi + xi * xi + xi * xi * xi);

                var epsilon = 1e-5;

                Assert.IsTrue(Math.Abs(n1 - n1e) < epsilon, "invalid value");
                Assert.IsTrue(Math.Abs(n2 - n2e) < epsilon, "invalid value");
                Assert.IsTrue(Math.Abs(m1 - m1e) < epsilon, "invalid value");
                Assert.IsTrue(Math.Abs(m2 - m2e) < epsilon, "invalid value");
            }
        }