BriefFiniteElementNet / BriefFiniteElement.Net

BriefFiniteElementDotNET (BFE.NET) is a library for linear-static Finite Element Method (FEM) analysis of solids and structures in .NET
GNU Lesser General Public License v3.0
154 stars 57 forks source link

GetExactInternalForcesAt() with multiple loads; Multiple loadcases with ElementalLoads - incorrect outcomes #50

Closed kkorus94 closed 4 years ago

kkorus94 commented 4 years ago

Hello,

Firstly, as this is my first post here, I would like to thank you for this project. It's a grat job and it has great potential to use.

During my work, I've detected two errors:

First - GetExactInternalForcesAt() with multiple loads. I've created a column with one fixed constraint at the "bottom node". It's loaded with two uniform loads - first of them simulates self-weight, the second one is perpendicular to the column.

            double h = 5;

            Node n1 = new Node(0, 0, 0);
            Node n2 = new Node(0, 0, h);
            n1.Constraints = Constraints.Fixed;

            var section = new UniformGeometric1DSection(SectionGenerator.GetRectangularSection(1, 0.5));
            var material = UniformIsotropicMaterial.CreateFromYoungShear(205e9, 81e9);

            BarElement e = new BarElement(n1, n2)
            {
                Section = section,
                Material = material
            };
            e.Behavior = BarElementBehaviours.FullFrame;

            var load = new UniformLoad()
            {
                Direction = Vector.FromXYZ(0, 0, -1),
                CoordinationSystem = CoordinationSystem.Global,
                Magnitude = 1
            };
            var load2 = new UniformLoad()
            {
                Direction = Vector.FromXYZ(1, 0, 0),
                CoordinationSystem = CoordinationSystem.Global,
                Magnitude = 10,
            };
            e.Loads.Add(load);
            e.Loads.Add(load2);

            Model model = new Model();
            model.Nodes.Add(n1);
            model.Nodes.Add(n2);
            model.Elements.Add(e);
            model.Solve();

Support reactions are correct, but forces at parameters seem to be reversed. if parameter -1 is a "starting parameter" of a beam, Fx at -0.99999 should be close to -5, Fz close to -50 and My close to 125. However, values of Fx are reversed - the one at -0.9999 should be the one at 0.9999 and so on.

2020-06-09_11h13_49


The second issue - Incorrect values of external forces in the case of multiple loadcases with elemental loads.

I've created a 3D structure and applied two loads to one of its bars - each load is in another load case. Loads are similar, just the amount of one is two times bigger than the other.

            double h = 5;
            double l = 10;
            double b = 2;

            Node n11 = new Node(0, 0, 0);
            Node n12 = new Node(l, 0, 0);
            Node n13 = new Node(l, 0, h);
            Node n14 = new Node(0, 0, h);

            Node n21 = new Node(0, b, 0);
            Node n22 = new Node(l, b, 0);
            Node n23 = new Node(l, b, h);
            Node n24 = new Node(0, b, h);

            List<Node> nodes = new List<Node>(){n11, n12, n13, n14, n21, n22, n23, n24};

            n11.Constraints = n12.Constraints = n21.Constraints = n22.Constraints = Constraints.MovementFixed;

            BarElement e11 = new BarElement(n11, n12);
            BarElement e12 = new BarElement(n12, n13);
            BarElement e13 = new BarElement(n13, n14);
            BarElement e14 = new BarElement(n14, n11);

            BarElement e21 = new BarElement(n21, n22);
            BarElement e22 = new BarElement(n22, n23);
            BarElement e23 = new BarElement(n23, n24);
            BarElement e24 = new BarElement(n24, n21);

            BarElement ec1 = new BarElement(n11, n21);
            BarElement ec2 = new BarElement(n12, n22);

            List<BarElement> bars = new List<BarElement>(){e11, e12, e13, e14, e21, e22, e23, e24, ec1, ec2 };

            var section = new UniformGeometric1DSection(SectionGenerator.GetRectangularSection(1, 0.5));
            var material = UniformIsotropicMaterial.CreateFromYoungShear(205e9, 81e9);

            foreach (BarElement e in bars)
            {
                e.Section = section;
                e.Material = material;
                e.Behavior = BarElementBehaviours.FullFrame;
            }

            LoadCase loadCase1 = new LoadCase("lc1", LoadType.Default);
            var load = new UniformLoad()
            {
                Direction = Vector.FromXYZ(0, 0, -1),
                CoordinationSystem = CoordinationSystem.Global,
                Magnitude = 1,
                Case = loadCase1
            };
            LoadCase loadCase2 = new LoadCase("lc2", LoadType.Default);
            var load2 = new UniformLoad()
            {
                Direction = Vector.FromXYZ(0, 0, -1),
                CoordinationSystem = CoordinationSystem.Global,
                Magnitude = 2,
                Case = loadCase2
            };
            e11.Loads.Add(load);
            e11.Loads.Add(load2);

            Model model = new Model();
            foreach(Node node in nodes) model.Nodes.Add(node);
            foreach (BarElement bar in bars) model.Elements.Add(bar);
            model.Solve();

Created structure: 2020-06-09_12h45_36

Model is solved with no errors, however, the values of bars forces are incorrect on the bars, where the loads are applied. Free of external loads bars values are correct.

2020-06-09_12h48_49

The problem doesn't appear with nodal loads.

Thank You in advance!

epsi1on commented 4 years ago

