|
[Sponsors] |
[swak4Foam] GroovyBC doesn't read variables and Expression |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 17, 2015, 03:52 |
GroovyBC doesn't read variables and Expression
|
#1 |
New Member
seyyed
Join Date: Jun 2014
Posts: 7
Rep Power: 11 |
hi
i changed buoyantBoussinesqSimpleFoam and add a heat source to it Code:
fvScalarMatrix TEqn ( fvm::div(phi, T) - fvm::Sp(fvc::div(phi), T) - fvm::laplacian(kappaEff, T) == Qt ); Code:
Info<< "Reading field Qt\n" << endl; volScalarField Qt ( IOobject ( "Qt", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Code:
type groovyBC; variables "Tzone{cellZone'poool}=average(T);Uzone{cellZone'poool}=average(mag(U));q=(((0.0888+(0.0783*Uzone))*((3363)-((0.6)*((exp((20.386)-((5132)/(Tzone))))*(133.3224)))))/(31.2));"; valueExpression "297.15"; gradientExpression "-q"; fractionExpression "1"; value uniform 297.15 ; but in the results groovyBC calculated expression in T but in Qt all values set to 0 result for T : Code:
{ type groovyBC; refValue uniform 297.15; refGradient uniform -3.57777; valueFraction uniform 1; value uniform 297.15; valueExpression "297.15"; gradientExpression "-q"; fractionExpression "1"; evaluateDuringConstruction 0; variables "Tzone{cellZone'poool}=average(T);Uzone{cellZone'poool}=average(mag(U));q=(((0.0888+(0.0783*Uzone))*((3363)-((0.6)*((exp((20.386)-((5132)/(Tzone))))*(133.3224)))))/(31.2));"; timelines ( ); lookuptables ( ); } Code:
{ type groovyBC; refValue uniform 0; refGradient uniform 0; valueFraction uniform 1; value uniform 297.15; valueExpression "297.15"; gradientExpression "-q"; fractionExpression "1"; evaluateDuringConstruction 0; variables "Tzone{cellZone'poool}=average(T);Uzone{cellZone'poool}=average(mag(U));q=(((0.0888+(0.0783*Uzone))*((3363)-((0.6)*((exp((20.386)-((5132)/(Tzone))))*(133.3224)))))/(31.2));"; timelines ( ); lookuptables ( ); } any suggestion? thanks |
|
November 18, 2015, 05:20 |
|
#2 |
Member
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 11 |
Hi Seyyed,
I added a heat source to buoyantBoussinesqPimpleFoam and also called it Qt! I have been working with groovyBC a bit and found that it is pretty smart, and can take a couple of different syntaxes, are you sure that this is not happening with you? And what do you mean by the "code compiles without any errors"? Can you run your solver on this case with the groovyBC boundary conditions? |
|
November 18, 2015, 17:11 |
|
#3 | |
New Member
seyyed
Join Date: Jun 2014
Posts: 7
Rep Power: 11 |
Quote:
"code compiles without any errors" i mean that when i make a syntax error on variables in groovyBC in Qt file the code dosnt show any error . do you enter Qt on your boundaries or in a volume ? |
||
November 19, 2015, 01:53 |
|
#4 |
Member
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 11 |
Hi Seyyed,
Quick question, is your solver compiling when you wmake it? My Qt is a volScalarField which I added in the createFields.H file as follows so that my solver reads it in when I run my solver: Code:
Info<< "Calculating field QT (Joule heating in K/s)\n" << endl; volScalarField QT ( IOobject ( "QT", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); I still do not understand your comment about your groovyBC "code compiling". Something would only happen when you run your solver, and if your solver is in fact trying to read your 0/Qt file. I still don't quite understand what exactly your problem is. |
|
November 21, 2015, 03:19 |
|
#5 | ||||
New Member
seyyed
Join Date: Jun 2014
Posts: 7
Rep Power: 11 |
Quote:
Quote:
Quote:
after that i made a case and in that case i used groovyBC for T and Qt groovyBC worked for T but not for Qt i think because i used Qt on a boundry my solver didnt read it i mean Qt must set in internalfield in a volume not surface Quote:
how do you calculate Qt? thanks for your reply |
|||||
November 24, 2015, 03:08 |
|
#7 |
Member
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 11 |
Hi Seyyed,
Is your Qt heating inside the volume at any point in time? It looks like, from the files that you sent, that Qt is zero everywhere except on one boundary. Could you not just implement this heat source using the boundary conditions for T and leave out Qt altogether? My Qt is a volScalarField for resistive heating from electrical current that passes through my domain. I calculate it using a separate electrical solver and then just use the volScalarField in my flow solver. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] How to define boundary condition variables by using previosly defined variables? | pawlo | OpenFOAM Community Contributions | 8 | September 13, 2020 11:37 |
[swak4Foam] access field variables in groovyBC | mehtab | OpenFOAM Community Contributions | 11 | February 4, 2019 12:08 |
[swak4Foam] Error using groovyBC - 'parser error for expression driver' | odellar | OpenFOAM Community Contributions | 4 | September 21, 2015 11:51 |
Something doens't work with wallHeatFlux utility or externalWallHeatFluxTemperat BC!! | zfaraday | OpenFOAM Post-Processing | 0 | February 5, 2015 16:47 |
cfx expression variables | Manoj Kumar | CFX | 2 | February 16, 2006 10:03 |