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

enum

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 5, 2010, 01:49
Default enum
  #1
Senior Member
 
MASOUD
Join Date: Mar 2009
Posts: 102
Rep Power: 17
MASOUD is on a distinguished road
Hi;
I need to define two scalars (UDS) and below you can find the UFDs for the aforementioned scalars.
I'm just wondering what does the "enum" do??? And shall I change anything?


********************
UDS-01
********************


#include "udf.h"
#include "sg.h"

/* Define which user-defined scalars to use. */
enum
{
E_CHARGE_UDS,
C_CHARGE_UDS,
N_REQUIRED_UDS
};
static real ACT_AREA_A=270000;
static real REF_EXCH_CURR_A=2.25;
static real MW_H2=0.002;
static real MW_CO2=0.044;
static real MW_H2O=0.018;
static real MW_MIX;
static real X_H2;
/*static real X_CO2;*/
/*static real X_H2O;*/
static real ALPHA_A=0.5;
static real ALPHA_C=1.5;
static real NO_ELEC=2;
static real FARADAY=96485;
static real UNI_GAS_CONS=8.314;
static real RXN_RATE_A;
static real Z;
static real ZZ;
static real ZZZ;
static real source;


DEFINE_SOURCE(ELECT_SOURCE_ANODE,c,t,dS,eqn)

{

MW_MIX=MW_H2*C_YI(c,t,0)+MW_CO2*C_YI(c,t,2)+MW_H2O *C_YI(c,t,3);
X_H2=C_YI(c,t,0)*MW_H2/MW_MIX;
/*X_CO2=C_YI(c,t,2)*MW_CO2/MW_MIX;*/
/*X_H2O=C_YI(c,t,3)*MW_H2O/MW_MIX;*/

Z=ACT_AREA_A*REF_EXCH_CURR_A*(pow((X_H2),0.25));

ZZ=exp((ALPHA_A*FARADAY*(C_UDSI(c,t,0)-C_UDSI(c,t,1)))/(UNI_GAS_CONS*C_T(c,t)));

ZZZ=exp(-(ALPHA_C*FARADAY*(C_UDSI(c,t,0)-C_UDSI(c,t,1)))/(UNI_GAS_CONS*C_T(c,t)));

RXN_RATE_A=Z*(ZZ-ZZZ);

source=-RXN_RATE_A;

dS[eqn]=0;

return source;
}



**************************
UDS-02
**************************


#include "udf.h"
#include "sg.h"

/* Define which user-defined scalars to use. */
enum
{
E_CHARGE_UDS,
C_CHARGE_UDS,
N_REQUIRED_UDS
};

static real ACT_AREA_C=300000;
static real REF_EXCH_CURR_C=0.4;
static real MW_O2=0.032;
static real MW_CO2=0.044;
static real MW_MIX;
static real X_O2;
static real X_CO2;
static real ALPHA_A=1.5;
static real ALPHA_C=0.5;
static real NO_ELEC=2;
static real FARADAY=96485;
static real UNI_GAS_CONS=8.314;
static real RXN_RATE_C;
static real Z;
static real ZZ;
static real ZZZ;
static real source;

DEFINE_SOURCE(ELECT_SOURCE_CATHODE,c,t,dS,eqn)

{

MW_MIX=MW_O2*C_YI(c,t,1)+MW_CO2*C_YI(c,t,2);
X_O2=C_YI(c,t,1)*MW_O2/MW_MIX;
X_CO2=C_YI(c,t,2)*MW_CO2/MW_MIX;

Z=ACT_AREA_C*REF_EXCH_CURR_C*pow(X_O2,0.375)*pow(X _CO2,(-1.25));

ZZ=exp((ALPHA_A*FARADAY*(C_UDSI(c,t,0)-C_UDSI(c,t,1)))/(UNI_GAS_CONS*C_T(c,t)));

ZZZ=exp(-(ALPHA_C*FARADAY*(C_UDSI(c,t,0)-C_UDSI(c,t,1)))/(UNI_GAS_CONS*C_T(c,t)));

RXN_RATE_C=Z*(ZZ-ZZZ);

source=RXN_RATE_C;

dS[eqn]=0;

return source;
}
MASOUD is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
what's mean enum in udf zhu FLUENT 3 May 6, 2024 04:24


All times are GMT -4. The time now is 01:47.