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 static void TestShowVisualizer(object objectToVisualize) { //VisualizerDevelopmentHost visualizerHost = new VisualizerDevelopmentHost(objectToVisualize, typeof(MatrixVisualizer)); //visualizerHost.ShowVisualizer(); var pl = objectToVisualize as SingleVariablePolynomial; if (pl == null) { return; } 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(); new Window() { Content = ctrl, Title = "polynomial Visualizer!", Width = 500, Height = 300 } .ShowDialog(); }
static void TestIssue22() { var model = new BriefFiniteElementNet.Model(); var n1 = new Node(-1, 0, 0) { Label = "n1", Constraints = BriefFiniteElementNet.Constraints.MovementFixed & BriefFiniteElementNet.Constraints.FixedRX }; var n2 = new Node(1, 0, 0) { Label = "n2", Constraints = BriefFiniteElementNet.Constraints.MovementFixed }; var loadPositionX = 0.5; var e1 = new BarElement(n1, n2) { Label = "e1" }; e1.Section = new BriefFiniteElementNet.Sections.UniformGeometric1DSection(SectionGenerator.GetRectangularSection(0.1d, 0.2d)); e1.Material = BriefFiniteElementNet.Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3); model.Nodes.Add(n1, n2); model.Elements.Add(e1); var force = new Force(0, 1, 1, 0, 0, 0); var elementLoad = new BriefFiniteElementNet.Loads.ConcentratedLoad { CoordinationSystem = CoordinationSystem.Global, Force = force, ForceIsoLocation = new IsoPoint(loadPositionX) }; e1.Loads.Add(elementLoad); model.Solve(); var eqv = e1.GetGlobalEquivalentNodalLoads(elementLoad); var data = e1.GetExactInternalForceAt(-0.99999999999); //e1.GetInternalForceAt(-0.99999999999); var func = new Func <double, double>(xi => e1.GetExactInternalForceAt(xi).My); FunctionVisualizer.VisualizeInNewWindow(func, -1 + 1e-10, 1 - 1e-10, 100); }
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(); }