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

porosity udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2015, 17:26
Default porosity udf
  #1
New Member
 
walied
Join Date: Aug 2014
Posts: 16
Rep Power: 11
walied123 is on a distinguished road
hello every body

i made a UDF for anode and cathode porosity in the SOFC module, but the energy residual get the following reading 1.#QNBe+00

PLEASE URGENT HELP.......
here is my UDF

#include "udf.h"

/**********************Anode Porosity **************/
DEFINE_PROFILE(anode_porosity, thread, np)
{
cell_t c;
real x[ND_ND];
real y;

begin_c_loop (c,thread)
{

C_CENTROID(x,c,thread);
y =x[1];

F_PROFILE(c,thread,np) =((y-1.53)/0.02)*(1-((y-1.53)/0.02));
}

end_c_loop (c,thread)

}

/*********************Cathode Porosity*****************/
DEFINE_PROFILE(cathode_porosity, thread, np)
{
cell_t c;
real x[ND_ND];
real y;

begin_c_loop (c,thread)
{

C_CENTROID(x,c,thread);
y=x[1];

F_PROFILE(c,thread,np) =((y-1.53)/0.02)*(1-((y-1.53)/0.02));
}

end_c_loop (c,thread)
}
walied123 is offline   Reply With Quote

Old   February 16, 2015, 12:04
Default
  #2
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 12
upeksa is on a distinguished road
Take into account the following:

- Remember the units given by UDF are meters

- The values of porosity must be 0-1.

- You must set an appropriate value for Ri and Rv
upeksa is offline   Reply With Quote

Old   February 16, 2015, 13:55
Default
  #3
New Member
 
walied
Join Date: Aug 2014
Posts: 16
Rep Power: 11
walied123 is on a distinguished road
thank you upeksa for your kind reply.
but what do you mean by Rv and Ri

regards
walied123 is offline   Reply With Quote

Old   February 17, 2015, 04:11
Default
  #4
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 12
upeksa is on a distinguished road
Quote:
Originally Posted by walied123 View Post
thank you upeksa for your kind reply.
but what do you mean by Rv and Ri

regards
Viscous resistence and inertial resistence.

Check this post

http://www.cfd-online.com/Forums/flu...us-medium.html

Looking at your UDF, nothing seems wrong with your code.

The error you get must have something to with some number out of range, so I think that the values of porosity you retrieve are higher than 1 or lower than 0.

Cheers
upeksa is offline   Reply With Quote

Old   February 17, 2015, 14:34
Default
  #5
New Member
 
walied
Join Date: Aug 2014
Posts: 16
Rep Power: 11
walied123 is on a distinguished road
hello upeksa;

thank you for your kind reply.

please can you check the following udf for any error.i compiled it without any problems but i need to know is it right as a writing........ .

#include "udf.h"
#include "math.h"
/************************************************** CONSTANT****************************************** *************/
#define m 1
#define rua 1.2
#define thermal 0.0242
#define anode_density 4760
#define electrolyte_density 1980
#define anode_ca 377
#define ca 1006.43
#define electrolyte_ca 2000
#define anode_THER 11
#define electrolyte_THER 2
#define cathode_density 4640
#define cathode_ca 377
#define cathode_THER 2.37
/************************************************** Anode Porosity****************************************** ********************/
DEFINE_PROFILE(Anode_porosity, t, i)
{
cell_t c;
real x[ND_ND],y;

begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
y=(x[1]*1000-1.56)/0.7;
C_PROFILE(c,t,i) = pow(y,m)*(1-pow(y,m));
}
end_c_loop (c,t)
}

/*************************************************C athode Porosity****************************************** ************************/
DEFINE_PROFILE(Cathode_porosity, t,i)
{

cell_t c;
real x[ND_ND],y;

begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
y=(x[1]*1000-1.5)/0.05;
C_PROFILE(c,t,i) = pow(y,m)*(1-pow(y,m));
}

end_c_loop (c,t)
}

