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

extract calculation result from udf

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2016, 03:40
Default extract calculation result from udf
  #1
New Member
 
anubhav
Join Date: Sep 2014
Posts: 8
Rep Power: 11
anubhavd is on a distinguished road
Hello
I have written a udf to calculate nucleation rate(function of temperature and concentration) taking temperature and concentration values from Ansys Fluent simulation.Now I need to extract the nucleation rate values.Can anyone suggest me how to extract this?
anubhavd is offline   Reply With Quote

Old   March 28, 2016, 10:49
Default
  #2
New Member
 
Join Date: Aug 2012
Posts: 5
Rep Power: 13
gewuzhizhi is on a distinguished road
do you want to extract these parameters on a predefined plane? first get the plane IDfrom the Boundary condition GUI,then using F_T(f,t) to get temperature,etc. you can search face macro in the help.cell macro is similar
gewuzhizhi is offline   Reply With Quote

Old   March 30, 2016, 07:35
Default
  #3
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 12
Bruno Machado is on a distinguished road
Quote:
Originally Posted by anubhavd View Post
Hello
I have written a udf to calculate nucleation rate(function of temperature and concentration) taking temperature and concentration values from Ansys Fluent simulation.Now I need to extract the nucleation rate values.Can anyone suggest me how to extract this?
you can easily define a UDMI and get copy the values of your variable into it.
Bruno Machado is offline   Reply With Quote

Old   March 30, 2016, 07:52
Default
  #4
New Member
 
anubhav
Join Date: Sep 2014
Posts: 8
Rep Power: 11
anubhavd is on a distinguished road
Dear Bruno Machado
I am copying my udf code can you please suggest me how to call UDMI and extract the values. I need to extract "J" values at different locations to plot contour.

#include "udf.h"
#include "math.h"

DEFINE_SOURCE(decay_rate_of_zn_vapor,c,t,dS,eqn)
{

real x[ND_ND];
real source;
real r,sigma,rho,R,S1,m,n,A,beta,K,N1,G1,J,M,Z,Psat,P;
if(C_YI(c,t,0)>0)
{

C_CENTROID(x,c,t);
K=1.3807e-23;
R=8.3143;
m=0.065;
A=6.023e23;
sigma=0.83;
rho=6559-0.884*(C_T(c,t)-692.677);
P=C_R(c,t)*C_YI(c,t,0)*R*C_T(c,t);
if(C_T(c,t)>700)

Psat=pow(10.,((-6620./C_T(c,t))-(1.255*log10(C_T(c,t)))+14.465));
else
Psat=1000*(pow(10.,((-6850./C_T(c,t))-(0.755*log10(C_T(c,t)))+10.365)));

return Psat;

S1=P/Psat;
r=(2*sigma*m*2.303)/(rho*R*C_T(c,t)*log10(S1));
G1=(4*3.14*pow(r,2)*sigma)/3;
N1=P/(K*C_T(c,t));
M=m/A;
beta=N1*pow((K*C_T(c,t)/(2*3.14*M)),0.5);
Z=(M/(2*3.14*pow(r,2)*rho))*(pow((sigma/(K*C_T(c,t))),0.5));
J=4*3.14*pow(r,2)*beta*Z*N*exp(-G1/(K*C_T(c,t)));

source=-(4*3.14*pow(r,3)*rho*J)/3;

dS[eqn]=0.0;
}
else
source = dS[eqn] = 0;
printf("Temperature: %g\n",C_T(c,t));
return source;

}
anubhavd is offline   Reply With Quote

Old   March 30, 2016, 08:08
Default
  #5
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 12
Bruno Machado is on a distinguished road
Quote:
Originally Posted by anubhavd View Post
Dear Bruno Machado
I am copying my udf code can you please suggest me how to call UDMI and extract the values. I need to extract "J" values at different locations to plot contour.

#include "udf.h"
#include "math.h"

DEFINE_SOURCE(decay_rate_of_zn_vapor,c,t,dS,eqn)
{

real x[ND_ND];
real source;
real r,sigma,rho,R,S1,m,n,A,beta,K,N1,G1,J,M,Z,Psat,P;
if(C_YI(c,t,0)>0)
{

C_CENTROID(x,c,t);
K=1.3807e-23;
R=8.3143;
m=0.065;
A=6.023e23;
sigma=0.83;
rho=6559-0.884*(C_T(c,t)-692.677);
P=C_R(c,t)*C_YI(c,t,0)*R*C_T(c,t);
if(C_T(c,t)>700)

Psat=pow(10.,((-6620./C_T(c,t))-(1.255*log10(C_T(c,t)))+14.465));
else
Psat=1000*(pow(10.,((-6850./C_T(c,t))-(0.755*log10(C_T(c,t)))+10.365)));

return Psat;

S1=P/Psat;
r=(2*sigma*m*2.303)/(rho*R*C_T(c,t)*log10(S1));
G1=(4*3.14*pow(r,2)*sigma)/3;
N1=P/(K*C_T(c,t));
M=m/A;
beta=N1*pow((K*C_T(c,t)/(2*3.14*M)),0.5);
Z=(M/(2*3.14*pow(r,2)*rho))*(pow((sigma/(K*C_T(c,t))),0.5));
J=4*3.14*pow(r,2)*beta*Z*N*exp(-G1/(K*C_T(c,t)));

source=-(4*3.14*pow(r,3)*rho*J)/3;

dS[eqn]=0.0;
}
else
source = dS[eqn] = 0;
printf("Temperature: %g\n",C_T(c,t));
return source;

}
in the Fluent, go to Define -> User define -> Memory and define 1 UDMI.
in your code, you can add the following line (where XXXXX is the variable you want to dump).

C_UDMI(c,t,0) = XXXXX;

Another tip to make you calculations quicker: i saw that you compute many times the temperature C_T(c,t) in your calculations. It is easier and quicker if you add a variable T (for example) to your list of variables and define it as your temperature

T = C_T(c,t);

then fluent wont compute many times the same variable.
Bruno Machado is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with unsteady calculation with source/sink UDF RobV FLUENT 1 November 13, 2016 06:44
UDF to extract particle positions and velocities at outlet marauder Fluent UDF and Scheme Programming 5 March 1, 2016 13:33
UDF to extract the velocity siamak1438 Fluent UDF and Scheme Programming 2 October 19, 2015 08:32
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 08:26
If it's right to use this UDF in DPM calculation? welch FLUENT 0 May 8, 2004 06:49


All times are GMT -4. The time now is 21:48.