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

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

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 27, 2021, 12:21
Default UDF ANSYS - reading Energy or mole values in a cell.
  #1
Senior Member
 
AH
Join Date: Apr 2014
Posts: 282
Rep Power: 13
visitor is on a distinguished road
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.
visitor is offline   Reply With Quote

Old   March 28, 2021, 06:04
Default
  #2
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?

#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;
}
visitor is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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: call values of turbulent kinetic energy from previous time step nickgaoda Fluent UDF and Scheme Programming 0 July 31, 2018 14:25
OpenFoam "Permission denied" and "command not found" problems. iyidaniel@yahoo.co.uk OpenFOAM Running, Solving & CFD 11 January 2, 2018 06:47
A CFX-POST error (ver 14.5.7) wangyflp88 CFX 2 July 22, 2017 00:17
execFlowFunctionObjects - unknown field problem Toorop OpenFOAM Post-Processing 16 March 14, 2016 03:25
Journal file error magicalmarshmallow FLUENT 3 April 4, 2014 12:25


All times are GMT -4. The time now is 18:50.