|
[Sponsors] |
March 3, 2022, 10:47 |
Referring to Arguments/ Variables in UDF
|
#1 |
Member
Will Crawford-Jones
Join Date: Jan 2021
Posts: 43
Rep Power: 5 |
Hello,
I'm creating my own UDF for 6-DOF contact. How do I refer to specific variables in my UDF? Specifically, i'm looking to refer to the components of my 6-DOF body's angular velocity, the components of my 6-DOF body' s velocity, the components of hydrodynamic torque applied to my 6-DOF body and the components of my hydrodynamic force applied to my 6-DOF body. I know i'm meant to refer to them near the top of my UDF and in the uclib.c file, but don't know the specific 'name' for these variables/ arguments. Please let me know where I can find a list. I hope this make sense, please let me know if not. Thanks Will |
|
March 4, 2022, 07:25 |
|
#2 |
Member
Will Crawford-Jones
Join Date: Jan 2021
Posts: 43
Rep Power: 5 |
To give you a little more information. I have made separate reports of these four variables and therefore they exist as a field function too. I want to refer to them as a field function in my UDF.
In my uclib.c file I have included... ucarg(calculateForce, "Cell", "$6-DOFBodyAngularVelocityyReport", sizeof(CoordReal[1])); ucarg(calculateForce, "Cell", "$6-DOFBodyMomentyReport", sizeof(CoordReal[1])); ucarg(calculateForce, "Cell", "$6-DOFBodyForcexReport", sizeof(CoordReal[1])); ucarg(calculateForce, "Cell", "$6-DOFBodyForcezReport", sizeof(CoordReal[1])); ucarg(calculateForce, "Cell", "$6-DOFBodyVelocityxReport", sizeof(CoordReal[1])); ucarg(calculateForce, "Cell", "$6-DOFBodyVelocityzReport", sizeof(CoordReal[1])); Near the top of my User Function I have included... calculateForce(Real (*result)[3], int size, CoordReal (*position)[3], unsigned int *bodyID, CoordReal (*bodyPosition)[3], CoordReal (*"$6-DOFBodyAngularVelocityyReport")[1], CoordReal (*"$6-DOFBodyMomentyReport")[1], CoordReal (*"$6-DOFBodyForcexReport")[1], CoordReal (*"$6-DOFBodyForcezReport")[1], CoordReal (*"$6-DOFBodyVelocityxReport")[1], CoordReal (*"$6-DOFBodyVelocityzReport")[1]) and a little lower down have ... omega[0] = 0; omega[1] = "$6-DOFBodyAngularVelocityyReport"; omega[2] = 0; torque[0] = 0; torque[1] = "$6-DOFBodyMomentyReport"; torque[2] = 0; drag_force[0] = "$6-DOFBodyForcexReport"; drag_force[1] = 0; drag_force[2] = "$6-DOFBodyForcezReport"; velocity[0] = "$6-DOFBodyVelocityxReport"; velocity[1] = 0; velocity[2] = "$6-DOFBodyVelocityzReport"; i then refer to the variables as drag_force[0] etc. However, when I try to compile I get the errors "error C2059: syntax error: 'string'" , "error C2090: function returns array" as well as some other errors. Any ideas how I should work with these variables? Thank you |
|
March 12, 2022, 10:41 |
|
#3 |
Member
Will Crawford-Jones
Join Date: Jan 2021
Posts: 43
Rep Power: 5 |
Star-CCM+ manual says "Field functions can be accessed in user functions by requesting them with their names enclosed in double- quotes; the syntax depends on whether they are scalar or vector field functions. Temperature would be referred to as “$Temperature”, for example, and velocity as “$$Velocity”. " And "Scalar field functions have CoordReal elemental type, even when the fundamental data that they represent has a different type." What I refer to above are scalars as they are the components of a vector.
Can any one provide help? Thanks in advance for any help you can provide. |
|
Tags |
dfbi, udf, variables |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Extracting flow variables inside domain in UDF | Abhinand | Fluent UDF and Scheme Programming | 8 | November 20, 2019 15:42 |
UDF to read and file flow variables | pramode77 | Fluent UDF and Scheme Programming | 0 | December 1, 2014 16:18 |
Setting up a parametric simulation with UDF variables | rohinibc | Fluent UDF and Scheme Programming | 4 | November 19, 2014 11:52 |
UDF for mean variables | Gab | FLUENT | 0 | September 28, 2007 17:17 |
udf with spacial and time variables | hongxiao | FLUENT | 6 | March 17, 2005 23:46 |