Compiling Coupling Interface Code to an Executable
To compile the EDEM-FLUENT coupling please see the ‘Coupling EDEM with ANSYS Fluent’ E-Learning guide found on the Altair Website. To access the E-Learning Login, go to eLearning Courses > EDEM > Coupling EDEM with ANSYS Fluent.
Windows
To create a simple executable a 3rd party compiler is required to compile C++ code. Altair EDEM does not support any specific compiler. However, Microsoft Visual Studio is commonly used and Visual Studio Community 2017 is shown in this example. When installing Visual Studio, it is important to install the C++ toolset (Universal Windows Platform development and Desktop development with c++). Depending on the installation, these may be installed by default or additional options in the installer.
- Place the .cpp files that you have written in a working directory, e.g. C:\code\Dynamics_Coupling. In this instance, a Free_Body.cpp file is used which can be found on the EDEM Forum.
- Start Visual Studio.
- Create a New Project (Win32 Console Application Visual C++).
Go to File > New > Project.
Set name: freebody
Set location to: C:\code\Dynamics Coupling - Click OK.
-
Select Application Settings and then do the following:
-
Select Console Application.
-
Select Empty Project.
-
Click Finish.
-
-
Add the file Free_Body.cpp to the project.
-
Copy this file to C:\code\Dynamics_Coupling\freebody.
-
Right-click Source Files > Add > Existing Item > Free_Body.cpp > Add.
-
- Go to Project > Properties and set the following:
- Configuration to All Configurations.
- Platform to All Platforms.
- Select Configuration Properties > C/C++ > General.
- Select Additional Include Directories > <Edit…>.
- Add the following paths then click OK.
C:\Program Files\Altair\2022.3\EDEM\bin\src\Api\Coupling
C:\Program Files\Altair\2022.3\EDEM\bin\src\Api\Core
-
Select Configuration Properties > Linker > General > Additional Library Directories > Edit.
Include the following: C:\Program Files\Altair\2022.3\EDEM\bin\lib\
-
Select Configuration Properties > Linker > Input > Additional Dependencies > Edit. \
-
Add EDEMCouplingClient4.lib.
-
Click OK.
-
-
Go to Project > Properties > Configuration Manager and set the following:
-
Active solution configuration to Release or Debug.
-
Active solution platform to x64 > close.
-
Build the solution (Build > Build Solution) to create the .exe file.
-
Linux
To compile coupling interface applications for use with EDEM running on Linux, it is recommended to use the GNU Compiler Collection, more referred to as gcc.
Compiling with gcc
If you have the source code <source_code>.cpp file in your working directory, use the following two commands to compile the source code:
g++ -std=c++11 -c -g -DDEMLINUX -I ~/2022.3/altair/EDEM/src/Api/Core -I ~/2022.3/altair/EDEM/src/Api/Coupling/ -MMD -MP -MF <output>.o.d -o <output>.o <source_code>.cpp
followed by:
g++ -std=c++11 -o <compiled> <output>.o -L ~/2022.3/altair/EDEM/lib -lEDEMCouplingClient4 -L ~/2022.3/altair/EDEM/bin -lQt5Core -lQt5Network
where <source_code>, <output>, and <compiled> are filenames of your choice. EDEM_XXXX is replaced with the version of EDEM you have installed, libEDEMCouplingClientXXXXX is replaced with the coupling client library version associated with it, and the libQtXXXX entries use the Qt version associated with that EDEM release.
The following table represents the coupling client library and Qt versions for reference:
EDEM version | Coupling Client Library version | libQt version |
2022 | libEDEMCouplingClient4.so | 5.12 |
2021 | ||
2020 | ||
2019 | 5.6 | |
2018 | ||
2017.2 | libEDEMCouplingClientV3_2_0.so | |
2017.1 | libEDEMCouplingClientV3_1_0.so | |
2017.0 | libEDEMCouplingClientV3_0_0.so |
(c) 2023 Altair Engineering Inc. All Rights Reserved.