|
[Sponsors] |
August 18, 2015, 04:53 |
wrong Mass flow rate calc in parallel
|
#1 |
New Member
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 11 |
Hi All
in parallel code of flow at boundary zone , UDf gives wrong value of F_Flux(f,t) in thousands. is there any looping modification for parallel to measure mass flow rate.? Need help.... while in serial code works well. |
|
August 18, 2015, 06:43 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Have a read of the "Parallel Considerations" chapter in the UDF manual. If you're using the begin_f_loop macro then the partition boundary faces would be called twice (once on each compute node). A simple solution to this problem is to check if the current node is this face's principal compute node, using:
Code:
if PRINCIPAL_FACE_P(f,tf) |
|
August 18, 2015, 16:17 |
reply
|
#3 | |
New Member
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 11 |
Quote:
Here is my code Code:
include "udf.h" #define zone_id 10015 DEFINE_ON_DEMAND(flowrate) { Domain *d=Get_Domain(1); Thread *t=Lookup_Thread(d,8); face_t f; real m_flow=0; int ncount=0; #if !RP_HOST /*node or serial*/ begin_f_loop(f,t) { if(PRINCIPAL_FACE_P(f,t)) /*also works in serial and parallel.*/ { ncount+=1; m_flow+=F_FLUX(f,t); } } end_f_loop(f,t) /*works same way in serial and parallel*/ #endif /*!RP_HOST*/ #if RP_NODE m_flow=PRF_GRSUM1(m_flow); #endif node_to_host_real_1(m_flow); /*this does nothing in serial and should never /*be inside a compiler directive*/ Message("faces are %d\n",ncount); Message("flow is %d\n",m_flow); } any idea what is wrong with loop to calculate f_flux(f,t) loop |
||
August 18, 2015, 20:36 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Assign a real number (e.g. "0.") instead of an integer (e.g. "0") when initialising real variables such as m_flow:
Code:
real m_flow=0.; |
|
August 19, 2015, 06:31 |
|
#5 | |
New Member
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 11 |
Quote:
is there any other method to get mass flow other than f_flux(f,t) i think it is problematic in parallel. another question is that should I declare variables and threads before !RP_HOST or in general. |
||
August 19, 2015, 08:29 |
|
#6 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
You're still confusing data types. %d is a format specifier for integers whereas the mass flux is a real number; use %e or similar instead for printing this value.
Variables should be declared on the relevant serial, host or compute nodes where they are used. For example, your ncount variable is used on all three cases with the Message function and therefore ncount should be declared outside of the compiler directives (which is currently done). |
|
August 19, 2015, 14:22 |
|
#7 | |
New Member
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 11 |
Quote:
Yupee!!!!! finally this worked right.Sir! Thank you for your quick and right response . Error was due to data type format. Another thing i am confused about. when I check flow rate via reports--> surface integral--> flow rate with volume fraction liquid phase on that surface it gives different value other than calculated by udf and there is also a difference in values if I chose surface integral report of mass flow rate. Can you please explain why this is so..?? |
||
August 19, 2015, 18:43 |
|
#8 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Are you summing over the correct zone ID? You've defined zone_id at the start of the UDF but you're looking up zone 8.
Try using your UDF with a simple case (not VOF) and if those results are correct, then is F_FLUX the total mass flow rate of all phases in VOF? |
|
August 29, 2015, 16:06 |
|
#9 |
New Member
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 11 |
I tested that UDF with correct zone id and it worked.
Thank you Now a days I am working for syamlal drag model in previous versions , we have to adjust C1 and D1 through UDF but in version 15 manual it is mentioned that they introduced this as Syamlal O'brien-para model in which it calculate and adjust these parameters automatically. but I did not find this in drag law panel list..may be it should be activated first to make it visible in list ... Sir..!! have you any idea about this thing??? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mass flow rate: calculation v/s computation | beguxa | FLUENT | 5 | December 2, 2018 22:02 |
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' | muth | OpenFOAM Running, Solving & CFD | 3 | August 27, 2018 05:18 |
Translational periodicity with specified mass flow rate | KalleT | CFX | 4 | May 17, 2017 19:48 |
Mass Flow Rate is not converging | destgir448 | CFX | 5 | December 11, 2010 06:55 |
mass flow rate error | Masood | FLUENT | 0 | May 22, 2005 01:32 |