CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Temperature profile UDF for 3D cylinder surface (https://www.cfd-online.com/Forums/fluent-udf/153885-temperature-profile-udf-3d-cylinder-surface.html)

Himel June 5, 2015 12:17

Temperature profile UDF for 3D cylinder surface
 
Hi,

I am trying to incorporate a temperature profile on a surface of a 3D cylidner.

I have been using this code. But, when i tried to interprete the code it starts to say undeclared variable. I have some idea to write UDF for 2D case where the boundary is a line, But for 3D case where the boundary is surface i am not very sure.

Can anyone please help me in this regard?

I am giving the code here.


#include "udf.h"
DEFINE_PROFILE(temperature_prof,thread,index)
{
real x[ND_ND];
real y;
face_t f;
begin _f_loop (f, thread)

{
F_centroid(x,f,thread);
y=x[0];
F_PROFILE(f,thread,index)=-11497.5*y*y-659.781*y+1350;
}
end_f_loop(f,thread)
}

I am confused about particularly the red line, for 2D surface sholud the x should be 1D or 2D array ?

thodij June 16, 2015 10:59

UDF for Imposing Heat Transfer Coefficient as a function of temperature on a line
 
Hi,

I am new to UDF's. I am trying to impose a Convection heat transfer coefficient on a line on the OD of the pipe (in a pipeline 2D axisymmetric model), as function of the surface temperature.

This is my attempt. Please provide your comments.

/*----------------------------------------------------------------------------------------
heffupstream_rev.c
UDF for specifying steady-state external CHTC, heff on a line as a function of Surface
Temperature, Ts in a 2D axisymmetric CFD model: heff(Ts) = beta1*exp(beta2*Ts) + beta3
Temperature Ts is in Kelvins.
/*---------------------------------------------------------------------------------------*/
#include "udf.h"
#define beta1 8.83421; /* W/m^2.K */
#define beta2 1.45536e-3; /* 1/K */
#define beta3 -5.25737; /* W/m^2.K */
/* t is a pointer to the face's thread */
DEFINE_PROFILE(heff_upstream, c, t)
{

/* Variable Declarations */
real Ts = C_T(c,t); /* Ts is in Kelvins & C_T is the Cell Temperature variable Macro */
face_t f; /* f is a face thread index */
begin_f_loop(f,t)
{
F_PROFILE(f, t) = beta1 * exp(beta2*Ts) + beta3;
}

end_f_loop(f, t)

}


All times are GMT -4. The time now is 12:20.