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

parallel version of DEFINE_PROFILE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 20, 2015, 06:28
Default parallel version of DEFINE_PROFILE
  #1
Member
 
Join Date: Jan 2015
Posts: 40
Rep Power: 11
philus is on a distinguished road
Hi all,

I have transformed my serial UDF with a parallel version looking the UDF manual (the pressure average example). The UDF is well compiled but the solver don't even interate one time.

The goal of this UDF is to compute an h value on a boundary from a mean Tw (wall temperature). I paste a simplified version:

Code:
DEFINE_PROFILE(name,t,i){
    real Tw, T_film;
    real h;
    real areatot=0.0;
    
    #if !RP_HOST
        face_t f;
        real A2[2];

        begin_f_loop(f,t){
            if(PRINCIPAL_FACE_P(f,t)){
                F_AREA(A2,f,t);
                areatot+=NV_MAG(A2);
                Tw+=F_T(f,t)*NV_MAG(A2);
            }
        } end_f_loop(f,t)
        
        # if RP_NODE
            areatot=PRF_GRSUM1(areatot);
            Tw=PRF_GRSUM1(Tw);
        #endif
    #endif
    
    node_to_host_real_2(areatot,Tw);
    
    #if !RP_NODE
        Tw/=areatot;
        h=Tw*2;
    #endif
    
    host_to_node_real_1(h);
    
    #if !RP_HOST
        begin_f_loop(f,t){
            if(PRINCIPAL_FACE_P(f,t)){
                F_PROFILE(f,t,i)= h;
            }
        } end_f_loop(f,t)
    #endif 
}
Can someone help me showing the errors?

Thanks in advance,
philus
philus is offline   Reply With Quote

Old   April 20, 2015, 08:43
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by philus View Post
The UDF is well compiled but the solver don't even interate one time.
But what does it do instead? Give an error? Or does it keep running without ever giving results, as if it were in an endless loop? Or something else?
pakk is offline   Reply With Quote

Old   April 20, 2015, 08:58
Default
  #3
Member
 
Join Date: Jan 2015
Posts: 40
Rep Power: 11
philus is on a distinguished road
The window "Running calculation" appears, but nothing happens and Fluent do not responds anymore.
philus is offline   Reply With Quote

Old   April 20, 2015, 09:38
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Strange. I don't know what can cause that.

You might try to simplify your UDF further, and see if that works.

For example: only calculate the average temperature, but not assign it to anything. Or: don't calculate the average temperature, and just assign the value 1 to the profile. That might give you information about which part fails.

(And minor detail: you did not initialize Tw, but that should not give the problem you see now.)
pakk is offline   Reply With Quote

Old   April 20, 2015, 12:08
Default
  #5
Senior Member
 
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14
Kokemoor is on a distinguished road
Two quick clarifying questions: this worked in serial before you added compiler directives, global reductions, and node/host transfers? Also, this is 2D?

My first try would be to remove the '#if !RP_HOST' around the final loop with 'F_PROFILE'. It seems like that shouldn't cause any problems, but if it isn't necessary, better to leave it out.

I'm not certain, but I think global reductions don't need to be protected by compiler directives. You could try removing the '#if RP_NODE' around your 'PRF_GRSUM1's.

Definitely not the cause of this issue, but I'd recommend where you define your area vector 'A2' either defining it as a vector
Code:
real NV_VEC(A2);
or with the 'ND_ND' macro
Code:
real A2[ND_ND];
Either of those will give you a vector of length 2 in 2D and 3 in 3D. Even if you know you'll only be doing 2D, it's good practice.
Kokemoor is offline   Reply With Quote

Old   April 21, 2015, 05:03
Default
  #6
Member
 
Join Date: Jan 2015
Posts: 40
Rep Power: 11
philus is on a distinguished road
Quote:
Originally Posted by Kokemoor View Post
Two quick clarifying questions: this worked in serial before you added compiler directives, global reductions, and node/host transfers? Also, this is 2D?
Exactly, I modified the serial version by adding the "#if"s. The simulation is 2D.

Quote:
Originally Posted by Kokemoor View Post
My first try would be to remove the '#if !RP_HOST' around the final loop with 'F_PROFILE'. It seems like that shouldn't cause any problems, but if it isn't necessary, better to leave it out.
This gives me a problem (cannot compile) because the host doesn't know "f".

Thanks for the hints!
philus is offline   Reply With Quote

Old   April 21, 2015, 06:08
Default
  #7
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
There are a number of lines in this code, which is a "simplified version" of your actual UDF. You need to determine where the error (or otherwise) is occurring. Start your debugging process by inserting commands to print information to the screen at key steps with the Message() function.

For example:
Code:
# if RP_NODE
    Message("I am node number %d and my total area = %e\n",myid,areatot);
    areatot=PRF_GRSUM1(areatot);
    Message("I am node number %d and now my shared total area = %e\n",myid,areatot);
    Tw=PRF_GRSUM1(Tw);
#endif
`e` is offline   Reply With Quote

Reply


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
Error running simpleFoam in parallel Yuby OpenFOAM Running, Solving & CFD 14 October 7, 2021 05:38
Problems when using su2 to solve quick start tutorial in parallel version wruudf SU2 Installation 1 May 19, 2015 17:25
Error during grid building (parallel version) Ale FLUENT 3 July 23, 2010 16:35
Parallel version Nikolay FLUENT 2 October 10, 2002 04:42
Parallel STAR version Michael Schmid Siemens 1 November 7, 2001 10:41


All times are GMT -4. The time now is 14:34.