//[TestMethod] public void LoadInternalForce_trapezoidload_eulerbernoullybeam_dirY() { //internal force of 2 node beam beam with uniform load and both ends fixed var w = 2.0; //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.(LoadCase.DefaultLoadCase, -Vector.K, w, CoordinationSystem.Global); new Loads.PartialNonUniformLoad(); u1.CoordinationSystem = CoordinationSystem.Global; u1.Direction = -Vector.K; // u1.StartLocation = new double[] { }; // u1.EndLocation = new double[] { }; //u1.StartMagnitude var hlpr = new ElementHelpers.EulerBernoulliBeamHelper(ElementHelpers.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 = w / 12 * (6 * length * x - 6 * x * x - length * length); var vi = w * (length / 2 - x); 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 d = testFrc.FirstOrDefault(i => i.Item1 == DoF.Ry).Item2 + exactFrc.My; Assert.IsTrue(d < 1e-5, "invalid value"); } }
public void LoadEquivalentNodalLoads_partialnonuniformload_eulerbernoullybeam_dirY() { //internal force of 2 node beam beam with uniform load and both ends fixed var w = 2.0; var x1 = -1; var x2 = 1; 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.PartialNonUniformLoad(); u1.Direction = -Vector.K; u1.CoordinationSystem = CoordinationSystem.Global; u1.SeverityFunction = Mathh.Polynomial.FromPoints(1.0, w); u1.StartLocation = new IsoPoint(x1); u1.EndLocation = new IsoPoint(x2); var hlpr = new ElementHelpers.EulerBernoulliBeamHelper(ElementHelpers.BeamDirection.Y, elm); var loads = hlpr.GetLocalEquivalentNodalLoads(elm, u1); var L = (elm.Nodes[1].Location - elm.Nodes[0].Location).Length; var m1 = w * L * L / 12; var m2 = -w * L * L / 12; var v1 = -w * L / 2; var v2 = -w * L / 2; Assert.IsTrue(Math.Abs(loads[0].Fz - v1) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(loads[0].My - m1) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(loads[1].Fz - v2) < 1e-5, "invalid value"); Assert.IsTrue(Math.Abs(loads[1].My - m2) < 1e-5, "invalid value"); }
public static ValidationResult Test_Trapezoid_1() { var buff = new ValidationResult(); buff.Title = "Test #2 for Trapezoid Load on BarElement"; buff.Span = new HtmlTag("span"); buff.Span.Add("p").Text("endforces from Trapezoidal load with 0 offset and same start and end should be same as uniform load"); var elm = new BarElement(new Node(0, 0, 0), new Node(1, 0, 0)); elm.Behavior = BarElementBehaviours.BeamZ; var direction = Vector.K + Vector.I + Vector.J; var ld_u = new Loads.UniformLoad(); ld_u.Magnitude = 1;//*Math.Sqrt(2); ld_u.Direction = direction; ld_u.CoordinationSystem = CoordinationSystem.Global; var ld_t = new Loads.PartialNonUniformLoad(); //ld_t.EndLocation = ld_t.StartLocation = new double[] { 0 }; //ld_t.StartMagnitude = ld_t.EndMagnitude = new double[] { 1 }; ld_t.Direction = direction; ld_t.CoordinationSystem = CoordinationSystem.Global; var loads = elm.GetGlobalEquivalentNodalLoads(ld_u); var loads2 = elm.GetGlobalEquivalentNodalLoads(ld_t); var epsilon = 1e-9; {//test 1 : equality betweeb above var resid = new Force[loads.Length]; for (var i = 0; i < loads.Length; i++) { var f = resid[i] = loads[i] - loads2[i]; buff.ValidationFailed = Math.Abs(f.Forces.Length) > epsilon || Math.Abs(f.Moments.Length) > epsilon; } } return(buff); }
public static void ValidateLoadInternalForce_B_z() { var load = new Loads.PartialNonUniformLoad(); load.Direction = Vector.J; var w = 1; //load.StartLocation = new double[] { -1 }; //load.EndLocation = new double[] { 1 }; //load.StartMagnitude = new double[] { w }; //load.EndMagnitude = new double[] { w }; var elm = new BarElement(new Node(0, 0, 0), new Node(2, 0, 0)); var hlpr = new BriefFiniteElementNet.ElementHelpers.EulerBernoulliBeamHelper(ElementHelpers.BeamDirection.Z, elm); var l = (elm.Nodes[0].Location - elm.Nodes[1].Location).Length; var v = new Func <double, double>(x => w * (l / 2 - x)); var m = new Func <double, double>(x => - (w / 12.0) * (6 * l * x - l * l - 6 * x * x)); var rdn = new Random(0); for (var i = 0; i < 10; i++) { var x_t = rdn.NextDouble() //0.125 * l; var xi = hlpr.Local2Iso(elm, x_t); var frc = hlpr.GetLoadInternalForceAt(elm, load, xi); var rv = v(x_t); var rm = m(x_t); //var dv = v(x_t) - frc.MembraneTensor.S13; //var dm = m(x_t) - frc.BendingTensor.M12; } }
public static void Run1() { ///https://user-images.githubusercontent.com/10573467/111787314-781d7d00-88c7-11eb-869d-d8d7d40db005.png var model = new Model(); //adding nodes model.Nodes.Add(new Node(0, 0, 0) { Label = "n0" }); model.Nodes.Add(new Node(5, 0, 5) { Label = "n1" }); //adding elements BarElement elm; model.Elements.Add(elm = new BarElement(model.Nodes["n0"], model.Nodes["n1"]) { Label = "e0" }); //assign constraint to nodes model.Nodes["n0"].Constraints = Constraints.MovementFixed; model.Nodes["n1"].Constraints = Constraints.MovementFixed; //define sections and material var secAA = new Sections.UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.67, 0.01, 0.006)); var mat = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3); //assign materials (model.Elements["e0"] as BarElement).Material = mat; //assign sections (model.Elements["e0"] as BarElement).Section = secAA; //creating loads var u1 = new Loads.PartialNonUniformLoad() { Direction = Vector.K, CoordinationSystem = CoordinationSystem.Local }; u1.SeverityFunction = Mathh.SingleVariablePolynomial.FromPoints(-1, -6, 1, -4); u1.StartLocation = new IsoPoint(-1); //set locations of trapezoidal load u1.EndLocation = new IsoPoint(1); //set locations of trapezoidal load //assign loads model.Elements["e0"].Loads.Add(u1); var cse = new LoadCase("T1", LoadType.Other); Util.AreaLoad2ConcentratedLoads(elm, u1, cse); //solve model model.Solve_MPC(LoadCase.DefaultLoadCase, cse); //retrieve solve result var n0reaction = model.Nodes["n0"].GetSupportReaction(); var n0reaction2 = model.Nodes["n0"].GetSupportReaction(cse); var n1reaction = model.Nodes["n1"].GetSupportReaction(); var n1reaction2 = model.Nodes["n1"].GetSupportReaction(cse); Console.WriteLine("Support reaction of n0: {0}", n0reaction); Console.WriteLine("Support reaction of n1: {0}", n1reaction); var x = 1.0; //need to find internal force at x = 1.0 m var iso = (model.Elements["e0"] as BarElement).LocalCoordsToIsoCoords(x); //find the location of 1m in iso coordination system var e4Force = (model.Elements["e0"] as BarElement).GetInternalForceAt(iso[0]); //find internal force Console.WriteLine("internal force at x={0} is {1}", x, e4Force); var r1 = new Force(fx: -13.33333333, fy: 0, fz: 13.333333333, mx: 0, my: 0, mz: 0); var r2 = new Force(fx: -11.666666666, fy: 0, fz: 11.66666666, mx: 0, my: 0, mz: 0); var d1 = n0reaction - r1; var d2 = n1reaction - r2; var epsilon = 1e-3; Debug.Assert(d1.Forces.Length < epsilon && d1.Moments.Length < epsilon); Debug.Assert(d2.Forces.Length < epsilon && d2.Moments.Length < epsilon); }
public static void Run1() { var model = new Model(); //adding nodes model.Nodes.Add(new Node(0, 0, 0) { Label = "n0" }); model.Nodes.Add(new Node(5, 5, 5) { Label = "n1" }); //adding elements model.Elements.Add(new BarElement(model.Nodes["n0"], model.Nodes["n1"]) { Label = "e0" }); //assign constraint to nodes model.Nodes["n0"].Constraints = Constraints.MovementFixed & Constraints.FixedRX; model.Nodes["n1"].Constraints = Constraints.MovementFixed; //define sections and material var secAA = new Sections.UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.67, 0.01, 0.006)); var mat = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3); //assign materials (model.Elements["e0"] as BarElement).Material = mat; //assign sections (model.Elements["e0"] as BarElement).Section = secAA; //creating loads var u1 = new Loads.PartialNonUniformLoad() { Direction = Vector.K, CoordinationSystem = CoordinationSystem.Global }; u1.SeverityFunction = Mathh.SingleVariablePolynomial.FromPoints(-1, -6, 1, -4); u1.StartLocation = new IsoPoint(-0.5); //set locations of trapezoidal load u1.EndLocation = new IsoPoint(0.5); //set locations of trapezoidal load //assign loads model.Elements["e0"].Loads.Add(u1); //solve model model.Solve_MPC(); //retrieve solve result var n0reaction = model.Nodes["n0"].GetSupportReaction(); var n1reaction = model.Nodes["n1"].GetSupportReaction(); Console.WriteLine("Support reaction of n0: {0}", n0reaction); Console.WriteLine("Support reaction of n1: {0}", n1reaction); var x = 1.0; //need to find internal force at x = 1.0 m var iso = (model.Elements["e0"] as BarElement).LocalCoordsToIsoCoords(x); //find the location of 1m in iso coordination system var e4Force = (model.Elements["e0"] as BarElement).GetInternalForceAt(iso[0]); //find internal force Console.WriteLine("internal force at x={0} is {1}", x, e4Force); }