Create a Cohesion Model on Linux
This section describes how to create a new cohesion contact model on Linux. To
complete this tutorial on Linux instead of Windows, the library file which is loaded into
EDEM must be compiled as a.so
(shared-object) file instead of a .dll
file.
-
Extract the following tutorial source files to a shared directory:
cohesion_prefsV2.txt
– Preference text file containing cohesion inputsCCohesionParameters.cpp
– CPU file for managing preference file inputsCCohesionParametersList.cpp
– CPU file for managing preference file inputsCVariableCohesion_v3_7_0.cpp
– CPU Physics modelVariableCohesion_v3_7_0.cpp
– CPU version fileCCohesionParameters.h
– Header file for managing preference file inputsCCohesionParametersList.h
– Header file for managing preference file inputsVariableCohesion_v3_7_0.h
– CPU header file for the Physics modelNote: EDEM header files (.h
) are required to compile the Contact Model as a Library (.so
). For more information about why header files are important, see the Programming Guide.- Open the file
CVariableCohesion_v3_7_0.cpp
in your preferred file editor.
-
Create the .
so
library file.- Open a terminal in the directory containing the source files.
- Enter the following
command:
gcc -std=c++11 -O2 -shared -fPIC -I/opt/Altair/2024.1/EDEM/src/Api/ContactModels/ -I/opt/Altair/2024.1/ EDEM/src/Api/Core/ -I/opt/Altair/2024.1/ EDEM/src/Misc/ CCohesionParameters.cpp CCohesionParametersList.cpp CVariableCohesion_v3_7_0.cpp VariableCohesion_v3_7_0.cpp -o VariableCohesion.so
If successful, a file namedVariableCohesion.so
will be displayed in the directory.Note: If the build fails, additional information is displayed to explain build failure. For more information about how to compile the library file, see Compile API Models to Libraries. -
Once the
.so
file is successfully compiled, see EDEM Creator - Use the Linear Cohesion API Model and proceed with the simulation.Note: The changes made within the source files are identical for both operating systems. For more information about how to add the Time Factor, see Create the New Cohesion Physics using a text editor such as Emacs, Vim or gedit, before compilation.