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

Plot UDF functions

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 28, 2005, 11:21
Default Plot UDF functions
  #1
Mike Spears
Guest
 
Posts: n/a
Hi, everyone

I am trying to use a UDF to add source terms in momentum equation, however I want to check the plot of the source terms in the flow domain. I find I have no way to do this in FLUENT, until I write the plot file in UDF itself. Does anyone find an easy way to plot the UDF functions, thanks very much.
  Reply With Quote

Old   March 28, 2005, 12:15
Default Re: Plot UDF functions
  #2
Z
Guest
 
Posts: n/a
hi if you want to do this you must put this source term in either user define scalar or user define memory.

Please ask if you have more questions
  Reply With Quote

Old   March 28, 2005, 18:46
Default Re: Plot UDF functions
  #3
Mike Spears
Guest
 
Posts: n/a
Thanks, Z, I have no problem in imposing this udf sourse term, it is just the matter of ploting it. You mean if i set it as user define scalar, I will be able to plot it, right? Which menu is used to plot this user define scalar? Thanks again.
  Reply With Quote

Old   March 29, 2005, 01:58
Default Re: Plot UDF functions
  #4
SS
Guest
 
Posts: n/a
let us say you define this source in DEFINE_SOURCE() {

source =blah*blah; C_UDMI(c,t,0)=source; /* This is UD memory*/

return source, }

Before compiling this code make sure that memory =1 (this is defined in DEFINED memory) Now after running this code in Visualisation panel you should be able to see USER DEFINE memory along with other post processing variables like pressure, velocity etc

I hope this is clear for you.
  Reply With Quote

Old   March 29, 2005, 17:22
Default Re: Plot UDF functions
  #5
Mike Spears
Guest
 
Posts: n/a
hi, SS

I get your point, I will try and lot of thanks for your help.
  Reply With Quote

Old   March 29, 2005, 19:30
Default Re: Plot UDF functions
  #6
Mike Spears
Guest
 
Posts: n/a
Thanks, it works fine, thanks a lot again.
  Reply With Quote

Old   September 11, 2010, 21:47
Default
  #7
New Member
 
Antonio
Join Date: Aug 2010
Posts: 19
Rep Power: 6
pandora is on a distinguished road
Hi there
I'm trying exactly the same thing, a contour plot of my source term to verify that is being read correctly.

My udf looks as follows:

DEFINE_SOURCE(tube,c,t,dS,eqn)
{
real x[ND_ND];
real source,a;
tiempo=RP_Get_Real("flow-time");
C_CENTROID(x,c,t);
fscanf(A,"%f",&source);
C_UDMI(c,t,0)=source;
return C_UDMI(c,t,0);
}

And I'm reading from A that has the source terms. I have also set memory=1. The problem is that no matter what I do, when I plot USER DEFINED MEMORY, is all equal to 0. The weird thing is that if I set C_UDMI(c,t,0) to, let's say, 10, then it plots correctly. This makes me think that perhaps is not even reading the file properly which is even more confusing since result seem to make sense. You folks have any idea of what's going on?

Many thanks

Quote:
Originally Posted by SS
;119043
let us say you define this source in DEFINE_SOURCE() {

source =blah*blah; C_UDMI(c,t,0)=source; /* This is UD memory*/

return source, }

Before compiling this code make sure that memory =1 (this is defined in DEFINED memory) Now after running this code in Visualisation panel you should be able to see USER DEFINE memory along with other post processing variables like pressure, velocity etc

I hope this is clear for you.
pandora is offline   Reply With Quote

Old   September 14, 2010, 07:30
Default
  #8
Member
 
Byron Smith R J
Join Date: Mar 2009
Location: India
Posts: 46
Rep Power: 8
byronsmith is on a distinguished road
hai
from wat u have posted, it seems that u r reading the source from a file and the variable a is defined as small letter in real and caps is used in the program. check whether the program is free of compilation error. then try printing the source term and see if it is being read correctly
byronsmith is offline   Reply With Quote

Old   October 20, 2010, 17:00
Default Plot source term
  #9
New Member
 
Antonio
Join Date: Aug 2010
Posts: 19
Rep Power: 6
pandora is on a distinguished road
Hi there,

How would you do this (plotting a source term) with ANSYS12/CFX?

Many thanks


Quote:
Originally Posted by byronsmith View Post
hai
from wat u have posted, it seems that u r reading the source from a file and the variable a is defined as small letter in real and caps is used in the program. check whether the program is free of compilation error. then try printing the source term and see if it is being read correctly
pandora is offline   Reply With Quote

Old   October 14, 2014, 00:12
Default hi
  #10
Member
 
Qureshi M Z I
Join Date: Sep 2013
Posts: 51
Rep Power: 3
m zahid is on a distinguished road
hi,

my UDF of source term is showing zero output. here is my Udf , if anybody know the problem please help me .

DEFINE_SOURCE(xmom,c,t,dS,eqn)
{
real x[ND_ND];
real source,ve;
C_CENTROID(x,c,t);
ve=sqrt((pow(C_U(c,t),2.0)+pow(C_V(c,t),2.0)+pow(C _W(c,t),2.0)));
source =-1.225*0.2*0.55* C_U(c,t)*ve;
C_UDMI(c,t,0)=source;
return source;
}


thanks
m zahid is offline   Reply With Quote

Reply

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
UDF Wall functions. ANY EXPERTS? syler3321 FLUENT 1 November 9, 2014 23:15
UDF Wall functions conundrum syler3321 FLUENT 0 June 18, 2011 19:25
functions in UDF Lucy FLUENT 4 April 14, 2011 16:41
compiling my UDF Seyed Farid Hosseinizadeh FLUENT 22 February 14, 2006 11:19
DEFINE_GEOM UDF Problems Pat FLUENT 0 August 14, 2003 13:16


All times are GMT -4. The time now is 04:44.