|
[Sponsors] |
Can someone help me with a UDF for a simple rotatory geometry?? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 1, 2013, 23:00 |
Can someone help me with a UDF for a simple rotatory geometry??
|
#1 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
Hello, I am trying to create a code to this geometry, as you can see at the images it is a simple geometry, it is a pipe with 2 bodies rotating inside, so far I have been reading the UDF manual, and I made a code I would like to make some questions but first here is the code:
#include "udf.h" DEFINE_CG_MOTION(Rotation,dt,vel,omega,time,dtime) { Thread *t; face_t f; /*reset velocities*/ NV_S(vel, =, 0.0); NV_S(omega, =, 0.0); /*not too sure what this is for*/ if (!Data_Valid_P()) return; /*get the thread pointer for which this motion is defines (I assume that this is the cell zone that I made)*/ t = DT_THREAD(dt); /* motion */ velocity[0] = 0; velocity[1] = 0; velocity[2] = 0; omega[0] = 0; omega[1] = 0; /*This will be just a random number, I will try different values anyway*/ omega[2] = 120; /*not sure how to do the loop and if I should make the loop for faces or cells*/ } Question 1: Do I have to create a UDF for each body? Or can I include both bodies at the same UDF? Question 2: Well as you can see at the code, I am not quite sure of how to make the loop (I have a decent programming knowledge, and because of this forced to learn C, I know how to create a loop, but I do not know what variables to include for the loop, so far I know the pointer will tell the program to use some faces/cells and that leads me to my other question) Question 3: Should I use faces or cells for the Loop? Question 4: There is something that I am missing? I read just the first 2 chapters of the UDF guide, I will finish all the guide soon, but I think that the next chapters will not clear those doubts. Thanks |
|
August 2, 2013, 00:25 |
|
#2 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
Sorry wrong forum
|
|
August 2, 2013, 18:23 |
|
#3 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
I would like to know if I should use the cells or the faces, so far I understand that I should use the faces because that will make the adjacent cells to move as well and that is what I am looking for
|
|
August 5, 2013, 09:07 |
|
#4 |
Senior Member
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23 |
Question 1: You do not need separate UDFs unless you have different rotational speed for each body. Yes you can use one UDF for several bodies.
Question 2: For simple rotational and translational motion there seem to be nothing wrong with the UDF. Instead of what you have you may use #include "udf.h" DEFINE_CG_MOTION(Rotation,dt,vel,omega,time,dtime) { /* motion */ velocity[0] = 0; velocity[1] = 0; velocity[2] = 0; omega[0] = 0; omega[1] = 0; /*This will be just a random number, I will try different values anyway*/ omega[2] = 120; /*not sure how to do the loop and if I should make the loop for faces or cells*/ } Question 3: I dont think so. Question 4: Again this is good enough for simple rotationg motion. Make sure you have your Dynamic mesh settings right. |
|
August 5, 2013, 16:51 |
|
#5 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
Vasava thanks for your reply, sadly I have to use 2 UDF because I have the same angular velocity but in different directions, therefore I will have to create a new UDF exactly the same but with Omega[2] = -120 instead of Omega[2] = 120, anyway I will try this today and post here the experience, to help others with the same problem, thanks again.
|
|
August 8, 2013, 00:37 |
|
#6 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
I will try your advice tomorrow thanks for it
|
|
August 8, 2013, 22:15 |
|
#7 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
Now I am getting this error:
The UDF library you are trying to load (libudf) is not compiled for 3ddp on the current platform (win64). The system cannot find the file specified. Not idea what it is Saw different posts but none of them were solved |
|
August 9, 2013, 01:55 |
|
#8 |
Senior Member
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23 |
You need to setup your visual c++ and SDK right. Here is a document that can help you.
|
|
August 9, 2013, 18:33 |
|
#9 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
Thank you Mr.Vasava you have been very helpful
|
|
August 9, 2013, 21:54 |
|
#10 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
My CMD shell says at the end v6.0 instead of v7.0, would this generate errors? Or I am able to work with this?
|
|
August 9, 2013, 22:14 |
|
#11 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
I uploaded my code and I got this warning
Rotation.c ..\..\src\Rotation.c(6) : error C2065: 'velocity' : undeclared identifier ..\..\src\Rotation.c(6) : error C2109: subscript requires array or pointer type ..\..\src\Rotation.c(7) : error C2109: subscript requires array or pointer type ..\..\src\Rotation.c(8) : error C2109: subscript requires array or pointer type I fixed the first one (pretty obvious) and I will work on the other ones. |
|
August 9, 2013, 22:19 |
|
#12 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
Looks like it was enough to just modify Velocity to Vel
|
|
August 10, 2013, 00:04 |
|
#13 |
Member
Arthur Loginow
Join Date: Aug 2012
Posts: 99
Rep Power: 14 |
When I build the udf everything is fine, when I load the library everything is fine when I save everything is fine, when I close the program and try to open the same case again I got this error from the fluent console
Auto-compilation of "libudf" failed. Please try to compile it manually. Opening library "C:\Users\Arthur\Desktop\Rotation2_files\dp0\FFF\F luent\libudf"... Error: The UDF library you are trying to load (libudf) is not compiled for 3ddp on the current platform (win64). Somehow is not working... |
|
August 12, 2013, 02:28 |
|
#14 |
Senior Member
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23 |
The error 'The UDF library you are trying....' means that your UDF has not been compiled.
The answers to 'how to fix?' lies in the errors: ..\..\src\Rotation.c(6) : error C2065: 'velocity' : undeclared identifier ..\..\src\Rotation.c(6) : error C2109: subscript requires array or pointer type ..\..\src\Rotation.c(7) : error C2109: subscript requires array or pointer type ..\..\src\Rotation.c(8) : error C2109: subscript requires array or pointer type Usually these errors even pin-point to the line where these errors occur. If you post your UDF here we can try to fix it. |
|
August 12, 2013, 09:23 |
|
#15 |
New Member
baydu
Join Date: Sep 2011
Posts: 10
Rep Power: 15 |
Try the following UDF, it is from the gear pump tutorial. You don't need to specify zero values because defaults are zero.
Check you that tutorial how to setup dynamic mesh parameters etc. #include "udf.h" DEFINE_CG_MOTION(object1, dt, vel, omega, time, dtime) { Domain *domain; domain = Get_Domain(1); omega[2]=-220.; } DEFINE_CG_MOTION(object2, dt, vel, omega, time, dtime) { Domain *domain; domain = Get_Domain(1); omega[2]=220.; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
FLUENT UDF Simple error. | startup0820 | Fluent UDF and Scheme Programming | 0 | August 14, 2012 04:54 |
Need help on meshing this simple geometry | nha1g08 | ANSYS Meshing & Geometry | 3 | March 9, 2011 03:13 |
[snappyHexMesh] Irregular mesh generation for simple box geometry | ajl42 | OpenFOAM Meshing & Mesh Conversion | 0 | March 7, 2011 18:04 |
Problem with a simple UDF to calculate cell-averaged particle values | kmayank | FLUENT | 1 | January 18, 2011 02:40 |
vitual _ real | deneb | FLUENT | 3 | January 22, 2007 05:31 |