Automating RFEM model generation with Python in the Cloud

Bas van der Hulst

by Bas van der Hulst

On request of one of our clients, VIKTOR has developed an integration with RFEM as one of its' digital building blocks to make creating models and executing RFEM from within your VIKTOR web application easy and quick. By parameterizing the concerning structure(s), automating the generation of the models, integrating the analysis, and post-processing of results within one single app, a significant increase in efficiency can be achieved.
How to create successful application that ensure adoption
Build successful applications

Learn the process to build apps that provide real value to your work and that other people will definitely want to use as well.

Automate where possible!

During my years as a structural (finite element) engineer, working for several different companies, I got to work with various structural software packages as well, including ABAQUS, ANSYS, NASTRAN, RFEM, SCIA, and more. Having experienced the effort and time needed to create finite element models, I became an advocate of automating this (labor-intense and often boring) process whenever possible, an opinion that is widely shared among our clients.

RFEM models with a few lines of Python

RFEM is a widely used software program developed by Dlubal for the 3D finite element analysis (FEA) of engineering structures, widely used by civil engineering companies around the world.

appRFEM model in VIKTOR.png

Creating an RFEM model within RFEM's structural software package

Creating RFEM models using the VIKTOR SDK (Software Development Kit) is done by witing object-oriented Python code. No knowledge of RFEM’s C# API is required. All the relevant building blocks can be found in the module viktor.external.rfem, of which the starting point is the RFEMModel, making it easy to implement for developers with basic Python knowledge. It also effortlessly integrates with all other parts of the SDK!

1model = Model() 2node1 = model.create_node(0, 0, 0) 3nide2 = model.create_node(10, 0, 0) 4material = mol.get_material("Steel S355 J0") 5cross_section = model.create_cross_section("my section", material) 6model.create_element(node1, node2, cross_section)

Python code showing how a (dummy) RFEM model is built-up in VIKTOR

An RFEM input file (.rfx) can be generated by calling model.get_rfx_file(), that can then be downloaded (so that it can be manually loaded into RFEM) or sent for analysis to VIKTOR’s RFEM worker.

Running the analysis in the VIKTOR web app

With VIKTOR you can perform an RFEM analysis from within your web application, without having to open the interface manually at all! This makes the analysis easily integratable into a fully automated design process. The analysis can be performed using the RFEMAnalysis class, by specifying the input file (.rfx) and working through a set of actions. This could be an input file, generated with get_rfx_file (see above), or one obtained some other way, as long as RFEM deems it valid:

1from viktor.external.rfem import RFEMAnalysis 2rfx_file = model.get_rfx_file() 3analysis = RFEMAnalysis(rfx_file, actions) 4analysis.execute(timeout=3600) 5model_with_results = analysis.get_model() 6results_lc_1 = analysis.get_result(load_case=1) 7results_lc_2 = analysis.get_result(load_case=2)

RFEM analysis with VIKTOR in your web application

The worker can perform a series of actions that can be chosen by the developer from a fixed set (this set might be extended by VIKTOR in the future, depending on the demand). For example, a typical energy optimization analysis can be performed on a selected set of load cases, by:

1Goal_energy = 10e3 # [Nm] 2Accuracy = 0.01 # [m] = 1 cm 3Optimize = EnergyOptimizationAction(load_cases=[1, 2], goal =goal_energy, accuracy=accuracy) 4Write = WriteResultsAction() # request deformations and internal forces for all load cases 5Actions = [optimize, write]

A typical enegry optimization analysis with VIKTOR

Executing the analysis invokes the input file to be sent to a designated (virtual) machine that executes the job (on a so-called ‘worker’), using the local RFEM software and license. After execution, the model with results (.rfx) and/or the requested results per load case can be retrieved in numerical form for further processing (e.g. for plotting graphs and tables in the app’s interface).

Creating user-friendly web apps with VIKTOR

Python code and RFEM packages can be intimidating for some people. VIKTOR provides the opportunity to create user-friendly web-based applications and run RFEM in the background. In this way, you can make your domain knowledge available to other people while also keeping your intellectual property save.

For example, think in a product configurates that enables a sales representative to design and price a product independently, while remaining the safe boundaries that you have determined as an engineer.

Here you can see the same RFEM model in a VIKTOR application. The person using it does not have to have any knowledge of RFEM or Python, nor a licence installed. It is available everywhere and from any device!

visualization of a RFEM model in a VIKTOR application

RFEM model in a VIKTOR application

RFEM binding with VIKTOR

VIKTOR’s RFEM binding makes it even easier to generate, analyse and post-process your RFEM models in an automated way, using the software you are familiar with. A VIKTOR worker provides a connection between the web application and the software, such that RFEM can be executed from within the browser. After the analysis, the results are returned and can be visualised on top of the model visualisation. This means that the manual tasks of constructing a RFEM model, analysing the model, and assessing the results can all be done with just a simple button click from within the VIKTOR interface!


An RFEM model, constructed from within the VIKTOR interface

Do you want to construct and analyse RFEM models quick and easy as well on the VIKTOR platform? Don't hesitate to contact us!


Related Blog Posts

plotly pandas numpy matplotlib python

Visualize your data with Python and VIKTOR

Read more

Save time by automating PLAXIS in the Cloud

Read more

Hackathon stimulates knowledge development

Read more