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

Momentum source UDF

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   May 3, 2001, 02:13
Default Momentum source UDF
  #1
Matthew Brannock
Guest
 
Posts: n/a
Hi, I've just written up some code for a momentum source compiled UDF, where the constant source is restricted by its position in the domain and is adjusted on each iteration. It compiled OK (which doesn't mean much) but I get an error when fluent tries to call the function:

Error: get_udf_function: function cell_x_source has wrong type: 5 != 3 Error Object: ()

What does this mean and how can I fix it? I am a novice at C programming so it is probably something majorly wrong with the variable and function types I'm using. Here's the code:

#include "udf.h"

/* ------------------------------------------------------------------------

X_Momentum_Source

This routine returns the source term for the X-momentum term for each

control volume in the domain.

------------------------------------------------------------------------ */ DEFINE_SOURCE(cell_x_source, cell, thread, dS, eqn) {

real source;

real xc[ND_ND]; /* 3D position in array */

C_CENTROID(xc,cell,thread); /* outputs xc (cell centroid) */

if (xc[0] > 0.95)

{

if (xc[0] < 1.05)

if (xc[1] > 0)

if (xc[1] < 1) /* Restricted position of momentum source */

/* source term */

source = 0.1;

/* derivative of source term w.r.t. x-velocity. */

dS[eqn] = 0;

}

else

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

  Reply With Quote

 


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
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 10:23
Pressure jump and momentum source Tanya FLUENT 1 June 4, 2009 15:22
UDF for energy source João Fernandes FLUENT 4 October 17, 2008 04:53
UDF: PROFILE + SOURCE Nuno FLUENT 0 September 1, 2008 15:31
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 13, 2000 23:03


All times are GMT -4. The time now is 23:32.