Engee documentation

LOGO Support Package

LOGOS is a software package for industrial 3D modeling and multidisciplinary engineering analysis. Integration with Engee is organized through the mechanism of User Functions (PF) in the LOGO "Platform" module, which is designed to connect third-party calculation modules.

Integration with LOGOS requires an installed and running Engee subsystem.Integration. Make sure that the client program is running and connected to the current Engee session before starting integration.

For detailed installation and configuration instructions, see the article Engee.Integrations.

Integration is performed by registering user-defined functions written in Python in the context of the LOGOS integration solver. These functions receive and send data from/to Engee over the UDP protocol via specific ports.:

  • Port 6848 — for receiving signals from Engee to the LOGO;

  • Port 6849 — for transmitting signals from LOGOS to Engee.

This interaction allows for cosimulation, a joint calculation where both systems exchange data in real time. This opens up opportunities for:

  • Using specialized Engee models inside the LOGOS strength calculations;

  • Transfer of calculated parameters between systems at each integration step;

  • Creation of complex models combining physics from different domains.

The User function (PF) is a callback function called by the calculation module during the task calculation process. The PF mechanism allows you to change or supplement the behavior of an existing calculation module without modifying it.

The PF connector is an interface (pointer to a function) through which the calculation module calls a user function with a predefined set of parameters. During task initialization, the interface module loads libraries from the PF, initializes connectors, and calls the PF at the right moments of calculation.

Each PF has its own API set of arguments and return values. The PF interface can be displayed automatically in the LOGO Platform editor when creating or enabling a custom function.

The general scheme of PF operation:

  1. The calculation module (for example, LOGOS-Heat or LOGOS-Strength) contains built-in PF connectors to which the user can connect his function.

  2. The connector transmits to the PF all the necessary data for the current calculation step (for example, temperature, voltage, density, etc.).

  3. The PF performs user logic (for example, recalculating the coefficient of thermal conductivity or calculating the destruction criterion).

  4. The results are returned to the calculation module, where they are used in the modeling process.

For the PF to work correctly, it is necessary that its interface matches the interface of the connector to which it is connected.

The list of PF in the LOGOS calculation modules is given below. For more information about PF LOGOS, see the official LOGOS documentation.

The built-in user functions of the LOGOS calculation modules
LOGOS-Warmth
Function name Appointment Basic parameters

1

sourceHeat

Initialization of the heat source in the center of the cell.

x, y, z, time, t, region, source, qdt

2

patchTFixed

A boundary condition with a fixed temperature.

namePatch, flag, x, y, z, time, kappa, Rho, Cv, T

3

patchTFlux

Boundary condition with heat flow.

namePatch, flag, x, y, z, time, kappa, Rho, Cv, T, fQ

4

patchTConvection

Boundary condition of convection.

namePatch, flag, x, y, z, time, kappa, Rho, Cv, T, fTs, fAlfa

5

kappa

Determines the coefficient of thermal conductivity.

nameMaterial, x, y, z, time, T, kappa

6

rho

Determines the density of the material.

nameMaterial, x, y, z, time, T, Rho

7

cv

Determines the heat capacity.

nameMaterial, x, y, z, time, T, Cv

8

ablationRate

The rate of mass material entrainment.

T, centerX, Y, Z, normalX, Y, Z


LOGOS-Durability
Function name Appointment Basic parameters

1

MatUser_ST

Custom voltage calculation.

Strain, Stress, MatConst, Temp, Time, statev

2

Mat_User_ST_GetDMatrix

Calculation of the matrix of material constants.

MatConst, statev, matD, nComp

3

ErosionUser_ST

User-defined destruction criterion (stationary).

crit_val, Strain, Stress, nComp

4

MatUser

Stress calculation for dynamic tasks.

strainVelF, stress, pu, eu, epsp, rou, ts, eraseFlag

5

EOSUser

A custom equation of state.

pu, eu, rou, divU, ts, time

6

ErosionUser

The destruction criterion for dynamic tasks.

strain, epsp, eraseFlag, time


LOGOS-Aero
Function name Appointment Basic parameters

1

UF_InitVelocity

Initialization of the velocity field.

cellIndex, time, x, y, z, u, v, w

2

UF_InitPressure

Initialization of the pressure field.

cellIndex, time, x, y, z, p

3

UF_InitTemperature

Initialization of the temperature field.

cellIndex, time, x, y, z, t

4

UF_InitCK

Initialization of component concentrations.

cellIndex, time, x, y, z, count, ck

5

UF_SourceEnergy

An energy source.

cellIndex, time, x, y, z, e

6

UF_SourceMomentum

The source of the pulse.

cellIndex, time, x, y, z, u, v, w

7

UF_DynamicViscosity

Dynamic viscosity.

t, p, count, y, ml

8

UF_ThermalConductivity

