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

How to make it work on parallel mode

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2019, 18:58
Default How to make it work on parallel mode
  #1
New Member
 
vivek
Join Date: Aug 2018
Posts: 14
Rep Power: 7
vivek162 is on a distinguished road
This UDF works perfectly in serial mode,

/************************************************** ********************
UDF to calculate temperature at outlet and use it as a inlet temperature (for closed loop )

************************************************** *********************/
#include "udf.h"
#include "prf.h"
#include "para.h"

real tavg, Tavg;
DEFINE_EXECUTE_AT_END(average_temp)
{
#if !RP_HOST
real temper = 0.0;
real area = 0.0;
real area_tot = 0.0;

Domain *d;
face_t f;
real A[ND_ND];

int zone_ID;
int ID = 7; /*outlet boundary wall*/
Thread *t;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);
tavg = 0.0;
Tavg = 0.0;

begin_f_loop(f,t)
{
F_AREA(A,f,t);
area = NV_MAG(A);
area_tot += area;
temper = F_T(f,t);
tavg += temper*area;
}
end_f_loop(f,t)
Tavg = tavg/=area_tot;

printf("Tavg = %g Total_area = %g\n",Tavg,area_tot);
#endif
}

#include "udf.h"
DEFINE_PROFILE(inlet_temp,t,i)
{
#if !RP_HOST
face_t f;
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = tavg;
}
end_f_loop(f,t)
/* printf("Inlet_temperature = %g\n",tavg); */
#endif
}



But when i try to compile it,

I am getting an error

Tavg = -nan(ind) Total_area = 0
Tavg = -nan(ind) Total_area = 0
Tavg = -nan(ind) Total_area = 0
Tavg = 295 Total_area = 7.83488e-05
Tavg = -nan(ind) Total_area = 0
Tavg = -nan(ind) Total_area = 0

I need help on how to use PRF_GSUM1(....)
vivek162 is offline   Reply With Quote

Old   December 17, 2019, 21:31
Default
  #2
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 407
Rep Power: 14
Светлана is on a distinguished road
Can you not use periodic BC to couple inlet and outlet?
Светлана is offline   Reply With Quote

Old   December 17, 2019, 23:04
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
/************************************************** ********************
UDF to calculate temperature at outlet and use it as a inlet temperature (for closed loop )

************************************************** *********************/
#include "udf.h"
#include "prf.h"
#include "para.h"

real tavg, Tavg;
DEFINE_EXECUTE_AT_END(average_temp)
{
real temper = 0.0;
real area = 0.0;
real area_tot = 0.0;

Domain *d;
face_t f;
real A[ND_ND];

int zone_ID;
int ID = 7; /*outlet boundary wall*/
Thread *t;
d = Get_Domain(1);
t = Lookup_Thread(d,ID);
tavg = 0.0;
Tavg = 0.0;

begin_f_loop(f,t)
{
F_AREA(A,f,t);
area = NV_MAG(A);
area_tot += area;
temper = F_T(f,t);
tavg += temper*area;
}
end_f_loop(f,t)
# if RP_NODE /* Perform node synchronized actions here; Does nothing in Serial */
area_tot = PRF_GRSUM1(area_tot);
tavg = PRF_GRSUM1(tavg);
# endif /* RP_NODE */
Tavg = tavg/=area_tot;
Message0("Tavg = %g Total_area = %g\n",Tavg,area_tot);
}

DEFINE_PROFILE(inlet_temp,t,i)
{
face_t f;
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = tavg;
}
end_f_loop(f,t)

}
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 19, 2019, 14:52
Default
  #4
New Member
 
vivek
Join Date: Aug 2018
Posts: 14
Rep Power: 7
vivek162 is on a distinguished road
Dear Tkachenko,

Yes, Periodic BC works perfectly but I also have to use outlet temperature to calculate thermal properties.
vivek162 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
Particle positions file-how to add it if it is not existing, to work in parallel vidyadhar OpenFOAM Programming & Development 0 September 23, 2016 03:47
problem with compiling boundary condition udf in parallel mode chem engineer Fluent UDF and Scheme Programming 11 June 29, 2015 06:23
[swak4Foam] Installing swak4Foam to OpenFOAM in mac Kaquesang OpenFOAM Community Contributions 22 January 21, 2013 11:51
parallel mode failure in 3ddp but not in 2ddp ak6g08 Fluent UDF and Scheme Programming 0 September 22, 2009 06:16
OpenFOAM with IBM AIX matthias OpenFOAM Installation 20 March 25, 2008 02:36


All times are GMT -4. The time now is 21:09.