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

SR_Rate UDF For a MEMs model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2013, 11:53
Default SR_Rate UDF For a MEMs model
  #1
New Member
 
Tim Maguire
Join Date: Sep 2009
Posts: 19
Rep Power: 17
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?

Thanks.

-Tim

Our Routine:
Code:
#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);
}
DEFINE_SR_RATE(OUR,f,fthread,r,mw,yi,rr)
{
 *rr =
reaction_rate(F_C0(f,fthread),THREAD_T0(f,fthread),mw,yi);
}
The Example Routine:

Code:
#include "udf.h"
/* ARRHENIUS CONSTANTS */
#define PRE_EXP 1e+15
#define ACTIVE 1e+08
#define BETA 0.0

real arrhenius_rate(real temp)
{
 return
PRE_EXP*pow(temp,BETA)*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*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);
}
DEFINE_SR_RATE(arrhenius,f,fthread,r,mw,yi,rr)
{
 *rr =
reaction_rate(F_C0(f,fthread),THREAD_T0(fthread),mw,yi);
}

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;
 c_face_loop(c,t,i)
 {
  if(THREAD_ID(C_FACE_THREAD(c,t,i)) == s_id)
  {
   (*n)++;
   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

Old   October 10, 2018, 03:16
Default udf for gluconic acid production
  #2
New Member
 
Devesh
Join Date: Oct 2018
Posts: 1
Rep Power: 0
deveshsaxena6 is on a distinguished road
Can anybody help me how to write udf for a bioreac
tion containing substrate, biomass and product.
deveshsaxena6 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
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 07: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 03:21
UDF: how to know domain number in the model? mssound FLUENT 0 May 17, 2010 16:00


All times are GMT -4. The time now is 13:56.