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

UDF combining

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools 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

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


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