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

unsteady inlet velocity udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 4, 2004, 09:15
Default unsteady inlet velocity udf
  #1
jill
Guest
 
Posts: n/a
The udf i am using for my inlet is similar to that of the "unsteady flow in a tube" example from the user's guide. I am modeling a "T" intersection where there are two inlets with different velocity profiles. i have created two udf's and they both compile using the interpreted udf. the problem that i encounter is when i try to set up the bc's. it seems as though i am not able to use both udf's at the same time (one for inlet A and the other for inlet B). If I compile the udf for inlet A and set up the bc everything works fine but then if i try to compile the udf for inlet B I get, "Error: chip exec: function XXX not found". If i try to compile both of them and then set the bc's only the later of the two are in the pulldowns. Can anyone help me? Thank you.

jill
  Reply With Quote

Old   December 4, 2004, 09:47
Default Re: unsteady inlet velocity udf
  #2
Luca
Guest
 
Posts: n/a
Maybe I have misunderstood but I think you should compile your 2 UDFs in a single file. So put your code in 1 file and compile it. Then you can hook both of them.Luca
  Reply With Quote

Old   December 4, 2004, 09:55
Default Re: unsteady inlet velocity udf
  #3
jill
Guest
 
Posts: n/a
No you didn't misunderstand....your response makes a lot of sense and it works now. Thank you very much.
  Reply With Quote

Old   December 4, 2004, 09:56
Default Re: unsteady inlet velocity udf
  #4
Luca
Guest
 
Posts: n/a
you're welcome. Luca
  Reply With Quote

Old   February 9, 2015, 07:22
Default
  #5
New Member
 
anonymous
Join Date: Jan 2015
Posts: 3
Rep Power: 11
Momo38 is on a distinguished road
Hi. I am not very good at programming. Like the case above was solved by combining the two program in one file. But I do not know how to combine it in one file. Here is my 2 program files,

#include "udf.h"
#define T_HOT 306.0
#define T_COLD 300.0
#define KTC_HOT 0.66 /* High thermal conductivity when hot */
#define KTC_COLD 0.64 /* Low thermal conductivity when cold */

DEFINE_PROPERTY(fmwcnt_thermal_conductivity, c, ct)
{
real temp, ktc_turbulent;

temp = C_T(c,ct);

if (temp == T_HOT)
ktc_turbulent = KTC_HOT;

else if (temp == T_COLD)
ktc_turbulent = KTC_COLD;

else
ktc_turbulent = KTC_COLD + (temp - T_COLD)*
(KTC_HOT - KTC_COLD)/(T_HOT - T_COLD);

return ktc_turbulent;
}


Here is the second program,
#include "udf.h"
#define T_HOT 306.0
#define T_COLD 300.0
#define MU_HOT 7.81e-4 /* Low viscosity when hot */
#define MU_COLD 8.81e-4 /* High viscosity when cold */

DEFINE_PROPERTY(fmwcnt_viscosity, c, ct)
{
real temp, mu_turbulent;

temp = C_T(c,ct);

if (temp == T_HOT)
mu_turbulent = MU_HOT;

else if (temp == T_COLD)
mu_turbulent = MU_COLD;

else
mu_turbulent = MU_COLD + (temp - T_COLD)*
(MU_HOT - MU_COLD)/(T_HOT - T_COLD);

return mu_turbulent;
}



Thanks
Momo38 is offline   Reply With Quote

Old   February 9, 2015, 09:13
Default
  #6
Senior Member
 
Cees Haringa
Join Date: May 2013
Location: Delft
Posts: 607
Rep Power: 0
CeesH is on a distinguished road
Hi,

Basically combining it in one file just means
- 1 set of headers and define functions
- 2 functions put in the body.

So for you that would give:

Code:
#include "udf.h" 
#define T_HOT 306.0
#define T_COLD 300.0
#define KTC_HOT 0.66 /* High thermal conductivity when hot */ 
#define KTC_COLD 0.64 /* Low thermal conductivity when cold */ 
#define MU_HOT 7.81e-4 /* Low viscosity when hot */ 
#define MU_COLD 8.81e-4 /* High viscosity when cold */ 

DEFINE_PROPERTY(fmwcnt_thermal_conductivity, c, ct) 
{ 
real temp, ktc_turbulent; 

temp = C_T(c,ct); 

if (temp == T_HOT) 
ktc_turbulent = KTC_HOT; 

else if (temp == T_COLD) 
ktc_turbulent = KTC_COLD; 

else 
ktc_turbulent = KTC_COLD + (temp - T_COLD)* 
(KTC_HOT - KTC_COLD)/(T_HOT - T_COLD); 

return ktc_turbulent; 
}

DEFINE_PROPERTY(fmwcnt_viscosity, c, ct) 
{ 
real temp, mu_turbulent; 

temp = C_T(c,ct); 

if (temp == T_HOT) 
mu_turbulent = MU_HOT; 

else if (temp == T_COLD) 
mu_turbulent = MU_COLD; 

else 
mu_turbulent = MU_COLD + (temp - T_COLD)* 
(MU_HOT - MU_COLD)/(T_HOT - T_COLD); 

return mu_turbulent; 
}
Then, save this whole thing under one name and compile in FLUENT. FLUENT will recognize it's actually 2 different UDFs.
CeesH is offline   Reply With Quote

Old   February 9, 2015, 09:16
Default
  #7
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
Hi,
simply put them in one files, and do not duplicate headers files (.h) and global variables:

Code:
#include "udf.h"
#define T_HOT 306.0
#define T_COLD 300.0
#define KTC_HOT 0.66 /* High thermal conductivity when hot */
#define KTC_COLD 0.64 /* Low thermal conductivity when cold */
#define MU_HOT 7.81e-4 /* Low viscosity when hot */
#define MU_COLD 8.81e-4 /* High viscosity when cold */

DEFINE_PROPERTY(fmwcnt_thermal_conductivity, c, ct)
{
real temp, ktc_turbulent;

temp = C_T(c,ct);

if (temp == T_HOT)
   ktc_turbulent = KTC_HOT;

else if (temp == T_COLD)
   ktc_turbulent = KTC_COLD;

else
   ktc_turbulent = KTC_COLD + (temp - T_COLD)*(KTC_HOT - KTC_COLD)/(T_HOT - T_COLD);

return ktc_turbulent;
}


DEFINE_PROPERTY(fmwcnt_viscosity, c, ct)
{
real temp, mu_turbulent;

temp = C_T(c,ct);

if (temp == T_HOT)
  mu_turbulent = MU_HOT;

else if (temp == T_COLD)
  mu_turbulent = MU_COLD;

else
  mu_turbulent = MU_COLD + (temp - T_COLD)*(MU_HOT - MU_COLD)/(T_HOT - T_COLD);

return mu_turbulent;
}
Hihi too late
__________________
Google is your friend and the same for the search button!
ghost82 is offline   Reply With Quote

Old   February 10, 2015, 03:47
Default
  #8
New Member
 
anonymous
Join Date: Jan 2015
Posts: 3
Rep Power: 11
Momo38 is on a distinguished road
Thanks CeesH and ghost82. The UDF can run by interpreted and it gives what I want. But I cant compiled due to the path error. Izzit compulsory to compiled it?

Thanks
Momo38 is offline   Reply With Quote

Old   February 10, 2015, 07:04
Default
  #9
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
It is not mandatory to compile this udf. You can interpret it without problems.
__________________
Google is your friend and the same for the search button!
ghost82 is offline   Reply With Quote

Reply


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
3D UDF Paraboilc Velocity Profile (Can't Maintain) Sing FLUENT 12 August 7, 2017 07:25
UDF for Inlet velocity Mijin Kim FLUENT 0 September 28, 2009 05:50
can i set the velocity and pressure at the inlet at the same time by UDF minyang.cau FLUENT 0 July 15, 2009 00:14
UDF Unsteady velocity profile Rashad FLUENT 0 February 27, 2008 15:57
USED UDF for inlet velocity in 3D sara FLUENT 0 October 11, 2007 19:04


All times are GMT -4. The time now is 11:13.