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

Cables simulation or workaround (maybe using truss elements)

Sep 24, 2016 at 8:48 PM
Hello there.

Is it possible to somehow have 'cables' in the simulation? I'm doing an educational game so it's not necessary to be very correct, something like a beam element that offers zero compression resistance would be a pretty good solution for me, but I lack the knowledge to do that. So perhaps there's a way to achieve a similar result, maybe using (3) truss elements (with free nodes), I'm not sure. Truss elements have a problem though, they are too restrictive, for some reason I couldn't manage to get them working on released nodes.

I've tried hinged beams (frame), springs (couldn't figure how to use them) and complex trusses to no avail.

Here's a starting point I'm using to test this (with some easy functions):
using System;
using BriefFiniteElementNet.Elements;

namespace BriefFiniteElementNet.CodeProjectExamples
{
    class Testing
    {
        private Model model;
        public void Run()
        {

            model = new Model();

            var n1 = AddNode(0, 0, 0, Constraint.Fixed);
            var n2 = AddNode(1, 0, 0, Constraint.Fixed);
            var n3 = AddNode(0, 1, 0, Constraint.Fixed);
            var n4 = AddNode(0, 0, 3, Constraint.Released);
            var n5 = AddNode(1, 1, 3, Constraint.Released, new NodalLoad(new Force(1e5, 1e5, 0, 0, 0, 0)));

            AddBeam(n1,n4);
            AddBeam(n2,n4);
            AddBeam(n3, n4);
            AddBeam(n4, n5);
            //var e4 = new TrussElement2Node(n2, n1);e4.A = 9e-4; e4.E = 210e9;model.Elements.Add(e4);

            model.Solve(BuiltInSolverType.ConjugateGradient);

            Console.Write("solved");
        }

        Node AddNode(double x, double y, double z, Constraint constraint)
        {
            Node newNode = new Node(x, y, z)
            { Constraints = constraint };
            model.Nodes.Add(newNode);
            return newNode;
        }
        Node AddNode(double x, double y, double z, Constraint constraint, NodalLoad load)
        {
            Node newNode = new Node(x, y, z)
            { Constraints = constraint };
            newNode.Loads.Add(load);
            model.Nodes.Add(newNode);
            return newNode;
        }
        Element1D AddBeam(Node n1, Node n2)
        {
            FrameElement2Node newElement = new FrameElement2Node(n1, n2) { G=1e11, E=2e11, A=1e-5 };
            newElement.ConsiderShearDeformation = false;
            newElement.Geometry = SectionGenerator.GetRectangularSection(.2, .2);
            newElement.UseOverridedProperties = false;
            model.Elements.Add(newElement);
            return newElement;
        }

    }

    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            new Testing().Run();
        }
        
    }
}
If you guys could somehow modify that to achieve something similar to a cable, I'd really appreciate, or if it's not possible I'd consider implementing a 'compressible' beam element in the project if you give me some initial pointers. I think it's possible with a modified matrix but I'm not really sure how the elements matrices work.

Thank you very much.
Coordinator
Sep 25, 2016 at 3:53 AM
Edited Sep 25, 2016 at 4:04 AM
Hello Dear,
A truss element with zero compression resistance - but non zero tension resistance - falls into nonlinear finite element analysis area. But BFE does only linear FEA so there is no - or at least a simple - way to directly implement such an element in project, because there is no compatible infrastructure.
I have no enough knowledge in nonlinear FEA, but i think you can do such an analysis with another techniques which BFE can be helpful, but not only tool that you should use to achieve the result.
That would not be easy as it is somehow nonlinear analysis.
Your target model does have how many elements & nodes?
Sep 25, 2016 at 1:43 PM
Hello. Thank you for your timely and kind reply.

Solving around 1000 elements and 2~3k Free DoFs in around 100 ms would be fine. BFE does that easily even on a quite old machine.

Since the application isn't intended for serious purposes, but to show the basics of structures (trusses, how forces (torque) propagates, etc.), it's not necessary to actually reflect real scenarios, but I need reproducible results. Results that won't change substantially on different hardwares, so I can't use the other solvers intended for real-time applications because they are all very indeterministic. I was using a physics engine intended for games and it's amazing how structures will behave very differently only if you move them 1m away, because floating point errors are added and when you have many elements the final difference is huge. Different hardwares will yield different results too, so a structure that's stable on my machine could collapse on yours. that's why I decided to go with an actual FE package for that. These high speed physics engine they work only with velocities, not forces, basically they accelerate all objects and then check for constraints and try to compensate.

