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 Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2019, 19:58
Default How to make it work on parallel mode
  #1
New Member
 
vivek
Join Date: Aug 2018
Posts: 14
Rep Power: 5
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, 22:31
Default
  #2
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 388
Rep Power: 11
Светлана is on a distinguished road
Can you not use periodic BC to couple inlet and outlet?
Светлана is offline   Reply With Quote

Old   December 18, 2019, 00:04
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,848
Rep Power: 29
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, 15:52
Default
  #4
New Member
 
vivek
Join Date: Aug 2018
Posts: 14
Rep Power: 5
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 04:47
problem with compiling boundary condition udf in parallel mode chem engineer Fluent UDF and Scheme Programming 11 June 29, 2015 07:23
[swak4Foam] Installing swak4Foam to OpenFOAM in mac Kaquesang OpenFOAM Community Contributions 22 January 21, 2013 12:51
parallel mode failure in 3ddp but not in 2ddp ak6g08 Fluent UDF and Scheme Programming 0 September 22, 2009 07:16
OpenFOAM with IBM AIX matthias OpenFOAM Installation 20 March 25, 2008 03:36


All times are GMT -4. The time now is 10:33.