CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Plot UDF functions (https://www.cfd-online.com/Forums/fluent/36183-plot-udf-functions.html)

Mike Spears March 28, 2005 11:21

Plot UDF functions
 
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.

Z March 28, 2005 12:15

Re: Plot UDF functions
 
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

Mike Spears March 28, 2005 18:46

Re: Plot UDF functions
 
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.

SS March 29, 2005 01:58

Re: Plot UDF functions
 
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.

Mike Spears March 29, 2005 17:22

Re: Plot UDF functions
 
hi, SS

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

Mike Spears March 29, 2005 19:30

Re: Plot UDF functions
 
Thanks, it works fine, thanks a lot again.

pandora September 11, 2010 21:47

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.


byronsmith September 14, 2010 07:30

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 October 20, 2010 17:00

Plot source term
 
Hi there,

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

Many thanks


Quote:

Originally Posted by byronsmith (Post 275138)
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


m zahid October 14, 2014 00:12

hi
 
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


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