# UDF ANSYS - reading Energy or mole values in a cell.

 Register Blogs Members List Search Today's Posts Mark Forums Read

 March 27, 2021, 12:21 UDF ANSYS - reading Energy or mole values in a cell. #1 Senior Member   AH Join Date: Apr 2014 Posts: 282 Rep Power: 13 How do you read a cell energy content and its mole value? I was thinking of converting this UDF from Fluent manual. Instead of returning mu_lam value in a cell, I will be returning different O2 mole value into a cell. But first I need to read the energy and CO2 mole values in a cells first. Thanks. #include "udf.h" DEFINE_PROPERTY(cell_viscosity,c,t) { real mu_lam; real temp = C_T(c,t); if (temp > 288.) mu_lam = 5.5e-3; else if (temp > 286.) mu_lam = 143.2135 - 0.49725 * temp; else mu_lam = 1.; return mu_lam; } above code, FLUENT 6.3 UDF Manual. Page 2-83.

 March 28, 2021, 06:04 #2 Senior Member   AH Join Date: Apr 2014 Posts: 282 Rep Power: 13 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? #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’. This needs to be obtained as energy in J/mol per a cell. The mol value here is of CO2. */ real energy_IN_cell_per_mol = C_E(cell,thread); if (temp ≥ 500 && < 1000) if (energy_IN_cell_per_mol ≥100e3 && <150e3); CO=1; O2=1; CO2=0; /* Below; energy taken (125e3) to split CO2, must be subtracted from cell. Then new value returned */ Energy = energy-150e3; return CO; return O2; return CO2; return endif; else CO2=1.; return CO2; }