BriefFiniteElementNet / BriefFiniteElement.Net

BriefFiniteElementDotNET (BFE.NET) is a library for linear-static Finite Element Method (FEM) analysis of solids and structures in .NET
https://www.bfe-framework.net
GNU Lesser General Public License v3.0
153 stars 58 forks source link

Elastic Release #170

Closed joc74pt closed 1 year ago

joc74pt commented 1 year ago

Hello,

To represent trusses I need to use elements in which the connections to the start and end node are not just Fixed or Released, but in which I can specify elasticity coefficients (in kN/m and kN*m/rad). Something like this is done in Robot in https://help.autodesk.com/view/RSAPRO/2024/ENU/?guid=GUID-51A66BF1-E966-4BD6-B4C0-E3E68FA8CCF4

Is there any way for me to model my structure using BriefFiniteElement.Net?

Best Regards

epsi1on commented 1 year ago

Hello, Not sure how does the robot works with elastic coef, but if your model is linear, the i think BFE can model your truss Have you checked the examples? (pls have a look at this link). Or if you give a brief example of what you are trying to model, then it would be easier to

joc74pt commented 1 year ago

Thanks for the quick response. I saw the examples and took a look at the entire project, which seemed excellent and very well designed. That's why I would like to use it.

My frames are analyzed in 2D.

The standards indicate that I have to model the connections with metal plates using semi-rigid connections.

An example of use would be something like the following ` var model = new Model();

        //adding nodes
        model.Nodes.Add(new Node(1.450999, 0, 0.056000) { Label = "n1" });
        model.Nodes.Add(new Node(1.4920985, 0, 0.056000) { Label = "n2" });
        model.Nodes.Add(new Node(1.4920985, 0, 0.057000) { Label = "n3" });
        model.Nodes.Add(new Node(1.4098990, 0, 0.056000) { Label = "n4" });
        model.Nodes.Add(new Node(1.4098990, 0, 0.056600) { Label = "n5" });
        model.Nodes.Add(new Node(0.0005000, 0, 0.056000) { Label = "n6" });
        model.Nodes.Add(new Node(2.9014995, 0, 0.056000) { Label = "n7" });
        model.Nodes.Add(new Node(1.4509490, 0, 0.056000) { Label = "n8" });
        model.Nodes.Add(new Node(1.4510490, 0, 0.056000) { Label = "n9" });

        //adding virtual elements
        model.Elements.Add(new BarElement(model.Nodes["n2"], model.Nodes["n3"]) { Label = "ev1"});
        model.Elements.Add(new BarElement(model.Nodes["n3"], model.Nodes["n1"]) { Label = "ev2"});
        model.Elements.Add(new BarElement(model.Nodes["n4"], model.Nodes["n5"]) { Label = "ev3" });
        model.Elements.Add(new BarElement(model.Nodes["n5"], model.Nodes["n1"]) { Label = "ev4" });

        model.Elements.Add(new BarElement(model.Nodes["n6"], model.Nodes["n4"]) { Label = "et5" });
        model.Elements.Add(new BarElement(model.Nodes["n4"], model.Nodes["n8"]) { Label = "et6" });
        model.Elements.Add(new BarElement(model.Nodes["n9"], model.Nodes["n2"]) { Label = "et7" });
        model.Elements.Add(new BarElement(model.Nodes["n2"], model.Nodes["n7"]) { Label = "et8" });
        //assign constraint to nodes
        model.Nodes["n6"].Constraints = Constraints.Fixed;
        model.Nodes["n7"].Constraints = new Constraint(DofConstraint.Released, DofConstraint.Fixed, DofConstraint.Fixed, DofConstraint.Fixed, DofConstraint.Fixed, DofConstraint.Fixed);

        //define sections and material
        var secVirtual = new Sections.UniformGeometric1DSection(SectionGenerator.GetRectangularSection(0.4, 0.4));
        var secC24 = new Sections.UniformGeometric1DSection(SectionGenerator.GetRectangularSection(0.10976, 0.03528));

        var matVirtual = Materials.UniformIsotropicMaterial.CreateFromShearPoisson(11000000, 0.3);
        var matC24 = Materials.UniformIsotropicMaterial.CreateFromShearPoisson(9000000, 0.3);

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

        //assign materials, sections and load
        foreach (var bar in model.Elements.OfType<BarElement>())
        {
            if (bar.Label.StartsWith("ev"))
            {
                bar.Material = matVirtual;
                bar.Section = secVirtual;
            }
            else if (bar.Label.StartsWith("et"))
            {
                bar.Material = matC24;
                bar.Section = secC24;
                bar.Loads.Add(u1);
            }
        }

        // *** This is what's missing: be able to indicate an elastic release instead of just Constraint.Release or Constraint.Fixed
        // something like this
        (model.Elements["ev1"] as BarElement).EndReleaseCondition = new ElasticRelease(214272.2724408010, 214272.2724408010, 301.4092017627);
        (model.Elements["ev3"] as BarElement).EndReleaseCondition = new ElasticRelease(214273.4719999990, 214273.4719999990, 301.4163000576);

        //solve model
        model.Solve_MPC();

        //retrieve solve result
        var n6reaction = model.Nodes["n6"].GetSupportReaction();
        var n7reaction = model.Nodes["n7"].GetSupportReaction();

        Console.WriteLine("Support reaction of n6: {0}", n6reaction);
        Console.WriteLine("Support reaction of n7: {0}", n7reaction);

`

