CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] a script for changing variables in groovyBC in 0 folder

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 25, 2013, 18:39
Default
  #21
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
I've tested the case you sent me and sent back the adapted case.

Note: I've renamed "omega" to "Omega" in the variables file, to avoid name collision with the "omega" turbulence field.

Indeed, "boolean" is not supported on the test types:
Quote:
Conditional operator
The conditional operator ( test ? val1 : val2) is defined for scalars and vectors
You'll have to change the "boolean" back to scalars, using something like:
Code:
wall_right=a<b ? 1 : 0;
And then test it accordingly:
Code:
wall_right == 1 ? a : b;
immortality likes this.
__________________
wyldckat is offline   Reply With Quote

Old   May 25, 2013, 19:13
Default
  #22
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
thank you for all things.thus now i can continue the work.
I'll test it and tell you by editing this post.
........
Now the error on this trouble is resolved completely.
Thank you very much.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; May 27, 2013 at 18:24.
immortality is offline   Reply With Quote

Old   May 27, 2013, 18:44
Default
  #23
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by wyldckat View Post
I've tested the case you sent me and sent back the adapted case.

Note: I've renamed "omega" to "Omega" in the variables file, to avoid name collision with the "omega" turbulence field.

Indeed, "boolean" is not supported on the test types:


You'll have to change the "boolean" back to scalars, using something like:
Code:
wall_right=a<b ? 1 : 0;
And then test it accordingly:
Code:
wall_right == 1 ? a : b;
Did IO understand it correctly: before you had a variable "test= a<b;" and it couldn't be used like this "test ? val1 : val2". That is possible, butI'd consider it a bug
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   May 28, 2013, 07:53
Default
  #24
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Hi Bernhard.
I reply instead of Bruno.yes Boolean doesn't work in spite of my expectation.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 28, 2013, 17:29
Default
  #25
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

Quote:
Originally Posted by gschaider View Post
Did IO understand it correctly: before you had a variable "test= a<b;" and it couldn't be used like this "test ? val1 : val2". That is possible, butI'd consider it a bug
OK, I'll make a note to file a bug report this coming weekend

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   May 29, 2013, 06:48
Default
  #26
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Hi
you want to report the bug to where?
Isn't it a groovyBC probelm?or OF?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 29, 2013, 15:49
Default
  #27
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Ehsan,

It's a bug in groovyBC. As for reporting bugs about groovyBC: http://openfoamwiki.net/index.php/Co...#Bug_reporting

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   May 29, 2013, 16:02
Default
  #28
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
why we should report there?while Bernhard knows it now himself?is it necessary to send the file?
Well then i have discovered a bug in groovyBC at last!
I was engaged with it and tell it to Bernhard 1.5 month ago but none of us got it serious enough
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; May 29, 2013 at 17:13.
immortality is offline   Reply With Quote

Old   May 29, 2013, 20:01
Default
  #29
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
why we should report there?while Bernhard knows it now himself?is it necessary to send the file?
It is necessary because it is not the only bug/enhancement that is pending. Now I know it, but you'd be surprised how quick I forget stuff that doesn't concern me. So if you rely on my memory chances are good that the bug will never get fixed. If it is in the bug report system I can't forget it. Also: why do you expect me to spend the time fixing a bug that hasn't been a problem for me yet if you can't be bothered to file a proper bug-report
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   May 30, 2013, 06:44
Default
  #30
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
OK.i'll report it.
you are right.you maybe forget it.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; June 24, 2013 at 04:40.
immortality is offline   Reply With Quote

Old   June 23, 2013, 16:41
Default
  #31
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Hi dear Bernhard
I reported it some times before that you provided 0.2.4 version.
have you managed to fix it (Boolean problem in variables) in new version?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; June 24, 2013 at 03:58.
immortality is offline   Reply With Quote

Old   June 24, 2013, 01:47
Default
  #32
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
It's your problem, not Bernhard Gschaider's. Just check the status of the bug report, or install the new thing. If you are too lazy to test this, it's not that big of a deal to you.
Bernhard is offline   Reply With Quote

Old   June 24, 2013, 03:56
Default
  #33
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Quote:
It's your problem, not Bernhard Gschaider's. Just check the status of the bug report, or install the new thing. If you are too lazy to test this, it's not that big of a deal to you.
its very better for you to be polite.I had looked at My report status before,was NOT need you to tell.I asked to real Bernhard Gschaider not blank Bernharrd,nobody forced you to speak rudely,its obvious from the posts who is more lazier,go and get your prize if you can find a bug in Swak4Foam like me,in return to go around and looking forward to insult people like jelous guys.
for better thinking you have to know,its not anyone problem.it was a problem in Swak4Foam that I discovered
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; June 25, 2013 at 07:09.
immortality is offline   Reply With Quote

Old   June 24, 2013, 12:08
Default
  #34
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Hi dear Bernhard
it has remained in 0.2.4 still and seems hasn't been corrected:
Code:
- From dictionary: /home/ehsan/Desktop/Central/Laminar_WR/WR_centralFoam3/processor2/0/T.boundaryField.left
Evaluating expression "(port3) ? T_3 : T_1"
[2]
[2]
[2]     From function parsingValue
[2]     in file lnInclude/CommonValueExpressionDriverI.H at line 1081.
[2]
FOAM parallel run exiting
[2]     From function ConcretePluginFunction<DriverType>::exists

