TrussElement internal force

Dec 5, 2015 at 8:57 AM
the internal force of truss element is not implemented. how do we get the tension/compression force of a truss member?
Coordinator
Dec 5, 2015 at 9:12 AM

Please have a check if you can use frame element with both end hinged instead.

Dec 5, 2015 at 9:21 AM
I'll give it a try , what should I pass to X parameter in GetInternalForceAt ? as far as I know the force in a truss member is constant all over the member length .
Coordinator
Dec 5, 2015 at 9:25 AM

Not necessarily , because truss element can have distributed force on it (witch not exists yet in library).

You can pass any X value (between zero and element length) to that and expect same internal force.

Dec 13, 2015 at 5:43 PM
Hi,
I replaced truss element with frame element , when I call model.solve() it seems that it works (no error) however, when I call getsupportreaction() it throws a null reference exception at line parent.LastResult.AddAnalysisResultIfNotExists(cse);
parent.LastResult is null .
Coordinator
Dec 13, 2015 at 5:48 PM
Edited Dec 13, 2015 at 6:08 PM
Can you expose your code?
Dec 13, 2015 at 6:10 PM
well, I'm loading your project using dotnet.loadassembly from another application (3ds max) . here is the code which interfaces between max-script code and BFE

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BriefFiniteElementNet.Controls;
using BriefFiniteElementNet.Elements;
using BriefFiniteElementNet;

namespace FiniteElementMethod
{
public class Model
{
    public BriefFiniteElementNet.Model model;
    public static double epsilon = 0.000001;
    // Initiating Model, Nodes and Members
    public Model()
    {
        model = new BriefFiniteElementNet.Model();
    }
    /// <summary>
    /// Add a new node and return the index of node 
    /// </summary>
    /// <param name="x">x position </param>
    /// <param name="y">y position </param>
    /// <param name="z">z position </param>
    /// <returns> if positive the node is a newly created , if negetive node is existing </returns>
    public int AddNode (double x,double y,double z)
    {
        Node n = new Node(x, y, z);

        int index = 0;
        foreach(Node item in model.Nodes)
        {
            if ((item.Location - n.Location).Length < epsilon)
            {                    
                return -1*(index+1);
            }
            index += 1;
        }
        int i = model.Nodes.Count;
        n.Label = "N"+(i+1).ToString();


        model.Nodes.Add(n);            
        return (i+1);                        
    }
   /// <summary>
   /// Add a truss element into the model
   /// </summary>
   /// <param name="node1">first node of the element</param>
    /// <param name="node2">second node of the element</param>
    /// <param name="E">elastic modulus</param>
   /// <param name="Eunit">unit of E 1:GFA 2:PA</param>
   /// <param name="A"></param>
   /// <param name="AUnit"></param>
    public void AddTrussElement(int node1,int node2,double E,int Eunit, double A,int AUnit)
    {
        var n1 = model.Nodes[node1];
        var n2 = model.Nodes[node2];
        if (n1 == null || n2 == null)
            return ;
        int c = model.Elements.Count;
        var _e = new TrussElement2Node(n1, n2) { Label = "E" + (c + 1).ToString() };
        if (model.Elements.Contains(_e))
            return ;            
        switch (Eunit)
        {
            case 1: // Gpa
                _e.E = E / 1000000000.0;
                break;
            case 2: // Pa
                _e.E = E;
                break;

        }
        switch (AUnit)
        {
            case 1: //mm
                _e.A = A / 1000000.0;
                break;
            case 2: //cm
                _e.A = A / 10000;
                break;
            case 3:
                _e.A = A;
                break;
        }
        model.Elements.Add(_e);


    }
    /// <summary>
    /// Add a frame element into the model
    /// </summary>
    /// <param name="node1">first node of the element</param>
    /// <param name="node2">second node of the element</param>
    /// <param name="E">elastic modulus</param>
    /// <param name="Eunit">unit of E 1:GFA 2:PA</param>
    /// <param name="A"></param>
    /// <param name="AUnit"></param>
    public void AddFrameElement(int node1, int node2, double E, int Eunit, double A, int AUnit)
    {
        var n1 = model.Nodes[node1];
        var n2 = model.Nodes[node2];
        if (n1 == null || n2 == null)
            return ;
        int c = model.Elements.Count;
        var _e = new FrameElement2Node(n1, n2) { Label = "E" + (c + 1).ToString() };
        if (model.Elements.Contains(_e))
            return ;
        switch (Eunit)
        {
            case 1: // Gpa
                _e.E = E / 1000000000.0;
                break;
            case 2: // Pa
                _e.E = E;
                break;

        }
        switch (AUnit)
        {
            case 1: //mm
                _e.A = A / 1000000.0;
                break;
            case 2: //cm
                _e.A = A / 10000;
                break;
            case 3:
                _e.A = A;
                break;
        }
        model.Elements.Add(_e);


    }

