CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF help (about temp gradient) (https://www.cfd-online.com/Forums/fluent/43526-udf-help-about-temp-gradient.html)

Jihwan January 29, 2007 10:08

UDF help (about temp gradient)
 
Hi

I have a problem accessing the temperature gradient in a UDF.

I want to give temperature gradient on the 2-D wall.

(Methematical fucntion is T(x)= 30 + ( 1.5 * lxl )

I spent a lot of time with manual. But I failed.

I need your help.

pinks January 29, 2007 10:59

Re: UDF help (about temp gradient)
 
Use DEFINE_profile macro, F_T and F_centroid. read centroid of the cell, assingn x(0) to a variable, and define the function on each face as F_T(f,t)= 30 + (1.5 * fabs(a)).where a=x(0). I hope this should work. All the best.


Jihwan January 29, 2007 11:12

Re: UDF help (about temp gradient)
 
thanks for your advice.

I tried..

But that couldn't interpreted..

and I don't know what is problem..

when I tried interpreted, than message came out -line 13: a: undeclared variable

can you help me?

my ccp file is

************************************************** * #include <udf.h>

DEFINE_PROFILE(temp_wall,thread,position) {

real x [ND_ND];

real r,y;

face_t f;

begin_f_loop(f,thread)

{

F_CENTROID(x,f,thread);

a=x[1];

F_T(f,thread)=30.+(1.5*fabs(a));

}

end_f_loop(f,thread) }


pinks January 29, 2007 11:29

Re: UDF help (about temp gradient)
 
you have not defined variable a, use r instead or define real a instead of real r,y; ur udf. u r using x[1], i hope ur wall is in y direction.


Jihwan January 29, 2007 11:45

Re: UDF help (about temp gradient)
 
thanks a lot. I succeed interpreted. but I failed compiling..

massage aappear

"pening library "Temp_wall"...

Error: open_udf_library: μ§€μ •λœ νŒŒμΌμ„ 찾을 수 μ-†μŠ΅λ‹ˆλ‹€.(<--KOREAN)

Error Object: ()"

what's prlblem?


Jihwan January 29, 2007 11:49

Re: UDF help (about temp gradient)
 
And my wall is in X direction

--------------------------->(wall-direction)

and My changed cpp file is

************************************************** *

#include <udf.h>

DEFINE_PROFILE(temp_wall,thread,position) {

real x [ND_ND];

real a,y;

face_t f;

begin_f_loop(f,thread)

{

F_CENTROID(x,f,thread);

a=x[1];

F_T(f,thread)=30.+(1.5*fabs(a));

}

end_f_loop(f,thread) }

pinks January 30, 2007 00:40

Re: UDF help (about temp gradient)
 
Hi, I am able to compile as well as load. try the following udf. Keep the [filename].c file in your working directory.. and confirm that you have a c compiler.

#include "udf.h"

DEFINE_PROFILE(temp_wall,thread,position) {

real x [ND_ND];

real a,y;

face_t f;

begin_f_loop(f,thread)

{

F_CENTROID(x,f,thread);

a=x[0];

F_T(f,thread)=30.+(1.5*fabs(a));

}

end_f_loop(f,thread) }

pinks January 30, 2007 00:41

Re: UDF help (about temp gradient)
 
x[0], x[1], x[2] stands for x,y and z dirctn respetively. If you ahve your wall in x direction use x[0]

Jihwan January 30, 2007 01:04

Re: UDF help (about temp gradient)
 
Thanks a lot Pinks.

I use visual C++.

But I don't know why didn't compiling.

I'll try again. (I got it about problem. udf coding is work, and compiler has a problem. is correct?)

And can I ask again if I continually failed ?

Have a nice day.. see ya


Jihwan January 30, 2007 02:10

Re: UDF help (about temp gradient)
 
Finally, I found problem.

my c compiler has not udf.h file.

bottom is message when try compiling to use C++

--------------------Configuration: temp_wall - Win32 Debug-------------------- Compiling... temp_wall.cpp d:\fluenty\c++\temp_wall.cpp(1) : fatal error C1083: Cannot open include file: 'udf.h': No such file or directory Error executing cl.exe.

temp_wall.exe - 1 error(s), 0 warning(s)

how can I do it ?


pinks January 31, 2007 01:02

Re: UDF help (about temp gradient)
 
Fluent provides free compiler visual studio.NET at the following link http://www.fluentusers.com/support/i...udf_serial.htm. If you are licensed user you can download. You just need to launch Fluent the .net command prompt.



All times are GMT -4. The time now is 02:22.