CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Need help with Compressible flow with DEFINE_SPECIFIC_HEAT (

highhopes July 6, 2012 11:51

Need help with Compressible flow with DEFINE_SPECIFIC_HEAT
Hi everyone,
I am simulating a compressible flow with the energy equation on. However I need to define the specific heat using a udf. I can get the cp values I want but I might also need a viable approximation for enthalpy in the same macro. For this aim, pressure and density seems necessary because cp=sigma(cpi)+pressure/density where cpi is the partial specific heat which I have no problem with.
However I cannot use the pressure in the macro because as I have read on other topics posted in the forum, transfer of cell info into the macro seems impossible. Has anyone dealt with an issue of this sort? Is there a workaround?

akm July 6, 2012 15:13

just an idea..

you can turn off the energy equation and solve energy field using a user-defined scalar. any heat generation or viscous heating can be added as scalar sources. buoyancy effect can be added as source term to the momentum equation. heat flux or constant temperature at wall can be modelled using scalar profile. and so on...
and finally your specific heat problem will be solved because the scalar diffusivity is defined on per-cell basis -- DEFINE_DIFFUSIVITY(name, c, t, i) -- scalar diffusivity of each cell is calculated separately, so you can use the cell pressure and density in the definition.

a lot of work, i know. but it will solve the issue.

flotus1 July 6, 2012 16:04


Originally Posted by highhopes (Post 370128)
...transfer of cell info into the macro seems impossible...

If I understand you correctly, you want to READ cell or face values to use them for calculations inside the UDF?
Thats easily feasible. For the cell Temperature for example, use

Don't know the expressions for density or pressure by heart, but the UDF Manual surely does.

highhopes July 6, 2012 20:14

akm, I tried replacing temperature with a user defined scalar variable however unfortunately the results of a simplified run I did earlier did not match. Probably I could not define all the terms of UDS equation to mimic the energy equation. How do you suggest that I find all the required terms?
And would you suggest adding the rate of (pressure/density) as a source term for enthalpy?
I would seriously use uds instead of temperature in order to define open boundary at the outlet. However I cannot be sure because I probably did some stuff wrong the first time.

flotus1, I could not find a way to access the cell and thread indices through DEFINE_SPECIFIC_HEAT and return the specific heat value for the corresponding cell.

akm July 7, 2012 00:52

what kind of flow are you dealing with exactly ??

flotus1 July 7, 2012 02:36

Not sure what the manual says about the DEFINE_SPECIFIC_HEAT subroutine.
But you might be able to use DEFINE_PROPERTY(name,c,t) instead.

Worked fine in one of my setups.

highhopes July 7, 2012 17:07

akm, I am modelling compressible flow at elevated temperatures with specific heat capacity values dependent on temperature in a tabulated manner.

flotus1, I am using fluent 12.1 and I cannot see the name of the DEFINE_PROPERTY macro name in the list when I want to specify specific heat. I can only access my udf using DEFINE_SPECIFIC_HEAT using this version of fluent.

All times are GMT -4. The time now is 16:53.