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

wrong Mass flow rate calc in parallel

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 1 Post By `e`
  • 1 Post By `e`
  • 1 Post By `e`

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 18, 2015, 03:53
Unhappy wrong Mass flow rate calc in parallel
  #1
New Member
 
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 8
shahjehan13 is on a distinguished road
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.
shahjehan13 is offline   Reply With Quote

Old   August 18, 2015, 05:43
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 15
`e` is on a distinguished road
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)
shahjehan13 likes this.
`e` is offline   Reply With Quote

Old   August 18, 2015, 15:17
Unhappy reply
  #3
New Member
 
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 8
shahjehan13 is on a distinguished road
Quote:
Originally Posted by `e` View Post
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)
Thanks for guide. I have considered principal node modification.

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);



}
this returns value of m_flow very large something 1223666 -34444

any idea what is wrong with loop to calculate f_flux(f,t) loop
shahjehan13 is offline   Reply With Quote

Old   August 18, 2015, 19:36
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 15
`e` is on a distinguished road
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.;
shahjehan13 likes this.
`e` is offline   Reply With Quote

Old   August 19, 2015, 05:31
Default
  #5
New Member
 
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 8
shahjehan13 is on a distinguished road
Quote:
Originally Posted by `e` View Post
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.;
Thanks for helping in it. actually problem i m facing is that f_flux(f,t) when i print out its value is a large number.
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.
shahjehan13 is offline   Reply With Quote

Old   August 19, 2015, 07:29
Default
  #6
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 15
`e` is on a distinguished road
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).
shahjehan13 likes this.
`e` is offline   Reply With Quote

Old   August 19, 2015, 13:22
Thumbs up
  #7
New Member
 
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 8
shahjehan13 is on a distinguished road
Quote:
Originally Posted by `e` View Post
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).

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..??
shahjehan13 is offline   Reply With Quote

Old   August 19, 2015, 17:43
Default
  #8
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 15
`e` is on a distinguished road
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?
`e` is offline   Reply With Quote

Old   August 29, 2015, 15:06
Default
  #9
New Member
 
Engr. Shah Jahan
Join Date: Aug 2015
Posts: 11
Rep Power: 8
shahjehan13 is on a distinguished road
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???
shahjehan13 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
Mass flow rate: calculation v/s computation beguxa FLUENT 5 December 2, 2018 21:02
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 3 August 27, 2018 04:18
Translational periodicity with specified mass flow rate KalleT CFX 4 May 17, 2017 18:48
Mass Flow Rate is not converging destgir448 CFX 5 December 11, 2010 05:55
mass flow rate error Masood FLUENT 0 May 22, 2005 00:32


All times are GMT -4. The time now is 18:58.