CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF for adding an energy source term to a porous zone (https://www.cfd-online.com/Forums/fluent/198419-udf-adding-energy-source-term-porous-zone.html)

mtfowen February 6, 2018 06:43

UDF for adding an energy source term to a porous zone
 
Hello!

I am using a porous zone to represent a heat exchanger in a 3D simulation and am trying to write a UDF to add an energy source term to the conservation equation as the flow passes through the zone.

In order to calculate the source term I need to know:

a) the mass flow rate entering the cell / zone
b) the temperature of the fluid at the zone inlet
c) the area of the cell face at the zone inlet

I will use the DEFINE_SOURCE macro as follows:

#include "udf.h"
DEFINE_SOURCE(heat_source,cell,thread,dS,eqn)
{
real source;

source= xyz;

dS[eqn] =0.0;
return source;
}

Any suggestions as to how I can extract the necessary information in this macro?

I know for example that for (c) I can use:

F_AREA(Avect, face, thread)
NV_MAG(Avect)

Is there a way to identify the face and face thread in the DEFINE_SOURCE macro or will I need a separate macro for this?

Thanks in advance.


All times are GMT -4. The time now is 14:54.