I'm considering OOFEM too, which has nonlinear and allows you to setup quite detailed materials, but I don't think it's going to perform acceptably. FEA is somewhat out of my expertise so I'm not very keen on doing substantial changes on a library and I'm looking for one that fits my needs. Maybe there just isn't a nonlinear solver that will perform fast enough so in this case I'd just drop the cables altogether and use BFE because so far I'm really happy with it. I've tested some massive structures and the results are very precise and it's very fast too.

Thank you.
Coordinator
Sep 25, 2016 at 5:31 PM
Thanks for information.
That is nice, i would be interested if can do any help, as this case is new for me :)
Also please note that there are several solvers in BFE (thanks to great collaborators), and choosing the right solver type does very affect the duration of solve time (look at this and this sections)
Sep 25, 2016 at 8:17 PM
Thank you for your reply.

Yes, I'm aware of the solvers but in this case since the model is going to be changed for each run Cholesky isn't of much use, specially because accuracy isn't a big concern. Conjugated Gradient is fast enough though, I wonder what performance impact a nonlinear version would have... there are some real-time physics engines using a "Nonsmooth Nonlinear Conjugated Gradient" so perhaps it's not very slow, although I really don't have any idea on what that "Nonsmooth" means.

BTW, I caught a minor mistake in the performance page:
Chol First Time: Time taken by Conjugate Gradient solver for analyzing structure for first time

Thank you.
Sep 26, 2016 at 11:43 AM
Edited Sep 26, 2016 at 11:47 AM
Hello, I forgot to ask something, isn't it possible that, instead of having a real 'cable' element (or a single element that behaves more or less like a cable), just to somehow achieve similar results with a clever setup of truss or hinged frame elements? I mean, in theory if you connect 3 nodes with 2 truss elements totally free/released on all nodes, they will result in something similar to that (like a distance limiter), but that won't result in a valid mathematical representation (understandably), but maybe there's some trick I'm not aware of.

I don't thing that's possible linearly, because say you make something like that, which would resemble an 'arm', if you apply force so the arm bends, if you apply the same force to the opposite direction, it will still bend but to the other side, the connected nodes won't be limited by the distance of both elements lengths, so I guess you'd need nonlinear anyway, but I'm not 100% sure on that.

Thank you.
Coordinator
Sep 26, 2016 at 5:15 PM
Edited Sep 26, 2016 at 5:17 PM
Yes you are right. not simply possible to use linear FEA to do nonlinear FEA.

A trick i can think of is that you use truss as cable, then apply the load and solve, and simply set E or A of cables with negative (compression) internal force to 0.0 in order to ignore them and solve again. and do this several time. finally you would be end up with a result which can be terribly wrong answer :) but i think that is up to you to get a acceptable result. There should be also some article/papers on the web that describe simple procedures for analyzing cable structures with things like truss elements (i did't search enough for this).
Sep 26, 2016 at 6:39 PM
Yes, that's what I was expecting but it doesn't hurt to ask... I thought about running the simulation multiple times and checking if the element is being compressed or tensioned, but unfortunately that's not a practical solution and surely could yield very unexpected results. I'm going to try searching online. I couldn't find a comprehensive paper on nonlinear conjugate gradient so far but I'm sure there's something out there, however, I'm not actually planning to implement that before trying some other things because that's really far from my area of expertise and I'm not planning to spend much time on that too.
Thank you very much for your support. I really appreciate it.
Sep 27, 2016 at 2:27 AM
I would suggest the most educational thing you could do is:

1 - Fork the project so that
             a) - one version is for engineers who do "need accurate stuff"
             b) - educational version can only solve for a simple 2D ( y axis vertical )  truss with max 20 nodes and 20 elements - and keep it 2D  to start with
2 - When you get the b) Version working, combine it back into a) Version

3 - Put a short element at each end of the truss member, length = 1/100 of element length, cross section properties factored by 0.01, primarily the Is and Js, Area not so critical. Automate all that, plot the bending moment diagram see if the moments look close enough to zero at each end of the truss elements - or in fact the pin joints at the end of to or bottom chord of a truss - i.e. the chords of the truss.

That proves you have a Pin Jointed element working.

Then auto remove any truss member ( 3 elements ) in compressions and reanalyse.

Serious:
https://www.scribd.com/doc/40660073/Analysis-of-Cables-Catenary-Structures

Emulation:
https://knowledge.autodesk.com/support/robot-structural-analysis-products/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/Robot/files/GUID-A761540B-9E96-4760-AF04-47E22059B834-htm.html

I am no expert on the above, just would make sense to keep "games" away from "science". I know this could be a first experience teaser, so no drama there.