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

error in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 2, 2019, 13:19
Smile error in UDF
  #1
New Member
 
iran
Join Date: Aug 2016
Posts: 20
Rep Power: 10
soleimanian is on a distinguished road
Hello
I want to define a velocity profile with UDF in ANSYS Fluent.
velocity profile is according to law Logarithm.
and I should use of the if expression in UDF code.
but when I interpreted this UDF code I received parse error.
I do not know why and I need to help me.
Thanks a lot.

my Code :

#include "udf.h"

/*define constant parameter*/
#define zmin 5.0;
#define ustar 0.086;
#define z0 0.3;
#define uuniform 25.0;

DEFINE_PROFILE(inlet_x_velocity, thread, position)
{
real x[ND_ND];
real Uz, Z;
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);

Z= x[2];

if(Z< zmin) Uz= zmin;
if(Z>zmin) Uz= (ustar / 0.4)*(double log (double (Z / z0))*uuniform;
F_PROFILE(f, thread, position)=Uz;
}
end_f_loop(f, thread)
}

Last edited by soleimanian; January 4, 2019 at 07:12.
soleimanian is offline   Reply With Quote

Old   January 2, 2019, 22:02
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you forgot } at the end

next time put your error message here, so people may understand what is the problem

best regards
AlexanderZ is offline   Reply With Quote

Old   January 4, 2019, 07:18
Default
  #3
New Member
 
iran
Join Date: Aug 2016
Posts: 20
Rep Power: 10
soleimanian is on a distinguished road
Quote:
Originally Posted by soleimanian View Post
Hello
I want to define a velocity profile with UDF in ANSYS Fluent.
velocity profile is according to law Logarithm.
and I should use of the if expression in UDF code.
but when I interpreted this UDF code I received parse error.
I do not know why and I need to help me.
Thanks a lot.

my Code :

#include "udf.h"

/*define constant parameter*/
#define zmin 5.0;
#define ustar 0.086;
#define z0 0.3;
#define uuniform 25.0;

DEFINE_PROFILE(inlet_x_velocity, thread, position)
{
real x[ND_ND];
real Uz, Z;
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);

Z= x[2];

if(Z< zmin) Uz= zmin;
if(Z>zmin) Uz= (ustar / 0.4)*(double log (double (Z / z0))*uuniform;
F_PROFILE(f, thread, position)=Uz;
}
end_f_loop(f, thread)
}
I'm facing to this error.
Best regards
Attached Images
File Type: jpg photo_2018-12-26_12-22-20.jpg (32.7 KB, 4 views)
soleimanian is offline   Reply With Quote

Old   January 6, 2019, 22:48
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include "udf.h"

/*define constant parameter*/
#define zmin 5.0
#define ustar 0.086
#define z0 0.3 
#define uuniform 25.0

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

	begin_f_loop(f,thread)
	{
		F_CENTROID(x, f, thread);
		Z= x[2];
		if (Z <= zmin) Uz = zmin;
		if (Z > zmin) Uz= (ustar / 0.4)*((double)log((double) (Z / z0))*uuniform);
		F_PROFILE(f, thread, position) = Uz;
	}
	end_f_loop(f, thread)
}
best regards
AlexanderZ 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
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 03:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 13:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


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