Hi, There are two issues, can you please edit your code accordingly:

        BriefFiniteElementNet.Controls.BarInternalForceVisualizer.VisualizeInNewWindow(elm);
kkorus94 commented 4 years ago

Hello, Thank You for your response.

I've just tried solving two methods (of two issues) with Model.Solve_MPC(), but the results are still the same.

These are the results of forces visualizations of the first issue:

2020-06-10_07h49_37

2020-06-10_07h49_45

2020-06-10_07h50_02

Other forces are 0. It seems that Fx is just reversed - it's the biggest on the loose, higher end of the column (and given the uniformLoad on the -z vector, it should be the biggest on the constraint, like the other forces).


The second issue: Model.Solve_MPC() doesn't change anything as well.

I've tried to get forces at more parameters on the loaded bar since the free bars' forces are correct. These are results (with two loads in two load cases, like in the code above) 2020-06-10_08h36_22

Since the magnitudes of the loads are 1 and 2 and the bar length is 10, "combined force value" is 1x10 + 2x10 = 30. It seems that the results of Fz are just combined, there is no difference between load cases. However, My value is disturbed in another way, but I don't know how.

Forces visualizations (for the loaded element e11): 2020-06-10_08h43_51 2020-06-10_08h44_03

Fz values on the chart are the same as these got by GetExactInternalForceAt - combination od two load cases. The strange thing is that values of My on the chart are other that outcomes of the method - max is about 25 and min about -12,5 - it's not corresponding to any outcome of GetExactInternalForceAt.

I've observed that the problem exists even if one of the load cases is empty (I've commented one of the loads in each case). Values of not-loaded elements are still correct, however loaded bars have still some strange values coming from nowhere. 2020-06-10_08h35_54 2020-06-10_08h35_09

Again, thank You for your quick response :). I hope that this problem can be resolved.

epsi1on commented 4 years ago

I've updated this visualizer to show internal force for specific LoadCase, can you please check with updated code? in the BarElementInternalForceVisualizer form, Exact internal force uses GetExactInternalForceAt() and Approximate uses BarElement.GetInternalForceAt() methods

kkorus94 commented 4 years ago

BarElementInternalForceVisualizer now visualizes values, that are corresponding to GetExactInternalForceAt(). Nevertheless, the values of GetExactInternalForceAt() of the loaded bars are still calculated incorrectly. As I've written - values of Fz are the sum of both loadcases and values of My are calculated in another, incorrect way. Something must be disturbing calculations on loaded bars.

2020-06-10_12h52_26

2020-06-10_12h52_33

2020-06-10_12h52_49

2020-06-10_12h52_42

2020-06-10_12h54_26

2020-06-10_12h54_33

epsi1on commented 4 years ago

Hi, Yes you are right. ExactInternalForce was calculating for sum of all load cases not a single one, code fixed like this in c80b867

    foreach (var load in this.Loads)
        if (load.Case == loadCase)//this line is added to ln#1002 of file BarElement.cs
            foreach (var helper in helpers)
kkorus94 commented 4 years ago

Hello, Yes, now it's working perfectly, thank You a lot :). Have You been thinking as well about the other issue concerning column and reversed results of forces (described in the first post in this discussion)?

epsi1on commented 4 years ago

Do you mean that moment and shear internal forces are calculated correctly, but axial internal force is calculated reversed?

kkorus94 commented 4 years ago

Yes, all values are correct, but axial forces are "reversed".

epsi1on commented 4 years ago

It should be fixed in 93e15d2. Can you please do same checks with ConcentratedLoad as well?

Thanks

epsi1on commented 4 years ago

This beam and truss internal force is nightmare. it had so many bugs, i think i had to first start documentation for this part instead of starting code. Anyways if there is a documentation for internal force of element with body loads effect, then it have worth to put them here.

kkorus94 commented 4 years ago

Now it's working correctly, with uniform and nodal loads. Thank You very much. If You want me to make any further tests with my code, just let me know in this issue ;).

epsi1on commented 4 years ago

Can you please check and see if there is same issue with ConcentratedLoad applying on a BarElement? It is possible to there be same problem (internal force being reversed) when ConcentratedLoad applied on a BarElement, like this issue that axial internal force was reversely shown.

Thanks

kkorus94 commented 4 years ago

Sorry, I thought that as a "concentrated load" You mean NodalLoad. I've never used ConcentraedLoad before. But yes, there the problem still exists. I've applied it to the column described before (node n1 with fixed constraint, n2 free, length of element: 5)

            ConcentratedLoad concentratedLoad = new ConcentratedLoad()
            {
                CoordinationSystem = CoordinationSystem.Global,
                Force = new Force(0,1,-1,0,0,0),
                ForceIsoLocation = new IsoPoint(0)
            };
            e.Loads.Add(concentratedLoad);

2020-06-17_08h33_55

So, the axial force is reversed. There are also two other issues with that:

If I try to get forces at parameter 0 (so, at the paint of concentrated load application), such an exception is thrown:

System.Exception: 'Internal force is descrete at xi = 0, thus have two values in this location. try to find internal force a little bit after or before this point'

BriefFiniteElementNet.Controls.BarInternalForceVisualizer.VisualizeInNewWindow(e); is not showing exact forces, just blank pages with no chart-lines.

epsi1on commented 4 years ago

Hi, There were some edits on code, can you please verify again with this concentrated load being reversed? As I checked with BarInternalForceVisualizer.VisualizeInNewWindow the result was not reversed neither anymore for axial force or shaft torsion. If any problem please feel free to reopen the issued. Thanks