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

help on UDF mass source

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2002, 18:23
Default help on UDF mass source
  #1
shao1
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; }
  Reply With Quote

Old   July 11, 2002, 19:20
Default Re: help on UDF mass source
  #2
Greg Perkins
Guest
 
Posts: n/a
Looks like you have an unnecessary source=0.0; in your Total_src routine.

Greg
  Reply With Quote

Old   July 11, 2002, 20:36
Default sorry, I put on the wrong code
  #3
shao1
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;

}
  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
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


All times are GMT -4. The time now is 17:39.