"enum" in UDS stuff
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"); } ---------------------- |
Quote:
{ 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. |
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; } |
All times are GMT -4. The time now is 17:21. |