Ejemplo n.º 1
0
        public static void ValidateOneSpanUniformLoad()
        {
            var model = new Model();

            var ndes = new Node[] {
                new Node(0, 0, 0),
                new Node(1, 0, 0),
                //new Node(2, 0, 0)
            };

            var h = 0.1;
            var w = 0.05;

            var a  = h * w;
            var iy = h * h * h * w / 12;
            var iz = w * w * w * h / 12;
            var j  = iy + iz;
            var e  = 210e9;

            var sec = new Sections.UniformParametric1DSection(a, iy, iz, j);
            var mat = UniformIsotropicMaterial.CreateFromYoungPoisson(e, 0.25);

            BarElement e1;

            model.Elements.Add(e1 = new BarElement(ndes[0], ndes[1])
            {
                Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
            });
            //model.Elements.Add(new BarElement(ndes[1], ndes[2]) { Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame });

            e1.StartReleaseCondition =
                //e1.EndReleaseCondition =
                Constraints.MovementFixed;

            var ld = new Loads.UniformLoad(LoadCase.DefaultLoadCase, Vector.K, 1000, CoordinationSystem.Global);

            var eqload = e1.GetGlobalEquivalentNodalLoads(ld);


            model.Nodes.Add(ndes);

            ndes[0].Constraints = ndes[2].Constraints = Constraints.Fixed;
            //ndes[1].Constraints = ndes[2].Constraints = Constraints.Fixed;

            //for (var i = 0; i < model.Elements.Count; i++)
            //    (model.Elements[i] as BarElement).Loads.Add();

            //ndes[1].Loads.Add(new NodalLoad(new Force(0, 1, 0, 0, 0, 0)));



            model.Solve_MPC();

            var res  = OpenseesValidator.OpenseesValidate(model, LoadCase.DefaultLoadCase, false);
            var disp = res[0];

            var idx = disp.Columns["Absolute Error"].Ordinal;

            var max = disp.Rows.Cast <DataRow>().Select(i => (double)i[idx]).Max();
        }
Ejemplo n.º 2
0
        public static void ValidateSingleInclinedFrame()
        {
            var model = new Model();
            var ndes  = new Node[] { new Node(0, 0, 0), new Node(2, 3, 5) };

            var h = 0.1;
            var w = 0.05;

            var a  = h * w;
            var iy = h * h * h * w / 12;
            var iz = w * w * w * h / 12;
            var j  = iy + iz;

            var sec = new Sections.UniformParametric1DSection(a, iy, iz, j);
            var mat = UniformIsotropicMaterial.CreateFromYoungPoisson(1, 0.25);

            var elm = new BarElement(ndes[0], ndes[1])
            {
                Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
            };

            //var elm2 = new BarElement(ndes[1], ndes[2]) { Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame };

            model.Elements.Add(elm);
            model.Nodes.Add(ndes);

            ndes[0].Constraints = Constraints.Fixed;

            ndes[1].Loads.Add(new NodalLoad(new Force(0, 1, 0, 0, 0, 0)));

            model.Solve_MPC();

            var res = OpenseesValidator.OpenseesValidate(model, LoadCase.DefaultLoadCase, false);
        }
Ejemplo n.º 3
0
        public static void testInternalForce_Console()
        {
            var model = new Model();
            var ndes  = new Node[] { new Node(0, 0, 0), new Node(3, 0, 0) };

            var h = UnitConverter.In2M(4);
            var w = UnitConverter.In2M(4);

            var e = UnitConverter.Psi2Pas(20e4);

            var a  = h * w;
            var iy = h * h * h * w / 12;
            var iz = w * w * w * h / 12;
            var j  = iy + iz;

            var sec = new Sections.UniformParametric1DSection(a = 1, iy = 1, iz = 1, j = 1);
            var mat = UniformIsotropicMaterial.CreateFromYoungPoisson(e = 1, 0.25);

            var elm = new BarElement(ndes[0], ndes[1])
            {
                Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
            };

            //var elm2 = new BarElement(ndes[1], ndes[2]) { Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame };

            model.Elements.Add(elm);
            model.Nodes.Add(ndes);

            ndes[0].Constraints = Constraints.Fixed;

            ndes[1].Loads.Add(new NodalLoad(new Force(1, 0, 1, 0, 0, 0)));

            model.Solve_MPC();

            var tr = elm.GetTransformationManager();

            var d1 = tr.TransformLocalToGlobal(elm.GetInternalDisplacementAt(1 - 1e-10, LoadCase.DefaultLoadCase));
            var d2 = ndes[1].GetNodalDisplacement(LoadCase.DefaultLoadCase);


            var frc = elm.GetInternalForceAt(-1, LoadCase.DefaultLoadCase);

            var gfrc = elm.GetTransformationManager().TransformLocalToGlobal(frc);

            var f0 = ndes[0].GetSupportReaction();
        }
