Run many analyses and post-processing them [SOLVED]

Hi!

Is there a smart way of running existing models in a sequence, and waiting until each analysis is finished until running the next?

I want to analyze an opening sequence of my bridge. I have already modelled and saved all analyses.


I am thinking of something like this but in a for-loop of some kind…

Hey @Poja :wave:

In case of “iteration”, you should use the Application.Run components.

Unfortunately, LiveLink has some minor issue with Iterations.

However, if you want to speed up the process, this would be an amazing opportunity to try C# or Python

FEM-Design for Python :slight_smile:

from femdesign.comunication import FemDesignConnection, Verbosity
from femdesign.calculate.command import DesignModule
from femdesign.calculate.analysis import Analysis, Design, CombSettings, CombItem


pipe = FemDesignConnection()

file_path= ["file_1.str", "file_2.str"]

for file in filePath:
  try:
      pipe.SetVerbosity(Verbosity.SCRIPT_LOG_LINES)
      pipe.Open(file )
      pipe.RunAnalysis(Analysis.FrequencyAnalysis(num_shapes=5))
      pipe.Save(file)
      pipe.Exit()
  except Exception as err:
      pipe.KillProgramIfExists()
      raise err

FEM-Design API for C#.

Let me know if you need any guidance.

Ok… that sound amazing… I am currently trying this, but don’t know if it will work

But to my knowledge, there were no API for Python just a short while ago, when we were talking to Shaho in the beggining of this year…

1 Like

It was a good idea but I think it will not work :slight_smile:

Switch to Application.Run and it will work like a charm!

Python package has just been released but it is really minimal. It only allows some comunications with the software. We currently do not support any model creation which can be done using some xml library but it is up to the user.

1 Like

OK!

This worked beautifully, you were right! Two minutes per analysis.
But I will definately check out the Python apparoach as well!

1 Like

@MarcoPelle !

I don’t see how the Python script you sent me would be faster than grasshopper
since it still has to open FEM-Design to perfom the analysis.

The benefit, though, is that it frees up grasshopper to be used in parallell instead of being busy during the analyses.

Have I understood it correctly?

Also, I run into this problem:

The code that I shared has a mistake :slight_smile:

I didn’t test the code and we should remove the pipe.Exit() as it is going to close down FemDesignConnection and it will then fail.

However, the python code will run faster as it will not open and close FEM-Design every time but it will keep the software only once.

Have a look at the following example and try to modify it accordingly.

I am still working on making the tool easier.
For the time being, I think that you need to specify as many CombItems as many load combinations.

combSettings.combitems.append(CombItem.StaticAnalysis(NLE=True))
1 Like

This works perfectly,
I am SOOO excited about this Python API and so impressed by your work!
I am trying to spread the word about FEM-Design as much as I can thanks to you @MarcoPelle!

1 Like

Do we have result reading functionality :drooling_face:?

If not, how to solve it iteratively in GH?

wow!

It is getting serious over here :slight_smile:

You can definitely read results also with the Application.Run (which I love :heart: )

As you are running several model, you will get a deep datatree (which will be fun to work with :yum:)

1 Like

Oh my god :smiley:
You have thought of everything already :smiley:
Looking forward to get serious with the Trees :rofl:

1 Like

Hi Marco!

Is there a smart way to retain the results that are extracted with Application.Run?
For instance saving them as a *.csv file or something to be able to load them into GH at any later point in time?
Because now, Rhino runs out of memory an crashes and internalizing the data does not remain after a restart of the application.

Maybe with the Bsc somehow?

Ehi @Poja

You have a big model and I imagine that you are having issue with those results :slight_smile:

However, if you have a look in the folder where you grasshopper script is stored, you will see several files.

The informations you are looking for are in the “results” folder.

bsc approach would definitely work but it will requires you to save the .bsc files from the GUI. So. let’s say that you have 2 different solutions.

If you have a better idea, we are always open for suggestions/feedbacks/improvements

