CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   time dependent source using DEFINE_SOURCE (http://www.cfd-online.com/Forums/fluent-udf/62644-time-dependent-source-using-define_source.html)

T81 March 16, 2009 07:22

time dependent source using DEFINE_SOURCE
 
Hi!

I'm doing a transient analysis is a 2D channel:

..............____________________________
heat --> |............................................ |
flux ---> |____________________________|

fluid ---> ----------------axis--------------------
..............____________________________
heat --> |............................................ |
flux ---> |____________________________|

I want to have a time dependent heat flux for the side walls (shown above).
I'm using the following code but I get the following error:
"chip-exec: qmax_source: wrong return type: void udf function expected"

I'm hooking the udf under Boundary Conditions --> Wall --> Heat Flux

What's wrong?

Thank you in advance.


Code:

/**************************************/
/* UDF for specifying time dependent heat source */
/**************************************/

#include "udf.h"

#define QMAX 156589

DEFINE_SOURCE(qmax_source,c,t,dS,eqn)
{
  real source;
  real time = CURRENT_TIME;
 
  if (time <= 100) /* time 0-100 q = QMAX */
    {
      /* source term */
      source = QMAX;

      /* derivative of source term. */
      dS[eqn] = 0.;
    }
  if (time > 100 && time < 200) /* time 100-200 q = 0 */
  {
    source = dS[eqn] = 0.;
  }
  if (time >= 200 && time < 300) /* time 200-300 q = QMAX */
  {
      source = QMAX;

      dS[eqn] = 0.;
  }
  if (time >= 300 && time <400) /* time 300 -400 q = 0 */
  {
    source = dS[eqn] = 0.;
  }
  else if (time >= 400)/* time 400- q = QMAX */
  {
    source = QMAX;

    dS[eqn] = 0.;
  }
 
  return source;
}


HenrikS March 16, 2009 07:55

This is not my area of expertise, but anyway... What the error message is saying is that you are using the wrong type of macro. It seems you cannot hook a DEFINE_SOURCE-macro to the BC->Wall->Heat Flux panel. I suggest you try writing a DEFINE_HEAT_FLUX-macro instead (see UDF manual chapter 2.3.8)? Hope this helps!

/Henrik

dmoroian March 16, 2009 08:38

Hi T81,
Did you try to use DEFINE_HEAT_FLUX or DEFINE_PROFILE macros?

Dragos

T81 March 16, 2009 08:42

Now I'm trying the DEFINE_PROFILE macro and its seems to work.

Thanks both of you for the replies.

lyes43 February 28, 2011 14:16

Hello T 81 i'm a student I 'm working on simulate a turbulent flow in a rectangular channel were heat blocks are amounted using Fluent i had some problems need a help if u can hlp me write to me lyes43@yahoo.com

T81 February 28, 2011 18:23

Hi lyes43,
I would be glad to help you (if I'm able to...) if you could describe your problem more specifically.
You can start a new thread for that, if this is not the appropriate thread.

Regards,
t81


All times are GMT -4. The time now is 10:31.