コード例 #1
0
        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);
        }
コード例 #2
0
        public static void Test1()
        {
            var model = new Model();

            Node n1, n2;

            model.Nodes.Add(n1 = new Node(0, 0, 0)
            {
                Constraints = Constraints.Fixed
            });
            model.Nodes.Add(n2 = new Node(1, 0, 0)
            {
                Constraints = Constraints.Fixed
            });

            var elm = new BarElement(n1, n2);

            elm.Section  = new BriefFiniteElementNet.Sections.UniformParametric1DSection(a: 0.01, iy: 0.01, iz: 0.01, j: 0.01);
            elm.Material = BriefFiniteElementNet.Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3);

            var load = new Loads.UniformLoad();

            load.Case = LoadCase.DefaultLoadCase;
            load.CoordinationSystem = CoordinationSystem.Global;
            load.Direction          = Vector.K;
            load.Magnitude          = 10;

            elm.Loads.Add(load);
            model.Elements.Add(elm);

            model.Solve_MPC();

            var f1 = elm.GetInternalForceAt(0);
            var f2 = elm.GetExactInternalForceAt(0);
        }
コード例 #3
0
        public static void Run()
        {
            var model = new Model();

            var l = 5.0;

            var n1 = new Node()
            {
                Constraints = Constraints.Fixed
            };
            var n2 = new Node(l, 0, 0)
            {
                Constraints = Constraints.Fixed
            };

            var elm = new BarElement();

            elm.Material = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.25);
            elm.Section  = new Sections.UniformGeometric1DSection(SectionGenerator.GetRectangularSection(0.05, 0.05));

            elm.Nodes[0] = n1;
            elm.Nodes[1] = n2;

            // elm.EndReleaseCondition = Constraints.RotationFixed;

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

            //var load2 = new Loads.ConcentratedLoad();// LoadCase.DefaultLoadCase, Vector.K, -100, CoordinationSystem.Global);
            //l/oad2.Force = new Force(0, 100, 100, 0, 0, 0);
            //load2.ForceIsoLocation = new IsoPoint(0.5, 0, 0);

            elm.Loads.Add(load);

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

            model.Solve_MPC();

            var fnc = new Func <double, double>(x =>
            {
                try
                {
                    var xi  = elm.LocalCoordsToIsoCoords(x);
                    var frc = elm.GetExactInternalForceAt(xi[0]);
                    return(frc.Fz);
                }
                catch
                {
                    return(0);
                }
            });

            Controls.FunctionVisualizer.VisualizeInNewWindow(fnc, 1E-6, l - 1E-6, 500);
        }
コード例 #4
0
        public static void SimplySupportedBeamUDL()
        {
            var model = new BriefFiniteElementNet.Model();

            var pin = new Constraint(
                dx: DofConstraint.Fixed, dy: DofConstraint.Fixed, dz: DofConstraint.Fixed,
                rx: DofConstraint.Fixed, ry: DofConstraint.Released, rz: DofConstraint.Released);

            Node n1, n2;

            model.Nodes.Add(n1 = new Node(x: 0.0, y: 0.0, z: 0.0)
            {
                Constraints = pin
            });
            model.Nodes.Add(n2 = new Node(x: 10.0, y: 0.0, z: 0.0)
            {
                Constraints = pin
            });

            var elm1 = new BarElement(n1, n2);

            model.Elements.Add(elm1);

            double       height   = 0.200;
            double       width    = 0.050;
            double       E        = 7900;
            var          section  = new UniformGeometric1DSection(SectionGenerator.GetRectangularSection(height, width));
            BaseMaterial material = UniformIsotropicMaterial.CreateFromYoungPoisson(E, 1);

            elm1.Section  = section;
            elm1.Material = material;

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

            elm1.Loads.Add(u1);

            model.Solve_MPC();

            double x;
            Force  reaction1 = n1.GetSupportReaction();

            x = reaction1.Fz;                                             //15000 = 3*10000/2 -> correct
            x = reaction1.My;                                             // 0 -> correct

            Force f1_internal = elm1.GetExactInternalForceAt(-1 + 1e-10); //-1 is start

            x = f1_internal.Fz;
            x = f1_internal.My;

            var delta = elm1.GetInternalDisplacementAt(0);
        }
コード例 #5
0
        public static void SingleSpanBeamWithOverhang()
        {
            var model = new BriefFiniteElementNet.Model();

            var pin = new Constraint(dx: DofConstraint.Fixed, dy: DofConstraint.Fixed, dz: DofConstraint.Fixed, rx: DofConstraint.Fixed, ry: DofConstraint.Fixed, rz: DofConstraint.Released);

            Node n1, n2;

            model.Nodes.Add(n1 = new Node(x: 0.0, y: 0.0, z: 0.0)
            {
                Constraints = pin
            });
            model.Nodes.Add(n2 = new Node(x: 10.0, y: 0.0, z: 0.0)
            {
                Constraints = pin
            });

            var elm1 = new BarElement(n1, n2);

            model.Elements.Add(elm1);

            elm1.Section  = new BriefFiniteElementNet.Sections.UniformParametric1DSection(a: 0.01, iy: 8.3e-6, iz: 8.3e-6, j: 16.6e-6); //section's second area moments Iy and Iz = 8.3*10^-6, area = 0.01
            elm1.Material = BriefFiniteElementNet.Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(210e9, 0.3);                //Elastic mudule is 210e9 and poisson ratio is 0.3

            var frc = new Force();

            frc.Fz = 1000;// 1kN force in Z direction

            var elementLoad = new BriefFiniteElementNet.Loads.ConcentratedLoad();

            elementLoad.CoordinationSystem = CoordinationSystem.Local;
            elementLoad.Force            = frc;
            elementLoad.ForceIsoLocation = new IsoPoint(0);

            //frc, 5, CoordinationSystem.Local);
            elm1.Loads.Add(elementLoad); //is this possible?

            model.Solve_MPC();           //crashes here


            var val = elm1.GetExactInternalForceAt(-0.25);

            var d2 = n2.GetNodalDisplacement();
        }
