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

A UDF to calculate energy per a cell and then returns new CO2 content in a cell.

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   April 2, 2021, 04:49
Default A UDF to calculate energy per a cell and then returns new CO2 content in a cell.
  #1
Senior Member
 
AH
Join Date: Apr 2014
Posts: 282
Rep Power: 13
visitor is on a distinguished road
My first attempt to thermal split CO2 in cells, and return new values of CO2, O2, and CO. Also the remaining energy per a cell (consumed due to CO2 splitting). ANY recommendations, advise please? Ignore values of temperature and energy for now.

#include "udf.h"
DEFINE_PROPERTY(cell_CO2_split, cell, thread)
{
/*program to handle CO2 thermal splitting, assumed figures for now*/
/* define CO2, CO, and O2 as real, and they must be in mol values */
real CO2;
real CO;
real O2;
/* define temperature in cell and get its value */
real temp = C_T(cell, thread);
/*
define as real the ‘energy_IN_cell_per_mol_wt’. This needs to be obtained as energy in J/mol per a cell. Divided by the mol weight value. For CO2.*/
dzdt>energy=dh_dt; /*gas phase enthalpy J/s.*/
dzdt>energy=new_dh_dt;
dzdt>species[CO2=gas_mass_cell]; /*gas phase species mass kg/s*/
energy_IN_cell_per_mol_wt=dh_dt/gas_mass_cell;
real energy_IN_cell_per_mol_wt = C_E(cell,thread);
if (temp ≥ 500 && < 1000)
if (energy_IN_cell_per_mol_wt ≥(100e3/0.044) && <(150e3/0.044));
/*Above division by 0.044 gives energy per a cell per molar weight of CO2. Where 0.044 is the molar weight of CO2.*/
CO=1;
O2=1;
CO2=0;
/*
Below; energy taken (125e3) to split CO2, must be subtracted from cell. Then new value returned
*/
new_dh_dt=(dh_dt) - 125e3; /*subtract energy taken by CO2 per a cell.*/
return CO;
return O2;
return CO2;
return new_dh_dt;
endif;
else
CO2=1.;
return CO2;
}
visitor is offline   Reply With Quote

 


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



All times are GMT -4. The time now is 09:48.