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

fuel cell simulation in Fluent

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 21, 2003, 05:23
Default fuel cell simulation in Fluent
  #1
Huang
Guest
 
Posts: n/a
Hi everyone, I am trying to simulate the mole fraction of the species nearby the anode of a fuel cell. The boundary conditions include the anode as porous media and fuel gas inlet flow. The species will react on the anode. Can I build up such a model using the models provided in Fluent? Should I use UDF? Thank you all!
  Reply With Quote

Old   May 21, 2003, 12:04
Default Re: fuel cell simulation in Fluent
  #2
Andrew Garrard
Guest
 
Posts: n/a
I also am working on fuel cells. Depending on exactly what you want to solve depends on what tools you need to use. I found that I had to creat 3 UDFS.

Best piece of advice I can give you is to know what equtions you are trying to solve befor you begin to build a model. If those equations are avaliabe in fluent you may not need to use a UDF.

The equations I have built a UDF for are the Butler Volmer equation and the current production.

If you would like more information I may be able to help.
  Reply With Quote

Old   May 21, 2003, 16:02
Default Re: fuel cell simulation in Fluent
  #3
rookie
Guest
 
Posts: n/a
Hello Andrew,

I work on modeling fuel cells as well. Could you give more details? e.g.Your model is two-phase or single phase? if two-phase flow, which model do you use? multiphase model or multispecies model or DPM? or something else? how do you model phase changes? Could you send me some UDFs for fuel cells?

Thank you so much!

rookie
  Reply With Quote

Old   May 21, 2003, 22:36
Default Separate User-group Fuel cell simulation
  #4
Murali
Guest
 
Posts: n/a
Guys,

I work in fuel cell modeling as well. I think we should form a usergroup or something about modeling of fuel cells to share information. I have been in this forum for quite some time and have considerable experience in CFD software. If interested in starting a separate user-group, I think we can all team together.

Please let me know.

Murali
  Reply With Quote

Old   May 22, 2003, 04:03
Default Re: Separate User-group Fuel cell simulation
  #5
Huang
Guest
 
Posts: n/a
I think it will be great if we can exchange ideas on this!
  Reply With Quote

Old   May 22, 2003, 10:01
Default Re: Separate User-group Fuel cell simulation
  #6
rookie
Guest
 
Posts: n/a
Hello Murali,

So far, found only a couple of guys working on Fuel cell in this forum. I think the simpliest method is to use email. In the mean time, I am going to develop an online fuel cell forum group, and posted on my website. But it may take a while for me to finish it.

Thank you!

Rookie
  Reply With Quote

Old   May 22, 2003, 14:08
Default Re: Separate User-group Fuel cell simulation
  #7
Murali
Guest
 
Posts: n/a
rookie,

I have seen quite a few guys appearing in the forum with fuel cell interests. A user forum would be great too. I thought we could start something immediately so that we may not lose the people who are currently visiting. Once u start your forum, this yahoo group can be merged with yours. Does that sound ok to you ?

Murali

http://groups.yahoo.com/group/fuel_cells/
  Reply With Quote

Old   September 6, 2013, 21:52
Default A have a question?
  #8
New Member
 
Loncho
Join Date: Aug 2013
Posts: 5
Rep Power: 13
chino is on a distinguished road
Quote:
Originally Posted by Andrew Garrard
;106103
I also am working on fuel cells. Depending on exactly what you want to solve depends on what tools you need to use. I found that I had to creat 3 UDFS.

Best piece of advice I can give you is to know what equtions you are trying to solve befor you begin to build a model. If those equations are avaliabe in fluent you may not need to use a UDF.

The equations I have built a UDF for are the Butler Volmer equation and the current production.

If you would like more information I may be able to help.
Hi, sorry but a need to do a little question about the Butler-Volmer UDF. Can you help me?
chino is offline   Reply With Quote

Old   September 8, 2013, 13:03
Default
  #9
Senior Member
 
A CFD free user's Avatar
 
A-A Azarafza
Join Date: Jan 2013
Posts: 226
Rep Power: 14
A CFD free user is on a distinguished road
@Chino
Hey mate, What's your problem? Tell me I will do my best to answer it.
Good luck
__________________
Regard yours
A CFD free user is offline   Reply With Quote

Old   September 8, 2013, 17:05
Default
  #10
New Member
 
