CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

UDF problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 30, 2003, 13:35
Default UDF problem
  #1
Thomas
Guest
 
Posts: n/a
I have this UDF (interpented) in order to add a source in a porous medium region.

------------------------------------------------

#include "udf.h"

DEFINE_SOURCE(cell_x_source, c, t, dS, eqn)

{

real T1; real T2; real source;

if (FLUID_THREAD_P(t) && THREAD_VAR(t).fluid.porous)

{

C_T(c,t) = T1;

} else

{

C_T(c,t) = T2;

}

source = T1-T2;

dS[eqn] = 0; return source;

}

----------------------------------------- But when I compile it I take the following message: ....... line 7: structure reference not implement (the line 7 is the line with the IF sentence)

Thanks in advance for any help
  Reply With Quote

Old   February 4, 2003, 21:01
Default Re: UDF problem
  #2
Greg Perkins
Guest
 
Posts: n/a
you cannot set the C_T(c,t) = value;

C_T is the temperature and this is the output of the energy balance. It cannot be set by the user!

Also, in your if, only one C_T = T1, T2 will be executed, thus defining a source by the difference doesn't make much sense!

What are you trying to accomplish. If you wish to fix the temperature in some cells then your source should look a bit like:

source = 1.0e10*(value - C(T(c,t)); dS[eqn] = -1.0e10;

Try reading the book by Patankar - Numerical heat Transfer 1980, - its easy to understand and a great help when setting source terms for C.V. models like Fluent.

Greg
  Reply With Quote

Old   February 6, 2003, 09:51
Default Re: UDF problem
  #3
Thomas
Guest
 
Posts: n/a
Thanks for the answer. In fact what am I try to do is to add a heat source in a porous medium. This source will be a fuction of the temperature difference between the porous medium and its surrounding air. Its somehow familiar with one of your subrutines you have posted here where you calculate the heat transfer between the solid and gas. In my problem there is porous and air.

Any help will appreciated

Regards Thomas
  Reply With Quote

Old   February 6, 2003, 18:22
Default Re: UDF problem
  #4
Greg Perkins
Guest
 
Posts: n/a
To do that in Fluent, you will need to model the solid temperature yourself using a UDS and not use the inbuilt porous media model. Why?

Well, Fluent assumes that the porous media and surrounding fluid are at thermal equilibrium and hence there can be no heat transfer between the two - it just uses a single temperature! In order to model heat transfer you will need to have separate energy equations for the gas and solid. For the solid you can modify my udf code which does that.Then you can write your source term as a function of the temperature difference. In fact the code I posted does all this, you can just modify the heat transfer co-efficient for your application.

Note you will need two source terms - one for each energy equation and they will need to be consistent!

Greg
  Reply With Quote

Old   February 7, 2003, 03:49
Default Re: UDF problem
  #5
Thomas
Guest
 
Posts: n/a
Thank you very much! I will try it

Regards Thomas
  Reply With Quote

Old   February 7, 2003, 09:49
Default Re: UDF problem (clarification)
  #6
Thomas
Guest
 
Posts: n/a
Does the proposed UDF valid only for 4.5x version?

I try to implement in 6.02 and I took the followning message during the compilation:

line (250) redefinition; different basic types

The line (250) corresponds to the routine for the diffusivity

Thanks again

Thomas
  Reply With Quote

Old   February 9, 2003, 17:51
Default Re: UDF problem (clarification)
  #7
Greg Perkins
Guest
 
Posts: n/a
Yeah I remember that - it was originally written for v5 but to get it to work in v6 you need to rename that diffusivity function. It turns out that Fluent 6 includes a new function with the same name as my original udf, and hence doesn't like it.

I found that a few times, in my udfs.

Greg

  Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 07:56
UDF problem mansha goraya FLUENT 0 October 29, 2007 01:31
udf compiling problem akr FLUENT 3 August 22, 2007 08:14
UDF problem chiseung FLUENT 4 January 10, 2002 10:58


All times are GMT -4. The time now is 07:06.