Ejemplo n.º 4
0
        public static void ValidateConsoleUniformLoad()
        {
            var model = new Model();

            var ndes = new Node[] {
                new Node(0, 0, 0),
                new Node(5, 2, 3)
            };

            var h = 0.1;
            var w = 0.05;

            var a  = h * w;
            var iy = h * h * h * w / 12;
            var iz = w * w * w * h / 12;
            var j  = iy + iz;
            var e  = 210e9;

            var sec = new Sections.UniformParametric1DSection(a, iy, iz, j);
            var mat = UniformIsotropicMaterial.CreateFromYoungPoisson(e, 0.25);

            model.Elements.Add(new BarElement(ndes[0], ndes[1])
            {
                Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
            });

            model.Nodes.Add(ndes);

            ndes[0].Constraints = Constraints.Fixed;

            (model.Elements[0] as BarElement).Loads.Add(new Loads.UniformLoad(LoadCase.DefaultLoadCase, Vector.K, 1000, CoordinationSystem.Local));

            model.Solve_MPC();

            var res = OpenseesValidator.OpenseesValidate(model, LoadCase.DefaultLoadCase, false);

            var disp = res[0];

            var idx = disp.Columns["Absolute Error"].Ordinal;

            var max = disp.Rows.Cast <DataRow>().Select(i => (double)i[idx]).Max();
        }
Ejemplo n.º 5
0
        public static void ValidateEndRelease()
        {
            var model = new Model();

            var ndes = new Node[] {
                new Node(0, 0, 0),
                new Node(3, 0, 0),
                new Node(6, 0, 0),
            };

            /**/
            var h = 0.1;
            var w = 0.05;

            var a  = h * w;
            var iy = h * h * h * w / 12;
            var iz = w * w * w * h / 12;
            var j  = iy + iz;
            var e  = 210e9;
            var nu = 0.3;

            var g = e / (2 * 1 + nu);
            /**/

            var sec = new Sections.UniformParametric1DSection(a, iy, iz, j);
            var mat = UniformIsotropicMaterial.CreateFromYoungShear(e, g);

            {
                var belm = new BarElement(ndes[0], ndes[1])
                {
                    Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
                };

                belm.StartReleaseCondition =
                    Constraints.FixedDX & Constraints.FixedDY & Constraints.FixedDZ &
                    Constraints.FixedRX;

                model.Elements.Add(belm);
            }
            {
                var belm = new BarElement(ndes[1], ndes[2])
                {
                    Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
                };

                belm.EndReleaseCondition =
                    Constraints.FixedDX & Constraints.FixedDY & Constraints.FixedDZ &
                    Constraints.FixedRX;

                model.Elements.Add(belm);
            }


            model.Nodes.Add(ndes);

            ndes[0].Constraints = ndes[2].Constraints = Constraints.Fixed;

            //ndes[1].Constraints =
            //    Constraints.FixedDX & Constraints.FixedRX
            //& Constraints.FixedDY & Constraints.FixedRZ//find beam.z dofs

            ;
            //(model.Elements[0] as BarElement).Loads.Add(new Loads.UniformLoad(LoadCase.DefaultLoadCase, Vector.K, 1000, CoordinationSystem.Local));

            ndes[1].Loads.Add(new NodalLoad(new Force(Vector.K, Vector.Zero)));
            //ndes[1].Loads.Add(new NodalLoad(new Force(Vector.J * 2, Vector.Zero)));

            model.Solve_MPC();


            var d = model.Nodes[1].GetNodalDisplacement();


            var t = (model.Elements[0] as BarElement).GetInternalForceAt(1);


            var res = OpenseesValidator.OpenseesValidate(model, LoadCase.DefaultLoadCase, false);

            var disp = res[0];

            var idx = disp.Columns["Absolute Error"].Ordinal;

            var max = disp.Rows.Cast <DataRow>().Select(i => (double)i[idx]).Max();
        }