in file lnInclude/ConcretePluginFunction.C at line 111
Constructor table of plugin functions for PatchValueExpressionDriver is not initialized
[0]
[0]
[0] --> FOAM FATAL ERROR:
[0]  Parser Error for driver PatchValueExpressionDriver at "1.2-6" :"field port3 not existing or of wrong type"
"(port3) ? T_3 : T_1"
^^^^^
---|

Context of the error:


- From dictionary: /home/ehsan/Desktop/Central/Laminar_WR/WR_centralFoam3/processor0/0/T.boundaryField.left
Evaluating expression "(port3) ? T_3 : T_1"
[0]
[0]
[0]     From function parsingValue
[0]     in file lnInclude/CommonValueExpressionDriverI.H at line 1081.
[0]
FOAM parallel run exiting
[0]

[3]
[3] --> FOAM FATAL ERROR:
[3]  Parser Error for driver PatchValueExpressionDriver at "1.2-6" :"field port3 not existing or of wrong type"
"(port3) ? T_3 : T_1"
^^^^^
---|
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; June 24, 2013 at 14:46.
immortality is offline   Reply With Quote

Old   June 24, 2013, 18:38
Default
  #35
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
Hi dear Bernhard
it has remained in 0.2.4 still and seems hasn't been corrected:
That is right. Release 0.2.4 was rolled before that issue even came up. Will be fixed in the next release. The bug report is there but due to other obligations it is unlikely that I will get to it this week
immortality likes this.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   July 14, 2013, 14:11
Default
  #36
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Hi dear Bernhard
I got the same error in mercurial repository version:
Code:
- From dictionary: /home/ehsan/Desktop/WR_2/processor1/0/p.boundaryField.right
Evaluating expression "(port2) ? p_2 : p_4"
[1]
[1]
[1]     From function parsingValue
[1]     in file lnInclude/CommonValueExpressionDriverI.H at line --> FOAM FATAL ERROR:
[0]  Parser Error for driver PatchValueExpressionDriver at "1.9" :"syntax error, unexpected '?', expecting $end"
"(port2) ? p_2 : p_4"
^
----------|

Context of the error:


- From dictionary: /home/ehsan/Desktop/WR_2/processor0/0/p.boundaryField.right
Evaluating expression "(port2) ? p_2 : p_4"
[0]
[0]
[0]     From function parsingValue
[0]     in file lnInclude/CommonValueExpressionDriverI.H at line 1160.
[0] 1160.
[1]
FOAM parallel run exiting
[1]

FOAM parallel run exiting
[0]
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
--------------------------------------------------------------------------
mpirun has exited due to process rank 0 with PID 12740 on
node Ehsan-com exiting without calling "finalize". This may
have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).
--------------------------------------------------------------------------
[Ehsan-com:12734] 1 more process has sent help message help-mpi-api.txt / mpi-abort
[Ehsan-com:12734] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
Killing PID 12731
 PyFoam WARNING on line 232 of file /usr/local/lib/python2.7/dist-packages/PyFoam/Execution/FoamThread.py : Process 12731 was already dead
when I have:
Code:
right
    {
        type groovyBC;
        #include "include/variables_R"
        fractionExpression "(port2 && M2<1) || (port4 && M4<1)  ? 1 : 0";
        valueExpression "(port2) ? p_2 : p_4";
        value $internalField;
        gradientExpression "0"; 
        
    }
what may be wrong?
it gives some error like:
Code:
- From dictionary: /home/ehsan/Desktop/WR_2/processor1/0/gas.boundaryField.left
Evaluating expression "(port3==1) ?  1 : 0"
while port3 is a boolean variable.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   July 20, 2013, 13:19
Default
  #37
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Hi Bernhard
it works fine.but if add some flexibility it will be more nice.for example if we had : bool_variable==1 ? somethingther thing;
it gives an error while
bool_variable ? somethingther thing;
works nice.
its good so in your opinion? maybe you have another view.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   July 21, 2013, 09:14
Default
  #38
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Ehsan,

Can you please share an extremely simple example case for what you're asking? Something like a modified cavity tutorial with the boundary condition or expression in question?

Because personally I did try to look at the bug report and all I found was the very complex example of the "variables" file, without any case attached to it

Please remember that time is not abundant to every one on this thread!

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   July 22, 2013, 17:57
Default
  #39
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
Hi Bernhard
it works fine.but if add some flexibility it will be more nice.for example if we had : bool_variable==1 ? somethingther thing;
it gives an error while
bool_variable ? somethingther thing;
works nice.
its good so in your opinion? maybe you have another view.
The constants to be used with boolean variables in swak are true and false. This is stated at least two times in the reference documentation found in the Documentation-folder of the swak-sources

So bool_variable==true should work
immortality likes this.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider 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
[swak4Foam] no change in solution by change in groovyBC variables immortality OpenFOAM Community Contributions 2 January 28, 2013 07:34
[swak4Foam] Defining two different variables at two patch in groovyBC with the same name immortality OpenFOAM Community Contributions 2 January 9, 2013 18:03
[swak4Foam] Air Conditioned room groovyBC Sebaj OpenFOAM Community Contributions 7 October 31, 2012 14:16
[swak4Foam] Wall heat transfer using groovyBC (XiFoam solver) usergk OpenFOAM Community Contributions 7 February 4, 2011 13:36
PHI file structure Eugene Phoenics 9 November 2, 2001 22:00


All times are GMT -4. The time now is 22:53.