Exemple #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();
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public static ValidationResult TestFixedEndMoment_uniformLoad()
        {
            var buff = new ValidationResult();

            buff.Title = "Test #1 for UniformLoad on BarElement";
            buff.Span.Add("p").Text("endforce from uniformload should be statically in equiblirium with uniform load");


            var elm = new BarElement(new Node(0, 0, 0), new Node(8.66, 0, 5));

            elm.Behavior = BarElementBehaviours.FullFrame;

            var ld = new Loads.UniformLoad();

            ld.Magnitude          = 1;//*Math.Sqrt(2);
            ld.Direction          = Vector.K;
            ld.CoordinationSystem = CoordinationSystem.Global;
            elm.Loads.Add(ld);

            var loads = elm.GetGlobalEquivalentNodalLoads(ld);

            {//test 1 : static balance
                var l = (elm.Nodes[1].Location - elm.Nodes[0].Location);

                var totEndForces = new Force();

                for (int i = 0; i < loads.Length; i++)
                {
                    totEndForces += loads[i].Move(elm.Nodes[i].Location, elm.Nodes[0].Location);
                }

                var d = l / 2;

                var gDir = ld.Direction;

                if (ld.CoordinationSystem == CoordinationSystem.Local)
                {
                    gDir = elm.GetTransformationManager().TransformLocalToGlobal(ld.Direction);
                }

                var cos = (1 / (d.Length * gDir.Length)) * Vector.Dot(d, gDir);

                var f_mid = gDir * ld.Magnitude * (l.Length);//uniform load as concentrated load at middle
                var m     = Vector.Cross(d, f_mid);

                var expectedForce = new Force(f_mid, m);
                var zero          = totEndForces - expectedForce;

                buff.ValidationFailed = !zero.Forces.Length.FEquals(0, epsilon) || !zero.Moments.Length.FEquals(0, epsilon);
            }


            return(buff);
        }
        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);
        }