|
[Sponsors] |
December 11, 2018, 10:22 |
regarding UDF
|
#1 |
New Member
Shivanshu Bajpai
Join Date: Dec 2018
Posts: 4
Rep Power: 8 |
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 |
|
December 12, 2018, 02:33 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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; } best regards |
|
December 12, 2018, 03:23 |
Regardin UDF
|
#3 |
New Member
Shivanshu Bajpai
Join Date: Dec 2018
Posts: 4
Rep Power: 8 |
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; } |
|
December 12, 2018, 05:18 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
why do you think it doesn't work?
udf seems to be correct did you apply this udf as material property? best regards |
|
December 12, 2018, 05:22 |
|
#5 |
New Member
Shivanshu Bajpai
Join Date: Dec 2018
Posts: 4
Rep Power: 8 |
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 |
|
December 12, 2018, 22:23 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
December 13, 2018, 05:16 |
Getting different answer when intializing through udf
|
#7 |
New Member
pavan
Join Date: Sep 2014
Posts: 5
Rep Power: 12 |
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 |
|
December 14, 2018, 03:47 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
|
|
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 03:18 |
Save output of udf in another udf! | JuanJoMex | FLUENT | 0 | February 8, 2018 13:43 |
UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 01:53 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |