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

how can i use multiple udfs

Register Blogs Community New Posts Updated Threads Search

Like Tree15Likes
  • 5 Post By Goldsstean
  • 9 Post By Goldsstean
  • 1 Post By Elechi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 23, 2010, 02:35
Default how can i use multiple udfs
  #1
New Member
 
Terry Tensinsky
Join Date: Feb 2010
Posts: 14
Rep Power: 16
hami9293 is on a distinguished road
Send a message via Skype™ to hami9293
Hello every body
as a amateur user of fluent i have a problem
when i want to define multiple udf in my case file, my last defined udfs disappeared.
How can use multiple udfs in one case file?

thank you.
hami9293 is offline   Reply With Quote

Old   February 23, 2010, 02:51
Default Re: how can i use multiple udfs
  #2
Member
 
Amol Ramteke
Join Date: May 2009
Location: Kolkata
Posts: 30
Rep Power: 17
Goldsstean is on a distinguished road
Write all the udf inside same header file for e.g

#include "udf.h"

DEFINE_PROPERTY(prop, c, t)
{

}

DEFINE_ON_DEMAND(ondemand)
{

}

So on...
mozkan26, teguhtf, rasoulb and 2 others like this.
Goldsstean is offline   Reply With Quote

Old   February 23, 2010, 03:09
Default how
  #3
New Member
 
Terry Tensinsky
Join Date: Feb 2010
Posts: 14
Rep Power: 16
hami9293 is on a distinguished road
Send a message via Skype™ to hami9293
#include "udf.h"
my udf is so:

DEFINE_PROFILE(inlet, thread, position)

{
real pi = 3.1459 ;
real P0 = 11208 ;

face_t f;
real t = CURRENT_TIME;

begin_f_loop(f, thread)
{
t = t - floor(t) ;
if ( t>=0.5 )
F_PROFILE(f, thread, position) = P0*sin(pi*t);
else
F_PROFILE(f, thread, position) = P0*(1.5 - 0.5*cos(2*pi(t-0.5)));
}
end_f_loop(f, thread)

}
should i change it ?
hami9293 is offline   Reply With Quote

Old   February 23, 2010, 03:13
Default
  #4
Member
 
Amol Ramteke
Join Date: May 2009
Location: Kolkata
Posts: 30
Rep Power: 17
Goldsstean is on a distinguished road
Could you explain what you want to do.
Goldsstean is offline   Reply With Quote

Old   February 23, 2010, 03:19
Default reply
  #5
New Member
 
Terry Tensinsky
Join Date: Feb 2010
Posts: 14
Rep Power: 16
hami9293 is on a distinguished road
Send a message via Skype™ to hami9293
I have a pipe that has one inlet and four outlet.
the boundary condition for the inlet and outlet in transient pressure.
my udf is this transient pressure.
now when I interpret the pressure that is used for e.g. out 2 the last interpreted udfs has disappeared.
hami9293 is offline   Reply With Quote

Old   February 23, 2010, 03:25
Default
  #6
Member
 
Amol Ramteke
Join Date: May 2009
Location: Kolkata
Posts: 30
Rep Power: 17
Goldsstean is on a distinguished road
Correct me if im wrong, you would like to give profile to inlet and outlet too. then this udf will not work write separate udf.

If not try to compile and hook.
Goldsstean is offline   Reply With Quote

Old   February 23, 2010, 03:34
Default explain.
  #7
New Member
 
Terry Tensinsky
Join Date: Feb 2010
Posts: 14
Rep Power: 16
hami9293 is on a distinguished road
Send a message via Skype™ to hami9293
let me explain more.

I have 5 different udfs for five boundaries . when i define e.g the third one , the two last defined udfs disappeared . ( i mean when i want to specify the boundary condition of the boundaries instead of 5 different udf i just have one .)
hami9293 is offline   Reply With Quote

Old   February 23, 2010, 04:39
Default
  #8
Member
 
Amol Ramteke
Join Date: May 2009
Location: Kolkata
Posts: 30
Rep Power: 17
Goldsstean is on a distinguished road
Where are the five udf above only you are showing one?

If you have five udf means write in same file.
Goldsstean is offline   Reply With Quote

Old   February 23, 2010, 04:45
Default reply
  #9
New Member
 
Terry Tensinsky
Join Date: Feb 2010
Posts: 14
Rep Power: 16
hami9293 is on a distinguished road
Send a message via Skype™ to hami9293
there are almost the same with a few differences in the formula of the pressure . I have written the first udf that is for inlet
hami9293 is offline   Reply With Quote

Old   February 23, 2010, 04:47
Default
  #10
Member
 
Amol Ramteke
Join Date: May 2009
Location: Kolkata
Posts: 30
Rep Power: 17
Goldsstean is on a distinguished road
Yes exactly, the whatever answer i have given first that is true.

Put all udf in same file.c ok
Goldsstean is offline   Reply With Quote

Old   February 23, 2010, 04:51
Default
  #11
Member
 
Amol Ramteke
Join Date: May 2009
Location: Kolkata
Posts: 30
Rep Power: 17
Goldsstean is on a distinguished road
For eg

#include "udf.h"

DEFINE_PROFILE(inlet1, thread, position)

{
your programe;
}

DEFINE_PROFILE(inlet2, thread, position)

{
your programe;
}

DEFINE_PROFILE(inlet3, thread, position)

{
your programe;
}
DEFINE_PROFILE(inlet4, thread, position)

{
your programe;
}
DEFINE_PROFILE(inlet5, thread, position)

{
your programe;
}


Save the file and interprete you will see all the profile and select respectively for the inlet.

ok thanks I have work c u
teguhtf, ssj, 87682111 and 6 others like this.
Goldsstean is offline   Reply With Quote

Old   February 23, 2010, 07:20
Default Thanks
  #12
New Member
 
Terry Tensinsky
Join Date: Feb 2010
Posts: 14
Rep Power: 16
hami9293 is on a distinguished road
Send a message via Skype™ to hami9293
Thank your lucky stars.
Really thank you for your kind helps .
c u later.
hami9293 is offline   Reply With Quote

Old   June 5, 2016, 22:09
Default nested if statement in udf
  #13
New Member
 
mm
Join Date: May 2016
Posts: 24
Rep Power: 9
mmunige is an unknown quantity at this point
Respected members

I am using udf for defining transient temperature at inlet boundary of my model in fluent. I am writing nested if statement, but model keeps on using the same equation after 180 seconds, and does not move to the next if else statement. My udf is as follows:

#include"udf.h"

DEFINE_PROFILE(inlet_temperature,thread,position )
{

face_t f;
begin_f_loop(f,thread)

{

real t = RP_Get_Real("flow-time");

if ( t <= 100.0 )

F_PROFILE(f,thread,position) = 379.48 + 0.0004*t;

else if (100.0 < t <= 180.0 )

F_PROFILE(f,thread,position) = 1.0624*t + 352.0;

else if (180.0 < t <= 200.0 )

F_PROFILE(f,thread,position) = 0.2716*t + 494.4;

else if (200.0 < t <= 400.0 )
F_PROFILE(f,thread,position) = 328.14*pow(t,0.097);
else
F_PROFILE(f,thread,position) = 727.82;

}
end_f_loop(f,thread)
}

sorry for my poor knowledge of programming.
please help me on this error.
Thanks.
mmunige is offline   Reply With Quote

Old   February 12, 2020, 09:47
Default
  #14
New Member
 
Tanuj Srivastava
Join Date: Mar 2019
Posts: 15
Rep Power: 7
S_Tanuj is on a distinguished road
Earlier I had the same issue. There were three UDF, out of the three two were of the same macro (DEFINE_SOURCE) and the other one was of the different macro (DEFINE_ZONE_MOTION). They can be easily compiled but make sure "the library name" should be different for both. Keeping the same name will lead to "fatal error". To compile, build and load separately.
S_Tanuj is offline   Reply With Quote

Old   February 12, 2020, 10:38
Default Use different function names
  #15
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
You can compile all in one library, however, you have to ensure that the function names, i.e., the first arguments are different for each DEFINE_ function. That's how those are supposed to be recognized within Fluent while hooking them.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 27, 2020, 20:25
Default C
  #16
New Member
 
Lucky Elechi
Join Date: May 2020
Location: Port Harcourt, Nigeria
Posts: 9
Rep Power: 6
Elechi is on a distinguished road
@S_Tanju... I think the problem is from your relational operators

This line "else if (100.0 < t <= 180.0 ) " should have been written as "else if 100.0 < t && t <= 180.0 "
nhossain2k6 likes this.

Last edited by Elechi; May 27, 2020 at 20:26. Reason: Typo error
Elechi 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
multiple UDFs mmdmov Fluent UDF and Scheme Programming 4 April 21, 2009 08:42
Unsteady and Flux UDFs for UDSs tom FLUENT 0 February 13, 2009 11:27
multiple UDFs at the same time bharti FLUENT 0 November 2, 2006 11:45
Multiple udfs? David Harris FLUENT 1 April 23, 2006 03:34
Multiple UDFs Graeme FLUENT 4 August 28, 2004 16:47


All times are GMT -4. The time now is 23:45.