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

UDF Internal Steam Reforming in Fuel Cell

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Kashif Rashid

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 26, 2014, 10:15
Default Not Working:UDF Internal Steam Reforming in Fuel Cell
  #1
New Member
 
Kashif Rashid
Join Date: Apr 2014
Posts: 8
Rep Power: 12
Kashif Rashid is on a distinguished road
I have written UDF in C, using fluent macro, “DEFINE_SOURCE”, for internal steam reforming (file attached). Reforming reactions are supposed to take place inside porous anode electrode of Fuel Cell. Pre-reformed fuel mixture is used which consist of (CH4, H2, H2O, CO, CO2) species. 6 source terms are generated (5 from species, 1 from heat sink, as steam reforming is an endothermic reaction). These source terms are hooked in "Cell Zone Conditions" of fluent. UDMI, memories in Fluent are also allocated to store data for above terms (see code file).
After doing all these things and running simulation, reactions are not taking place; there is no change in concentration of species at inlet and outlet. Can someone take a look on UDF and suggest me what i am doing wrong? Heat is being provided outside the porous anode to facilitate the endothermic reaction.
In the next step I shall include electrochemical reactions in this UDF taking place at the surface of anode, which are exothermic. Reforming reaction reactions will use this heat.
Attached Files
File Type: c MSR_Define_Source.c (3.4 KB, 52 views)
Adel abaidi likes this.

Last edited by Kashif Rashid; September 28, 2014 at 03:46. Reason: made some changes in the UDF
Kashif Rashid is offline   Reply With Quote

Old   September 26, 2014, 17:03
Default
  #2
Senior Member
 
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25
mprinkey will become famous soon enough
I think you are asking for trouble by doing the chemistry computations in the energy DEFINE_SOURCE and storing them in UDMs. The energy equation is called late in the segregated solver iteration (after the mass equation solution), so your UDMs are empty when you address them in the mass DEFINE_SOURCE, at least for the first iteration.

Computing all of your sources in one part of code makes sense. But If you do that, move those calculations to a DEFINE_ADJUST so that all of the (related) source terms are updated together at the beginning of the iteration and placed in the UDMs. Then all of the DEFINE_SOURCEs just need to read and apply the UDM data.

I am not sure that this will fix your problem of not seeing any effect of the UDF. The UDF would be using lagged values of the UDMs after the first iteration, which is wrong...but it should show some effect. You can try doing a hand calculation to verify quickly to see what the typical source value should be. See if your UDMs are of the right order of magnitude. Check your units too. FLUENT expects kg/m^3/s for the mass and species source terms.
mprinkey is offline   Reply With Quote

Old   September 27, 2014, 14:47
Default Modification in UDF (DEFINE_ADJUST)
  #3
New Member
 
Kashif Rashid
Join Date: Apr 2014
Posts: 8
Rep Power: 12
Kashif Rashid is on a distinguished road
Mr. mprinkey, I have modified UDF as you suggested by using "Define_Adjust" macro. There are variations in the mass fractions of species during simulation but after the solution converged there in no change in the composition of all the species at inlet and outlet (updated UDF attached).

Secondly, i have done hand calculations as well for initial composition of mixture, both results (hand cal. and soln. after converged) are of similar because after convergence composition is same. Units of rate and species source are right (checked).

What else should be done in UDF to desire results??? Please take a look on the modified UDF and suggest possible solution, why this UDF is not working? The response/recommendations from other senior members shall also be highly appreciated.
Attached Files
File Type: c UDF_MSR.c (6.7 KB, 52 views)

Last edited by Kashif Rashid; September 28, 2014 at 03:07.
Kashif Rashid 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
How to identify boundary cell and internal cell dbxmcf OpenFOAM Running, Solving & CFD 2 November 6, 2016 10:11
Journal file error magicalmarshmallow FLUENT 3 April 4, 2014 13:25
FvMatrix coefficients shrina OpenFOAM Running, Solving & CFD 10 October 3, 2013 15:38
UDF for heat source on surface instead of the whole cell zone?? benson621 Fluent UDF and Scheme Programming 4 December 8, 2011 12:54
Warning 097- AB Siemens 6 November 15, 2004 05:41


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