Beispiel #1
0
        public static void test1()
        {
            var load = new PartialNonUniformLoad();            //creating new instance of load

            load.SeverityFunction = Mathh.Polynomial.FromPoints(-1, 5, 1, 7);

            load.StartLocation = new IsoPoint(-0.5);      //set locations of trapezoidal load
            load.EndLocation   = new IsoPoint(0.5);       //set locations of trapezoidal load

            load.Direction          = Vector.K;           //set direction
            load.CoordinationSystem =
                CoordinationSystem.Global;                //set coordination system

            var model = new Model();

            model.Nodes.Add(new Node(0, 0, 0)
            {
                Label = "n0"
            });
            model.Nodes.Add(new Node(4, 0, 0)
            {
                Label = "n1"
            });

            model.Elements.Add(new BarElement(model.Nodes["n0"], model.Nodes["n1"])
            {
                Label = "e0"
            });

            model.Nodes["n0"].Constraints     =
                model.Nodes["n1"].Constraints =
                    Constraints.Fixed;

            var sec = new Sections.UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.67, 0.01, 0.006));
            var mat = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3);

            (model.Elements["e0"] as BarElement).Material = mat;

            (model.Elements["e0"] as BarElement).Section = sec;

            var u1 = load;

            model.Elements["e0"].Loads.Add(u1);

            model.Solve_MPC();

            var n1Force = model.Nodes["n1"].GetSupportReaction();

            Console.WriteLine("support reaction of n1: {0}", n1Force);
            var elm = model.Elements[0] as BarElement;

            var frc = elm.GetGlobalEquivalentNodalLoads(u1);
        }
Beispiel #2
0
        public static void Run()
        {
            var model = new Model();

            model.Nodes.Add(new Node(0, 0, 0)
            {
                Label = "n0"
            });
            model.Nodes.Add(new Node(4, 0, 0)
            {
                Label = "n1"
            });

            model.Elements.Add(new BarElement(model.Nodes["n0"], model.Nodes["n1"])
            {
                Label = "e0"
            });

            model.Nodes["n0"].Constraints     =
                model.Nodes["n1"].Constraints =
                    Constraints.Fixed;

            var sec = new Sections.UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.67, 0.01, 0.006));
            var mat = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3);

            (model.Elements["e0"] as BarElement).Material = mat;

            (model.Elements["e0"] as BarElement).Section = sec;

            var u1 = new Loads.UniformLoad(LoadCase.DefaultLoadCase, -Vector.K, 1, CoordinationSystem.Global);

            model.Elements["e0"].Loads.Add(u1);

            model.Solve_MPC();

            var n1Force = model.Nodes["n1"].GetSupportReaction();

            Console.WriteLine("support reaction of n1: {0}", n1Force);
            var elm = model.Elements[0] as BarElement;

            var frc = elm.GetExactInternalForceAt(1 - 1e-9);
        }
