|
[Sponsors] |
March 26, 2019, 13:04 |
Warning: UDF FLUENT
|
#1 |
New Member
hraf5
Join Date: Mar 2018
Posts: 8
Rep Power: 8 |
Hi everyone,
I'm getting the following warning when I compiled a UDF function in Fluent. I obtained the following warning: warning C4700: uninitialized local variable 'x' used is this program right, or something is missing?? #include "udf.h" #define PI 3.14 #define A 20.0 #define freq 10.0 DEFINE_PROFILE(unsteady_inlet_x_velocity, thread, position) { real y[ND_ND] ; real x; face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f,thread, position) = sin(15.*PI/180)*A*sin(400.*PI*(x-0.001))*sin(400.*PI*(x-0.001))*sin(freq*2.*PI*t); } end_f_loop(f, thread) } DEFINE_PROFILE(unsteady_inlet_y_velocity, thread, position) { real y[ND_ND]; real x; face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f,thread, position) = cos(15.*PI/180)*A*sin(400.*PI*(x-0.001))*sin(400.*PI(x-0.001))*sin(freq*2.*PI*t); } end_f_loop(f, thread) } |
|
March 26, 2019, 13:28 |
|
#2 | |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66 |
just follow the error message
you declared x here Quote:
Check out the example from the Fluent manual. You are missing lines that should look like so: Code:
F_CENTROID(y, f, thread); x = y[0]; x=y[0] takes the 1st value of the centroid coordinate (the x position in this case). If you want the y coordinate then do y[1], and do y[2] if you want the z coordinate. |
||
March 26, 2019, 16:05 |
question
|
#3 |
Member
Join Date: Sep 2018
Posts: 31
Rep Power: 8 |
Thanks a lot for your advice, I did everything you asked me to do but I still get the error mentioned above
------------------------------------------------------------------------------------ vprofile1.c(31): error C2064: term does not evaluate to a function taking 337 arguments ------------------------------------------------------------------------------------ To clarify things, my basic equation is noted as 1: 1) A*sin(400.*PI*(x-0.001))*sin(400.*PI*(x-0.01))*sin(freq*2.*PI*t) and concerning the X and Y axes present the projection of this equation according to these axes. I hoped things were very clear how can I solve this problem? Best regards |
|
March 26, 2019, 17:38 |
|
#4 |
Member
Join Date: Sep 2018
Posts: 31
Rep Power: 8 |
|
|
March 26, 2019, 22:32 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
put here final version of your code
best regards |
|
March 27, 2019, 04:14 |
|
#6 |
Member
Join Date: Sep 2018
Posts: 31
Rep Power: 8 |
Hello everyone,
I hope someone can compile this code and modify or correct it if there are any errors, I would be very grateful. Best regards ------------------------------------------ #include "udf.h" #define PI 3.14 #define A 20.0 #define freq 10.0 DEFINE_PROFILE(unsteady_inlet_x_velocity, thread, position) { real y[ND_ND] ; real x; face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f,thread, position) = sin(15.*PI/180)*A*sin(400.*PI*(x-0.001))*sin(400.*PI*(x-0.001))*sin(freq*2.*PI*t); } end_f_loop(f, thread) } DEFINE_PROFILE(unsteady_inlet_y_velocity, thread, position) { real y[ND_ND]; real x; face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_CENTROID(y,f,thread); x = y[0]; F_PROFILE(f,thread, position) = cos(15.*PI/180)*A*sin(400.*PI*(x-0.001))*sin(400.*PI(x-0.001))*sin(freq*2.*PI*t); } end_f_loop(f, thread) } |
|
March 27, 2019, 05:13 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
#include "udf.h" #include "math.h" #define PI 3.14 #define A 20.0 #define freq 10.0 DEFINE_PROFILE(unsteady_inlet_x_velocity, thread, position) { real y[ND_ND] ; real x; face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_CENTROID(y,f,thread); x = y[0]; F_PROFILE(f,thread, position) = sin(15.*PI/180)*A*sin(400.*PI*(x-0.001))*sin(400.*PI*(x-0.001))*sin(freq*2.*PI*t); } end_f_loop(f, thread) } |
|
March 27, 2019, 07:28 |
|
#8 |
Member
Join Date: Sep 2018
Posts: 31
Rep Power: 8 |
dear AlexanderZ,
thank you very much for your help to clarify the problem exists only in the part that represents the projection along the axis OY #include "udf.h" #include "math.h" #define PI 3.14 #define A 20.0 #define freq 10.0 DEFINE_PROFILE(unsteady_inlet_x_velocity, thread, position) { real y[ND_ND] ; /* projection along the OX axis */ real x; face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f,thread, position) = sin(15.*PI/180)*A*sin(400.*PI*(x-0.001))*sin(400.*PI*(x-0.001))*sin(freq*2.*PI*t); } end_f_loop(f, thread) } ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- DEFINE_PROFILE(unsteady_inlet_y_velocity, thread, position) { real y[ND_ND]; /* projection along the OY axis */ real x; face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_CENTROID(y,f,thread); x = y[0]; F_PROFILE(f,thread, position) = cos(15.*PI/180)*A*sin(400.*PI*(x-0.001))*sin(400.*PI(x-0.001))*sin(freq*2.*PI*t); } end_f_loop(f, thread) } ---------------------------------------------------------------------- ---------------------------------------------------------------------- Best regards |
|
March 27, 2019, 20:34 |
|
#9 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
to clarify - no
best regards |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 08:15 |
Two questions on Fluent UDF | Steven | Fluent UDF and Scheme Programming | 7 | March 23, 2018 04:22 |
Problem with compiling UDF in Fluent | amojodi | Fluent UDF and Scheme Programming | 4 | April 14, 2015 10:01 |
using METIS functions in fortran | dokeun | Main CFD Forum | 7 | January 29, 2013 05:06 |