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

please help me to correct my udf

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By pakk
  • 1 Post By pakk
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 5, 2017, 16:43
Default please help me to correct my udf
  #1
New Member
 
anonymousss
Join Date: Jul 2017
Posts: 10
Rep Power: 9
alikhan is on a distinguished road
hi
im trying to create a tornado ,so i write audf for simulating the tornado but i cant set the angle between two radial and tangential velocities in cylinderical domain which has the inlet in half of the body .in tornado i need swirling ratio .it's equation is s=tantetha/2a that 2a has a constant value but i dont have thetha , so by this udf that i have i should have s=.5 but i cant set thetha a canstant thetha to reach .5 in value beacase i dont have thetha can u correct my udf im really need it for my thesis



/************************************************** ***********************/
/* vprofile.c */
/* UDF for specifying a steady-state velocity profile boundary condition */
/************************************************** ***********************/

#include "udf.h"

DEFINE_PROFILE(inlet_radial_velocity, thread, position)
{
real x[ND_ND]; /* this will hold the position vector */
real z;
face_t f;

begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z = x[2];
F_PROFILE(f,thread,position)= 10.*pow((z/106.),1./7.);
}
end_f_loop(f,thread)
}

/************************************************** ***********************/
/* vprofile.c */
/* UDF for specifying a steady-state velocity profile boundary condition */
/************************************************** ***********************/

#include "udf.h"

DEFINE_PROFILE(inlet_tangential_velocity, thread, position)
{
real x[ND_ND],theta; /* this will hold the position vector */
real z;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z = x[2];
theta=atan(x[1]/x[0]);
F_PROFILE(f,thread,position)= 2.*1.0176*(tan(theta)/2.05)*10.*pow((z/106.),1./7.);
}
end_f_loop(f,thread)
}
alikhan is offline   Reply With Quote

Old   December 6, 2017, 04:57
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by alikhan View Post
...it's equation is s=tantetha/2a that 2a has a constant value but i dont have thetha , so by this udf that i have i should have s=.5 but i cant set thetha a canstant thetha to reach .5 in value beacase i dont have thetha ...
I try to find out what you are asking... It looks like you want to set theta, but you can not find theta in your code...
Quote:
...
theta=atan(x[1]/x[0]);
...
Found it! Does this solve your problem? If not, be clear about what you want, because then I have no idea what you are asking...
alikhan likes this.
pakk is offline   Reply With Quote

Old   December 6, 2017, 06:30
Unhappy thank you pakk for your reply
  #3
New Member
 
anonymousss
Join Date: Jul 2017
Posts: 10
Rep Power: 9
alikhan is on a distinguished road
Boundary conditions for tornado simulator and bluff-body
At the inlet, the flow velocity has two components (radial and tangential) in order to
produce the swirling flow field. The radial and tangential velocity components are given
by equations (1) and (2), respectively.

1=V1*(z/z1)^1/7 2=Vt=2H0/R0*S*Vr i have the value of V1=10m/s ,Z1=106m,2H0/R0=2*1.0176,s=tantheta/2.05 that S should have value equal to 0.5 thetha is un known i set it constant like 45 degree once another time in radian but nothing happen
alikhan is offline   Reply With Quote

Old   December 6, 2017, 06:40
Default im really appreciated pakk for your answer it,s the domain
  #4
New Member
 
anonymousss
Join Date: Jul 2017
Posts: 10
Rep Power: 9
alikhan is on a distinguished road
Capture1.JPGCapture.JPGCapture2.JPGCapture3.JPGCapture4.JPG
alikhan is offline   Reply With Quote

Old   December 6, 2017, 06:42
Red face
  #5
New Member
 
anonymousss
Join Date: Jul 2017
Posts: 10
Rep Power: 9
alikhan is on a distinguished road
Quote:
Originally Posted by pakk View Post
I try to find out what you are asking... It looks like you want to set theta, but you can not find theta in your code...

Found it! Does this solve your problem? If not, be clear about what you want, because then I have no idea what you are asking...
thank you so much i give you some information may be it help you to understand my problem pleasr read my replies
alikhan is offline   Reply With Quote