    /// <summary>
    /// sets the constraints of a node
    /// </summary>
    /// <param name="nodeIndex"> the index of the node </param>
    /// <param name="dx"></param>
    /// <param name="dy"></param>
    /// <param name="dz"></param>
    /// <param name="rx"></param>
    /// <param name="ry"></param>
    /// <param name="rz"></param>
    public void SetConstraints(int nodeIndex, bool dx, bool dy, bool dz, bool rx, bool ry, bool rz)
    {
        if (nodeIndex >= 0 && nodeIndex < model.Nodes.Count)
        {
            Node n = model.Nodes[nodeIndex];
            n.Constraints = new Constraint(
                dx?DofConstraint.Fixed: DofConstraint.Released,
                dy?DofConstraint.Fixed: DofConstraint.Released,
                dz?DofConstraint.Fixed: DofConstraint.Released,
                rx?DofConstraint.Fixed: DofConstraint.Released,
                ry?DofConstraint.Fixed: DofConstraint.Released,
                rz?DofConstraint.Fixed: DofConstraint.Released
                );
        }
    }
    /// <summary>
    /// Add nodal node to a node
    /// </summary>
    /// <param name="nodeIndex"> index of node in model </param>
    /// <param name="fx"></param>
    /// <param name="fy"></param>
    /// <param name="fz"></param>
    /// <param name="mx"></param>
    /// <param name="my"></param>
    /// <param name="mz"></param>
    public void AddNodalLoad(int nodeIndex, double fx, double fy, double fz, double mx, double my, double mz)
    {
        if (nodeIndex >= 0 && nodeIndex < model.Nodes.Count)
        {
            Node n = model.Nodes[nodeIndex];
            Force f = new Force(fx,fy,fz,mx,my,mz);
            NodalLoad nl = new NodalLoad(f);
            n.Loads.Add(nl);
        }

    }       
    /// <summary>
    /// clears the load list of the node
    /// </summary>
    /// <param name="nodeIndex">the index of node in the model</param>
    public void ClearLoads(int nodeIndex)
    {
        if (nodeIndex >= 0 && nodeIndex < model.Nodes.Count)
        {
            Node n = model.Nodes[nodeIndex];

            n.Loads.Clear();
        }
    }
    public int GetNodeCount()
    {
        return model.Nodes.Count;
    }
    public int GetElementCount()
    {
        return model.Elements.Count;
    }
    /// <summary>
    /// retrives the support reaction
    /// </summary>
    /// <param name="nodeIndex"></param>
    /// <returns></returns>
    public Force GetSupportReaction (int nodeIndex)
    {

        return model.Nodes[nodeIndex].GetSupportReaction();
    }
    /// <summary>
    /// solves the model
    /// </summary>
    /// <param name="solverType"></param>
    public void Solve(int solverType)
    {
        switch (solverType)
        {
            case 1:// default
                break;
                model.Solve();
            case 2: // CholeskyDecomposition
                model.Solve(BuiltInSolverType.CholeskyDecomposition);
                break;
            case 3: //ConjugateGradient
                model.Solve(BuiltInSolverType.ConjugateGradient);
                break;

        }                        
    }

}
}
Coordinator
Dec 13, 2015 at 6:17 PM
Do you call Node.GetSupportReaction() after model.Solve()?
Dec 14, 2015 at 3:19 AM
Yes
Coordinator
Dec 14, 2015 at 5:20 AM
I've made some updates on code.
Can you please check again with updated codes?
Coordinator
Dec 15, 2015 at 7:42 AM
Did it work?
Dec 15, 2015 at 7:17 PM
Yes, thank you. actually it was my mistake having model.solve() under break statement turns up to be unreachable !
I’m very excited about this, maybe I can record some videos of 3ds max structural molding by Para 3d (www.para-3d.com ) and structural analysis using BFE.
Just wondering if you are still actively working on this project?
Coordinator
Dec 16, 2015 at 6:21 AM
alitorabi wrote:
I’m very excited about this, maybe I can record some videos of 3ds max structural molding by Para 3d (www.para-3d.com ) and structural analysis using BFE.
Sure, can you please?
Just wondering if you are still actively working on this project?
I'm also working on another alternative project for FEA in .NET (not done yet), with more features compare to BFE. But that probably will be commercial and not open source.
I would like to make the BFE the community and opensource version of that one, anyways I'm sure that even in that case i'll keep working on BFE as it's opensource and a little well known...
Dec 16, 2015 at 6:19 PM
In example 1 when I retrieve the internal force of a frame element at 0 position it returns a force object which its FX is 433.012 and FY and FZ are zero. I calculated manually and it seems to be correct (250*sqrt(3)) , however I don't understand why the FX has the value and not FY or FZ?
Coordinator
Dec 17, 2015 at 11:59 AM

Please google for local and global coordination system in FEM for truss elements…