joc74pt commented 1 year ago

Elements ev1 and ev3 have a connection to the end node with springs image

epsi1on commented 1 year ago

Elements ev1 and ev3 have a connection to the end node with springs image

for this type of connection, I think you could use two nodes in same location plus ParametricSpring. in above image there would be 3 nodes, n1, n2 and n3. location of n1 is x=0, location of n2 and n3 is x=Le (both have same location. The bar element is connected to n1 and n2, also a ParametricSpring element is connected from n2 to n3. n1 and n3 are both fixed to ground but n2 is released. you need to set stiffness parameters of Kx and Ky and Kr to the ParametricSpring element, E,I and A to the BarElement. in other word you can use a BarElement plus a ParametricSpring in order to model the element in your image.

joc74pt commented 1 year ago

I did as you suggested. But it is giving the following exception "System.Exception: 'Matrix must be symmetric positive definite.'"

I send you below my code:

` var model = new Model();

        //adding nodes
        model.Nodes.Add(new Node(1.450999, 0, 0.056000) { Label = "n1" });
        model.Nodes.Add(new Node(1.4920985, 0, 0.056000) { Label = "n2" });
        model.Nodes.Add(new Node(1.4920985, 0, 0.057000) { Label = "n3" });
        model.Nodes.Add(new Node(1.4920985, 0, 0.057000) { Label = "n3a" });
        model.Nodes.Add(new Node(1.4098990, 0, 0.056000) { Label = "n4" });
        model.Nodes.Add(new Node(1.4098990, 0, 0.056600) { Label = "n5" });
        model.Nodes.Add(new Node(1.4098990, 0, 0.056600) { Label = "n5a" });
        model.Nodes.Add(new Node(0.0005000, 0, 0.056000) { Label = "n6" });
        model.Nodes.Add(new Node(2.9014995, 0, 0.056000) { Label = "n7" });
        model.Nodes.Add(new Node(1.4509490, 0, 0.056000) { Label = "n8" });
        model.Nodes.Add(new Node(1.4510490, 0, 0.056000) { Label = "n9" });

        //adding virtual elements
        model.Elements.Add(new BarElement(model.Nodes["n2"], model.Nodes["n3"]) { Label = "ev1" });
        model.Elements.Add(new ParametricSpring(model.Nodes["n3"], model.Nodes["n3a"]) { Label = "sev1", KDx = 214272.2724408010, KDz = 214272.2724408010, KRy = 301.4092017627 });
        model.Elements.Add(new BarElement(model.Nodes["n3a"], model.Nodes["n1"]) { Label = "ev2" });
        model.Elements.Add(new BarElement(model.Nodes["n4"], model.Nodes["n5"]) { Label = "ev3" });
        model.Elements.Add(new ParametricSpring(model.Nodes["n5"], model.Nodes["n5a"]) { Label = "sev3", KDx = 214272.2724408010, KDz = 214272.2724408010, KRy = 301.4092017627 });
        model.Elements.Add(new BarElement(model.Nodes["n5a"], model.Nodes["n1"]) { Label = "ev4" });

        model.Elements.Add(new BarElement(model.Nodes["n6"], model.Nodes["n4"]) { Label = "et5" });
        model.Elements.Add(new BarElement(model.Nodes["n4"], model.Nodes["n8"]) { Label = "et6" });
        model.Elements.Add(new BarElement(model.Nodes["n9"], model.Nodes["n2"]) { Label = "et7" });
        model.Elements.Add(new BarElement(model.Nodes["n2"], model.Nodes["n7"]) { Label = "et8" });
        //assign constraint to nodes
        model.Nodes["n6"].Constraints = Constraints.Fixed;
        model.Nodes["n7"].Constraints = new Constraint(DofConstraint.Released, DofConstraint.Fixed, DofConstraint.Fixed, DofConstraint.Fixed, DofConstraint.Fixed, DofConstraint.Fixed);

        //define sections and material
        var secVirtual = new Sections.UniformGeometric1DSection(SectionGenerator.GetRectangularSection(0.4, 0.4));
        var secC24 = new Sections.UniformGeometric1DSection(SectionGenerator.GetRectangularSection(0.10976, 0.03528));

        var matVirtual = Materials.UniformIsotropicMaterial.CreateFromShearPoisson(11000000, 0.3);
        var matC24 = Materials.UniformIsotropicMaterial.CreateFromShearPoisson(9000000, 0.3);

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

        //assign materials, sections and load
        foreach (var bar in model.Elements.OfType<BarElement>())
        {
            if (bar.Label.StartsWith("ev"))
            {
                bar.Material = matVirtual;
                bar.Section = secVirtual;
            }
            else if (bar.Label.StartsWith("et"))
            {
                bar.Material = matC24;
                bar.Section = secC24;
                bar.Loads.Add(u1);
            }
        }

        //solve model
        model.Solve_MPC();

        //retrieve solve result
        var n6reaction = model.Nodes["n6"].GetSupportReaction();
        var n7reaction = model.Nodes["n7"].GetSupportReaction();

        Console.WriteLine("Support reaction of n6: {0}", n6reaction);
        Console.WriteLine("Support reaction of n7: {0}", n7reaction);

`

epsi1on commented 1 year ago

could you please simplify your model to a single BarElement and single Spring element and check if the exception still exists? Also check this link for the how to fix not pos def error: How to fix Not Pos Def

joc74pt commented 1 year ago

With one single Spring element it works. But it throws an exception if I put two Spring elements. I did as indicated in the link, but no info is returned to help me know what is the problem

` var model = new Model();

        //adding nodes
        model.Nodes.Add(new Node(1.5, 0, 0.057000) { Label = "n1" });
        model.Nodes.Add(new Node(1.5, 0, 0.057000) { Label = "n2" });
        model.Nodes.Add(new Node(2.0, 0, 0.057000) { Label = "n3" });
        model.Nodes.Add(new Node(2.0, 0, 0.057000) { Label = "n4" });
        //adding virtual elements
        model.Elements.Add(new ParametricSpring(model.Nodes["n1"], model.Nodes["n2"]) { Label = "e1", KDx = 214272.2724408010, KDz = 214272.2724408010, KRy = 301.4092017627 });
        model.Elements.Add(new BarElement(model.Nodes["n2"], model.Nodes["n3"]) { Label = "e2" });
        model.Elements.Add(new ParametricSpring(model.Nodes["n3"], model.Nodes["n4"]) { Label = "e3", KDx = 214272.2724408010, KDz = 214272.2724408010, KRy = 301.4092017627 });
        //assign constraint to nodes
        model.Nodes["n1"].Constraints = Constraints.Fixed;
        model.Nodes["n4"].Constraints = new Constraint(DofConstraint.Released, DofConstraint.Fixed, DofConstraint.Fixed, DofConstraint.Fixed, DofConstraint.Fixed, DofConstraint.Fixed);

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

        //assign materials, sections and load
        ((BarElement)model.Elements["e2"]).Material = Materials.UniformIsotropicMaterial.CreateFromShearPoisson(11000000, 0.3);
        ((BarElement)model.Elements["e2"]).Section = new Sections.UniformGeometric1DSection(SectionGenerator.GetRectangularSection(0.4, 0.4));
        ((BarElement)model.Elements["e2"]).Loads.Add(u1);

        model.Trace.Listeners.Add(new ConsoleTraceListener());
        PosdefChecker.CheckModel_mpc(model, LoadCase.DefaultLoadCase);

        //solve model
        model.Solve_MPC();

        //retrieve solve result
        var n1reaction = model.Nodes["n1"].GetSupportReaction();
        var n4reaction = model.Nodes["n4"].GetSupportReaction();

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

`

epsi1on commented 1 year ago

From the code I can tell you the BarElement can freely rotate around X axis (torsion). that is at least one problem

joc74pt commented 1 year ago

I've managed to run without errors. I will now do tests and compare results. Thanks a lot for the help.