Old   December 6, 2017, 06:44
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Copied from your code:

Code:
theta=atan(x[1]/x[0]);
F_PROFILE(f,thread,position)= 2.*1.0176*(tan(theta)/2.05)*10.*pow((z/106.),1./7.);
For simplicity, let's define S and a:

Code:
theta=atan(x[1]/x[0]);
a=1.025;
S=tan(theta)/(2*a);
F_PROFILE(f,thread,position)= 2.*1.0176*S*10.*pow((z/106.),1./7.);
I did nothing until now, just rephrasing your code.

And now you want to use a different definition for S, namely S=0.5.
Code:
theta=atan(x[1]/x[0]);
a=1.025;
S=0.5;
F_PROFILE(f,thread,position)= 2.*1.0176*S*10.*pow((z/106.),1./7.);
Let's combine everything, and remove unnecessary definitions:
Code:
F_PROFILE(f,thread,position)= 2.*1.0176*0.5*10.*pow((z/106.),1./7.);
Is this what you want?
pakk is offline   Reply With Quote

Old   December 6, 2017, 07:10
Red face
  #7
New Member
 
anonymousss
Join Date: Jul 2017
Posts: 10
Rep Power: 9
alikhan is on a distinguished road
Quote:
Originally Posted by pakk View Post
Copied from your code:

Code:
theta=atan(x[1]/x[0]);
F_PROFILE(f,thread,position)= 2.*1.0176*(tan(theta)/2.05)*10.*pow((z/106.),1./7.);
For simplicity, let's define S and a:

Code:
theta=atan(x[1]/x[0]);
a=1.025;
S=tan(theta)/(2*a);
F_PROFILE(f,thread,position)= 2.*1.0176*S*10.*pow((z/106.),1./7.);
I did nothing until now, just rephrasing your code.

And now you want to use a different definition for S, namely S=0.5.
Code:
theta=atan(x[1]/x[0]);
a=1.025;
S=0.5;
F_PROFILE(f,thread,position)= 2.*1.0176*S*10.*pow((z/106.),1./7.);
Let's combine everything, and remove unnecessary definitions:
Code:
F_PROFILE(f,thread,position)= 2.*1.0176*0.5*10.*pow((z/106.),1./7.);
Is this what you want?
thank you so much is there a lot of difference between my code and this correction you made i want to know why?
alikhan is offline   Reply With Quote

Old   December 6, 2017, 07:17
Default is this okay due to your correction?
  #8
New Member
 
anonymousss
Join Date: Jul 2017
Posts: 10
Rep Power: 9
alikhan is on a distinguished road
/************************************************** ***********************/
/* vprofile.c */
/* UDF for specifying a steady-state velocity profile boundary condition */
/************************************************** ***********************/

#include "udf.h"

DEFINE_PROFILE(inlet_radial_velocity, thread, position)
{
real x[ND_ND]; /* this will hold the position vector */
real z;
face_t f;

begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z = x[2];
F_PROFILE(f,thread,position)= 10.*pow((z/106.),1./7.);
}
end_f_loop(f,thread)
}

/************************************************** ***********************/
/* vprofile.c */
/* UDF for specifying a steady-state velocity profile boundary condition */
/************************************************** ***********************/

#include "udf.h"

DEFINE_PROFILE(inlet_tangential_velocity, thread, position)
{
real x[ND_ND],theta; /* this will hold the position vector */
real z;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z = x[2];
theta=atan(x[1]/x[0]);
a=1.025;
S=0.5;
S=tan(theta/2*a);
F_PROFILE(f,thread,position)= 2.*1.0176*S*10.*pow((z/106.),1./7.);
}
end_f_loop(f,thread)
}

alikhan is offline   Reply With Quote

Old   December 6, 2017, 07:23
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by alikhan View Post
thank you so much is there a lot of difference between my code and this correction you made i want to know why?
If you want to know why: read my post. I did my best to explain it, I am not going to repeat myself. If you have specific questions, come back.
alikhan likes this.
pakk is offline   Reply With Quote