Coefficient of thermal conductivity.

t, p, count, y, kp

9

UF_SpecificHeat

Heat capacity at constant pressure.

t, p, count, y, cp

10

UF_BC_Param

Parameters of boundary conditions.

faceIndex, patch, iteration, time, x, y, z, parameters

The listed user functions are built into the main LOGOS calculation modules and can be used as templates when developing your own PF in Python or for integration with Engee.

The simulation module

The simulation module cosimulation.py — this is an auxiliary module in Python that provides exchange between Engee and LOGOS over the UDP protocol. The module allows you to organize bidirectional signal exchange between systems in real time according to the following logic:

  • Two UDP sockets are created: reception (port 6848) and transmission (port 6849);

  • The module initializes the connection once and stores the time of the Engee model;

  • The custom LOGO function calls cosimulate(time, signals) and gets a list of values from Engee.

To work, it is enough to place cosimulation.py next to the custom functions and import it at the beginning of the code:

import cosimulation     # или: from cosimulation import engee_sim

Below is a complete sample file cosimulation.py. This module configures two UDP connections between LOGOS and Engee, exchanges data at each calculation step, and stores the current model time of the Engee system. Class EngeeSim creates a connection, receives signals from Engee and sends signals back from LOGOS.

A global object is created at the end of the file. engee_sim, which is initialized during import and used in custom functions.

The contents of the file cosimulation.py
#!/usr/bin/python
# -*- coding: utf-8 -*-

import socket
import struct
from typing import List

# Абстракция для взаимодействия {docs_engee} и LOGOS
class EngeeSim:
    def __init__(self):
        # Сокеты для связи
        self.sock_comm = None  # сокет для отправки данных (LOGOS -> {docs_engee})
        self.sock_snd = None   # сокет для приема данных ({docs_engee} -> LOGOS)
        # Параметры модели {docs_engee}
        self.engee_model_time = 0.0
        self.engee_sample_time = 0.0

    def __del__(self):
        # При удалении объекта закрываем сокеты
        if self.sock_comm:
            self.sock_comm.close()
        if self.sock_snd:
            self.sock_snd.close()

    def init_intercommunicate(self):
        # Инициализация UDP-соединения.
        self.sock_comm = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sock_snd = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sock_snd.settimeout(0.05)
        # Порт 6849 — передача данных из LOGOS в {docs_engee}
        self.sock_comm.connect(("127.0.0.1", 6849))
        # Порт 6848 — прием данных от {docs_engee}
        self.sock_snd.bind(("127.0.0.1", 6848))
        # Отправляем служебное сообщение для установления связи
        self.sock_comm.send(b"INIT")

    def cosimulate(self, logos_model_time: float, signals: List[float]):
        # Обмен сигналами между LOGOS и {docs_engee} на каждом шаге расчета.
        # Проверяем синхронизацию по времени модели
        if logos_model_time <= engee_sim.engee_model_time + engee_sim.engee_sample_time:
            return []

        try:
            # We accept data from {docs_engee}
            recv_data = self.sock_snd.recv(2048)
except socket.timeout:
# If there is no data, we return an empty list
            return []

        # Decompressing the data as a double (8 bytes)
        engee_data = []
        for i in range(0, len(recv_data), 8):
            chunk = recv_data[i:i+8]
            engee_data.append(struct.unpack('d', chunk)[0])

        # The first two values are the step and the {docs_engee} model time
        engee_sim.engee_sample_time = engee_data[0]
        engee_sim.engee_model_time = engee_data[1]
        engee_data = engee_data[2:]

        # Packing signals from LOGOS to send to {docs_engee}
        packed_data = b""
        for sig in signals:
            packed_data += struct.pack("d", sig)

        # Sending data to {docs_engee}
        self.sock_comm.send(packed_data)
        return engee_data

##################################################################
# Initializing data transfer between {docs_engee} and LOGOS
engee_sim = EngeeSim()
engee_sim.init_intercommunicate()
##################################################################

Use in a custom function

To link the calculation in the LOGO with the Engee model, you need to connect the module cosimulation.py and call his method cosimulate() inside the user function (PF). This will allow you to exchange signals at each step: send data from LOGOS to Engee and receive values from there that can be used in calculations.

  1. Open your custom function in the Platform module.

  2. At the very beginning of the function, add the import line:

    import cosimulation   # или: from cosimulation import engee_sim
  3. Then add a challenge cosimulate() to exchange data with Engee.

A ready-made example of the function is shown below.:

import cosimulation  # Подключаем модуль косимуляции