Loncho
Join Date: Aug 2013
Posts: 5
Rep Power: 13
chino is on a distinguished road
Well, I don't know how I can apply the Bultler-Volmer equation, in some articles I have found some variables that I need.
The problem is with the local reactive concentration and the temperature in the microfluidic fuel cell, because I don´t know how this variable can be writing in the UDF Bultler-Volmer equation? The two variables are results of my simulation.
The reactions in the anode a cathode has been achieved using "species transport" model, it is an isotermic reactions.

It is difficult to explain, but I am very graveful with your help.
chino is offline   Reply With Quote

Old   September 8, 2013, 17:07
Default Hi again.
  #11
New Member
 
Loncho
Join Date: Aug 2013
Posts: 5
Rep Power: 13
chino is on a distinguished road
Well, I don't know how I can apply the Bultler-Volmer equation, in some articles I have found some variables that I need.
The problem is with the local reactive concentration and the temperature in the microfluidic fuel cell, because I don´t know how this variable can be writing in the UDF Bultler-Volmer equation? The two variables are results of my simulation.
The reactions in the anode a cathode has been achieved using "species transport" model, it is an isotermic reactions.

It is difficult to explain, but I am very graveful with your help.
Attached Images
File Type: jpg Butler - Volmer.jpg (54.9 KB, 95 views)
chino is offline   Reply With Quote

Old   September 9, 2013, 10:51
Default
  #12
Senior Member
 
A CFD free user's Avatar
 
A-A Azarafza
Join Date: Jan 2013
Posts: 226
Rep Power: 14
A CFD free user is on a distinguished road
@ Chino
Hi
You should accept that you didn't ask your question exactly. It's quite vague and difficult to understand your mean. But, I suppose that you've probably have difficulty in recalling local temperature and concentration. Right? If so, you can recall them easily in the UDF by corresponding macro. For instance, you can recall temperature with C_T(c,t) or mass fractions of involved species by C_YI(c,t,i). That's my grasp of what you asked. Hope it helps
Good luck
__________________
Regard yours

Last edited by A CFD free user; September 10, 2013 at 16:00.
A CFD free user is offline   Reply With Quote

Old   September 10, 2013, 13:35
Default
  #13
New Member
 
Tom Tranter
Join Date: Mar 2013
Location: Leeds, UK
Posts: 21
Rep Power: 13
pmtgt is on a distinguished road
Hi,

I am also having a problem modelling the Butler-Volmer equation in an attempt to create an alternative model to the one provided by Ansys in fluent. I'm basically not getting the same results as the oficial model.

I have set up a 2D fuel cell model and started by trying to solve the solid and membrane potentials as UDS equations with source terms in the catalyst layers based on the transfer current given by the overpotential (as the fluent manual tells you). I've set the value of the electric potential to 0.75 at the cathode terminal/wall and 0 at the anode and have zero flux BCs for all external walls.
I've made the electron conductivity very low for the membrane and very high everywhere else and the reverse for the proton conductivity.

I have 4 source terms, in the anode side I have Ra_plus for the positive electric potential and Ra_minus for the negative protonic potential which is the same magnitude but opposite sign. A similar situation occurs on the cathode side I have Rc_minus for the electric and Rc_plus for the protonic potentials.

Like any good programmer I've copied most of the code from the pem.c udf provided with fluent but edited out the bits I don't need yet like the concentrations. A section of the listing for Ra_plus is below. The others follow the same pattern with signs changed accordingly and for the cathode side I subtract the open circuit voltage from the overpotential.

