udf for pressure variation with time
1 Attachment(s)
i have been working on designing a udf for systolic and diastolic pressure variations. so far i have compiled it in C but fluent gives me error in line 5 . if anybody can detect that error
i have attached my udf . regards |
So you meant pressure variation with space and not time?
There are typos in your udf, you didn't give any value to y, etc. Start with this example from UDF manual 15.0 and insert your else-if conditions: 2.3.19.3. Example 1 - Pressure Profile Code:
/*********************************************************************** |
the pressure variation is with time and i gave the initial value for time = 0.005 sec even that didnt work. udf does not run after line 5. nd y is time .
|
i started off with the same example and derived the udf i have posted ..but now its not running
|
Then you have to define y like this in your udf:
real y = CURRENT_TIME; |
1 Attachment(s)
thank you so much . my udf runs now and is detected at the inlet pressure options.
but the solution does not initialize and gives errors that i am unable to comprehend :confused: i have attached an image of the errors kindly if u can have a look. and secondly do i need to start my fluent via SDK? as it is already interpreting the udf . |
It's hard to say because I don't really know what you tried...
In the udf that you attached in your 1st post, it looks like you are using y for 2 things: position and time. You should define y as position: real y; .... then inside the f_loop: y = x[1]; And define another variable as time: real t = CURRENT_TIME; Good luck |
i dont intend to give y two variables the equations i have used are with respect to time . so y is time not position . so i do not need to define y=x[1], as this represents position. if u can kindly let me know the changes i have to make to make y only time varying
regards |
show us your udf please, not in an attached file, directly in a reply
|
# include "udf.h"
#DEFINE_PROFILE(pressure_profile,t,i) { real x[ND_ND] real y= CURRENT_TIME; face_t f; } begin_f_loop(f,t); { F_CENTROID(x,f,t); if (y>0.005 && y<=0.4); F_profile(f,t,i)=(-492.9*y^4+1224.3*y^3-1081.8*y^2+357.6*y+64.2); else if (y>0.4 && y<=0.46); F_profile(f,t,i)= (100*y+60); else F_profile(f,t,i)=(14195*y^4-11116*y^3+2087*y^2+106*y+70.9); end_f_loop(f,t) } here is my udf. will appreciate any input regards |
inspect the braces compared to the example in post #2...
|
the udf runs in visual studio giving no errors or warnings. now i am going to download SDK. i hope fluent reads it this time
thank you for ur help:) |
Quote:
I don't know about running UDFs in VS, but I can tell you that it's preferable to follow the UDF Manual syntax if you want your udf to work. |
# include "udf.h"
#DEFINE_PROFILE(pressure_profile,t,i) { real x[ND_ND] real y= CURRENT_TIME; face_t f; } this brace is closure for the parameters above.its correct in syntax begin_f_loop(f, t); { F_CENTROID(x, f, t); if (y > 0.005 && y <= 0.4); F_profile(f, t, i) = (-492.9*y ^ 4 + 1224.3*y ^ 3 - 1081.8*y ^ 2 + 357.6*y + 64.2); else if (y > 0.4 && y <= 0.46); F_profile(f, t, i) = (100 * y + 60); else F_profile(f, t, i) = (14195 * y ^ 4 - 11116 * y ^ 3 + 2087 * y ^ 2 + 106 * y + 70.9); }brace not required here otherwise it gives errors end_f_loop(f,t) } |
Quote:
|
Macfly is right about the braces. The variable declarations and the f_loop are both part of the define macro. Closing your brace after the variable declarations says that the macro ends here, and your loop isn't part of anything.
Using Visual Studio to decide whether your code will run or not won't tell you anything useful; UDFs are not programs, they are chunks of code that Fluent uses to compile libraries. |
i have changed the braces as suggested by macfly. but still the problem previals that the solution does not initialize :confused:
|
All times are GMT -4. The time now is 04:25. |