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

conductivity, viscosity, and density udf

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By Galileo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2014, 09:37
Post conductivity, viscosity, and density udf
  #1
New Member
 
mdakbari's Avatar
 
m.akbari
Join Date: Apr 2014
Posts: 14
Rep Power: 12
mdakbari is on a distinguished road
hello friends, i have 3 .c files that need to be checked cause i am not sure which they work or not.
i really appreciate u to check it for me,
i'm waiting for ur comments dudes
best wishes for u

conductivity.c

density.c

viscos.c
mdakbari is offline   Reply With Quote

Old   April 14, 2014, 12:33
Default Re: My UDF Code
  #2
Member
 
Engr Adeniyi
Join Date: Jan 2011
Posts: 32
Rep Power: 16
Galileo is on a distinguished road
Quote:
Originally Posted by mdakbari View Post
hello friends, i have 3 .c files that need to be checked cause i am not sure which they work or not.
i really appreciate u to check it for me,
i'm waiting for ur comments dudes
best wishes for u

Attachment 30141

Attachment 30142

Attachment 30143

Hi,
Can you explain what problem you are facing with the code? You don't have to have 3 different files for your code. You can place them all in one file (since they are not that lengthy).
Since I don't know what you are trying to do. I will suggest you try and debug the code using a simple way as follows.
1) Do the calculations in an Excel sheet with different inputs
2) Place some lines to print the output to the console in Fluent.
2a) Note that I have put a limit to the number of times your code will print to the console so that it does not hang up your system.
I hope that will help in what you are trying to do. I did not run the code but I think it looks OK, the red parts are my addition to your code to help you in debugging, I have not changed anything, you can remove them after the debugging.

Regards


APPENDIX
/************************************************** *******************
UDF that simulates solidification by specifying a temperaturedependent
thermal conductivity property
************************************************** ********************/
#include "udf.h"

int printStopper=0; /*This is a dummy counter */
DEFINE_PROPERTY(cell_density,cell,thread)
{
real rho;
real temp = C_T(cell,thread);
rho=(-3.570*(pow(10,-3))*(pow(temp,2))+(1.88*temp+753.2));

if(printStopper<=100)
{printStopper++;
CX_Message("*****Cell Temp: %3.2f Kelvin, Rho= %E kg/m3 \n",temp,rho);
}

return rho;
}
DEFINE_PROPERTY(cell_conductivity,cell,thread)
{
real ktc;
real temp = C_T(cell,thread);
ktc=(-8.354*0.000001*(pow(temp,2)))+((6.53*0.001*temp)-0.5981);

if(printStopper<=100)
{printStopper++;
CX_Message("*****Cell Temp: %3.2f Kelvin, KTC= %E W/m.K \n",temp,ktc);
}

return ktc;
}

DEFINE_PROPERTY(cell_viscosity,cell,thread)
{
real mu;
real temp = C_T(cell,thread);
mu=2.591*(pow(10,-5))*(pow(10,(238.3/(temp-143.2))));

if(printStopper<=100)
{printStopper++;
CX_Message("*****Cell Temp: %3.2f Kelvin, Viscosity= %E Pa.s \n",temp,mu);
}

return mu;
}
aestas, mdakbari and afnch like this.
Galileo is offline   Reply With Quote

Old   April 15, 2014, 03:15
Default
  #3
New Member
 
mdakbari's Avatar
 
m.akbari
Join Date: Apr 2014
Posts: 14
Rep Power: 12
mdakbari is on a distinguished road
hello my friend galileo, ur reply was so helpful and i really appreciate it.
it did work finally for me but i used just that part of ur recommendation: You don't have to have 3 different files for your code. You can place them all in one file (since they are not that lengthy)
it was a very nice and on time reply.
thank u very veryyyyyyyyy much
mdakbari is offline   Reply With Quote

Old   December 12, 2018, 12:08
Default
  #4
New Member
 
Shivanshu Bajpai
Join Date: Dec 2018
Posts: 4
Rep Power: 7
shivanb is on a distinguished road
@Mdakbari I miss also using udf for density, viscosity, and conductivity. But when I am using the same in fluent my solution is not converging. How to solve this problem
shivanb is offline   Reply With Quote

Reply

Tags
check, conductivity, density, udf, viscosity


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
Simulation of a single bubble with a VOF-method Suzzn CFX 21 January 29, 2018 00:58
Variable density and viscosity ravibhadauria FLUENT 0 September 15, 2011 17:09
Constant velocity of the material Sas CFX 15 July 13, 2010 08:56
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 12:02


All times are GMT -4. The time now is 20:29.