Beispiel #3
0
        public void Run()
        {
            var model = new Model();

            model.Nodes.Add(new Node(-10, 0, 0)
            {
                Label = "n0"
            });
            model.Nodes.Add(new Node(-10, 0, 6)
            {
                Label = "n1"
            });
            model.Nodes.Add(new Node(0, 0, 8)
            {
                Label = "n2"
            });
            model.Nodes.Add(new Node(10, 0, 6)
            {
                Label = "n3"
            });
            model.Nodes.Add(new Node(10, 0, 0)
            {
                Label = "n4"
            });

            model.Elements.Add(new BarElement(model.Nodes["n0"], model.Nodes["n1"])
            {
                Label = "e0"
            });
            model.Elements.Add(new BarElement(model.Nodes["n1"], model.Nodes["n2"])
            {
                Label = "e1"
            });
            model.Elements.Add(new BarElement(model.Nodes["n2"], model.Nodes["n3"])
            {
                Label = "e2"
            });
            model.Elements.Add(new BarElement(model.Nodes["n3"], model.Nodes["n4"])
            {
                Label = "e3"
            });


            model.Nodes["n0"].Constraints     =
                model.Nodes["n4"].Constraints =
                    Constraints.Fixed;

            var secAA = new Sections.UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.67, 0.01, 0.006));
            var secBB = new Sections.UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.52, 0.01, 0.006));
            var mat   = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3);

            (model.Elements["e0"] as BarElement).Material = mat;
            (model.Elements["e1"] as BarElement).Material = mat;
            (model.Elements["e2"] as BarElement).Material = mat;
            (model.Elements["e3"] as BarElement).Material = mat;

            (model.Elements["e0"] as BarElement).Section = secAA;
            (model.Elements["e1"] as BarElement).Section = secBB;
            (model.Elements["e2"] as BarElement).Section = secBB;
            (model.Elements["e3"] as BarElement).Section = secAA;


            var u1 = new Loads.UniformLoad(LoadCase.DefaultLoadCase, new Vector(0, 0, 1), -6000, CoordinationSystem.Global);
            var u2 = new Loads.UniformLoad(LoadCase.DefaultLoadCase, new Vector(0, 0, 1), -5000, CoordinationSystem.Local);

            model.Elements["e1"].Loads.Add(u1);
            model.Elements["e2"].Loads.Add(u2);

            model.Solve_MPC();

            var n3Force = model.Nodes["N3"].GetSupportReaction();

            Console.WriteLine("support reaction of n3: {0}", n3Force);

            {
                var x = 1.0;

                var iso = (model.Elements["e3"] as BarElement).LocalCoordsToIsoCoords(x);

                var e4Force = (model.Elements["e3"] as BarElement).GetInternalForceAt(iso[0]);
                Console.WriteLine("internal force at x={0} is {1}", x, e4Force);
            }
        }
Beispiel #4
0
        public void Run()
        {
            var model = new Model();

            //adding nodes
            model.Nodes.Add(new Node(-10, 0, 0)
            {
                Label = "n0"
            });
            model.Nodes.Add(new Node(-10, 0, 6)
            {
                Label = "n1"
            });
            model.Nodes.Add(new Node(0, 0, 8)
            {
                Label = "n2"
            });
            model.Nodes.Add(new Node(10, 0, 6)
            {
                Label = "n3"
            });
            model.Nodes.Add(new Node(10, 0, 0)
            {
                Label = "n4"
            });

            //adding elements
            model.Elements.Add(new BarElement(model.Nodes["n0"], model.Nodes["n1"])
            {
                Label = "e0"
            });
            model.Elements.Add(new BarElement(model.Nodes["n1"], model.Nodes["n2"])
            {
                Label = "e1"
            });
            model.Elements.Add(new BarElement(model.Nodes["n2"], model.Nodes["n3"])
            {
                Label = "e2"
            });
            model.Elements.Add(new BarElement(model.Nodes["n3"], model.Nodes["n4"])
            {
                Label = "e3"
            });

            //assign constraint to nodes
            model.Nodes["n0"].Constraints     =
                model.Nodes["n4"].Constraints =
                    Constraints.Fixed;

            //define sections and material
            var secAA = new Sections.UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.67, 0.01, 0.006));
            var secBB = new Sections.UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.52, 0.01, 0.006));
            var mat   = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3);

            //assign materials
            (model.Elements["e0"] as BarElement).Material = mat;
            (model.Elements["e1"] as BarElement).Material = mat;
            (model.Elements["e2"] as BarElement).Material = mat;
            (model.Elements["e3"] as BarElement).Material = mat;

            //assign sections
            (model.Elements["e0"] as BarElement).Section = secAA;
            (model.Elements["e1"] as BarElement).Section = secBB;
            (model.Elements["e2"] as BarElement).Section = secBB;
            (model.Elements["e3"] as BarElement).Section = secAA;

            //creating loads
            var u1 = new Loads.UniformLoad(LoadCase.DefaultLoadCase, new Vector(0, 0, 1), -6000, CoordinationSystem.Global);
            var u2 = new Loads.UniformLoad(LoadCase.DefaultLoadCase, new Vector(0, 0, 1), -5000, CoordinationSystem.Local);

            //assign loads
            model.Elements["e1"].Loads.Add(u1);
            model.Elements["e2"].Loads.Add(u2);

            //solve model
            model.Solve_MPC();

            //retrieve solve result
            var n0reaction = model.Nodes["N0"].GetSupportReaction();
            var n4reaction = model.Nodes["N4"].GetSupportReaction();

            Console.WriteLine("Support reaction of n0: {0}", n0reaction);
            Console.WriteLine("Support reaction of n4: {0}", n4reaction);

            var d1 = model.Nodes["N1"].GetNodalDisplacement();

            Console.WriteLine("Displacement of n1: {0}", d1);


            Controls.BarInternalForceVisualizer.VisualizeInNewWindow((model.Elements["e1"] as BarElement));

            //Controls.ModelInternalForceVisualizer.VisualizeInNewWindow(model);
        }
