CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Guide me (https://www.cfd-online.com/Forums/fluent-udf/98211-guide-me.html)

Negar GH March 6, 2012 02:55

Guide me
 
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).I send only species 1 transport UDF for two sides of membrane. 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_source1Re,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;
source1Re=j1+per1;
end_c_loop(c,t)}}}return source1Re;}

Sabby January 16, 2018 05:16

Hey, I'm working on a membrane seperation process too and i have to simulate the coupled heat and mass transfer on ansys fluent .I'm new with fluent
I'm wondering if i should use multiphase model or write my own udf !

annan January 16, 2018 07:09

I think you will have to use both


All times are GMT -4. The time now is 10:53.