|
[Sponsors] |
April 20, 2012, 05:13 |
groovyBC controlled by scalar
|
#1 |
New Member
Jaroslav Volavy
Join Date: May 2009
Posts: 2
Rep Power: 0 |
Hi all,
could somebody help me? I'm trying to implement thermostat function in OpenFOAM. I'm using groovyBC. I want something like this (in the 0/T file): Code:
hotWall { type groovyBC; variables "Thot=Burner*373.15 + (1-Burner)*293.15;"; valueExpression "Thot"; } If I declare Burner as volScalarField in the solver and change the value on the corresponding patch (hotWall), it works fine. But this is quite complicated and IMHO nasty way how to do it. So my question is: Is there any way how to achieve this using variable Burner only as a scalar? I tried this (and many other variation): Code:
dimensionedScalar Burner ( "Burner", scalar(1) ); Do you have any idea how to use only scalar in the groovyBC? Thank very much for your help regards Jaroslav |
|
April 20, 2012, 21:23 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
You'll have to make the place were global variables are stored known to the solver with Code:
#include "GlobalVariablesRepository.C" Code:
GlobalVariablesRepository::getGlobalVariables().addValue( "Burner", "BurnerControl", ExpressionResult(dimensionedScalar("burner",dimless,burner)) ); Now in the boundary condition you've got to make the global scope known with Code:
globalScopes ( BurnerControl ); If you want to keep your solver "swak-free" then an alternative would be to implement the burner algorithm in a functionObject and set the global variable there. This is possible with the swakCoded-functionObject (which basically is the usual coded-FO with the possibility to set globals) or the pythonIntegration-functionObject. |
||
April 25, 2012, 13:16 |
|
#3 |
New Member
Jaroslav Volavy
Join Date: May 2009
Posts: 2
Rep Power: 0 |
Hi Bernhard,
thank you very much for your help! It works. My monster code is alive! (thunder in background ) Jaroslav |
|
April 25, 2012, 13:56 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
May 28, 2012, 08:05 |
|
#5 |
New Member
Raimonds Vilums
Join Date: Oct 2010
Posts: 17
Rep Power: 17 |
||
May 28, 2012, 11:24 |
|
#6 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Currently the constructor only supports dimensioned values. But as you see above (dimless) this is no problem. The constructor is templated to accept any dimensioned-thing, but the internals (ugly, but serves its purpose) of ExpressionResult only accept scalar, vector, tensor, symmTensor and sphericalThensor |
||
July 13, 2016, 14:50 |
|
#7 |
Senior Member
Manu Chakkingal
Join Date: Feb 2016
Location: Delft, Netherlands
Posts: 129
Rep Power: 10 |
Hi Bernhard,
I followed the steps as shown. I added the libraries and the paths correctly. I also added the "include" file at the top of .C file before main(). Now if I add GlobalVariablesRepository::getGlobalVariables().ad dValue( "Burner", "BurnerControl", ExpressionResult(dimensionedScalar("burner",dimles s,burner)) ); to the createFields, I get the 'No matching function for call to 'Foam::GlobalVariableRepository'' error. Could you please let me know where do I make the function call?
__________________
Regards Manu |
|
Tags |
groovybc, scalar, thermostat |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
Division by zero exception - loop over scalarField | Pat84 | OpenFOAM Programming & Development | 6 | February 18, 2017 06:57 |
Issue symmetryPlane 2.5d extruded airfoil simulation | 281419 | OpenFOAM Running, Solving & CFD | 5 | November 28, 2015 14:09 |
Diverging solution in transonicMRFDyMFoam | tsalter | OpenFOAM Running, Solving & CFD | 30 | July 7, 2014 07:20 |
compressible flow in turbocharger | riesotto | OpenFOAM | 50 | May 26, 2014 02:47 |