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

regarding UDF

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 11, 2018, 09:22
Default regarding UDF
  #1
New Member
 
Shivanshu Bajpai
Join Date: Dec 2018
Posts: 4
Rep Power: 7
shivanb is on a distinguished road
Can anyone help me writing the UDF for the density varying with temperature
as follows
rho(T)=1000*(1-((T+288.9414)/(508929.2*T+34673158.1))-(T-3.9863)^2)
Thanks
shivanb is offline   Reply With Quote

Old   December 12, 2018, 01:33
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Ansys FLuent Customization manual
look for DEFINE_PROPERTY macro
example
Code:
/*********************************************************************
UDF that simulates solidification by specifying a temperaturedependent
viscosity property
**********************************************************************/
#include "udf.h"
DEFINE_PROPERTY(cell_viscosity,c,t)
{
real mu_lam;
real temp = C_T(c,t);
if (temp > 288.)
mu_lam = 5.5e-3;
else if (temp > 286.)
mu_lam = 143.2135 - 0.49725 * temp;
else
mu_lam = 1.;
return mu_lam;
}
modify this code to your needs

best regards
AlexanderZ is offline   Reply With Quote

Old   December 12, 2018, 02:23
Default Regardin UDF
  #3
New Member
 
Shivanshu Bajpai
Join Date: Dec 2018
Posts: 4
Rep Power: 7
shivanb is on a distinguished road
I have written the following UDF but I don't whether its correct or not. I tried it in fluent but its not working. Any idea for any correction please tell me

#include "udf.h"
DEFINE_PROPERTY(cell_density,c,t)
{
real rho;
real T= C_T(c,t);
rho= 1000*(1-((T-273.15+288.9414)/(508929.2*(T-273)+34673158.1))-(T-273-3.9863)*(T-273-3.9863));

return rho;
}
shivanb is offline   Reply With Quote

Old   December 12, 2018, 04:18
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
why do you think it doesn't work?
udf seems to be correct
did you apply this udf as material property?

best regards
AlexanderZ is offline   Reply With Quote

Old   December 12, 2018, 04:22
Default
  #5
New Member
 
Shivanshu Bajpai
Join Date: Dec 2018
Posts: 4
Rep Power: 7
shivanb is on a distinguished road
Yes I applied it as material property but solution is not getting converged now. for constant density it was converging but now it is showing floating point error. I don't know how to proceed further.
Please help what to do now
shivanb is offline   Reply With Quote

Old   December 12, 2018, 21:23
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
check your equation, put simple equation first to clarify, that everything works well, most likely problem comes from your equation
make more strict convergence criteria, make more iterations
put smaller relaxation value

best regards
AlexanderZ is offline   Reply With Quote

Old   December 13, 2018, 04:16
Default Getting different answer when intializing through udf
  #7
New Member
 
pavan
Join Date: Sep 2014
Posts: 5
Rep Power: 11
pavankonchada is on a distinguished road
The below is a part of density udf for PCM
r1=(9*(pow(temp,3)))
the value I am getting when initializing is 239613872.000000
but the actual value is 239613851.304
please help me due to this I am getting divergence
pavankonchada is offline   Reply With Quote

Old   December 14, 2018, 02:47
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Check your equation: rho= 1000*(1-((T-273.15+288.9414)/(508929.2*(T-273)+34673158.1))-(T-273-3.9863)*(T-273-3.9863));
It gives negative values
Code:
temperature(K)  value
300	-528630.3942
310	-1088904.394
320	-1849178.393
330	-2809452.393
340	-3969726.393
350	-5330000.393
360	-6890274.392
370	-8650548.392
380	-10610822.39
390	-12771096.39
400	-15131370.39
410	-17691644.39
420	-20451918.39
430	-23412192.39
440	-26572466.39
450	-29932740.39

best regards
AlexanderZ 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
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 02:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 12:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 00:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


All times are GMT -4. The time now is 08:57.