Ejemplo n.º 6
0
        public static void TestEndrelease()
        {
            var m1 = new Model();
            var m2 = new Model();

            var l = 4.0;

            var I = (0.1 * 0.1 * 0.1 * 0.1) / 12;
            var A = (0.1 * 0.1 * 0.1);
            var E = 210e9;

            var sec = new Sections.UniformParametric1DSection(A, I, I, I);
            var mat = new Materials.UniformIsotropicMaterial(E, 0.3);
            var p   = 1e3;


            //var p0 = new Point(0, 0, 0);
            //var p1 = new Point(3, 4, 5);


            {//model 1
                var el1 = new BarElement(2);
                var el2 = new BarElement(2);

                el1.Nodes[0] = new Node(0, 0, 0)
                {
                    Constraints = Constraints.Fixed, Label = "n0"
                };;
                el2.Nodes[0] = el1.Nodes[1] = new Node(l / 2, 0, 0)
                {
                    Label = "n1"
                };
                el2.Nodes[1] = new Node(l, 0, 0)
                {
                    Label = "n2"
                };

                el1.Section  = el2.Section = sec;
                el1.Material = el2.Material = mat;

                m1.Nodes.Add(el1.Nodes);
                m1.Nodes.Add(el2.Nodes[1]);

                m1.Elements.Add(el1, el2);

                m1.Nodes["n1"].Loads.Add(new NodalLoad(new Force(0, 0, p, 0, 0, 0)));

                var k = (el1 as BarElement).GetLocalStifnessMatrix();
            }

            {//model 2
                var el2 = new BarElement(3);

                el2.Nodes[0] = new Node(0, 0, 0)
                {
                    Constraints = Constraints.Fixed, Label = "n0"
                };
                el2.Nodes[1] = new Node(l / 2, 0, 0)
                {
                    Label = "n1"
                };
                el2.Nodes[2] = new Node(l, 0, 0)
                {
                    Constraints = Constraints.Fixed, Label = "n2"
                };

                el2.NodalReleaseConditions[2] = Constraints.Released;

                el2.Section  = sec;
                el2.Material = mat;

                m2.Nodes.Add(el2.Nodes);
                m2.Elements.Add(el2);

                m2.Nodes["n1"].Loads.Add(new NodalLoad(new Force(0, 0, p, 0, 0, 0)));

                var k = (el2 as BarElement).GetLocalStifnessMatrix();
            }

            m1.Solve_MPC();
            m2.Solve_MPC();

            var d1 = m1.Nodes["n1"].GetNodalDisplacement();
            var d2 = m2.Nodes["n1"].GetNodalDisplacement();
        }
