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

DEFINE_PROFILE parallelization problem

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 25, 2019, 23:45
Thumbs up DEFINE_PROFILE parallelization problem
  #1
New Member
 
Beichao Hu
Join Date: Nov 2017
Posts: 9
Rep Power: 8
sakura006 is on a distinguished road
Hello everyone

I am trying to write a UDF to make one of the mass flow inlet boundary equal to the flow rate of another pressure outlet. I have problem with the parallelization. My code works in serial mode, but it always fail to initialize in the parallel mode. The error message is always segmentation fault. I have tried to initialize the case first and then load the UDF, but it did not work either. I have been stuck in this problem for a few days, any help is appropriated. Thanks in advance.



#include "udf.h"
#include "mem.h"
#include "sg.h"
#include "prop.h"

int pdu_out = 12;


DEFINE_PROFILE(pdu_leakage,th,i)
{
real pdu_mfr = 0.0;
int surface_thread_id = pdu_out;
#if !RP_HOST
Thread *thread;
face_t face;
Domain *d;
#endif

host_to_node_int_1(surface_thread_id);

#if !RP_HOST
d = Get_Domain(1);
thread = Lookup_Thread(d,surface_thread_id);

begin_f_loop(face, thread)
if (PRINCIPAL_FACE_P(face,thread))
{
pdu_mfr += F_FLUX(face,thread);
}
end_f_loop(face, thread);
# if RP_NODE
pdu_mfr = PRF_GRSUM1(pdu_mfr);
#endif
#endif

node_to_host_real_1(pdu_mfr);

#if !RP_HOST
begin_f_loop(face, th)
if(PRINCIPAL_FACE_P(face,th))
{
F_PROFILE(face, th, i) = pdu_mfr;
}
end_f_loop(face,th);
#endif
}
sakura006 is offline   Reply With Quote

Old   November 26, 2019, 03:34
Default
  #2
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:
#include "udf.h"
#include "mem.h"
#include "sg.h"
#include "prop.h"

int pdu_out = 12;


DEFINE_PROFILE(pdu_leakage,th,i)
{
real pdu_mfr = 0.0;
int surface_thread_id = pdu_out;
Thread *thread;
face_t face;
Domain *d;
d = Get_Domain(1);
thread = Lookup_Thread(d,surface_thread_id);
begin_f_loop(face, thread)
if (PRINCIPAL_FACE_P(face,thread))
{
pdu_mfr += F_FLUX(face,thread);
}
end_f_loop(face, thread);
# if RP_NODE
pdu_mfr = PRF_GRSUM1(pdu_mfr);
#endif

begin_f_loop(face, th)
if(PRINCIPAL_FACE_P(face,th))
{
F_PROFILE(face, th, i) = pdu_mfr;
}
end_f_loop(face,th);
}
sakura006 and snow.shaoy like this.
__________________
best regards


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

Old   November 26, 2019, 10:20
Default
  #3
New Member
 
Beichao Hu
Join Date: Nov 2017
Posts: 9
Rep Power: 8
sakura006 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
Code:
#include "udf.h"
#include "mem.h"
#include "sg.h"
#include "prop.h"

int pdu_out = 12;


DEFINE_PROFILE(pdu_leakage,th,i)
{
real pdu_mfr = 0.0;
int surface_thread_id = pdu_out;
Thread *thread;
face_t face;
Domain *d;
d = Get_Domain(1);
thread = Lookup_Thread(d,surface_thread_id);
begin_f_loop(face, thread)
if (PRINCIPAL_FACE_P(face,thread))
{
pdu_mfr += F_FLUX(face,thread);
}
end_f_loop(face, thread);
# if RP_NODE
pdu_mfr = PRF_GRSUM1(pdu_mfr);
#endif

begin_f_loop(face, th)
if(PRINCIPAL_FACE_P(face,th))
{
F_PROFILE(face, th, i) = pdu_mfr;
}
end_f_loop(face,th);
}

Thank you for you help. The problem is solved.
sakura006 is offline   Reply With Quote

Reply

Tags
define profile, parallel code


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
Problem with parallelization and a constant field located at constant folder rucky96 OpenFOAM 7 January 29, 2021 16:54
BuoyantBoussinesqSimpleFoam_Facing problem Mondal131211 OpenFOAM Running, Solving & CFD 1 April 10, 2019 19:41
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 05:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13


All times are GMT -4. The time now is 12:24.