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
148 stars 57 forks source link

Matrix must be symmetric positive definite #121

Closed Sullivanecidi closed 2 years ago

Sullivanecidi commented 2 years ago

When I executed the code below, an error says: Matrix must be symmetric positive definite

            var model = new Model();
            var n1 = new Node(0, 0, 0) { Label = "n1", Constraints = Constraints.Fixed };
            var n2 = new Node(10, 0, 0) { Label = "n2", Constraints = Constraints.RotationFixed };
            var beam = new BarElement(n1, n2) { Label = "Beam", Behavior = BarElementBehaviour.BeamYEulerBernoulli };
            //beam.Section = new UniformGeometric1DSection(SectionGenerator.GetISetion(0.24, 0.67, 0.01, 0.006));
            beam.Section = new UniformParametric1DSection() { A = 1e-4, Iy = 1e-6, Iz = 1e-6, J = 1e-6 };
            beam.Material = UniformIsotropicMaterial.CreateFromYoungPoisson(1e10, 0.2);

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

            var force = new Force(0,0,-1000,0,0,0);
            n2.Loads.Add(new NodalLoad( force));

            model.Solve_MPC();

Where is the matter?

epsi1on commented 2 years ago

Hi, This is because of some DoFs of your model are not properly restrained. Dx, Dy and Rz Dofs second node is free to move, (because of only BeamYEulerBernoulli behavior). So fixing those DoFs in second node fix the error: Edited line 3 of your code and works:

var n2 = new Node(10, 0, 0) { Label = "n2", Constraints = Constraints.RotationFixed & Constraints.FixedDX & Constraints.FixedDY };