Compile Coupling Interface Code to an Executable
You can compile simple user-written code into a stand-alone executable to work with the coupling interface.
-
Download and install a third-party compiler to compile C++ code.
Note: To create a simple executable a third-party compiler is required to compile C++ code as 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++ tool set (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.For example,C:\code\Dynamics_Coupling
. In this instance, aFree_Body.cpp
file is used which can be found on the EDEM forum. -
Start Visual Studio.
-
To create a new project (Win32 Console Application Visual C++), go to
.
-
Set
name:freebody
. -
Set the location to:
C:\code\Dynamics Coupling
and then 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 the following location:
C:\code\Dynamics_Coupling\freebody
. - Right-click
- Copy this file to the following location:
-
Go to
and set the following:
- Configuration to All Configurations.
- Platform to All Platforms.
- Select
- Select Additional Include Directories and then click Edit.
- Add the following paths then click
OK.
C:\Program Files\Altair\<version number>\EDEM\bin\src\Api\Coupling
C:\Program Files\Altair\<version number>\EDEM\bin\src\Api\Core
.
-
Select
.
- Include the following:
C:\Program Files\Altair\<version number>\EDEM\lib\
- Include the following:
-
Select
.
- Add
EDEMCouplingClient4.lib
. - Click OK.
- Add
-
Go to
, and set the following:
- Active solution configuration to Release or
Debug.
Active solution platform to x64 and then click Close.
Build the solution (
) to create the.exe
file.
Note: To compile the EDEM-FLUENT coupling, see Coupling EDEM with ANSYS Fluent’ E-Learning on the Altair website. To access the E-Learning Login, go to with ANSYS Fluent. - Active solution configuration to Release or
Debug.
Compile Coupling Interface Applications on 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.
<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 ~/<version number>/altair/EDEM/src/Api/Core -I ~/<version number>/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 ~/<version number>/altair/EDEM/lib -lEDEMCouplingClient4 -L ~/<version number>/altair/EDEM/bin -lQt5Core -lQt5Network
where
<source_code>
, <output>
, and
<compiled>
are file names of your choice.
Replace EDEM_XXXX
with the version of EDEM you have installed, replace
libEDEMCouplingClientXXXXX
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 lists the coupling client library and libQt versions:
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 |