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

RP_Set_Integer does not work in parallel

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

Like Tree3Likes
  • 3 Post By coglione

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 3, 2014, 07:14
Question RP_Set_Integer does not work in parallel
  #1
New Member
 
Manuel
Join Date: Jan 2014
Posts: 18
Rep Power: 12
86lolo is on a distinguished road
Hello everyone.
I have some code where I need to change a RP variable from an UDF ON_DEMAND. I need the macro RP_Set_Integer. Well, it does not work in parallel, even protecting it with the #if !RP directives. I have tried it on Fluent 14.5.0, both in Windows and in Linux.

What I say can be tried without a mesh or case files. Just start Fluent, compile and load the following UDF:
Code:
#include "udf.h"
#include "prf.h"
#include "para.h"

DEFINE_ON_DEMAND(actualize_rp)
{
	#if !RP_NODE
	RP_Set_Integer("myrpvar",30);
	#endif
}
This on_demand will set a RP variable to 30. Now, you can run these simple commands and see the output:
Code:
(rp-var-define 'myrpvar -10 'integer #f)
(rpgetvar 'myrpvar)
/define/ud/eod  "actualize_rp::libudf"
(rpgetvar 'myrpvar)
I obtained the following console outputs:
Code:
[Output in serial]
> (rp-var-define 'myrpvar -10 'integer #f)
myrpvar
> (rpgetvar 'myrpvar)
-10
> /define/ud/eod  "actualize_rp::libudf"
> (rpgetvar 'myrpvar)
-30

[Output in parallel]
> (rp-var-define 'myrpvar -10 'integer #f)
myrpvar
> (rpgetvar 'myrpvar)
-10
> /define/ud/eod  "actualize_rp::libudf"
> (rpgetvar 'myrpvar)
-10
Clearly, in parallel the RP_Set_Integer does not do its work. I have tried multiple combinations of #if !RP directives (even not including them at all) with no result. Has anyone here worked with this macro in parallel? Hot to make it work? I am quite puzzled since I think I am using right the #if !RP_NODE.
In other thread similar problem has been reported:http://www.cfd-online.com/Forums/flu...able-name.html; but I think that this does not help me because I am struggling just with the host, the nodes do not play at all.

The ultimate target of this is that I need to perform time-step iterations until the flow reaches a certain condition. For that, I have an scheme do-loop in which:
-iterate 25 more time steps
-execute an on_demand function, which will check if the condition I need is met: if so, it will set variable rp_end_loop to 1
-if rp_end_loop is 1, end loop; else, repeat steps.
My on_demand function evaluates properly the conditions to be met (with function Message, information is displayed in console and it is stated when the loop should end), but this loop will never end because it fails to actualize the rp variable!!!

I comment this in case someone can think of any other way of passing information from an UDF to scheme console (in any form which could be evaluated as a boolean, rp variable, scheme variable, whatever). If someone does not know how to make this RP_Set_Integer work, but knows some another workaround for my problem, I'd be extremely grateful.

Help please!!! I really need this, I can't continue my work until I solve this... and serial calculation is not affordable.

Thanks in advance
86lolo is offline   Reply With Quote

Old   July 3, 2014, 09:07
Default
  #2
Senior Member
 
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 17
coglione is on a distinguished road
Hello Manuel,

welcome into the strange world of Fluent's scheme environment.
Don't ask me why, but using
(%rpgetvar 'myrpvar) will do the trick.

cheers
wc34071209, pakk and 86lolo like this.
coglione is offline   Reply With Quote

Old   July 3, 2014, 12:37
Default
  #3
New Member
 
Manuel
Join Date: Jan 2014
Posts: 18
Rep Power: 12
86lolo is on a distinguished road
Enormous thanks, coglione.

I could continue. That trick solved the issue in the UDF I have posted. However, I realized that in my code it wasn't working. I then realize that apparently, every fluent/scheme command in a "do loop" should be introduced as (ti-load-menu-string "command"). Sounds ridiculous. I really find lisp/scheme so unfriendly and tedious...

But, I repeat again, thanks a lot! I could continue thanks to you
86lolo is offline   Reply With Quote

Reply

Tags
parallel, rp variables, scheme, udf

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
Any Parallel install procedure on Mac OS JinZhiyi SU2 Installation 2 March 11, 2014 02:12
Parallel processing problem newbie29 OpenFOAM Running, Solving & CFD 1 June 22, 2012 05:23
CFX parallel multi-node jobs fail w/ SLURM on Ubuntu 10.04 danieru CFX 0 February 17, 2012 07:20
HP MPI warning...Distributed parallel processing Peter CFX 10 May 14, 2011 07:17
Cases with small length scale work fine on a single processor but fail in parallel adona058 OpenFOAM Bugs 5 April 17, 2009 05:41


All times are GMT -4. The time now is 06:13.