## Fluids

#### macro for temperature and mole fraction

• hbilal1076
Subscriber

I am working on 2D flame combustor, In Ansys fluent, when simulation is executed, how temperature and mole fraction of radiating media (H2O and CO2 ) of each grid can be determined using macros?

Can any one help me to write the macro for temperature and mole fraction of radiating media of each grid?

• Rob
Ansys Employee
You might want to start with the UDF manual, you'll find all sorts of useful examples in there, several of which will help you. However, it's not clear what you're actually trying to do: radiation isn't just a function of temperature and mole fraction.
• DrAmine
Ansys Employee
Temperature is straightforward mole fraction will require small loop but in the manual there is an example how to get it. ­ƒñö
• hbilal1076
Subscriber
Dear Prof. Rob and Dr Amine Thank you very much for your kind reply.
I have a UDF manual, I just understand that the macro C_T return the temperature of certain grid and begin_c_loop and end_c_loop are the macro loop each grid in computational domain, similarly, I have to find the mole fraction of each grid.
For instance, in the attached figure, If the Temperature of a certain grid is 1500 K, and mole fraction of CO2 and H2O are 0.1 and 0.2 respectively. It can be seen that, the PMAC of CO2 and H2O are 0.08 and 0.02, so the absorption coefficient of this grid is 0.08*0.1+0.02*0.2 and then I have to loop the grid, after all, there are thousand of grids in the computational domain.
I hope you understand on what I am trying to find out and help me to write a macro for temperature and mole fraction fraction of CO2 and H2O so that I am able to execute a calculation using the coupled simulation.
Thank you very much for your precious time and assistance.
Sincerely Bilal

• Rob
Ansys Employee
Don't forget to account for the cell size: absorption has a unit of per length. Otherwise that sounds about right, and you'll want to dump that value to a UDM for post processing and potentially for whatever you're going to do with that data. We can give vague guidance on UDFs, but otherwise can only point you at the documentation.
• DrAmine
Ansys Employee
No I do not understand what you want to do, sorry. If you are referring to absorption: you can rely on built-in models or write a UDF for that.
• hbilal1076
Subscriber
Dear DrAmine Yes, I am looking to write a model in order to find the absorption using UDF, can you help me to write one?
TIA.
• DrAmine
Ansys Employee
I am sorry my help will be limited here in just providing guidance to which supported macros you can use.