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

Compile udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 24, 2014, 14:12
Default Compile udf
  #1
New Member
 
mojtaba
Join Date: Dec 2014
Posts: 1
Rep Power: 0
moji1366 is on a distinguished road
Dear My collegue
I wote a UDF for volumetric reaction but I cannot compile it before using the ANSYS FLUENT 14.5
I would be approciate every body that can help me.
The written program (rate.c) are as the following. Please write to me the response and send to "mojtaba.aslani66@gmail.com"

#include "udf.h"

#define R 8.314

DEFINE_VR_RATE(reaction,c,t,r,mw,species_massf,rat e,rr_t)
{
real n_CO2=species_massf[0]/mw[0];
real n_CO=species_massf[1]/mw[1];
real n_H2=species_massf[2]/mw[2];
real n_CH4=species_massf[3]/mw[3];
real n_N2=species_massf[4]/mw[4];
real n_H2O=species_massf[5]/mw[5];

real Total_n=(n_CO2+n_CO+n_H2+n_CH4+n_N2+n_H2O);

/*mole fraction*/
real mf_CO2=n_CO2/Total_n;
real mf_CO=n_CO/Total_n;
real mf_H2=n_H2/Total_n;
real mf_CH4=n_CH4/Total_n;
real mf_H2O=n_H2O/Total_n;

/*pressure*/
real P=C_P(c,t);

/*Temperature*/
real T=C_T(c,t);

/*Partial pressures*/
real P_CO2=mf_CO2*P;
real P_CO=mf_CO*P;
real P_H2=mf_H2*P;
real P_CH4=mf_CH4*P;
real P_H2O=mf_H2O*P;

/*Kinetic coefficient*/
real k_1=1.17e15*exp(-240100/(R*T));
real k_2=2.83e14*exp(-243900/(R*T));
real k_3=5.43e5*exp(-67130/(R*T));

/*Equilibrium constant*/
real K_CO=8.23e-5*exp(70650/T);
real K_H2=6.12e-9*exp(82900/T);
real K_H2O=1.77e5*exp(-88680/T);
real K_CH4=6.65e-4*exp(38280/T);

real Ke_1=exp((26830/T)+30114);
real Ke_2=exp((4400/T)+4.036);
real Ke_3=Ke_1*Ke_2;

/*Needed for calculations*/
real DEN=1+K_CO*P_CO+K_H2*P_H2+K_CH4*P_CH4+K_H2O*P_H2O/P_H2;

if (!strcmp(r->name, "reaction-1"))
{
*rate=2.2275*(k_1/pow(P_H2,2.5))*(P_CH4*P_H2O-pow(P_H2,3.5)*P_CO/Ke_1)/pow(DEN,2);
}

else if (!strcmp(r->name, "reaction-2"))
{
*rate=2.2275*(k_2/pow(P_H2,3.5))*(P_CH4*pow(P_H2O,2.5)-pow(P_H2,4)*P_CO2/Ke_3)/pow(DEN,2);
}

else if (!strcmp(r->name, "reaction-3"))
{
*rate=2.2275*(k_3/P_H2)*(P_CO*P_H2O-P_H2*P_CO2/Ke_2)/pow(DEN,2);
}

*rr_t=*rate;

}
moji1366 is offline   Reply With Quote

Old   December 24, 2014, 16:24
Default
  #2
New Member
 
hosein
Join Date: Sep 2013
Posts: 16
Rep Power: 12
ho3ein.agl is on a distinguished road
hi mojtaba.

Did you try this:
step1: uninstall visual studio express 2013 or 2010 or c++
step2: install Microsoft Visual Studio 2010 Ultimate v10.0 (or pro)

everything is fine
even dont need to start workbench or fluent from SDK
ho3ein.agl is offline   Reply With Quote

Old   December 25, 2014, 12:43
Default
  #3
New Member
 
mohsen
Join Date: Dec 2014
Posts: 4
Rep Power: 11
mohsen.eng20 is on a distinguished road
hi friends
is u'r problem with compiling the udf or writing udf code?if that is compiling what is the error?
mohsen.eng20 is offline   Reply With Quote

Old   May 19, 2020, 21:43
Default
  #4
WZX
New Member
 
zaixing
Join Date: Apr 2020
Posts: 9
Rep Power: 5
WZX is on a distinguished road
Hello,friend.My doctoral project is aslo about Steam Reforming by using CFD.
I also face the same problem. How did you solve it?
WZX 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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 06:05
Fluent does not always compile UDF properly davesmith_01 Fluent UDF and Scheme Programming 3 February 10, 2011 14:09
UDF COMPILE Miguel Olvera FLUENT 4 March 18, 2007 08:07
Fluent doesn´t compile UDF on Windows HSeldon FLUENT 4 February 14, 2007 23:01
UDF compile HELP!! Leigh FLUENT 19 August 27, 2006 23:03


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