BriefFiniteElementNet / BriefFiniteElement.Net

BriefFiniteElementDotNET (BFE.NET) is a library for linear-static Finite Element Method (FEM) analysis of solids and structures in .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems with iterating a model

Riekelt-Post opened this issue · comments

Hello,

I am trying to use the Model.Solve() in an iterating for-loop:


       public void Iterate()
        {
            for (int i = 0; i < Iterations; i++)
            {           
                //Add forces
                foreach (BarElement e in ModelFEM.Elements)
                    AddForces(e);

                // Solve
                ModelFEM.Solve(BuiltInSolverType.ConjugateGradient));

                // Add displacements to all elements
                foreach (BarElement e in ModelFEM.Elements)
                {
                    e.StartNode.Location += e.StartNode.GetNodalDisplacement().Displacements;
                    e.EndNode.Location += e.EndNode.GetNodalDisplacement().Displacements;
                }
            }
        }

This does not give the results I would expect. It comes close but there are strange deviations.

When I store the element data in an other object and declare a new model at the start of every iteration and put the stored elementdata in the new model, it works like it should be. But I do not prefer to do it that way, because it is time consuming.

Do I miss something in the code above? I tried to clear the Model.LastResult.Clear(), but this didn't work.

I hope you can help me with this

Riekelt.

Yes Model.LastResult.Clear() should work.
After solve model, the analysis result (like total displacement and force vectors) are stored inside Model.LastAnalysisResult in order to prevent solving model in each query. when you clear that then they should be cleared out

Can you check again with the Model.Solve_MPC() instead of Model.Solve()?
Thanks

Also note that because you are updating the model in each iteration (location of nodes) and loads at same time, then it is not possible to reuse solve result from last step and process will be time consuming. Only thing i can think of, is to precondition the PCG solver with result from last step, that maybe do a little difference in speed of processing...

I tried to use Model.LastResult.CLear() again, but now I do this at the end of every iteration in stead of at the beginning of every iteration. Now it works like it should.

Thank you for that.

I also tried the Model.Solve_MPC(). This one is much faster, but the displacements are enormous, so not realistic. Do you have any clue why that is happening?

Riekelt

If you do not use RigidElement and other MpcElements, then Model.Solve() and Model.SolveMpc()'s results should be near identical (identical displacement and support force and internal force of elements).
If result are not identical regarding above notes, then it can be a bug...

If you find bug please report it in order to be fixed.
Thanks