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

There was an error in the UDF definition inlet speed

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 26, 2019, 21:35
Default There was an error in the UDF definition inlet speed
  #1
New Member
 
Yeyue
Join Date: Dec 2019
Posts: 3
Rep Power: 6
Yeyue is on a distinguished road
Velocity changes with the temperature of the flow field. I don't know how the UDF calls the fluent temperature field. UDF programming is as follows, import fluent prompts the error as follows, I hope to get your help ~Thank you.

#include"udf.h"
DEFINE_PROFILE(in_x_velocity,cell,thread)
{
real x[ND_ND];
real y;
real temp=C_T(cell,thread);
real n;
real y;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
y=x[1];
n=5.7171-0.009*temp;
y=4.7*10e-6*exp(6800/temp);
real yy;
yy=pow(m,1/n);
{ if(temp>291.15)
F_PROFILE(f,cell,thread)=0.02*(n+3)/(n+1)*(1-pow((y/0.010435),(n+1)));
else
F_PROFILE(f,cell,thread)=0.02*(n+3)/(n+1)*(1/(4*pow(1.52,n)+(n+3)*(5.964-0.02*temp)*100*1.52/yy)*(4*pow(1.52,n)/y*(1-pow((y/0.010435),(n+1)))+2(n+1)*(5.964-0.02*temp)*100*1.52/yy*(1-pow((y/0.010435),2))
}
end_f_loop(f,thread)
}


cpp -I"D:\ansys\ANSYS Inc\v150\fluent\fluent15.0.0/src" -I"D:\ansys\ANSYS Inc\v150\fluent\fluent15.0.0/cortex/src" -I"D:\ansys\ANSYS Inc\v150\fluent\fluent15.0.0/client/src" -I"D:\ansys\ANSYS Inc\v150\fluent\fluent15.0.0/multiport/src" -I. -DUDFCONFIG_H
"<C:/Users/ADMINI~1/AppData/Local/Temp/udfconfig-30856-node1.h>" "C:/Users/ADMINI~1/AppData/Local/Temp/Velocity1.c.30856.1.c"
Error: C:/Users/ADMINI~1/AppData/Local/Temp/Velocity1.c.30856.1.c: line 6: non-integer subscript expression: pointer to structure.
Yeyue is offline   Reply With Quote

Old   December 26, 2019, 21:59
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 must compile following
Code:
#include "udf.h"
#include "math.h"
DEFINE_PROFILE(in_x_velocity,t, i)
{
real x[ND_ND];
real y;
real temp;
real n;
real y;
real yy;
face_t f;
begin_f_loop(f,t)
{
	temp=F_T(f,t)
	F_CENTROID(x,f,t);
	y=x[1];
	n=5.7171-0.009*temp;
	y=4.7*10e-6*exp(6800/temp);
	yy=pow(m,1/n);
	{ if(temp>291.15)
	F_PROFILE(f,t,i)=0.02*(n+3)/(n+1)*(1-pow((y/0.010435),(n+1)));
	else
	F_PROFILE(f,t,i)=0.02*(n+3)/(n+1)*(1/(4*pow(1.52,n)+(n+3)*(5.964-0.02*temp)*100*1.52/yy)*(4*pow(1.52,n)/y*(1-pow((y/0.010435),(n+1)))+2(n+1)*(5.964-0.02*temp)*100*1.52/yy*(1-pow((y/0.010435),2))
	}
end_f_loop(f,t)
}
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 26, 2019, 22:51
Default udf
  #3
New Member
 
Yeyue
Join Date: Dec 2019
Posts: 3
Rep Power: 6
Yeyue is on a distinguished road
Hello, I modified it according to your comments, but the following problems will still occur, and I look forward to your reply.

#include"udf.h"
#include"math.h"
DEFINE_PROFILE(in_x_velocity,thread,index)
{
real x[ND_ND];
real y;
real n;
real yy;
real w;
real temp;
face_t f;
Thread *t;
begin_f_loop(f,thread)
{
temp=F_T(f,t);
F_CENTROID(x,f,thread);
y=x[1];
n=5.7171-0.009*temp;
yy=0.0000047*exp(6800/temp);
w=pow(yy,1/n);
{ if(temp>291.15)
F_PROFILE(f,thread,index)=0.02*(n+3)/(n+1)*(1-pow((y/0.010435),(n+1)));
else if(temp>=288.15&&temp>=291.15)
F_PROFILE(f,thread,index)=0.02*(n+3)/(n+1)*(1/(4*pow(1.52,n)+(n+3)*(5.964-0.02*temp)*100*1.52/w)*(4*pow(1.52,n)/yy*(1-pow((y/0.010435),(n+1)))+2(n+1)*(5.964-0.02*temp)*100*1.52/w*(1-pow((y/0.010435),2))
}
end_f_loop(f,thread)
}



cpp -I"D:\ansys\ANSYS Inc\v150\fluent\fluent15.0.0/src" -I"D:\ansys\ANSYS Inc\v150\fluent\fluent15.0.0/cortex/src" -I"D:\ansys\ANSYS Inc\v150\fluent\fluent15.0.0/client/src" -I"D:\ansys\ANSYS Inc\v150\fluent\fluent15.0.0/multiport/src" -I. -DUDFCONFIG_H
"<udfconfig.h>" "C:\Users\Administrator\Desktop\UDF\Velocity1. c"
Error: udfconfig.h: line 16: parse error.
-----------------------------------
best regards
Yeyue is offline   Reply With Quote

Old   December 27, 2019, 02:06
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
https://www.youtube.com/watch?v=OPfgkORSESQ
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 27, 2019, 02:28
Default
  #5
New Member
 
Yeyue
Join Date: Dec 2019
Posts: 3
Rep Power: 6
Yeyue is on a distinguished road
I can't open the website you sent. Can you help me modify this program if you are convenient? Thank you very much.


--------------------------------------
best regards
Yeyue is offline   Reply With Quote

Old   December 27, 2019, 05:00
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
make working directory
put there your case file and UDF file
open VIsual Studio console and run Fluent from this console
compile UDF, load UDF
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply

Tags
fluent, udf, velocity


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
Disappearing mass when using udf inlet profile divergence Fluent UDF and Scheme Programming 5 January 2, 2021 15:56
how to put udf inlet velocity and udf outlet pressure in fluent raminostadi Fluent UDF and Scheme Programming 4 July 3, 2017 07:43
UDF profile: Fluent method for coupling inlet and outlet I-mech Fluent UDF and Scheme Programming 0 May 10, 2014 11:36
"Closing" a pressure inlet via UDF? dave88 Fluent UDF and Scheme Programming 0 August 27, 2013 19:14
Urgent! Help on UDF to set inlet velocity Ray Hong FLUENT 4 December 30, 2005 13:32


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