/*************************************************A node Density******************************************* *********************/
DEFINE_PROPERTY(A_Density, c,t)
{
real va, ve, p, d, u, y, x[ND_ND], dens, POR, po;
C_CENTROID(x,c,t);
y = x[1];
u = (y*1000 - 1.56) / 0.7;
va = pow(u, m); /* ve is the electrolyte material volume fraction*/
POR = C_POR(c,t);
ve = 1 - (va+POR); /* va is the anode material volume fraction*/
po = va*anode_density + ve*electrolyte_density;
dens = po*(1 - POR) + rua* POR;
return dens;
}
/*****************************************Anode thermal conductivity************************************** ***********/
DEFINE_PROPERTY(A_THER_cond,c,t)
{

real va, ve, p, d, u, x[ND_ND], POR, A, B, D, G, Lo,R,T,H, y, termal_cond_anode;
C_CENTROID(x,c,t);
y = x[1];
u = (y*1000 - 1.56) / 0.7;
va = pow(u, m);
POR = C_POR(c,t); /* va is the anode material volume fraction*/
ve = 1 - (va+POR); /* ve is the electrolyte material volume fraction*/
A = (3 * (anode_THER - electrolyte_THER)*va);
B = (3 * va*electrolyte_THER + (anode_THER +2* electrolyte_THER)*(1 - va));
Lo =electrolyte_THER*(1+( A / B));
D = Lo*(Lo*(1 - pow(POR, (2 / 3))) + thermal*pow(POR, (2 / 3)));
R = (pow(POR, (1 / 3))*thermal);
T = (1 - pow(POR, (1 / 3)))*((1 - pow(POR, 2 / 3))*Lo);
H = (1 - pow(POR, (1 / 3)))*(pow(POR, (2 / 3)))*thermal;
G = R + T + H;
termal_cond_anode = D / G;
return termal_cond_anode;
}
/********************************** CATHODE_DENSITY ************************************************** ******/
DEFINE_PROPERTY(C_Density, c,t)
{

real va, ve, p, d, u, y, x[ND_ND], dens, POR, po;

C_CENTROID(x,c,t);
y = x[1];
u = (y*1000 - 1.5) / 0.05;
POR = C_POR(c,t);
ve = pow(u, m); /* va is the anode material volume fraction*/
va = 1 - (ve+POR); /* ve is the electrolyte material volume fraction*/
po = va*anode_density + ve*electrolyte_density;
dens = po*(1 - POR) + rua* POR;
return dens;

}
/****************************************Cathode thermal conductivity************************************** ************/
DEFINE_PROPERTY(C_THER_cond, c,t)
{

real va, ve, p, d, u, x[ND_ND], POR, y,M,K,P,W, Lo,U1,J, termal_cond;
C_CENTROID(x,c,t);
y = x[1];
u = (y*1000 - 1.5) / 0.05;
POR = C_POR(c,t);
ve = pow(u, m); /* va is the anode material volume fraction*/
va = 1 - (ve+POR); /* ve is the electrolyte material volume fraction*/
M = (3 * (-cathode_THER + electrolyte_THER)*ve);
K = (3 * ve*cathode_THER + (2 * cathode_THER + electrolyte_THER)*(1 - ve));
Lo = cathode_THER*(1+(M / K));
P = Lo*(Lo*(1 - pow(POR, 2 / 3)) + thermal*pow(POR, 2 / 3));
J = pow(POR, 1 / 3)*thermal;
U1 = (1 - pow(POR, 1 / 3))*((1 - pow(POR, 2 / 3))*Lo);
W = (1 - pow(POR, 1 / 3))*(pow(POR, 2 / 3))*thermal;
termal_cond = P / (J + U1 + W);
return termal_cond;
}
walied123 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
UDF for writing porosity as a function of distance from the wall rohinibc Fluent UDF and Scheme Programming 5 August 8, 2012 08:16
UDF for porosity cfd-novice FLUENT 2 August 20, 2009 03:19
UDF for porosity Giacomo FLUENT 3 July 23, 2007 09:23
UDF for orous zone porosity ap FLUENT 2 November 10, 2004 18:26
Macros for writing UDF for porosity umesh FLUENT 1 June 13, 2003 04:20


All times are GMT -4. The time now is 21:52.