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

Shell elements not positive definite exception #29

Closed rubsy92 closed 4 years ago

rubsy92 commented 4 years ago

Hi, I'm trying to test the shell elements, but each time I run an analysis I get the "not positive definite" exception. I noticed that you always constrain all nodes in your examples, what's the reason for that? Correct me if I'm wrong but I would assume that you don't get any displacement when you constrain everything?

epsi1on commented 4 years ago

Constraining a node means set Node.Constraints = Constraints.Fixed. If set all nodes are constrainted as fix then there is no nodal displacement at all. Yes you are right.

The reason you do get not pos def error, is that there is at least a DoF on a node that is not fixed to ground nor connected to any element.

Which shell element you are using?

rubsy92 commented 4 years ago

I used the full shell implementation (so all 3 components). I noticed that it does calculate when I change the solver type to ConjugateGradient (which you commented out in the code)... But there I noticed that the displacements are not correct (with a factor of my shell thickness). I'll try to look into it this weekend.

epsi1on commented 4 years ago

You mean use TriangleElement with behavior of FullThinShell? if you was not able to fix it, then pls serialize your model or a model with same error and send it here to check it out...,

rubsy92 commented 4 years ago

Hi,

I used "TriangleElement" as the element type and " triElm.Behavior = TriangleElementBehaviours.Shell;" as the behaviour. The steps I took:

########CODE####### MAIN METHOD: var nx = 6; var ny = 6; var nz = 1; var grd = StructureGenerator.Generate3DTriangleElementGridTest(nx, ny, nz); model = grd; grd.Solve_MPC();

METHOD FOR MODEL: public static Model Generate3DTriangleElementGridTest(int m, int n, int l) { var buf = new Model();

        var dx = 0.15;
        var dy = 0.15;
        var dz = 0.15;

        var nodes = new Node[m, n, l];

        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j < n; j++)
            {
                for (int k = 0; k < l; k++)
                {
                    var pos = new Point(j * dx, i * dy, k * dz);
                    var nde = new Node() { Location = pos };
                    buf.Nodes.Add(nde);
                    nodes[i, j, k] = nde;
                }
            }
        }

        //elements parallel to XZ
        for (int j = 0; j < n; j++)
        {
            for (int i = 0; i < m - 1; i++)
            {
                for (int k = 0; k < l - 1; k++)
                {
                    {
                        var elm2 = new TriangleElement();
                        elm2.Nodes[0] = nodes[i, j, k];
                        elm2.Nodes[1] = nodes[i, j, k + 1];
                        elm2.Nodes[2] = nodes[i + 1, j, k];

                        buf.Elements.Add(elm2);
                    }

                    {
                        var elm2 = new TriangleElement();
                        elm2.Nodes[0] = nodes[i + 1, j, k + 1];
                        elm2.Nodes[1] = nodes[i, j, k + 1];
                        elm2.Nodes[2] = nodes[i + 1, j, k];

                        buf.Elements.Add(elm2);
                    }

                }
            }
        }

        //elements parallel to YZ
        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j < n - 1; j++)
            {
                for (int k = 0; k < l - 1; k++)
                {
                    {
                        var elm2 = new TriangleElement();
                        elm2.Nodes[0] = nodes[i, j, k];
                        elm2.Nodes[1] = nodes[i, j, k + 1];
                        elm2.Nodes[2] = nodes[i, j + 1, k];

                        buf.Elements.Add(elm2);
                    }

                    {
                        var elm2 = new TriangleElement();
                        elm2.Nodes[0] = nodes[i, j + 1, k + 1];
                        elm2.Nodes[1] = nodes[i, j, k + 1];
                        elm2.Nodes[2] = nodes[i, j + 1, k];

                        buf.Elements.Add(elm2);
                    }

                }
            }
        }

        //elements parallel to XY
        for (int k = 0; k < l; k++)
        {
            for (int j = 0; j < n - 1; j++)
            {
                for (int i = 0; i < m - 1; i++)
                {
                    {
                        var elm2 = new TriangleElement();
                        elm2.Nodes[0] = nodes[i, j, k];
                        elm2.Nodes[1] = nodes[i + 1, j, k];
                        elm2.Nodes[2] = nodes[i, j + 1, k];

                        buf.Elements.Add(elm2);
                    }

                    {
                        var elm2 = new TriangleElement();
                        elm2.Nodes[0] = nodes[i + 1, j + 1, k];
                        elm2.Nodes[1] = nodes[i + 1, j, k];
                        elm2.Nodes[2] = nodes[i, j + 1, k];

                        buf.Elements.Add(elm2);
                    }

                }
            }
        }

        foreach (var elm in buf.Elements)
        {
            var triElm = elm as TriangleElement;

            if (triElm == null)
                continue;

            triElm.Behavior = TriangleElementBehaviours.Shell;

            var h = 0.03;
            var w = 0.003;

            var e = 210e9;
            var nu = 0.3;

            var sec = (Sections.UniformParametric2DSection)(triElm.Section = new Sections.UniformParametric2DSection());

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

            sec.T = 0.003;

        }

        for (int i = 0; i < m; i++)
        {

                nodes[i, 0, 0].Constraints = Constraint.Fixed;

        }
        for (int i = 0; i < m; i++)
        {
            nodes[i, n-1, 0].Loads.Add(new NodalLoad(new Force(1500,0,0,0,0,0), LoadCase.DefaultLoadCase));
        }
        return buf;
    }
epsi1on commented 4 years ago

Thanks for details, Let me check and investigate the code

epsi1on commented 4 years ago

there is a minor problem in DKT code, which is fixed, (forgot to put Math.Abs() around jacobian determinant!) Code is updated, and your code should not give that error anymore. Also thanks for reporting the bug! cheers