Ejemplo n.º 7
0
        public static void Test3NodeBeam()
        {
            var m1 = new Model();
            var m2 = new Model();

            var l = 2.0;

            var I = 1; //(0.1 * 0.1 * 0.1 * 0.1) / 12;
            var A = 1; //(0.1 * 0.1 * 0.1);
            var E = 1; //210e9;

            var sec = new Sections.UniformParametric1DSection(A, I, I, I);
            var mat = new Materials.UniformIsotropicMaterial(E, 0.3);
            var p   = 1e3;


            //var p0 = new Point(0, 0, 0);
            //var p1 = new Point(3, 4, 5);


            {//model 1
                var el1 = new BarElement(3);

                //el1.Behavior= BarElementBehaviour.BeamZEulerBernoulli;
                el1.Nodes[0] = new Node(0, 0, 0)
                {
                    Constraints = Constraints.Fixed
                };;
                el1.Nodes[1] = new Node(l / 2, 0, 0)
                {
                    Constraints = Constraints.Released
                };
                el1.Nodes[2] = new Node(l, 0, 0)
                {
                    Constraints = Constraints.Released
                };

                el1.Section  = sec;
                el1.Material = mat;

                m1.Nodes.Add(el1.Nodes);
                m1.Elements.Add(el1);
                m1.Nodes.Last().Loads.Add(new NodalLoad(new Force(0, 0, p, 0, 0, 0)));

                var k = (el1 as BarElement).GetLocalStifnessMatrix();
            }


            {//model 2
                var el1 = new BarElement(3);

                //el1.Behavior= BarElementBehaviour.BeamZEulerBernoulli;
                el1.Nodes[0] = new Node(0, 0, 0)
                {
                    Constraints = Constraints.Fixed
                };;
                el1.Nodes[1] = new Node(l / 2, 0, 0)
                {
                    Constraints = Constraints.Released
                };
                el1.Nodes[2] = new Node(l, 0, 0)
                {
                    Constraints = Constraints.Released
                };

                el1.Section  = sec;
                el1.Material = mat;

                m1.Nodes.Add(el1.Nodes);
                m1.Elements.Add(el1);
                m1.Nodes.Last().Loads.Add(new NodalLoad(new Force(0, 0, p, 0, 0, 0)));

                var k = (el1 as BarElement).GetLocalStifnessMatrix();
            }


            m1.Solve_MPC();

            var d1 = m1.Nodes.First().GetSupportReaction();
            //var d2 = m2.Nodes.Last().GetNodalDisplacement();
        }
