How to use UDS solve this problem
Hi Guys, I have a set of eqs and want to use UDS to solve them. I solved this problem before with my own code and Matlab. I just want to see whether I can get the same results and learn how to use UDS. The following is the set of the eqs. I also attach the UDF I wrote for your information. I still have problem to get the right answer as I got before. I cannot find out the errors.
d^2 C1/dx^2 = PHI^2 * {C1*exp[(1ALPHA)(C2C3)]  C0*exp[ALPHA(C2C3)]} d^2 C2/dx^2 = PHI1^2 * {C1*exp[(1ALPHA)(C2C3)]  C0*exp[ALPHA(C2C3)]} d^2 C3/dx^2 = PHI2^2 * {C1*exp[(1ALPHA)(C2C3)]  C0*exp[ALPHA(C2C3)]} The dependent variables are C1, C2, and C3. The others are constant /************************************************** **************** UDF that adds momentum source term and derivative to duct flow ************************************************** *****************/ #include "udf.h" #define PHI2 0.1406 #define PHI12 0.8277 #define PHI22 0.8277 #define C0 0.5714 #define ALPHA 0.5 enum { C1, C2, C3 }; DEFINE_SOURCE(C1_source, cell, thread, dS, eqn) { real source; dS[eqn] = PHI2 * exp((1ALPHA)*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3))); source = PHI2 * (C_UDSI(cell,thread,C1) * exp((1ALPHA)*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3)))  C0 * exp(ALPHA*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3)))); return source; } DEFINE_SOURCE(C2_source, cell, thread, dS, eqn) { real source; dS[eqn] = PHI12 * ((1ALPHA)*C_UDSI(cell,thread,C1) * exp((1ALPHA)*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3))) + ALPHA* C0 * exp(ALPHA*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3)))); source = PHI12 * (C_UDSI(cell,thread,C1) * exp((1ALPHA)*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3)))  C0 * exp(ALPHA*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3)))); return source; } DEFINE_SOURCE(C3_source, cell, thread, dS, eqn) { real source; dS[eqn] = PHI22 * ((ALPHA1)*C_UDSI(cell,thread,C1) * exp((1ALPHA)*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3)))  ALPHA*C0 * exp(ALPHA*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3)))); source = PHI22 * (C_UDSI(cell,thread,C1) * exp((1ALPHA)*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3)))  C0 * exp(ALPHA*(C_UDSI(cell,thread,C2)C_UDSI(cell,thread,C3)))); return source; } Thanks 
I am quite sure that you can't use UDS for this particular case. Because is Fluent is solving partial differential equation (scalar transport equation), however you would like to solve set of ordinary differential equations. In other words your left side of equations is completely different from Fluent ones.

Quote:

I have done like that before. It has so many complicated points that should be cared.

Saeed,
Can you recall any particular tips? Anyone is helpful to me. 
It seems you want to add three new scalar equations. So add three UDS. These equations only have source and diffusion terms. So disable unsteady and convection terms in UDS menu. Now you need to write UDF for defining source and diffusion terms.

All times are GMT 4. The time now is 19:00. 