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

Guide me

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 4, 2012, 00:37
Unhappy Guide me
  #1
New Member
 
Negar
Join Date: Dec 2011
Posts: 2
Rep Power: 0
Negar GH is on a distinguished road
Hello dear friends,I simulated a membrane process by FLUENT.I have a mixture consist of two species and process is gas separation.I wrote a UDF for source terms but I have a problem with line (Domain* domain; cell_t c; face_t f; Thread *t; Domain *d; int i.Please guide me.Thanks a lot.

#include "udf.h"
#include "mem.h"


#define ro 0.13
#define M1 2
#define M2 44
#define epsilon1 0.9
#define epsilon2 1
#define k 1
#define sigma11 1
#define sigma12 0.9
#define sigma22 1.1
#define sigma21 0.95
#define Co1 2.72e-6
#define Co2 23.29e-8
#define Ea1 8.71
#define Ea2 -1.72
#define R 8.314
#define A 0.002512
#define deltaP 100000


Domain* domain; cell_t c; face_t f; Thread *t; Domain *d; int i;

DEFINE_SOURCE(species_source1,c,t,dS,eqn)
{
real y1;
real y2;
real dy1;
real x1;
real x2;
real p;
real T;
real D11;
real D12;
real j1;
real permeance1;
real per1;
real source1;

thread_loop_c (t,domain) { if (THREAD_ID(thread)==2) { begin_c_loop_all(c,t)
{
y1=C_YI(c,t,0);
y2=C_YI(c,t,1);
dy1=C_YI_G(c,t,0)[1];
p=C_P(c,t);
T=C_T(c,t);
x1=(y1/M1)/(y1/M1+y2/M2);
x2=1-x1;
D11=0.018583*pow(T,1.5)*(pow(((1/M1)+(1/M1)),0.5))/(p*pow(sigma11,2)*k/(pow(epsilon1*epsilon1,0.5)));
D12=0.018583*pow(T,1.5)*(pow(((1/M1)+(1/M2)),0.5))/(p*pow(sigma12,2)*k/(pow(epsilon1*epsilon2,0.5)));
j1=-(ro*(1-x1)*dy1)/((x1/D11)+(x2/D12));
permeance1=Co1*exp(Ea1/(R*T));
per1=permeance1*A*deltaP/M1;
source1=-(j1+per1);
end_c_loop(c,t)
}
}}
return source1;
}

DEFINE_SOURCE(species_source2,c,t,dS,eqn)
{

real y1;
real y2;
real dy2;
real x1;
real x2;
real p;
real T;
real D21;
real D22;
real j2;
real permeance2;
real per2;
real source2;

thread_loop_c (t,domain) { if (THREAD_ID(thread)==2) { begin_c_loop_all(c,t)
{
y1=C_YI(c,t,0);
y2=C_YI(c,t,1);
dy2=C_YI_G(c,t,1)[1];
p=C_P(c,t);
T=C_T(c,t);
x1=(y1/M1)/(y1/M1+y2/M2);
x2=1-x1;
D21=0.018583*pow(T,1.5)*(pow(((1/M2)+(1/M1)),0.5))/(p*pow(sigma21,2)*k/(pow(epsilon1*epsilon1,0.5)));
D22=0.018583*pow(T,1.5)*(pow(((1/M2)+(1/M2)),0.5))/(p*pow(sigma22,2)*k/(pow(epsilon2*epsilon2,0.5)));
j2=-(ro*(1-x2)*dy2)/((x1/D21)+(x2/D22));
permeance2=Co2*exp(Ea2/(R*T));
per2=permeance2*A*deltaP/M2;
source2=-(j2+per2);
end_c_loop(c,t)
}
}}
return source2;
}
Negar GH is offline   Reply With Quote

Reply


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
CFX-Mesh, guide vanes (baffles) and problems. R. Janny CFX 2 October 1, 2012 04:57
Spalart-Allmaras model in Ansys Fluent 12.0 theory guide macfly FLUENT 0 February 7, 2010 17:03
Fluent 5.5. What the differences with fluent 5.3?? confused FLUENT 2 July 29, 2001 21:58
CFD Books Guide Pre-Release, Help Needed David & Jonas Main CFD Forum 1 March 2, 2000 02:57


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