def erosion_user(nsh, nip, ncmr, nhv, Cmr, strainVelF, strain, stress,
                 pu, eu, epsp, rou, divU, ts, loc, tt, time, eraseFlag):

    # Отправляем в {docs_engee} три сигнала: давление, энергию и плотность
    signals_from_engee = cosimulation.engee_sim.cosimulate(time, [pu, eu, rou])

    # Если данных нет ({docs_engee} еще не ответил) — возвращаем все без изменений
    if not signals_from_engee:
        return nsh, nip, ncmr, nhv, Cmr, strainVelF, strain, stress, \
               pu, eu, epsp, rou, divU, ts, loc, tt, time, eraseFlag

    # Извлекаем сигналы, полученные из {docs_engee}
    strain_from_engee = signals_from_engee[0]   # предельная пластическая деформация
    epsp_from_engee = signals_from_engee[1]     # текущая пластическая деформация

    # Критерий разрушения: если epsp >= strain, элемент считается разрушенным
    if epsp_from_engee >= strain_from_engee:
        eraseFlag = True

    # Returning the updated values to the LOGOS calculation
    return nsh, nip, ncmr, nhv, Cmr, strainVelF, strain, stress, \
           pu, eu, epsp_from_engee, rou, divU, ts, loc, tt, time, eraseFlag

How it works:

  1. Module import — when importing cosimulation.py an object is automatically created and configured engee_sim, which opens a UDP connection to Engee.

  2. Challenge cosimulate() — at each step of the calculation, the LOGO:

    • The current model time is passed as the first argument (time);

    • The second is a list of signals that need to be sent to Engee (for example, [pu, eu, rou]).

  3. Data exchange:

    • The module sends these signals to Engee via port 6849;

    • Next, a response is expected from Engee on port 6848;

    • If a response is received, the module returns a list of values that came from Engee.

  4. Data usage — the returned values can be used in the logic of a function, for example, to set certain conditions.

  5. If there is no data available — cosimulate() returns an empty list, and the calculation continues without exchange.

After preparing the module cosimulation.py and writing a custom function (for example, erosion_user) it is necessary to connect it to the LOGO and start a joint calculation with Engee.

Step 1. Connecting the function to the LOGO

  1. Open the "Platform" module in the LOGO.

  2. The Project tab → select the required calculation task. An example of a path where a project can be located: VNIIEF/LOGOS-EXAMPLES-5.3.24.109/LOGOS-MIP/Projects/project_name

    logos 1

  3. Right-click on the task and select "Properties".

    logos 2

    The Single Task Editor window opens:

    logos 3

  4. In the list of PF connectors, find the appropriate one (for example, erosion_user to calculate erosion).

    logos 4

  5. Double-click on the connector to open the Custom Function Editor.

  6. In the editor that opens, paste the code of your function using cosimulate():

    import cosimulation  # Импортируем модуль косимуляции
    
    def erosion_user(nsh, nip, ncmr, nhv, Cmr, strainVelF, strain, stress,
                     pu, eu, epsp, rou, divU, ts, loc, tt, time, eraseFlag):
    
        # Signal exchange between LOGOS and {docs_engee}
        signals = cosimulation.engee_sim.cosimulate(time, [pu, eu, rou])
    
        if not signals:
            return nsh, nip, ncmr, nhv, Cmr, strainVelF, strain, stress, \
                   pu, eu, epsp, rou, divU, ts, loc, tt, time, eraseFlag
    
        strain_from_engee, epsp_from_engee = signals
    
        # Destruction criterion: if epsp >= strain, the element is considered destroyed
        if epsp_from_engee >= strain_from_engee:
            eraseFlag = True
    
        return nsh, nip, ncmr, nhv, Cmr, strainVelF, strain_from_engee, stress, \
               pu, eu, epsp_from_engee, rou, divU, ts, loc, tt, time, eraseFlag
  7. Go back to the Task Editor, select the created function and connect it to the appropriate connector.

LOGOS can have its own set of connectors for each task. Before connecting, make sure that the signature of your function (the list of arguments) matches the interface of the selected connector.


Step 2. Starting the simulation

The startup order is important for proper synchronization of Engee and LOGOS.

  1. First, run the model in Engee. It should be loaded and awaiting connection from LOGOS.

  2. Then run the calculation in LOGOS (within 1 minute after starting the model in Engee).

    logos 5

Engee must be started first! If you start the LOGO before starting the model in Engee, the connection will not be established.

The calculation step in Engee must be equal to or a multiple of the LOGOS calculation step.


Step 3. Checking the successful connection

After launching, check the messages in the Engee log. The successful connection is shown in the lines:

INFO | Object has been created: Logos
INFO | Successfully interconnected with LOGOS!

Step 4. Control of transmitted signals

To verify the data coming from LOGOS, open Data Inspector data inspector icon in Engee:

logos 6 logos 7

Here you can observe the values of the signals transmitted between the systems in real time.

Step 5. Completion of the calculation

After the calculation is completed, both programs shut down synchronously. The calculation results can be viewed in LOGOS via the Scientific View module — select the desired output file in the Postprocessor:

logos 8