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

udf issue

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 23, 2017, 04:41
Default udf issue
  #1
New Member
 
masoud
Join Date: Apr 2017
Posts: 1
Rep Power: 0
m.jalali is on a distinguished road
I am working with udf in ansys fluent . I need an udf for viscosity Changes with pH . Viscosity as a function of error function varies with pH(erf(pH)). I wrote an udf is as follows:
#include "udf.h"
#include "mem.h"
//#include "math.h"
DEFINE_PROPERTY(cell_viscosity,c,t)
{
real c_mu_eff ;
real mu_lam_0= 0.001 ; /* base viscosity (acid viscosity at pH=0 or 7)*/
real mu_lam_m= 200. ; /* maximum increment in the viscosity w.r.t*/
real C_ca; /* mass freaction of calcium*/
real pH;
real C_max_ca= 10.; /* corresponding calcium ion where viscosity reaches the maximom value (wt)*/
real mw=36.5; /* molcolar whight of hcl*/
real w2=1.1, w3=2.; /* constant coefficiet*/
C_ca= C_YI(c,t,1)*100.; /* mass freaction of calcium ion*/
pH=-log10(C_YI(c,t,2)*C_R(c,t)/mw);

c_mu_eff = mu_lam_0*(1.+mu_lam_m*exp(-(C_ca-C_max_ca)/w2)*(erf(PH-1)+1.)/w3);
C_UDMI(c,t,4)= mu_lam_0*(1.+mu_lam_m*exp(-(C_ca-C_max_ca)/w2)*(erf(PH-1)+1.)/w3);

return c_mu_eff;
}

But when I compile the code gives the error as follows:
error: erf: undeclared variable
Can anyone help me؟
m.jalali is offline   Reply With Quote

Old   April 24, 2017, 04:58
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Remove the two /'s before #include "math.h".
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
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 07:37
UDF for Wave Generation and UDF Compilation Error Engrsdm Fluent UDF and Scheme Programming 0 December 19, 2016 00:50
Help with unsteady calculation with source/sink UDF RobV FLUENT 1 November 13, 2016 05:44
UDF compilation/ platform issue! Help!! :s lmarf88 Fluent UDF and Scheme Programming 4 April 11, 2014 13:11
DEFINE_DPM_OUTPUT macro UDF HELP Puneet FLUENT 3 November 28, 2003 10:55


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