static void TestHingedInternalForce() { //test internal force of a beam with partially end release var model = StructureGenerator.Generate3DBarElementGrid(2, 1, 1); var bar = model.Elements[0] as BarElement; bar.StartReleaseCondition = Constraints.MovementFixed & Constraints.FixedRX; bar.EndReleaseCondition = Constraints.MovementFixed & Constraints.FixedRX; //var ld = new Loads.UniformLoad() { Direction = Vector.K, Magnitude = -100 }; var ld = new Loads.ConcentratedLoad() { Force = new Force(0, 0, -1, 0, 0, 0), ForceIsoLocation = new IsoPoint(0.0) }; bar.Loads.Add(ld); model.Solve_MPC(); var func = new Func <double, double>(xi => bar.GetExactInternalForceAt(xi).My); FunctionVisualizer.VisualizeInNewWindow(func, -1 + 1e-10, 1 - 1e-10, 100); }
public void LoadEquivalentNodalLoads_ConcentratedLod_eulerbernoullybeam_dirY_My_End() { var l = 4.0; var w = 2.0; var a = l; var nodes = new Node[2]; nodes[0] = (new Node(0, 0, 0) { Label = "n0" }); nodes[1] = (new Node(l, 0, 0) { Label = "n1" }); var elm = new BarElement(nodes[0], nodes[1]) { Label = "e0" }; var f = new Force(0, 0, 0, 0, w, 0); var loc = new IsoPoint(elm.LocalCoordsToIsoCoords(a)[0]); var u1 = new Loads.ConcentratedLoad(f, loc, CoordinationSystem.Global); var hlpr = new ElementHelpers.EulerBernoulliBeamHelper(ElementHelpers.BeamDirection.Y, elm); var loads = hlpr.GetLocalEquivalentNodalLoads(elm, u1); var d0 = Force.Zero; var d1 = loads[1] - f; Assert.IsTrue(Math.Abs(d0.Forces.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d0.Moments.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d1.Forces.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d1.Moments.Length) < 1e-5, "invalid value"); }
public void LoadEquivalentNodalLoads_ConcentratedLod_eulerbernoullybeam_dirY_My_Start() { //equivalent nodal load of a concentrated load applied at start point is same as load itself! var w = 2.0; var a = 0; 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(new Force(0, 0, 0, 0, w, 0), new IsoPoint(elm.LocalCoordsToIsoCoords(a)[0]), CoordinationSystem.Global); var hlpr = new ElementHelpers.EulerBernoulliBeamHelper(ElementHelpers.BeamDirection.Y, elm); var loads = hlpr.GetLocalEquivalentNodalLoads(elm, u1); var d0 = loads[0] - u1.Force; var d1 = Force.Zero; Assert.IsTrue(Math.Abs(d0.Forces.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d0.Moments.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d1.Forces.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d1.Moments.Length) < 1e-5, "invalid value"); }
private static void testMultySpan() { var model = StructureGenerator.Generate3DBarElementGrid(4, 1, 1); var bar1 = model.Elements[0] as BarElement; var bar2 = model.Elements[1] as BarElement; var bar3 = model.Elements[2] as BarElement; model.Nodes[0].Constraints = Constraints.MovementFixed & Constraints.FixedRY; model.Nodes[1].Constraints = Constraints.MovementFixed; // & Constraints.FixedRY; model.Nodes[2].Constraints = Constraints.MovementFixed; // MovementFixed & Constraints.FixedRY; model.Nodes[3].Constraints = Constraints.MovementFixed & Constraints.FixedRY; var l = (model.Nodes.Last().Location - model.Nodes[0].Location).Length; //bar.StartReleaseCondition = Constraints.MovementFixed & Constraints.FixedRX; //bar.EndReleaseCondition = Constraints.MovementFixed & Constraints.FixedRX; //var ld = new Loads.UniformLoad() { Direction = Vector.K, Magnitude = -100 }; var ld = new Loads.ConcentratedLoad() { Force = new Force(0, 0, -1, 0, 0, 0), CoordinationSystem = CoordinationSystem.Global, ForceIsoLocation = new IsoPoint(0.0) }; var ld2 = new Loads.UniformLoad() { Direction = -Vector.K, Magnitude = 1, CoordinationSystem = CoordinationSystem.Global, }; bar1.Material = bar2.Material = bar3.Material; bar1.Section = bar2.Section = bar3.Section; bar1.Loads.Add(ld2); //bar2.Loads.Add(ld2); bar3.Loads.Add(ld2); model.Solve_MPC(); var r0 = model.Nodes[0].GetSupportReaction(); var st = model.Nodes[0].Location; var mid = model.Nodes[1].Location; var en = model.Nodes[2].Location; var ss = model.Nodes.Select(ii => ii.GetSupportReaction()).ToArray(); var pts = new List <Tuple <double, double> >(); foreach (var elm in model.Elements) { var b = elm as BarElement; if (b == null) { continue; } for (var ii = -1.0; ii <= 1; ii += 0.001) { var global = b.IsoCoordsToGlobalCoords(ii); try { var f1 = b.GetExactInternalForceAt(ii); var f2 = b.GetInternalForceAt(ii); var f = f2 - f1; pts.Add(Tuple.Create(global.Y, -f1.My)); } catch { } } } pts.Sort((i, j) => i.Item1.CompareTo(j.Item1)); FunctionVisualizer.VisualizeInNewWindow((x => { var tt = pts.LastOrDefault(j => j.Item1 <= x); if (tt != null) { return(tt.Item2); } return(0); }), 0, l, 1000); throw new NotImplementedException(); }
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 LoadEquivalentNodalLoads_ConcentratedLod_eulerbernoullybeam_dirZ_Fy() { //internal force of 2 node beam beam with uniform load and both ends fixed // ^y w // | || // | \/ // ====================================== --> x // / // /z var w = 2.0; var a = 2; 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(new Force(0, -w, 0, 0, 0, 0), new IsoPoint(elm.LocalCoordsToIsoCoords(a)[0]), CoordinationSystem.Global); var hlpr = new ElementHelpers.EulerBernoulliBeamHelper(ElementHelpers.BeamDirection.Z, elm); var loads = hlpr.GetLocalEquivalentNodalLoads(elm, u1); var L = (elm.Nodes[1].Location - elm.Nodes[0].Location).Length; var b = L - a; var ma = w * a * b * b / (L * L); var mb = w * a * a * b / (L * L); var ra = w * (3 * a + b) * b * b / (L * L * L); //1f var rb = w * (a + 3 * b) * a * a / (L * L * L); //1g var expectedF0 = new Force(0, -ra, 0, 0, 0, -ma); var expectedF1 = new Force(0, -rb, 0, 0, 0, mb); /* * var m1 = -w * L * L / 12; * var m2 = w * L * L / 12; * * var v1 = -w * L / 2; * var v2 = -w * L / 2; */ var d0 = loads[0] - expectedF0; var d1 = loads[1] - expectedF1; Assert.IsTrue(Math.Abs(d0.Forces.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d0.Moments.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d1.Forces.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d1.Moments.Length) < 1e-5, "invalid value"); }
public void LoadEquivalentNodalLoads_ConcentratedLod_eulerbernoullybeam_dirZ_Mz() { //internal force of 2 node beam beam with uniform load and both ends fixed //https://www.amesweb.info/Beam/Fixed-Fixed-Beam-Bending-Moment.aspx // ^ // ^m m0 ^ // | /z | // | / | // ====================================== --> x // var w = 2.0; var a = 1.234560; 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(new Force(0, 0, 0, 0, 0, w), new IsoPoint(elm.LocalCoordsToIsoCoords(a)[0]), CoordinationSystem.Global); var hlpr = new ElementHelpers.EulerBernoulliBeamHelper(ElementHelpers.BeamDirection.Z, elm); var loads = hlpr.GetLocalEquivalentNodalLoads(elm, u1); var L = (elm.Nodes[1].Location - elm.Nodes[0].Location).Length; 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 var expectedR1 = new Force(0, ra, 0, 0, 0, ma); //expected reaction 1 var expectedR2 = new Force(0, rb, 0, 0, 0, -mb); //expected reaction 2 /* * var m1 = -w * L * L / 12; * var m2 = w * L * L / 12; * * var v1 = -w * L / 2; * var v2 = -w * L / 2; */ var d0 = loads[0] + expectedR1; var d1 = loads[1] + expectedR2; Assert.IsTrue(Math.Abs(d0.Forces.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d0.Moments.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d1.Forces.Length) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(d1.Moments.Length) < 1e-5, "invalid value"); }
public void LoadInternalForce_concentratedLLoad_Shaft_Mx() { //internal force of 2 node truss with concentrated 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, w, 0, 0); u1.CoordinationSystem = CoordinationSystem.Global; u1.ForceIsoLocation = new IsoPoint(elm.LocalCoordsToIsoCoords(forceLocation)[0]); var hlpr = new ShaftHelper(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); var mi = 0.0; var vi = 0.0; { var a = forceLocation; var b = L - a; var ra = (1 - (a / L)) * w; var rb = (1 - (b / L)) * w; mi = ra + ((x > forceLocation) ? -w : 0.0); } 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: -mi, my: 0, mz: 0); var df = Math.Abs(testFrc.Mx) - Math.Abs(exactFrc.Mx); 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_truss_Fx() { //internal force of 2 node truss with concentrated 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(w, 0, 0, 0, 0, 0); u1.CoordinationSystem = CoordinationSystem.Global; u1.ForceIsoLocation = new IsoPoint(elm.LocalCoordsToIsoCoords(forceLocation)[0]); var hlpr = new TrussHelper(); 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 ra = (1 - (a / L)) * w; var rb = (1 - (b / L)) * w; mi = ra + ((x > forceLocation) ? -w : 0.0); } var ends = hlpr.GetLocalEquivalentNodalLoads(elm, u1); var testFrc = hlpr.GetLoadInternalForceAt(elm, u1, new double[] { xi[0] * (1 - 1e-9) }); var exactFrc = new Force(fx: -mi, fy: 0, fz: vi, mx: 0, my: 0, mz: 0); var df = testFrc.FirstOrDefault(i => i.Item1 == DoF.Dx).Item2 + exactFrc.Fx; Assert.IsTrue(Math.Abs(df) < 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"); } }