コード例 #6
0
        static public void Run3()
        {
            // 2 x 20m spans with elements of 1m length
            // Test of running model with 4 loadcases - 2 with vertical loads and 2 with settlements
            // It can be seen that results for loadCase3 are only correct if it uses the DefaultLoadCase

            List <Node>       nodeList    = new List <Node>();
            List <BarElement> elementList = new List <BarElement>();

            var model = new BriefFiniteElementNet.Model();

            for (double n = 0; n <= 40; n = n + 1)
            {
                nodeList.Add(new Node(x: n, y: 0.0, z: 0.0)
                {
                    Label = "N" + n
                });
            }

            nodeList[0].Constraints  = Constraints.MovementFixed & Constraints.FixedRX;           // Constraints.FixedDX & Constraints.FixedDY & Constraints.FixedDZ & Constraints.FixedRY & Constraints.FixedRZ;
            nodeList[20].Constraints = Constraints.FixedDZ & Constraints.FixedDY;                 // z = vertical
            nodeList[nodeList.Count - 1].Constraints = Constraints.FixedDZ & Constraints.FixedDY; // z = vertical

            model.Nodes.AddRange(nodeList);

            model.Trace.Listeners.Add(new ConsoleTraceListener());

            List <LoadCase> loadCases = new List <LoadCase>();

            LoadCase loadCase1 = new LoadCase("L1", LoadType.Dead);
            LoadCase loadCase2 = new LoadCase("L2", LoadType.Dead);
            LoadCase loadCase3 = new LoadCase("L3", LoadType.Other);  // using LoadCase.DefaultLoadCase gives correct loadCase3 results
            LoadCase loadCase4 = new LoadCase("L4", LoadType.Other);

            loadCases.Add(loadCase1);
            loadCases.Add(loadCase2);
            loadCases.Add(loadCase3);
            loadCases.Add(loadCase4);

            var load1 = new BriefFiniteElementNet.Loads.UniformLoad(loadCase1, new Vector(0, 0, 1), -6000, CoordinationSystem.Global); // Load in N/m
            var load2 = new BriefFiniteElementNet.Loads.UniformLoad(loadCase2, new Vector(0, 0, 1), -6000, CoordinationSystem.Global); // Load in N/m

            var a     = 0.1;                                                                                                           // m²
            var iy    = 0.008333;                                                                                                      // m4
            var iz    = 8.333e-5;                                                                                                      // m4
            var j     = 0.1 * 0.1 * 0.1 * 1 / 12.0;                                                                                    // m4
            var e     = 205e9;                                                                                                         // N/m²
            var nu    = 0.3;                                                                                                           // Poisson's ratio
            var secAA = new BriefFiniteElementNet.Sections.UniformParametric1DSection(a, iy, iz, j);

            var mat = BriefFiniteElementNet.Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(e, nu);

            for (int m = 0; m < 40; m++)
            {
                BarElement el = new BarElement(nodeList[m], nodeList[m + 1]);
                el.Section  = secAA;
                el.Material = mat;
                el.Loads.Add(load1);
                el.Loads.Add(load2);
                elementList.Add(el);
            }

            model.Elements.Add(elementList.ToArray());

            model.Nodes[20].Settlements.Add(new Settlement(loadCase3, new Displacement(0, 0, -0.010, 0, 0, 0)));  // -10mm settlement
            model.Nodes[20].Settlements.Add(new Settlement(loadCase4, new Displacement(0, 0, -0.010, 0, 0, 0)));  // +10mm settlement

            foreach (LoadCase loadCase in loadCases)
            {
                model.Solve_MPC(loadCase);
            }

            //model.Solve_MPC(loadCase1,loadCase2,loadCase3,loadCase4);

            BarElement elem = (BarElement)model.Elements[9];

            for (int load = 0; load < loadCases.Count; load++)
            {
                //BarElement elem = (BarElement)model.Elements[9];
                // For settlement loadcases GetExactInternalForce does not return the correct results

                Force f = (load < 2) ?
                          elem.GetExactInternalForceAt(+0.999999, loadCases[load]) :
                          elem.GetInternalForceAt(+0.999999, loadCases[load]);

                Console.WriteLine("Element 10 BMyy is {0:0.000} kNm at end", f.My / 1000);
            }

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


            var c1 = elem.GetInternalForceAt(+0.999999, loadCase3);
            var c2 = elem.GetInternalForceAt(+0.999999, loadCase4);

            // Results: Element 10 BMyy is -149.500 kNm at end (correct)
            //          Element 10 BMyy is -149.500 kNm at end (correct)
            //          Element 10 BMyy is 0.000 kNm at end (incorrect, should be -64.060)
            //          Element 10 BMyy is 64.060 kNm at end (correct)
        }