CFD Online Logo CFD Online URL
Home > Forums > FLUENT

UDF for imposing a BC

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   July 14, 2003, 01:14
Default UDF for imposing a BC
Posts: n/a
Hi All,

In a problem, I have to get average temperature from an outlet and impose it on another inlet. Following is a UDF, which is not complete, but, i think it is enough to explain my approach. I need your suggestions.

***************************************** # include "udf.h"

real temp=0.0;

DEFINE_ADJUST(get_temp,d) { Thread *t; face_t f;

d = Get_Domain(17); (17 is zone ID of the outlet) temp = F_T(f,t);(will this give me avg. temp at the outlet)

return temp; }

DEFINE_PROFILE(temp_profile,t,i) {

real x[ND_ND];

face_t f;

begin_c_loop(c,t) {


} **********************************

  Reply With Quote

Old   July 15, 2003, 05:05
Default Re: UDF for imposing a BC
Andrew Garrard
Posts: n/a
OK, I am not an expert on this, but I think you should consider the following points:

1) Your variables have to be continuous strings, e.g. realTemp or real_temp, but not real temp.

2) You are not actually doing anything with your DEFINE_ADJUST function. If you are defining the profile on the inlet you only need the DEFINE_PROFILE for the inlet.

3) When you use your Get_Domain macro I think you want the Lookup_Thread Macro instead.

4) You are making a face loop when you are not dealing with any faces, also the face loop is not doing anything.

Here is a suggested alternative:

DEFINE_PROFILE(temp_at_inlet, thread_inlet, i) { real temp; /* defining a variable */ Domain *domain = Get_Domain(domainID); /* where domainID is zone ID for domian */ fact_t f_inlet, f_outlet; /* defining faces at inlet and outlet */ Thread *thread_outlet = Lookup_Thread(domain, ThreadID) /* where thread ID is your ID for outlet face thread */

/* you will then want some sort of face loop macro for the averaging of the outlet temp e.g. */ begin_f_loop(f_outlet, thread_outlet) { } end_f_loop(f_outlet, thread_outlet)

and then another f_loop to implement the result into the inlet:

beging_f_loop(f_inlet, thread_outlet) { F_PROFILE(f_inlet, thread_outlet, i) = avg_temp; } end_f_loop(f_inlet, thread_outlet)

I just did this on the fly, but I think it is the right approch you should be using. Check the fluent manuals for the macros that I have used to make sure you use the correct arguments etc...
  Reply With Quote

Old   July 15, 2003, 06:04
Default Re: UDF for imposing a BC
Posts: n/a
Hi Andrew,

Thanks a lot. I'll try it out.

Bye, Prasad
  Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 08:37
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01

All times are GMT -4. The time now is 11:42.