/* UDF to calculate overpotential using two electric potential fields defined as uds and transfer current source */
#include "udf.h"
#define TINY 1.0e-16
#define Farad 9.65e7
#define alpha_c 0.512
#define alpha_a 0.5
#define i_ref_a 100000
#define i_ref_c 100
#define v_oc 1.01
DEFINE_SOURCE(Ra_plus, c, t, dS, eqn)
{
/* Assign the UDS index numbers */
enum /* user-defined scalar (UDS) */
{
phi_s, /* solid phase potential */
phi_m, /* membrane phase potential */
n_uds_required
};
enum /* user-defined memory (UDM) */
{
surf_eta, /* 6 overpotential */
trans_current, /*13 transfer current A/m3 */
n_udm_required
};
/* Set overpotential as difference in two potential fields */
real source=0.0;
real c_c = 0.2;
real c_w = MAX(c_c,TINY);
real eta = C_UDSI(c,t,phi_s)-C_UDSI(c,t,phi_m);
real A_p=0.0;
real sat = 0.0;
real s_corr = 1.0;
real gamma = 1.0;
int i=0;
int n_electrons=2;
real alpha_eta_a, alpha_eta_c, exp_a, exp_c;
const real exponent_limit = 25.;
const real exp_big = exp(exponent_limit);
const real exp_sml = 0.;
const real eta_cut = 1.0e-10;

/* prevent over- and underflow of exp() */
alpha_eta_c = alpha_c*eta;
if (exponent_limit < alpha_eta_c)
exp_c = exp_big;
else if (-exponent_limit > alpha_eta_c)
exp_c = exp_sml;
else
exp_c = exp(alpha_eta_c);
/* prevent over- and underflow of exp() */
alpha_eta_a = alpha_a*eta;
if (exponent_limit < alpha_eta_a)
exp_a = exp_big;
else if (-exponent_limit > alpha_eta_a)
exp_a = exp_sml;
else
exp_a = exp(alpha_eta_a);

A_p = i_ref_a*(exp_a-exp_c)/(Farad*n_electrons);
C_UDMI(c,t,surf_eta) = eta;

dS[eqn]=(alpha_a*exp(alpha_eta_a)-alpha_c*exp(alpha_eta_c))*i_ref_a*pow(c_w,gamma)*s _corr; /*anode*/
//dS[eqn]=(alpha_c*exp(alpha_eta_c)-alpha_a*exp(alpha_eta_c))*i_ref_c*pow(c_w,gamma)*s _corr; /*cathode*/

source=A_p*n_electrons*Farad*pow(c_w,gamma)*s_corr ;
return source;

}

If anyone is willing to help I can send them images and the case and udf files

Kind regards

Tom
pmtgt is offline   Reply With Quote

Old   September 11, 2013, 13:13
Default Thank you
  #14
New Member
 
Loncho
Join Date: Aug 2013
Posts: 5
Rep Power: 13
chino is on a distinguished road
Quote:
Originally Posted by A CFD free user View Post
@ Chino
Hi
You should accept that you didn't ask your question exactly. It's quite vague and difficult to understand your mean. But, I suppose that you've probably have difficulty in recalling local temperature and concentration. Right? If so, you can recall them easily in the UDF by corresponding macro. For instance, you can recall temperature with C_T(c,t) or mass fractions of involved species by C_YI(c,t,i). That's my grasp of what you asked. Hope it helps
Good luck
I will do my best to resolve my problem in this month. You answer my question, I answer if it is possible that you can look at my UDF when I finish it?
chino is offline   Reply With Quote

Old   September 11, 2013, 14:49
Default
  #15
Senior Member
 
A CFD free user's Avatar
 
A-A Azarafza
Join Date: Jan 2013
Posts: 226
Rep Power: 14
A CFD free user is on a distinguished road
@ Chino
why not. I will see like others and do my best to help you. Share it on this page whenever you complete it.
Good luck
__________________
Regard yours
A CFD free user is offline   Reply With Quote

Old   September 12, 2013, 13:10
Default
  #16
New Member
 
Loncho
Join Date: Aug 2013
Posts: 5
Rep Power: 13
chino is on a distinguished road
Quote:
Originally Posted by A CFD free user View Post
@ Chino
why not. I will see like others and do my best to help you. Share it on this page whenever you complete it.
Good luck
Well I send you the Butler-Volmer equation for the anodic reaction, I never do a program in C lenguage so I will have some problem with the redaction. One more time, thank you for your help.
Attached Files
File Type: txt Butler_Volmer.txt (589 Bytes, 93 views)
chino is offline   Reply With Quote

Old   November 26, 2020, 08:49
Default
  #17
New Member
 
吴宇靖
Join Date: Oct 2020
Posts: 2
Rep Power: 0
wuyujing is on a distinguished road
Quote:
Originally Posted by A CFD free user View Post
@Chino
Hey mate, What's your problem? Tell me I will do my best to answer it.
Good luck
Hi
I'm modeling DMFC, and i need to write a udf, but i don't know how to define Butler-Volmer equation. I saw overpotential defined by UDS in many paper, Is current density defined in UDS source macro or in adjust macro? please help me!
wuyujing is offline   Reply With Quote

Old   November 26, 2020, 19:39
Default
  #18
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you need to use user defined scalar (UDS) to calculate Butler-Volmer equation.

adjust macro is just a macro to be executed before each iteration/time step

read ansys fluent customization manual for more information
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   July 2, 2024, 09:44
Default
  #19
yyb
New Member
 
Lily
Join Date: Jul 2024
Posts: 16
Rep Power: 2
yyb is on a distinguished road
Quote:
Originally Posted by pmtgt View Post
Hi,

