Skip to content

Help on "Matrix must be symmetric positive definite" error #11

@ceanwang

Description

@ceanwang

Hi,

Tried to calculate a 2d truss with code below, but got a message saying "Matrix must be symmetric positive definite". What's wrong with the code?

Thanks for help.

Cean

    private static void Truss2D()
    {
        Console.WriteLine("Simple 2D truss with 3 members");
        
        var model = new Model();

        var n1 = new Node(0, 0, 0);
        n1.Label = "n1";//Set a unique label for node
        var n2 = new Node(1, 0, 1.732) { Label = "n2" };//using object initializer for assigning Label
        var n3 = new Node(1, 0, 0) { Label = "n3" };

        var e1 = new TrussElement2Node(n1, n2) { Label = "e1" };
        var e2 = new TrussElement2Node(n2, n3) { Label = "e2" };
        var e3 = new TrussElement2Node(n1, n3) { Label = "e3" };

        e1.A = e2.A = e3.A  = 0.001;
        e1.E = e2.E = e3.E  = 200e9;

        model.Nodes.Add(n1, n2, n3);
        model.Elements.Add(e1, e2, e3);

        n1.Constraints  = Constraints.Fixed;
        n2.Constraints = Constraints.RotationFixed;
        n3.Constraints = Constraints.RotationFixed;
        
        var force = new Force(10000, 0, 0, 0, 0, 0);
        n2.Loads.Add(new NodalLoad(force));//adds a load with LoadCase of DefaultLoadCase to node loads

        model.Solve();

        Console.ReadKey();

    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions