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

My UDF works well with Fluent 16 but not with Fluent 19

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 17, 2018, 22:03
Default My UDF works well with Fluent 16 but not with Fluent 19
  #1
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 8
Ahmed A. Serageldin is on a distinguished road
My UDF works well with Fluent 16 but did not works well with Fluent 19.
Is there any modification I have to do with my UDF or any setting in Fluent 19?
I attached The UDF to your consideration
#include "udf.h"

#define m 17
#define cp 4182

real Q[8761];
real avetempa=288.15;

DEFINE_ON_DEMAND(read_data)
{
int i;
real b;
FILE *rfile; /* declare a FILE pointer */
#if RP_HOST
host_to_node_sync_file("test.dat");
#endif
#if RP_NODE
host_to_node_sync_file("/");
#endif
rfile = fopen("data.txt", "r"); /* open file for reading */
#if RP_HOST
Message("file opened\n");
#endif
for (i=0;i<8760;i++)
{
fscanf(rfile, "%f\n", &b); /* that supposes one value per line */
Q[i]=b;
}
fclose(rfile);
#if RP_HOST
Message("file closed\n");
#endif
}

/* Defining outlet temperature.*/
DEFINE_ADJUST(average_exit_temp,domain)
{
real tempa=0.0;
real totalarea=0.0;
int ID1 = 4;//'108; /* the outlet boundary condition identifier*/
int ktt=N_TIME-1;

#if !RP_HOST
face_t f1;
real A[ND_ND];
Thread *outlet_thread = Lookup_Thread(domain,ID1);

begin_f_loop(f1,outlet_thread)
{
if PRINCIPAL_FACE_P(f1,outlet_thread)
{
F_AREA(A,f1,outlet_thread);
totalarea +=NV_MAG(A);
tempa +=NV_MAG(A)*F_T(f1,outlet_thread);
}
}
end_f_loop(f1,outlet_thread)

#if RP_NODE
tempa = PRF_GRSUM1(tempa);
totalarea = PRF_GRSUM1(totalarea);
#endif

avetempa= tempa/totalarea;
if(ktt==0) avetempa=288.15;
# endif

node_to_host_real_1(avetempa);

#if RP_HOST
Message("average temperature : %g K q7=%g\n",avetempa,Q[ktt]);
#endif
}

DEFINE_PROFILE(Inlettemp,thread,pos)
{
face_t f;
real x[ND_ND],btt;
real ftime = CURRENT_TIME;
int k_time=N_TIME;
real qheat=Q[k_time-1];

#if RP_NODE
begin_f_loop(f, thread)
{
if PRINCIPAL_FACE_P(f,thread)
{
if(ftime<1200) btt=288.15;
else btt = avetempa +((qheat-0.0000008*ftime)/(m*cp/60));
F_PROFILE(f, thread, pos) =btt;
}
}
end_f_loop(f, thread)
#endif
}
Ahmed A. Serageldin is offline   Reply With Quote

Old   October 18, 2018, 12:53
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,668
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Fluent v19 and onwards no longer supports serial mode because they want the environment to be the same from now on. A consequence is that udf's which previously only worked in serial will no longer work because there is no longer a serial mode.


You can start Fluent in serial mode by passing the -t0 flag. Launching Fluent in serial mode will actually start parallel Fluent, equivalent to the -t1 flag.


Or fix your udf. Sorry I'm too lazy to debug your udf.
LuckyTran is offline   Reply With Quote

Old   October 18, 2018, 19:17
Default
  #3
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 8
Ahmed A. Serageldin is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Fluent v19 and onwards no longer supports serial mode because they want the environment to be the same from now on. A consequence is that udf's which previously only worked in serial will no longer work because there is no longer a serial mode.


You can start Fluent in serial mode by passing the -t0 flag. Launching Fluent in serial mode will actually start parallel Fluent, equivalent to the -t1 flag.


Or fix your udf. Sorry I'm too lazy to debug your udf.
Thank you for kindly reply.
I used parallel fluent on Fluent 16, and this UDF is working good but when I tried it with Fluent 19 it compiled without errors, and I hooked the inlet profile and executed the read data macros but when I initialized and started calculation I found that q_time=0 and did not change with time. q_time values are stored in the data.txt file which has 8761 readings
what do you think is the wrong is it the structure of UDF or problem in Fluent 19?
Ahmed A. Serageldin is offline   Reply With Quote

Old   October 19, 2018, 11:38
Default
  #4
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,668
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
What the heck is q_time? It's not in your udf anywhere.
LuckyTran 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
A Problem of Fluent Interpreted UDF: parse error knight Fluent UDF and Scheme Programming 25 August 16, 2018 10:26
Two questions on Fluent UDF Steven Fluent UDF and Scheme Programming 7 March 23, 2018 03:22
How does FLUENT process an UDF!!!!???? Bharadwaj B S Fluent UDF and Scheme Programming 31 March 9, 2015 06:32
Error inputting udf into fluent for mass source ejvikings Fluent UDF and Scheme Programming 0 April 26, 2012 21:42
fluent UDF external library lapack problem Rick FLUENT 0 May 7, 2008 10:16


All times are GMT -4. The time now is 22:27.