This project has moved. For the latest updates, please go here.

how can add weight of the structure on systems

Dec 16, 2015 at 3:16 PM
hi, firstly thanks for this great project.

i have some question,

1- how can add weight of the structure on systems?
2- how can add UniformLoad1D on TrussElement2Node ? when i use UniformLoad1D command , the code give an error -NotImplementedException was unhandled- on UniformLoad1D.cs class throw new NotImplementedException();

thanks.
Coordinator
Dec 16, 2015 at 6:33 PM
1- If you mean automatically creating loads from mass sources, there is not such a capabilty yet, you shoul code it which i don't think be hard.
2- Are you adding unifiorm axial load to truss element? or beam loads?

thanks
Dec 17, 2015 at 9:19 AM
yes i add uniform load on the truss element. i change your example1 and paste it.
        // Initiating Model, Nodes and Members
        var model = new Model();

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

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

        //var e1 = new FrameElement2Node(n1, n5) { Label = "e1" };
        //var e2 = new FrameElement2Node(n2, n5) { Label = "e2" };
        //var e3 = new FrameElement2Node(n3, n5) { Label = "e3" };
        //var e4 = new FrameElement2Node(n4, n5) { Label = "e4" };


        //Note: labels for all members should be unique, else you will receive InvalidLabelException when adding it to model

        e1.A = e2.A = e3.A = e4.A = 9e-4;
        e1.E = e2.E = e3.E = e4.E = 210e9;

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

        //Applying restrains
        n1.Constraints = n2.Constraints = n3.Constraints = n4.Constraints = Constraint.Fixed;
        n5.Constraints = Constraint.RotationFixed;


        //Applying load
        var force = new Force(0, 0, -1000, 0, 0, 0);
        n5.Loads.Add(new NodalLoad(force));//adds a load with LoadCase of DefaultLoadCase to node loads
        //
        var uniforce = new UniformLoad1D(-1000, LoadDirection.Z, CoordinationSystem.Global);
        e1.Loads.Add(uniforce);
        //

        //Adds a NodalLoad with Default LoadCase
        model.Solve();

        var r1 = n1.GetSupportReaction();
        var r2 = n2.GetSupportReaction();
        var r3 = n3.GetSupportReaction();
        var r4 = n4.GetSupportReaction();

        var rt = r1 + r2 + r3 + r4;//shows the Fz=1000 and Fx=Fy=Mx=My=Mz=0.0
Coordinator
Dec 17, 2015 at 12:53 PM

the truss element cannot have bending moment inside it, Due to it's stiffness matrix it just can have internal force of axial.

You should use a beam with both ends hinged for this case.

Dec 29, 2015 at 5:19 PM
Edited Dec 29, 2015 at 5:28 PM
Place this code in FrameElement2Node.cs file
The code assumes you're in X-Y plane ie vertical load direction is in Y direction.
        /// <summary>
        /// Generate own weight loadcase of the element
        /// </summary>
        /// <param name="loadcase">own weight load case </param>
        /// <returns></returns>
        public void GenerateOwnWeightLoad(LoadCase loadcase)
        {
            loadcase.LoadType = LoadType.OwnWeight;

            // local or global?
            // -1 mean load is downward 
            UniformLoad1D uniformload = new UniformLoad1D(-1 * this.A * this.material.Gama, LoadDirection.Y, CoordinationSystem.Local);
            uniformload.Case = loadcase;

            this.loads.Add(uniformload);
        }
And implementation would be like
            // add own weight loadcase
            foreach (FrameElement2Node elem in model.Elements)
            {
                elem.GenerateOwnWeightLoad(ownweight);
            }
Coordinator
Dec 29, 2015 at 6:34 PM
MohamedSalah wrote:
Place this code in FrameElement2Node.cs file
The code assumes you're in X-Y plane ie vertical load direction is in Y direction.
        /// <summary>
        /// Generate own weight loadcase of the element
        /// </summary>
        /// <param name="loadcase">own weight load case </param>
        /// <returns></returns>
        public void GenerateOwnWeightLoad(LoadCase loadcase)
        {
            loadcase.LoadType = LoadType.OwnWeight;

            // local or global?
            // -1 mean load is downward 
            UniformLoad1D uniformload = new UniformLoad1D(-1 * this.A * this.material.Gama, LoadDirection.Y, CoordinationSystem.Local);
            uniformload.Case = loadcase;

            this.loads.Add(uniformload);
        }
And implementation would be like
            // add own weight loadcase
            foreach (FrameElement2Node elem in model.Elements)
            {
                elem.GenerateOwnWeightLoad(ownweight);
            }
I think it is better to set the coordination system of the UniformLoad1D to CoordinationSystem.Global, also its direction to LoadDirection.Z and a negative magnitude . That way even if the beams are not in x-y plane (like this), that would not cause any problem and work exactly identical to this code in horizontal elements with no web rotation ...
Dec 30, 2015 at 8:00 AM
You're right for setting the load coordinate system to Global, but I'm not sure for Load direction.
It depends on whether you work in 2D or 3D.
If you work in
• 2D X-Y plane, load direction should be Y.
• 2D X-Z plane or 3D XYZ, Load direction should be Z.

Setting load direction to Z if you work in 2D X-Y plane will make no effect, and I'm not sure if it causes errors.
Jan 26, 2016 at 4:59 PM
hi all,
there is no such a property "material" in FrameElement2Node class! Am i missing some reference/extensions?
Jan 26, 2016 at 6:34 PM
I did it this way :
/// <summary>
        /// adding self-weight to an element
        /// </summary>
        /// <param name="WeightPerUnit"></param>
        /// <param name="load_unit"></param>
        public static void AddSelfLoad(FrameElement2Node _e, double WeightPerUnit)
        {           
            double lenght = _e.GetElementLength();
            double f = (((FrameElement2Node) _e).A * lenght) * WeightPerUnit;
            if (f!= 0 )
            {
                var _l = new UniformLoad1D(-f, LoadDirection.Z, CoordinationSystem.Global);
                _e.Loads.Add(_l);
            }
        }
Jan 26, 2016 at 8:29 PM
alitorabi wrote:
hi all,
there is no such a property "material" in FrameElement2Node class! Am i missing some reference/extensions?
No, you're not missing any references.
I added that Material class to my local fork but unfortunately the main directory was deleted when i tried to delete a .git file.
Any way, it's easy to add it.
Coordinator
Jan 28, 2016 at 2:19 PM
Guys, if you've implemented some interesting methods, can you please implement it as an extension method and upload it to the project "BriefFiniteElementNet.StructuralExtension" in same solution which BriefFiniteElementNet exists? Or if you find it useful say me to do that...

Thank you.