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

"enum" in UDS stuff

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 25, 2010, 14:32
Default "enum" in UDS stuff
  #1
Senior Member
 
MASOUD
Join Date: Mar 2009
Posts: 102
Rep Power: 8
MASOUD is on a distinguished road
What is the meaning of the following codes:

---------------------
enum
{
P1,
N_REQUIRED_UDS
};

----------------------

***********************************

----------------------

DEFINE_ADJUST(p1_adjust, domain)
{

/* Make sure there are enough user defined-scalars. */
if (n_uds < N_REQUIRED_UDS)
Internal_Error("not enough user-defined scalars allocated");

}

----------------------
MASOUD is offline   Reply With Quote

Old   March 26, 2010, 00:30
Default
  #2
Senior Member
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 105
Rep Power: 7
gearboy is on a distinguished road
Quote:
Originally Posted by MASOUD View Post
What is the meaning of the following codes:

---------------------
enum
{
P1,
N_REQUIRED_UDS
};

----------------------

***********************************

----------------------

DEFINE_ADJUST(p1_adjust, domain)
{

/* Make sure there are enough user defined-scalars. */
if (n_uds < N_REQUIRED_UDS)
Internal_Error("not enough user-defined scalars allocated");

}

----------------------
enum
{
P1,
N_REQUIRED_UDS
};

P1=0,N_REQUIRED_UDS=1; see c language primers for enum usage

n_uds is a macro to get the number of uds that have been allocated.
gearboy is offline   Reply With Quote

Old   March 29, 2010, 00:54
Default
  #3
Senior Member
 
MASOUD
Join Date: Mar 2009
Posts: 102
Rep Power: 8
MASOUD is on a distinguished road
Thanks.
Anyway what's the point of using enum?

Plz check the below code what's the "sg.h" for???

I have 2 UDS. I wrote their code in separate files. Should I put their names in both files?


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

enum
{
ELECT_CHARGE_UDS,
CARB_CHARGE_UDS,
N_REQUIRED_UDS
};

static real ACT_AREA=1;
static real REF_EXCH_CURR_A=1;
static real MW_H2=1;
static real REF_CONC=1;
static real BETA=1;
static real ALPHA=1;
static real NO_ELEC=1;
static real EQU_POT_A=1;
static real FARADAY=1;
static real UNI_GAS_CONS=1;
static real STOCH=1;
static real RXN_RATE_A;
static real Z;
static real ZZ;
static real ZZZ;
static real source;

DEFINE_ADJUST(ELECT_CHARGE_UDS, domain)
{

if (n_uds < N_REQUIRED_UDS)
Internal_Error("not enough user-defined scalars allocated");
}

DEFINE_SOURCE(ELECT_CHARGE_UDS,c,t,dS,eqn)
{
Z=ACT_AREA*REF_EXCH_CURR_A*pow(((C_YI(c,t,0)*C_R(c ,t)/MW_H2)/REF_CONC),BETA);

ZZ=exp((ALPHA*NO_ELEC*FARADAY*(C_UDSI(c,t,0)-EQU_POT_A))/(UNI_GAS_CONS*C_T(c,t)));

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

RXN_RATE_A=Z*(ZZ-ZZZ);

source=(-STOCH/(NO_ELEC*FARADAY))*RXN_RATE_A;

dS[eqn]=0;

return source;
}

DEFINE_DIFFUSIVITY(ELECT_CHARGE_UDS,c,t,0)
{
return 1;
}
MASOUD 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
PEM modeling UDS diffusivity in mixture gemini FLUENT 6 August 7, 2012 07:37
Doubts UDS Flux, UDS Unsteady for VOF model kel85uk FLUENT 0 March 17, 2010 09:53
UDS Flux Function Choice Yang Chung FLUENT 0 August 10, 2008 06:57
UDS, parameters and computations hedge FLUENT 2 August 16, 2007 05:19
UDS David FLUENT 1 March 21, 2005 12:31


All times are GMT -4. The time now is 18:21.