Beispiel #5
0
        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 Run()
        {
            var delta = 2;

            var n1 = new Node(0 * delta, 0, 0)
            {
                Constraints = Constraints.Fixed
            };
            var n2 = new Node(1 * delta, 0, 0);
            var n3 = new Node(2 * delta, 0, 0); // { Constraints = Constraints.FixedDZ  };
            var n4 = new Node(3 * delta, 0, 0); // { Constraints = Constraints.FixedDZ  };
            var n5 = new Node(4 * delta, 0, 0)
            {
                Constraints = Constraints.Fixed
            };

            var e1 = new BarElement(n1, n2);
            var e2 = new BarElement(n2, n3);
            var e3 = new BarElement(n3, n4);// { StartReleaseCondition = Constraint.MovementFixed };
            var e4 = new BarElement(n4, n5);

            var sec = new Sections.UniformGeometric1DSection(SectionGenerator.GetRectangularSection(0.05, 0.05));
            var mat = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3);

            e1.Section  = e2.Section = e3.Section = e4.Section = sec;
            e1.Material = e2.Material = e3.Material = e4.Material = mat;

            var model = new Model();

            var load = new Loads.UniformLoad(LoadCase.DefaultLoadCase, Vector.J + Vector.K, -100, CoordinationSystem.Global);

            e1.Loads.Add(load);
            e2.Loads.Add(load);
            e3.Loads.Add(load);
            e4.Loads.Add(load);

            var elms = new[] { e1, e2, e3, e4 };

            //n1.Loads.Add(new NodalLoad(new Force(0, 0, 100, 0, 0, 0)));
            //n2.Loads.Add(new NodalLoad(new Force(0, 0, 100, 0, 0, 0)));
            //n3.Loads.Add(new NodalLoad(new Force(0, 0, 100, 0, 0, 0)));
            //n4.Loads.Add(new NodalLoad(new Force(0, 0, 100, 0, 0, 0)));
            //n5.Loads.Add(new NodalLoad(new Force(0, 0, 100, 0, 0, 0)));

            model.Elements.Add(e1, e2, e3, e4);
            model.Nodes.Add(n1, n2, n3, n4, n5);

            model.Solve_MPC();

            var rnd = new Random();

            var fnc = new Func <double, double>(x =>
            {
                try
                {
                    var i = x / (delta);

                    var ii = (int)i;

                    var elm = elms[ii];


                    var x_i = (i - ii) * delta;

                    //x_i = delta - x_i;

                    x_i += rnd.NextDouble() * 1e-3;

                    if (x_i < 0)
                    {
                        x_i = 0;
                    }

                    if (x_i > delta)
                    {
                        x_i = delta;
                    }

                    var xi = elm.LocalCoordsToIsoCoords(x_i)[0];

                    var f = elm.GetExactInternalForceAt(xi);

                    return(f.Fz);
                }
                catch
                {
                    return(0);
                }
            });


            Controls.FunctionVisualizer.VisualizeInNewWindow(fnc, 1E-6, 4 * delta - 1E-6, 537);
        }
        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);
        }