CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   3d parabolic Velocity profile (https://www.cfd-online.com/Forums/fluent-udf/153369-3d-parabolic-velocity-profile.html)

mohibanwar May 24, 2015 15:54

3d parabolic Velocity profile
 
Hello i have written a code for 3-d velocity profile at an inlet.But when i interpret the code it give me the following error:

cpp -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.7/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.7/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.7/client/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.7/multiport/src" -I. -DUDF
ONFIG_H="<udfconfig-host.h>" "C:\Working\jet.c"
Error: C:\\Working\\jet.c: line 13: subscripted expression is not an array or pointer: double.

Can any one suggest me the solution for it,It will be a huge favor to me thanks.

COde is as following:

#include "udf.h"

DEFINE_PROFILE(inlet_z_velocity, thread, index)
{
real z[ND_ND]; /* this will hold the position vector */
real x;
real y;
real a,n;
real Umax,Umean;
face_t f;
begin_f_loop(f, thread) /*loops over all faces in the thread passed in the DEFINE macro argument*/
{
F_CENTROID(x,f,thread);
x =z[1];
y =z[1];

n = 7;
d = 0.001; /* m */
Umean = 15; /* m/s */

Umax = Umean*(((n+1)*(2*n+1))/(2*pow(n,2)));
a = pow((pow(y,2)+pow(z,2)),0.5);
F_PROFILE(f, thread, index) =-1(Umax*pow(1-sqrt(pow(x,2)+pow(y,2))/(d/2),(1/n)));
}
end_f_loop(f, thread)
}

`e` May 24, 2015 18:17

You've mixed up the position variables (possibly from copying the code over from a 2-D case), specifically:
  1. You've declared "z" as an array but used your variable "x" for the F_CENTROID macro.
  2. You're assigning the same position dimension to both your "x" and "y" variables (using "z[1]").

Try using another array for your position vector to avoid confusion, for example:
Code:

real posVector[ND_ND];
real x, y, z;
...
F_CENTROID(posVector,f,thread);
x = posVector[0];
y = posVector[1];
z = posVector[2];


mohibanwar May 25, 2015 10:29

Quote:

Originally Posted by `e` (Post 547514)
You've mixed up the position variables (possibly from copying the code over from a 2-D case), specifically:
  1. You've declared "z" as an array but used your variable "x" for the F_CENTROID macro.
  2. You're assigning the same position dimension to both your "x" and "y" variables (using "z[1]").

Try using another array for your position vector to avoid confusion, for example:
Code:

real posVector[ND_ND];
real x, y, z;
...
F_CENTROID(posVector,f,thread);
x = posVector[0];
y = posVector[1];
z = posVector[2];


Hello Respected Senior Member"e",
I am really thankful to you for your help and i really appreciate you to Answer our irritating immature posts as we are new users to the Fluent UDF programming and after your guidance and suggestions i have change my code but there are last error while compiling kindly figure it out what is the problem in it.Thanks

Error is,
..\..\src\modi1.c(22) : error C2064: term does not evaluate to a function taking -1000 arguments

May be it is in the 22 line of program as i already expected as i have change this according to my case.Kindly check my program once agian.I will be very thankful to you.
My modified code is;

#include "udf.h"
DEFINE_PROFILE(inlet_z_velocity, thread, index)
{
real posVector[ND_ND]; /* this will hold the position vector */
real x, y, z;
real a,n,d;
real Umax,Umean;
face_t f;
begin_f_loop(f, thread) /*loops over all faces in the thread passed in the DEFINE macro argument*/
{
F_CENTROID(posVector,f,thread);
x = posVector[0];
y = posVector[1];
z = posVector[2];

n = 7;
d = 0.001; /* m */
Umean = 15; /* m/s */

Umax = Umean*(((n+1)*(2*n+1))/(2*pow(n,2)));
a = pow((pow(x,2)+pow(y,2)),0.5);
F_PROFILE(f, thread, index) =-1(Umax*pow(1-sqrt(pow(x,2)+pow(y,2))/(d/2),(1/n)));
}
(PROBLEM IS HERE)
end_f_loop(f, thread)
}

`e` May 25, 2015 19:02

You've forgotten the multiplication operator "*" after the "-1". The outer brackets and "1" are unnecessary; try:

Code:

F_PROFILE(f, thread, index) = -Umax*pow(1-sqrt(pow(x,2)+pow(y,2))/(d/2),(1/n));


All times are GMT -4. The time now is 00:27.