CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

GroovyBC doesn't read variables and Expression

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

Like Tree2Likes
  • 1 Post By Nicole
  • 1 Post By Nicole

Reply
 
LinkBack Thread Tools Display Modes
Old   November 17, 2015, 04:52
Default GroovyBC doesn't read variables and Expression
  #1
New Member
 
seyyed
Join Date: Jun 2014
Posts: 7
Rep Power: 4
S.M.H is on a distinguished road
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
     
    );
then i changed createFields.H to read Qt from 0 file
Code:
 Info<< "Reading field Qt\n" << endl;
    volScalarField Qt
    (
        IOobject
        (
            "Qt",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
now i want that Qt in 0 file change with groovyBC in each iteration

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 ;
i used this expression in boundry file T, too
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    (
);
    }
result for Qt:
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    (
);
    }
then i noticed that if i add a semicolon or a braket in variables and make a syntax error code compile without any errors that means code doesn't read groovyBC variables and Expression

any suggestion?

thanks
S.M.H is offline   Reply With Quote

Old   November 18, 2015, 06:20
Default
  #2
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 4
Nicole is on a distinguished road
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?
S.M.H likes this.
Nicole is offline   Reply With Quote

Old   November 18, 2015, 18:11
Default
  #3
New Member
 
seyyed
Join Date: Jun 2014
Posts: 7
Rep Power: 4
S.M.H is on a distinguished road
Quote:
Originally Posted by Nicole View Post
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?
it works properly for T and the expression are the same

"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 ?
S.M.H is offline   Reply With Quote

Old   November 19, 2015, 02:53
Default
  #4
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 4
Nicole is on a distinguished road
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.
S.M.H likes this.
Nicole is offline   Reply With Quote

Old   November 21, 2015, 04:19
Default
  #5
New Member
 
seyyed
Join Date: Jun 2014
Posts: 7
Rep Power: 4
S.M.H is on a distinguished road
Quote:
Originally Posted by Nicole View Post
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.
Quote:
is your solver compiling when you wmake it?
yes it compile perfect


Quote:
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
i wmake the solver and it compile
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:
Info<< "Calculating field QT
can u attch your Qt file?
how do you calculate Qt?

thanks for your reply
S.M.H is offline   Reply With Quote

Old   November 21, 2015, 04:27
Default
  #6
New Member
 
seyyed
Join Date: Jun 2014
Posts: 7
Rep Power: 4
S.M.H is on a distinguished road
0.zip
10.zip

i attach my T and Qt file in 0 file and in 10 file after 10 iterations
S.M.H is offline   Reply With Quote

Old   November 24, 2015, 04:08
Default
  #7
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 4
Nicole is on a distinguished road
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.
Nicole is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
access field variables in groovyBC mehtab OpenFOAM Running, Solving & CFD 10 October 23, 2015 19:59
Error using groovyBC - 'parser error for expression driver' odellar OpenFOAM Running, Solving & CFD 4 September 21, 2015 11:51
Something doens't work with wallHeatFlux utility or externalWallHeatFluxTemperat BC!! zfaraday OpenFOAM Post-Processing 0 February 5, 2015 17:47
Low Mixing time Problem Mavier CFX 5 April 29, 2013 00:00
cfx expression variables Manoj Kumar CFX 2 February 16, 2006 11:03


All times are GMT -4. The time now is 05:39.