I am also having a problem modelling the Butler-Volmer equation in an attempt to create an alternative model to the one provided by Ansys in fluent. I'm basically not getting the same results as the oficial model.

I have set up a 2D fuel cell model and started by trying to solve the solid and membrane potentials as UDS equations with source terms in the catalyst layers based on the transfer current given by the overpotential (as the fluent manual tells you).


I've set the value of the electric potential to 0.75 at the cathode terminal/wall and 0 at the anode and have zero flux BCs for all external walls.
I've made the electron conductivity very low for the membrane and very high everywhere else and the reverse for the proton conductivity.

I have 4 source terms, in the anode side I have Ra_plus for the positive electric potential and Ra_minus for the negative protonic potential which is the same magnitude but opposite sign. A similar situation occurs on the cathode side I have Rc_minus for the electric and Rc_plus for the protonic potentials.


Like any good programmer I've copied most of the code from the pem.c udf provided with fluent but edited out the bits I don't need yet like the concentrations. A section of the listing for Ra_plus is below. The others follow the same pattern with signs changed accordingly and for the cathode side I subtract the open circuit voltage from the overpotential.

/* UDF to calculate overpotential using two electric potential fields defined as uds and transfer current source */
#include "udf.h"
#define TINY 1.0e-16
#define Farad 9.65e7
#define alpha_c 0.512
#define alpha_a 0.5
#define i_ref_a 100000
#define i_ref_c 100
#define v_oc 1.01
DEFINE_SOURCE(Ra_plus, c, t, dS, eqn)
{
/* Assign the UDS index numbers */
enum /* user-defined scalar (UDS) */
{
phi_s, /* solid phase potential */
phi_m, /* membrane phase potential */
n_uds_required
};
enum /* user-defined memory (UDM) */
{
surf_eta, /* 6 overpotential */
trans_current, /*13 transfer current A/m3 */
n_udm_required
};
/* Set overpotential as difference in two potential fields */
real source=0.0;
real c_c = 0.2;
real c_w = MAX(c_c,TINY);
real eta = C_UDSI(c,t,phi_s)-C_UDSI(c,t,phi_m);
real A_p=0.0;
real sat = 0.0;
real s_corr = 1.0;
real gamma = 1.0;
int i=0;
int n_electrons=2;
real alpha_eta_a, alpha_eta_c, exp_a, exp_c;
const real exponent_limit = 25.;
const real exp_big = exp(exponent_limit);
const real exp_sml = 0.;
const real eta_cut = 1.0e-10;

/* prevent over- and underflow of exp() */
alpha_eta_c = alpha_c*eta;
if (exponent_limit < alpha_eta_c)
exp_c = exp_big;
else if (-exponent_limit > alpha_eta_c)
exp_c = exp_sml;
else
exp_c = exp(alpha_eta_c);
/* prevent over- and underflow of exp() */
alpha_eta_a = alpha_a*eta;
if (exponent_limit < alpha_eta_a)
exp_a = exp_big;
else if (-exponent_limit > alpha_eta_a)
exp_a = exp_sml;
else
exp_a = exp(alpha_eta_a);

A_p = i_ref_a*(exp_a-exp_c)/(Farad*n_electrons);
C_UDMI(c,t,surf_eta) = eta;

dS[eqn]=(alpha_a*exp(alpha_eta_a)-alpha_c*exp(alpha_eta_c))*i_ref_a*pow(c_w,gamma)*s _corr; /*anode*/
//dS[eqn]=(alpha_c*exp(alpha_eta_c)-alpha_a*exp(alpha_eta_c))*i_ref_c*pow(c_w,gamma)*s _corr; /*cathode*/

source=A_p*n_electrons*Farad*pow(c_w,gamma)*s_corr ;
return source;

}

If anyone is willing to help I can send them images and the case and udf files

Kind regards

Tom
Quote:
Originally Posted by wuyujing View Post
Hi
I'm modeling DMFC, and i need to write a udf, but i don't know how to define Butler-Volmer equation. I saw overpotential defined by UDS in many paper, Is current density defined in UDS source macro or in adjust macro? please help me!
May I ask where your potential is added? Is it realized with udf? Or did you set it directly in the fluent command window?
Thanks a lot!

What are solid-phase potentials and membrane-phase potentials, respectively?
yyb is offline   Reply With Quote

Old   July 2, 2024, 10:04
Default
  #20
yyb
New Member
 
Lily
Join Date: Jul 2024
Posts: 16
Rep Power: 2
yyb is on a distinguished road
Quote:
Originally Posted by pmtgt View Post
Hi,

