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

Error message udf file

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 9, 2011, 03:46
Default Error message udf file
  #1
New Member
 
A BIBI
Join Date: Jul 2011
Posts: 3
Rep Power: 6
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, 05:06
Default
  #2
New Member
 
Josy
Join Date: Mar 2009
Location: India
Posts: 29
Rep Power: 8
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, 05:35
Default
  #3
New Member
 
A BIBI
Join Date: Jul 2011
Posts: 3
Rep Power: 6
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 08:56.
Keskidi is offline   Reply With Quote

Old   July 9, 2011, 17:19
Default
  #4
Member
 
Micael Boulet
Join Date: Mar 2009
Location: Quebec, Canada
Posts: 95
Rep Power: 9
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, 17:48
Default
  #5
New Member
 
A BIBI
Join Date: Jul 2011
Posts: 3
Rep Power: 6
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

Thread Tools
Display Modes

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 On
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
Paraview command not found hardy OpenFOAM Paraview & paraFoam 7 September 18, 2008 04:59
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00


All times are GMT -4. The time now is 18:23.