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

UDF combining

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 8, 2011, 07:02
Default UDF combining
  #1
New Member
 
Join Date: Jun 2011
Posts: 1
Rep Power: 0
michalku is on a distinguished road
I try to resolve a problem with UDFs.
Want to combine to reaction in one DEFINE_VR_RATE UDF. See below. However, I have a problem to compile it in Fluent.
Can anybody check the UDF and say me where the problem could be?
Thanks!

Michal

#include "udf.h"
static const real Arrhenius = 1.e15;
static const real E_Activation = 1.e6;

DEFINE_VR_RATE(myrate,c,t,r,mw,yi,rr,rr_t)
{
/*If more than one reaction is defined, it is necessary to distinguish
between these using the names of the reactions. */
if (!strcmp(r->name, "reaction-1"))


{
real ci, prod;
int i;
/* Calculate Arrhenius reaction rate */
prod = 1.;
for(i = 0; i < r->n_reactants; i++)
{
ci = C_R(c,t) * yk[r->reactant[i]] / wk[r->reactant[i]];
prod *= pow(ci, r->exp_reactant[i]);
}
*rate = r->A * exp( - r->E / (UNIVERSAL_GAS_CONSTANT * C_T(c,t))) *
pow(C_T(c,t), r->b) * prod;
*rr_t = *rate;
/* No "return..;" value. */
}
}
else if (!strcmp(r->name, "reaction-2"))
static const real Arrhenius = 1.e15;
static const real E_Activation = 1.e6;

{
DEFINE_VR_RATE(myrate,c,t,r,mw,yi,rr,rr_t)
{
/*If more than one reaction is defined, it is necessary to distinguish
between these using the names of the reactions. */
if (!strcmp(r->name, "reaction-1"))
{



real ci, prod;
int i;
/* Calculate Arrhenius reaction rate */
prod = 1.;
for(i = 0; i < r->n_reactants; i++)
{
ci = C_R(c,t) * yk[r->reactant[i]] / wk[r->reactant[i]];
prod *= pow(ci, r->exp_reactant[i]);
}
*rate = r->A * exp( - r->E / (UNIVERSAL_GAS_CONSTANT * C_T(c,t))) *
pow(C_T(c,t), r->b) * prod;
*rr_t = *rate;
/* No "return..;" value. */
}
else
{
/* Message("Unknown Reaction\n"); */
}
/* Message("Actual Reaction: %s\n",r->name); */
}
michalku 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 parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 04:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


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