I am also having a problem modelling the Butler-Volmer equation in an attempt to create an alternative model to the one provided by Ansys in fluent. I'm basically not getting the same results as the oficial model.

I have set up a 2D fuel cell model and started by trying to solve the solid and membrane potentials as UDS equations with source terms in the catalyst layers based on the transfer current given by the overpotential (as the fluent manual tells you). I've set the value of the electric potential to 0.75 at the cathode terminal/wall and 0 at the anode and have zero flux BCs for all external walls.
I've made the electron conductivity very low for the membrane and very high everywhere else and the reverse for the proton conductivity.

I have 4 source terms, in the anode side I have Ra_plus for the positive electric potential and Ra_minus for the negative protonic potential which is the same magnitude but opposite sign. A similar situation occurs on the cathode side I have Rc_minus for the electric and Rc_plus for the protonic potentials.

Like any good programmer I've copied most of the code from the pem.c udf provided with fluent but edited out the bits I don't need yet like the concentrations. A section of the listing for Ra_plus is below. The others follow the same pattern with signs changed accordingly and for the cathode side I subtract the open circuit voltage from the overpotential.

/* UDF to calculate overpotential using two electric potential fields defined as uds and transfer current source */
#include "udf.h"
#define TINY 1.0e-16
#define Farad 9.65e7
#define alpha_c 0.512
#define alpha_a 0.5
#define i_ref_a 100000
#define i_ref_c 100
#define v_oc 1.01
DEFINE_SOURCE(Ra_plus, c, t, dS, eqn)
{
/* Assign the UDS index numbers */
enum /* user-defined scalar (UDS) */
{
phi_s, /* solid phase potential */
phi_m, /* membrane phase potential */
n_uds_required
};
enum /* user-defined memory (UDM) */
{
surf_eta, /* 6 overpotential */
trans_current, /*13 transfer current A/m3 */
n_udm_required
};
/* Set overpotential as difference in two potential fields */
real source=0.0;
real c_c = 0.2;
real c_w = MAX(c_c,TINY);
real eta = C_UDSI(c,t,phi_s)-C_UDSI(c,t,phi_m);
real A_p=0.0;
real sat = 0.0;
real s_corr = 1.0;
real gamma = 1.0;
int i=0;
int n_electrons=2;
real alpha_eta_a, alpha_eta_c, exp_a, exp_c;
const real exponent_limit = 25.;
const real exp_big = exp(exponent_limit);
const real exp_sml = 0.;
const real eta_cut = 1.0e-10;

/* prevent over- and underflow of exp() */
alpha_eta_c = alpha_c*eta;
if (exponent_limit < alpha_eta_c)
exp_c = exp_big;
else if (-exponent_limit > alpha_eta_c)
exp_c = exp_sml;
else
exp_c = exp(alpha_eta_c);
/* prevent over- and underflow of exp() */
alpha_eta_a = alpha_a*eta;
if (exponent_limit < alpha_eta_a)
exp_a = exp_big;
else if (-exponent_limit > alpha_eta_a)
exp_a = exp_sml;
else
exp_a = exp(alpha_eta_a);

A_p = i_ref_a*(exp_a-exp_c)/(Farad*n_electrons);
C_UDMI(c,t,surf_eta) = eta;

dS[eqn]=(alpha_a*exp(alpha_eta_a)-alpha_c*exp(alpha_eta_c))*i_ref_a*pow(c_w,gamma)*s _corr; /*anode*/
//dS[eqn]=(alpha_c*exp(alpha_eta_c)-alpha_a*exp(alpha_eta_c))*i_ref_c*pow(c_w,gamma)*s _corr; /*cathode*/

source=A_p*n_electrons*Farad*pow(c_w,gamma)*s_corr ;
return source;

}

If anyone is willing to help I can send them images and the case and udf files

Kind regards

Tom
Also, where did you get the pem.c udf file from? Can you send me the case and files? I am studying something about PEMEC, but have no idea.
Much appreciated!
yyb 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
Fluent Fuel Cell Module Tutorial - Error!!! shamsnoor FLUENT 6 August 7, 2012 08:30
Fuel cell modeling Steven FLUENT 9 April 29, 2012 07:51
fuel cell for udf pour FLUENT 2 August 16, 2008 12:39
Modelling Fuel cell in fluent Jan FLUENT 0 October 10, 2004 12:08
modelling fuel cell duct in fluent rajesh kumar tippabhotla FLUENT 2 October 7, 2004 13:04


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