|
[Sponsors] |
July 11, 2002, 18:23 |
help on UDF mass source
|
#1 |
Guest
Posts: n/a
|
Hi, I am doing a sample run using UDF. It's a single phase mixing tank with production and depletion of species. There are originally three species in the liquid: benzene, ethanol, and water. As time goes on, Benzene will discrease, and ethanol will increase. The rate of depletion of Benzene is R=-S*X/(900*(1+S)); the rate of production of Ethanol is R=S*X/(9000*(1+S)); Where S and X are the mass concentration of Benzene and Ethanol respectively. When I enable the UDF, both of the mass fractions of Benzene and Ethanol decrease. My UDF is as follows, please help me to find out the problem. Thanks! ------------------------------------------------------- DEFINE_SOURCE(Benzene_src,cell,thread,dS,eqn) { real source, S, X; if(!Data_Valid_P()) return 0.0; S = C_YI(cell,thread,0)*C_R(cell,thread); X = C_YI(cell,thread,1)*C_R(cell,thread); source = -S*X/(900*(1+S)); dS[eqn] = 0.0;
return source; } DEFINE_SOURCE(Ethanol_src,cell,thread,dS,eqn) { real source, S, X; if(!Data_Valid_P()) return 0.0; S = C_YI(cell,thread,0)*C_R(cell,thread); X = C_YI(cell,thread,1)*C_R(cell,thread); source = S*X/(9000*(1+S));*/ source = 0.002; dS[eqn] = 0.0; return source; } DEFINE_SOURCE(Total_src,cell,thread,dS,eqn) { real source, S, X; if(!Data_Valid_P()) return 0.0; S = C_YI(cell,thread,0)*C_R(cell,thread); X = C_YI(cell,thread,1)*C_R(cell,thread); source = -S*X/(900*(1+S))+S*X/(9000*(1+S)); source = 0.0; dS[eqn] = 0.0; return source; } |
|
July 11, 2002, 19:20 |
Re: help on UDF mass source
|
#2 |
Guest
Posts: n/a
|
Looks like you have an unnecessary source=0.0; in your Total_src routine.
Greg |
|
July 11, 2002, 20:36 |
sorry, I put on the wrong code
|
#3 |
Guest
Posts: n/a
|
Sorry, I put on the wrong code. Here is the code with problem. Please find the problem for me. Thanks!
------------------------------------------------- DEFINE_SOURCE(Benzene_src,cell,thread,dS,eqn) { real source, S, X; if(!Data_Valid_P()) return 0.0; S = C_YI(cell,thread,0)*C_R(cell,thread); X = C_YI(cell,thread,1)*C_R(cell,thread); source = -S*X/(900*(1+S)); dS[eqn] = 0.0; return source; } DEFINE_SOURCE(Ethanol_src,cell,thread,dS,eqn) { real source, S, X; if(!Data_Valid_P()) return 0.0; S = C_YI(cell,thread,0)*C_R(cell,thread); X = C_YI(cell,thread,1)*C_R(cell,thread); source = S*X/(9000*(1+S)); dS[eqn] = 0.0; return source; } DEFINE_SOURCE(Total_src,cell,thread,dS,eqn) { real source, S, X; if(!Data_Valid_P()) return 0.0; S = C_YI(cell,thread,0)*C_R(cell,thread); X = C_YI(cell,thread,1)*C_R(cell,thread); source = -S*X/(900*(1+S))+S*X/(9000*(1+S)); dS[eqn] = 0.0; return source; } |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mass and energy source - evaporation | neilduffy1024 | ANSYS | 4 | July 16, 2013 23:50 |
Problem with Mass source, Momentum source theory | diffo | Fluent UDF and Scheme Programming | 0 | August 20, 2009 06:10 |
[Gmsh] Compiling gmshFoam with OpenFOAM-1.5 | BlGene | OpenFOAM Meshing & Mesh Conversion | 10 | August 6, 2009 04:26 |
UDF Source terms not producing expected results... | Emmanuel Resch | FLUENT | 0 | July 31, 2008 14:55 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 01:24 |