CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

SR_Rate UDF For a MEMs model

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

LinkBack Thread Tools Display Modes
Old   February 22, 2013, 11:53
Default SR_Rate UDF For a MEMs model
New Member
Tim Maguire
Join Date: Sep 2009
Posts: 19
Rep Power: 8
timjm is on a distinguished road
We are trying to model a MEMs device with biological "cells" on one surface of the device.

1. Is it possible to define a full series of reactions at a surface using SR_RATE.

2. I am trying to follow an example I saw in the user manual for SR_RATE. Do I need to define the reaction three times as in the example, or could I just remove all of the extraneous calcs outside of the SR_RATE command?



Our Routine:
#include "udf.h"

/*define the Constants */
#define sa 1875 /* surface area of bottom face of bioreactor mm^2 */
#define l 1e6 /* number of cells */
#define our 0.25 /* OUR for 1e6 hepatocytes */

real OUR_rate(real conc)
 return -our*l/sa*conc;

/*define the scalars */
#define Air 0
#define O2 1
#define H2O 2

/* Reaction Rate Routine */
real reaction_rate(cell_t c, Thread *cthread,real mw[],real yi[])
 real concO2 = C_R(c, cthread)*yi[O2]/mw[O2];

 return OUR_rate(concO2);
 *rr =
The Example Routine:

#include "udf.h"
#define PRE_EXP 1e+15
#define ACTIVE 1e+08
#define BETA 0.0

real arrhenius_rate(real temp)

/* Species numbers. Must match order in Fluent panel */
#define HF  0
#define WF6 1
#define H2O 2
#define NUM_SPECS 3

/* Reaction Exponents */
#define HF_EXP  2.0
#define WF6_EXP 0.0
#define H2O_EXP 0.0

#define MW_H2 2.0
#define STOIC_H2 3.0
/* Reaction Rate Routine that is used in both UDFs */

real reaction_rate(cell_t c, Thread *cthread,real mw[],real yi[])

*/ Note that all arguments in the reaction_rate function
call in your .c source file MUST be on the same line or a
compilation error will occur */

 real concenHF = C_R(c,cthread)*yi[HF]/mw[HF];

 return arrhenius_rate(C_T(c,cthread))*pow(concenHF,HF_EXP);
 *rr =

real contact_area(cell_t c,Thread *t,int s_id,int *n)
 int i = 0;
 real area = 0.0, A[ND_ND];

 *n = 0;
  if(THREAD_ID(C_FACE_THREAD(c,t,i)) == s_id)
   F_AREA(A,C_FACE(c,t,i), C_FACE_THREAD(c,t,i));
   area += NV_MAG(A);

 return area;
timjm is offline   Reply With Quote


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 for Srivastava and Sundaresan friction model Musa FLUENT 1 March 14, 2014 03:42
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12
Why my UDF doesn't work when I activate the non-premixed combustion species model? TMorgado Fluent UDF and Scheme Programming 0 February 5, 2013 15:09
UDF for Heat Exchanger model francois louw FLUENT 2 July 16, 2010 02:21
UDF: how to know domain number in the model? mssound FLUENT 0 May 17, 2010 15:00

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