Ok!

I will experiment with it a little. But as it looks like now, I have no idea which csv -file belongs to which model. Is there a way to name them through GH? And is there a way to access them through the API?

Fundamentally, I would like to “tap” into the *.strFEM files through the API wihout opening the application (as Application.Run does), but maybe that is not practically possible… But since my background is from Abaqus (Brigade), I am used to being able to read output-files directly in Python without involving any other application.

As it is now, it takes equally long time to run the analyses as it takes to extract reactions and bar internal forces for two bars. Mainly because the application must open each time, even for post-processing.

The BSC-files are very powerful (or at least the table/list functionality in FEM-Design), shouldn’t there be a component in GH for that?

The issue happen in case of iterations/optimisations routine. Otherwise, you can use the live-link which is called femdesign.connection which will open FEM-Design only once.

LiveLink in conjunction with the two following components will read the results of the open file in FEM-Design.

The issues (the only few user get) raises when there are iterations which LiveLink can not handle yet.

@MarcoPelle, to clarify:

I am talking batch/interation/optimization for all things! That’s the whole point for me to work with Grasshopper / Python in an automated manner. So as in my case, generating 10 different models for opening stage of a bridge is standard procedure, not even optimization/iteration, but batch-modelling and batch-post processing.

Östra.pdf (442.7 KB)

If I imagine a workflow for the post processing as it is right now:

  • Lets say I have extracted a) Bar internal forces and b) Point Reactions and now want to experiment with labelled sections for just one of the models (the first one) wihout loosing results a & b. Relying on the genrated csv-files would be difficult in an automated manner as I understand it (or?).

  • So somehow, I need to have a component for fast saving / retrieval of results a & b, for instance by being able to save them with a custom name (or is there already a better/similar solution?).

Of course, but the topic here is “Run many analyses” and it should be added “and post-processing them”

Maybe this is something to implement in the Python API at least, if the demand is not high for similar work-flows by regular users.

Becasue working with openable bridges, I need this approach all the time. It is already very far/well developed i.m.o, I think there are just minor efforts required.

EDIT:
Forgot to mention the issue that a slight miss-click / change in the GH-canvas
can activate the Application.Run to go through all analyses, and would I interrupt the process I loose everything :rofl: Already happaned many times…

With FEM-Design 24, we will need to refactor the result reading. We will consider implementing a better way to automatise the post-processing in case of multiple models.

As you can understand, it does not happen really often to post-process multiple model at the same time.

However, our C# API would allow you to optimise a little bit your workflow as you would be able to:

  • FEM-Design will only open once for the entire iteration
  • save results in a specified folder

Long story short, for the time being, you can stick with the workflow as specified in your image (unless you want to switch to C# or Python)

That is great! I really think you are taking a step in the right direction if you want to compete in the field of bridge engineering, very good!! This is needed as soon as the model changes in any way.

Which field of engineering are you refering to?

In bridges, we have many openable/movable structures but also various and complex construction stages. Both SOFISTIK and Brigade+ (Abaqus) which are your competitors in the field of bridge engineering are capable in one way or another to tackle these challanges. But as for now, I prefere FEM-Design because of its amazing Grasshopper API and un-matched support (by @MarcoPelle).

This is an example I have worked with

But of course you have bridge launching which is not uncommon at all, and constrcution stages for arch/cable-stayed/suspension brigdes as well as broken structural elements in different combinations (cables/bars) etc etc…

Do you have an example for Python of post-processing?

1 Like

thanks for the kind word :yum:
You have just won a drink next time I am in Goteborg. :beers:

Have a look at the examples that I have created in the last 2 days :rofl:

The following method is the one which will help you in saving the results in a specified location.

pipe.GenerateListTables(r"bsc/comb-nodal-displacements.bsc", r"results/comb-displacement.csv")

We can not programmatically create the bsc file yet but it is something which will work on.

1 Like