Ejemplo n.º 8
0
        public static void StiffnessCenterTest()
        {
            #region model
            var model = new Model();

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

            model.Nodes.Add(new Node(0, 0, 1)
            {
                Label = "n4"
            });
            model.Nodes.Add(new Node(0, 2, 1)
            {
                Label = "n5"
            });
            model.Nodes.Add(new Node(4, 2, 1)
            {
                Label = "n6"
            });
            model.Nodes.Add(new Node(4, 0, 1)
            {
                Label = "n7"
            });


            var a  = 0.1 * 0.1;                    //area, assume sections are 10cm*10cm rectangular
            var iy = 0.1 * 0.1 * 0.1 * 0.1 / 12.0; //Iy
            var iz = 0.1 * 0.1 * 0.1 * 0.1 / 12.0; //Iz
            var j  = 0.1 * 0.1 * 0.1 * 0.1 / 12.0; //Polar
            var e  = 20e9;                         //young modulus, 20 [GPa]
            var nu = 0.2;                          //poissons ratio

            var sec = new Sections.UniformParametric1DSection(a, iy, iz, j);
            var mat = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(e, nu);

            model.Elements.Add(new BarElement(model.Nodes["n0"], model.Nodes["n4"])
            {
                Label = "e0", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n1"], model.Nodes["n5"])
            {
                Label = "e1", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n2"], model.Nodes["n6"])
            {
                Label = "e2", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n3"], model.Nodes["n7"])
            {
                Label = "e3", Section = sec, Material = mat
            });

            model.Elements.Add(new BarElement(model.Nodes["n4"], model.Nodes["n5"])
            {
                Label = "e4", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n5"], model.Nodes["n6"])
            {
                Label = "e5", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n6"], model.Nodes["n7"])
            {
                Label = "e6", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n7"], model.Nodes["n4"])
            {
                Label = "e7", Section = sec, Material = mat
            });



            model.Nodes["n0"].Constraints             =
                model.Nodes["n1"].Constraints         =
                    model.Nodes["n2"].Constraints     =
                        model.Nodes["n3"].Constraints =
                            Constraints.Fixed;
            #endregion

            var rgd = new RigidElement_MPC();

            rgd.Nodes.Add(model.Nodes["n4"]);
            rgd.Nodes.Add(model.Nodes["n5"]);
            rgd.Nodes.Add(model.Nodes["n6"]);
            //rgd.Nodes.Add(model.Nodes["n7"]);



            //var eqDof = new TelepathyLink

            model.MpcElements.Add(rgd);

            var loc = new StiffnessCenterFinder().GetCenters(model, rgd, LoadCase.DefaultLoadCase);
        }
        public ValidationResult Validate()
        {
            var model = new Model();

            var ndes = new Node[] {
                new Node(0, 0, 0),
                new Node(1, 0, 0),
                new Node(2, 0, 0),
                new Node(3, 0, 0),
            };

            /**/
            var h = 0.1;
            var w = 0.05;

            var a  = h * w;
            var iy = h * h * h * w / 12;
            var iz = w * w * w * h / 12;
            var j  = iy + iz;
            var e  = 210e9;
            var nu = 0.3;

            var g = e / (2 * 1 + nu);
            /**/

            var sec = new Sections.UniformParametric1DSection(a, iy, iz, j);
            var mat = UniformIsotropicMaterial.CreateFromYoungShear(e, g);

            //bar-element -> rigid linkg -> bar element
            {
                var barElm = new BarElement(ndes[0], ndes[1])
                {
                    Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
                };
                model.Elements.Add(barElm);
            }
            {
                var rigidElm = new RigidElement_MPC();
                rigidElm.Nodes = new NodeList()
                {
                    ndes[1], ndes[2]
                };
                rigidElm.UseForAllLoads = true;
                model.MpcElements.Add(rigidElm);
            }
            {
                var barElm = new BarElement(ndes[2], ndes[3])
                {
                    Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
                };
                model.Elements.Add(barElm);
            }
            model.Nodes.Add(ndes);

            ndes[0].Constraints = Constraints.Fixed;

            ndes[3].Loads.Add(new NodalLoad(new Force(1000, 2000, 5000, 1000, 2000, 2000)));
            //ndes[1].Loads.Add(new NodalLoad(new Force(Vector.J * 2, Vector.Zero)));

            model.Solve_MPC();

            var span = new HtmlTag("span");

            span.Add("p").Text("Validation of rigid element");
            span.Add("paragraph").Text("The rigid element connects different nodes through non-deformable elements. ");
            span.Add("h3").Text("Model Definition");

            span.Add("paragraph").Text(string.Format(CultureInfo.CurrentCulture, "A linear beam of 3 meters long, with 4 nodes, 2 bar elements and 1 rigid element in-between.")).AddClosedTag("br");

            span.Add("paragraph").Text("The first node is fixed in the 3D space.").AddClosedTag("br");
            span.Add("paragraph").Text("The last node is loaded with a random load; both forces and moments.").AddClosedTag("br");
            span.Add("paragraph").Text("The rigid element should transfer all rotational DOF from the second node to the thrid. The displacements  along the beam will be trasnfered ass well, although the the displacements in the perpendicular direct will scale.").AddClosedTag("br");

            span.Add("h3").Text("Validation Result");
            span.Add("h4").Text("Nodal Displacements");
            span.Add("paragraph").Text(string.Format("Validation output for nodal displacements:"));


            var n1   = model.Nodes[1].GetNodalDisplacement();
            var n2   = model.Nodes[2].GetNodalDisplacement();
            var diff = n1 - n2;

            //linear beam with loads -> rigid elements introduces rigid body -> Y and Z (translations perpendicular to the beam) are non zero and scaled. Set to zero to avoid confusion with result.
            diff.DY = diff.DZ = 0.0;

            //span.Add("p").AddClass("bg-info").Text(string.Format("-Max ABSOLUTE Error: {0:e3}", diff));//htmltags cannot encode the delta and teta chars so will use vector length
            span.Add("p").AddClass("bg-info")
            .Text(string.Format("-Max ABSOLUTE Error: Displacement:{0:e3} , Rotation:{1:e3}",
                                diff.Displacements.Length, diff.Rotations.Length));

            var buf = new ValidationResult();

            buf.Span  = span;
            buf.Title = "Rigid element Validation";

            return(buf);
        }
        public static void ValidateConsoleUniformLoad()
        {
            var model = new Model();

            var ndes = new Node[] {
                new Node(0, 0, 0),
                new Node(3, 0, 0)
            };

            /**/
            var h = 0.1;
            var w = 0.05;

            var a  = h * w;
            var iy = h * h * h * w / 12;
            var iz = w * w * w * h / 12;
            var j  = iy + iz;
            var e  = 210e9;
            var nu = 0.3;

            var g = e / (2 * 1 + nu);
            /**/

            var sec = new Sections.UniformParametric1DSection(a, iy, iz, j);
            var mat = UniformIsotropicMaterial.CreateFromYoungShear(e, g);

            BarElement        belm;
            FrameElement2Node frmelm;

            belm = new BarElement(ndes[0], ndes[1])
            {
                Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
            };
            frmelm = new FrameElement2Node(ndes[0], ndes[1])
            {
                Iz = sec.Iz, Iy = sec.Iy, A = sec.A, J = sec.J, E = e, G = g
            };

            var bk   = belm.GetGlobalStifnessMatrix();
            var fk   = frmelm.GetGlobalStifnessMatrix();
            var diff = bk - fk;

            model.Elements.Add(belm);

            model.Nodes.Add(ndes);

            ndes[0].Constraints = Constraints.Fixed;

            //ndes[1].Constraints =
            //    Constraints.FixedDX & Constraints.FixedRX
            //& Constraints.FixedDY & Constraints.FixedRZ//find beam.z dofs

            ;
            var ul = new Loads.UniformLoad(LoadCase.DefaultLoadCase, Vector.K, 1000, CoordinationSystem.Global);

            (model.Elements[0] as BarElement).Loads.Add(ul);


            var eqv = (model.Elements[0] as BarElement).GetGlobalEquivalentNodalLoads(ul);

            //ndes[1].Loads.Add(new NodalLoad(new Force(Vector.K, Vector.Zero)));
            //ndes[1].Loads.Add(new NodalLoad(new Force(Vector.J*2, Vector.Zero)));

            model.Solve_MPC();


            var d = model.Nodes[1].GetNodalDisplacement();

            var t = (model.Elements[0] as BarElement).GetInternalForceAt(-1);


            var res = OpenseesValidator.OpenseesValidate(model, LoadCase.DefaultLoadCase, false);

            var disp = res[0];

            var idx = disp.Columns["Absolute Error"].Ordinal;

            var max = disp.Rows.Cast <DataRow>().Select(i => (double)i[idx]).Max();
        }
Ejemplo n.º 11
0
        public void Run()
        {
            var model = new Model();

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

            model.Nodes.Add(new Node(0, 0, 1)
            {
                Label = "n4"
            });
            model.Nodes.Add(new Node(0, 2, 1)
            {
                Label = "n5"
            });
            model.Nodes.Add(new Node(4, 2, 1)
            {
                Label = "n6"
            });
            model.Nodes.Add(new Node(4, 0, 1)
            {
                Label = "n7"
            });


            var a  = 0.1 * 0.1;                    //area, assume sections are 10cm*10cm rectangular
            var iy = 0.1 * 0.1 * 0.1 * 0.1 / 12.0; //Iy
            var iz = 0.1 * 0.1 * 0.1 * 0.1 / 12.0; //Iz
            var j  = 0.1 * 0.1 * 0.1 * 0.1 / 12.0; //Polar
            var e  = 20e9;                         //young modulus, 20 [GPa]
            var nu = 0.2;                          //poissons ratio

            var sec = new Sections.UniformParametric1DSection(a, iy, iz, j);
            var mat = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(e, nu);

            model.Elements.Add(new BarElement(model.Nodes["n0"], model.Nodes["n4"])
            {
                Label = "e0", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n1"], model.Nodes["n5"])
            {
                Label = "e1", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n2"], model.Nodes["n6"])
            {
                Label = "e2", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n3"], model.Nodes["n7"])
            {
                Label = "e3", Section = sec, Material = mat
            });

            model.Elements.Add(new BarElement(model.Nodes["n4"], model.Nodes["n5"])
            {
                Label = "e4", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n5"], model.Nodes["n6"])
            {
                Label = "e5", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n6"], model.Nodes["n7"])
            {
                Label = "e6", Section = sec, Material = mat
            });
            model.Elements.Add(new BarElement(model.Nodes["n7"], model.Nodes["n4"])
            {
                Label = "e7", Section = sec, Material = mat
            });



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

            var d_case  = new LoadCase("d1", LoadType.Dead);
            var l_case  = new LoadCase("l1", LoadType.Dead);
            var qx_case = new LoadCase("qx", LoadType.Dead);
            var qy_case = new LoadCase("qy", LoadType.Dead);

            var d1 = new Loads.UniformLoad(d_case, -1 * Vector.K, 2e3, CoordinationSystem.Global);
            var l1 = new Loads.UniformLoad(l_case, -1 * Vector.K, 1e3, CoordinationSystem.Global);



            model.Elements["e4"].Loads.Add(d1);
            model.Elements["e5"].Loads.Add(d1);
            model.Elements["e6"].Loads.Add(d1);
            model.Elements["e7"].Loads.Add(d1);

            model.Elements["e4"].Loads.Add(l1);
            model.Elements["e5"].Loads.Add(l1);
            model.Elements["e6"].Loads.Add(l1);
            model.Elements["e7"].Loads.Add(l1);

            var qx_f = new Force(5000 * Vector.I, Vector.Zero);
            var qy_f = new Force(10000 * Vector.J, Vector.Zero);

            model.Nodes["n4"].Loads.Add(new NodalLoad(qx_f, qx_case));
            model.Nodes["n4"].Loads.Add(new NodalLoad(qy_f, qy_case));

            model.Solve_MPC();



            var combination1 = new LoadCombination();// for D + 0.8 L

            combination1[d_case] = 1.0;
            combination1[l_case] = 0.8;

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

            Console.WriteLine("support reaction of n3: " + n3Force);

            var e1 = (model.Elements["e1"] as BarElement);

            var e1Force = (model.Elements["e1"] as BarElement).GetInternalForceAt(0);

            Console.WriteLine("internal force of e1 at middle : ", e1Force);
        }
        public static void Run()
        {
            var model = new Model();

            var l = 5;

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


            var axialLoad      = 1000;
            var horizontalLoad = 1000;

            var f = new Force(horizontalLoad, 0, axialLoad, 0, 0, 0);

            /**/
            var h = 0.1;
            var w = 0.05;

            var a  = h * w;
            var iy = h * h * h * w / 12;
            var iz = w * w * w * h / 12;
            var j  = iy + iz;
            var e  = 210e9;
            var nu = 0.3;

            var g = e / (2 * 1 + nu);
            /**/

            var sec = new Sections.UniformParametric1DSection(a, iy, iz, j);
            var mat = UniformIsotropicMaterial.CreateFromYoungShear(e, g);

            var belm = new BarElement(n1, n2)
            {
                Material = mat, Section = sec, Behavior = BarElementBehaviours.FullFrame
            };

            model.Elements.Add(belm);
            model.Nodes.Add(n1, n2);

            n1.Constraints = Constraints.Fixed;

            n2.Loads.Add(new NodalLoad(f));


            model.Solve_MPC();

            var d = model.Nodes[1].GetNodalDisplacement();

            var expectedDx = (horizontalLoad * l * l * l) / (3 * e * iy);
            var expectedRy = (horizontalLoad * l * l) / (2 * e * iy);
            var expectedDz = axialLoad * l / (e * a);

            var epsilon = 0.0;

            if (Math.Abs(d.DX - expectedDx) > epsilon)
            {
                throw new NotImplementedException();
            }
            if (Math.Abs(d.RY - expectedRy) > epsilon)
            {
                throw new NotImplementedException();
            }
            if (Math.Abs(d.DZ - expectedDz) > epsilon)
            {
                throw new NotImplementedException();
            }
        }