CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Error message udf file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 9, 2011, 04:46
Default Error message udf file
  #1
New Member
 
A BIBI
Join Date: Jul 2011
Posts: 3
Rep Power: 15
Keskidi is on a distinguished road
Hello,
i want to introduce a velocity profile at the inlet of a 3D tube.
My udf file is:
#include "udf.h"
DEFINE_PROFILE(inlet_z_velocity,thread,index)
{
real z[ND_ND];
real x;
real y;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(z,f,thread);
x = x[0];
y = x[1];
F_PROFILE(f,thread,index) = 0.217*pow(pow((pow(y,2)+pow(x,2)),0.5)/3.9,1/7);
}
end_f_loop(f,thread)
}


When i put it in fluent i've got the message
line11: subscripted expression is not an array or pointer : double

Thks for your help
Keskidi is offline   Reply With Quote

Old   July 9, 2011, 06:06
Default
  #2
New Member
 
Josy
Join Date: Mar 2009
Location: India
Posts: 29
Rep Power: 17
Josyula is on a distinguished road
Hi,
I think z = x[2]; has to be added.
Check and see.
Josyula is offline   Reply With Quote

Old   July 9, 2011, 06:35
Default
  #3
New Member
 
A BIBI
Join Date: Jul 2011
Posts: 3
Rep Power: 15
Keskidi is on a distinguished road
Now fluent read the file but it is not what i expect
To be more precise, the face is on the XY plane and the velocity orientated in the z direction.
But if i check the initialization, the profile is flat.
I modified the file like that:#include "udf.h"
DEFINE_PROFILE(inlet_z_velocity,thread,index)
{
real z[ND_ND];
real x;
real y;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(z,f,thread);
x = z[1];
y = z[2];
F_PROFILE(f,thread,index) = 0.217*pow(pow((pow(y,2)+pow(x,2)),0.5)/3.9,1/7);
}
end_f_loop(f,thread)
}

Last edited by Keskidi; July 9, 2011 at 09:56.
Keskidi is offline   Reply With Quote

Old   July 9, 2011, 18:19
Default
  #4
Senior Member
 
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18
Micael is on a distinguished road
You want to calculate velocity magnitude in z direction?

If I understand what you want, that could be like that:
Code:
#include "udf.h"
DEFINE_PROFILE(inlet_z_velocity,thread,index)
{
real coord[ND_ND];  /* face centroid coordinate */
real x;
real y;
face_t f;
 
begin_f_loop(f,thread)
  {
    F_CENTROID(coord,f,thread);
    x = coord[0];
    y = coord[1];
    F_PROFILE(f,thread,index) = 0.217*pow(pow((pow(y,2)+pow(x,2)),0.5)/3.9,1./7);
}
  end_f_loop(f,thread)
}
However, the main reason why you got a flat profil is because of "1/7". That is just zero in C language, because operation on 2 integers still gives an integer (integer value of 1/7 is zero). I change it for 1./7 in the code above.
Micael is offline   Reply With Quote

Old   July 9, 2011, 18:48
Default
  #5
New Member
 
A BIBI
Join Date: Jul 2011
Posts: 3
Rep Power: 15
Keskidi is on a distinguished road
Yes exactly.
It's working well with 1./7
Thanks a lot
Keskidi is offline   Reply With Quote

Reply


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
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found piprus OpenFOAM Installation 22 February 25, 2010 14:43
[OpenFOAM] Paraview command not found hardy ParaView 7 September 18, 2008 05:59
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


All times are GMT -4. The time now is 21:11.