CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

Referring to Arguments/ Variables in UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By wcj1n18

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 3, 2022, 09:47
Default Referring to Arguments/ Variables in UDF
  #1
Member
 
Will Crawford-Jones
Join Date: Jan 2021
Posts: 43
Rep Power: 5
wcj1n18 is on a distinguished road
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
xyg13147755292 likes this.
wcj1n18 is offline   Reply With Quote

Old   March 4, 2022, 06:25
Default
  #2
Member
 
Will Crawford-Jones
Join Date: Jan 2021
Posts: 43
Rep Power: 5
wcj1n18 is on a distinguished road
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
wcj1n18 is offline   Reply With Quote

Old   March 12, 2022, 09:41
Default
  #3
Member
 
Will Crawford-Jones
Join Date: Jan 2021
Posts: 43
Rep Power: 5
wcj1n18 is on a distinguished road
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.
wcj1n18 is offline   Reply With Quote

Reply

Tags
dfbi, udf, variables


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 14:42
UDF to read and file flow variables pramode77 Fluent UDF and Scheme Programming 0 December 1, 2014 15:18
Setting up a parametric simulation with UDF variables rohinibc Fluent UDF and Scheme Programming 4 November 19, 2014 10:52
UDF for mean variables Gab FLUENT 0 September 28, 2007 16:17
udf with spacial and time variables hongxiao FLUENT 6 March 17, 2005 22:46


All times are GMT -4. The time now is 05:12.