|
[Sponsors] | |||||
|
|
|
#1 |
|
New Member
Beichao Hu
Join Date: Nov 2017
Posts: 9
Rep Power: 10 ![]() |
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 } |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 35 ![]() ![]() |
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);
}
__________________
best regards ****************************** press LIKE if this message was helpful |
|
|
|
|
|
|
|
|
#3 | |
|
New Member
Beichao Hu
Join Date: Nov 2017
Posts: 9
Rep Power: 10 ![]() |
Quote:
Thank you for you help. The problem is solved.
|
||
|
|
|
||
![]() |
| Tags |
| define profile, parallel code |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 17:54 |
| BuoyantBoussinesqSimpleFoam_Facing problem | Mondal131211 | OpenFOAM Running, Solving & CFD | 1 | April 10, 2019 20:41 |
| Gambit - meshing over airfoil wrapping (?) problem | JFDC | FLUENT | 1 | July 11, 2011 06:59 |
| natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
| Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |