UDF problem

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

 January 30, 2003, 13:35 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

 February 4, 2003, 21:01 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

 February 6, 2003, 09:51 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

 February 6, 2003, 18:22 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

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

 February 7, 2003, 09:49 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

 February 9, 2003, 17:51 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

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Rizwan Fluent UDF and Scheme Programming 32 May 8, 2015 06:05 july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56 mansha goraya FLUENT 0 October 29, 2007 01:31 akr FLUENT 3 August 22, 2007 07:14 chiseung FLUENT 4 January 10, 2002 10:58

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