Old   December 6, 2017, 07:26
Default
  #10
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by alikhan View Post
/************************************************** ***********************/
/* vprofile.c */
/* UDF for specifying a steady-state velocity profile boundary condition */
/************************************************** ***********************/

#include "udf.h"

DEFINE_PROFILE(inlet_radial_velocity, thread, position)
{
real x[ND_ND]; /* this will hold the position vector */
real z;
face_t f;

begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z = x[2];
F_PROFILE(f,thread,position)= 10.*pow((z/106.),1./7.);
}
end_f_loop(f,thread)
}

/************************************************** ***********************/
/* vprofile.c */
/* UDF for specifying a steady-state velocity profile boundary condition */
/************************************************** ***********************/

#include "udf.h"

DEFINE_PROFILE(inlet_tangential_velocity, thread, position)
{
real x[ND_ND],theta; /* this will hold the position vector */
real z;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z = x[2];
theta=atan(x[1]/x[0]);
a=1.025;
S=0.5;
S=tan(theta/2*a);
F_PROFILE(f,thread,position)= 2.*1.0176*S*10.*pow((z/106.),1./7.);
}
end_f_loop(f,thread)
}

This is of course not ok. Because you are not careful about what you replaced. Be more careful! Details matter!
alikhan likes this.
pakk is offline   Reply With Quote

Old   December 6, 2017, 07:28
Wink thank you so much
  #11
New Member
 
anonymousss
Join Date: Jul 2017
Posts: 10
Rep Power: 9
alikhan is on a distinguished road
Quote:
Originally Posted by pakk View Post
This is of course not ok. Because you are not careful about what you replaced. Be more careful! Details matter!
thank you so much i try my best to make it . have nice day
alikhan is offline   Reply With Quote

Old   December 6, 2017, 15:23
Unhappy hi i know that is untolerable but i need your help
  #12
New Member
 
anonymousss
Join Date: Jul 2017
Posts: 10
Rep Power: 9
alikhan is on a distinguished road
Quote:
Originally Posted by pakk View Post
Copied from your code:

Code:
theta=atan(x[1]/x[0]);
F_PROFILE(f,thread,position)= 2.*1.0176*(tan(theta)/2.05)*10.*pow((z/106.),1./7.);
For simplicity, let's define S and a:

Code:
theta=atan(x[1]/x[0]);
a=1.025;
S=tan(theta)/(2*a);
F_PROFILE(f,thread,position)= 2.*1.0176*S*10.*pow((z/106.),1./7.);
I did nothing until now, just rephrasing your code.

And now you want to use a different definition for S, namely S=0.5.
Code:
theta=atan(x[1]/x[0]);
a=1.025;
S=0.5;
F_PROFILE(f,thread,position)= 2.*1.0176*S*10.*pow((z/106.),1./7.);
Let's combine everything, and remove unnecessary definitions:
Code:
F_PROFILE(f,thread,position)= 2.*1.0176*0.5*10.*pow((z/106.),1./7.);
Is this what you want?



i dont know how to apply both s=0.5 and s= tan(theta)/2a at the same time itry alot but i'm really weak in programming and udf
alikhan is offline   Reply With Quote

Old   December 11, 2017, 04:22
Default
  #13
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by alikhan View Post
i dont know how to apply both s=0.5 and s= tan(theta)/2a at the same time itry alot but i'm really weak in programming and udf
s=0.5 and s=tan(theta)/2a means tan(theta)/2a=0.5

So if s=0.5, you don't have to set theta anymore... That is what I did above.
pakk 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
Fluent Radiation/porous media Schmitt pierre-Louis FLUENT 26 September 1, 2016 11:29
how to correct the error of (c) file after the compile of udf? mokrane FLUENT 0 April 23, 2015 14:40
how can I correct the udf? happyrabbit FLUENT 9 January 28, 2011 10:50
DEFINE_GEOM UDF Problems Pat FLUENT 0 August 14, 2003 14:16
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03


All times are GMT -4. The time now is 16:52.