Collision UDF
The collision UDF may replace the built-in collision models Caught On First Touch, Hamaker or Sieving. Select it on the Particles - Interaction Model tab.
A collision UDF contains five functions.
Two sample UDF files are delivered with GeoDict: CollisionUDF-Count.cpp, CollisionUDF-Hamaker.cpp.
udf_entryMessage
This function is called when the UDF is attached and can be used to print a message to the console.
Input: none
Return value: none
Example:
|
udf_exitMessage
This function is called when the UDF is detached and can be used to print a message to the console.
Input: none
Return value: none
Example:
|
udf_numberOfMaterialParameters
The function defines the number of material parameter that the UDF requires as input. This defines the number of material parameters to enter into the Particles tab table. These material parameters may be, for example, the Hamaker constant or the restitution.
Input: none
Return value: integer
Example: the example file CollisionUDF-Count defines two material parameters
|
udf_nameOfMaterialParameters
The function allows to set the headings that will appear in the Particles tab table. You must define headings for a number of parameters as defined in the udf_numberOfMaterialParameters function
Input:
- parameter number (integer)
Return value: const char*
Example: the example file CollisionUDF-Count defines two material parameters
For each material using the collision UDF, two columns will now appear in the Size Distribution table:
|
udf_collision
This function describes the collision of a particle with a solid. It is called whenever a particle collides with the solid filter material. The return value of the function is a struct that contains particle position and velocity after the collision and a trap code number. Filtered particles should get a trap code from 32-39; particles that continue to move after the collision should get a trap code of 0.
Input:
- ParticleData_UDF struct
- CollisionData_UDF struct
- double[] array containing the material parameters of the filter material at the collision point entered in the FilterDict dialog. This array has as many entries as defined in the udf_numberOfMaterialParameters function
Return value: The return value of the function is a struct that contains particle position and velocity after the collision and a trap code.
Example: the example file CollisionUDF-Count
|
GeoDict passes the relevant data to these functions with help of the structs ParticleData_UDF and CollisionData_UDF. These structs are defined in the CollisionStructs.h header file which can be found in the include folder.
ParticleData_UDF
CollisionData_UDF