CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] groovyBC - non uniform gradient problem (https://www.cfd-online.com/Forums/openfoam-community-contributions/152646-groovybc-non-uniform-gradient-problem.html)

marluc May 5, 2015 16:40

groovyBC - non uniform gradient problem
 
Hallo,

I am solving a three dimensional pipe flow with a non-uniform applied gradient on half its surface. I am using the following groovyBC:
Code:

    wallHeat
    {
        type                    groovyBC;
        gradientExpression      "2e5/4*pi*cosTheta";
        fractionExpression      "0";
        variables              "r=sqrt(sqr(pos().x)+sqr(pos().y));cosTheta=mag(pos().x/r);";
        refGradient            uniform 50000;
        refValue                  uniform 50000;
        value                  uniform 50000;
    }

solve for a volScalarField T and from it I calculate a volScalarField T1.

The internalField values of T1 are correct but the boundary values on the above patch are not because they are always set at the specified uniform value and not as a nonUniform List as for the field T:

For T1:
Code:

wallHeat
    {
        type            groovyBC;
        refValue        uniform 50000;
        refGradient    uniform 50000;
        valueFraction  uniform 1;
        value          uniform 50000;
        valueExpression "0";
        gradientExpression "2e5/4*pi*cosTheta";
        fractionExpression "0";
        evaluateDuringConstruction 0;
        variables     
2
(
"r=sqrt(sqr(pos().x)+sqr(pos().y));"
"cosTheta=mag(pos().x/r);"
)
;
        timelines      (
);
        lookuptables    (
);

For T:
Code:

  wallHeat
 {
    type            groovyBC;
    refValue        uniform 0;
    refGradient    nonuniform List<scalar>
400
(
157049
156807
156323
155598
.
.
.     
 valueFraction  uniform 0;
 value          nonuniform List<scalar>
 400
(
479.485
479.069
478.242
477.005
.
.
.
)
;
        valueExpression "0";
        gradientExpression "2e5/4*pi*cosTheta";
        fractionExpression "0";
        evaluateDuringConstruction 0;
        variables
 2
(
 "r=sqrt(sqr(pos().x)+sqr(pos().y));"
 "cosTheta=mag(pos().x/r);"
 )
 ;
        timelines      (
);
        lookuptables    (
 );

As you can see it seems that the non-uniform gradient BC is not evaluated for T1. But why? Is it because I don't solve any equation for that field but I just derive it from T? But if I use a fixedGradient BC then everything works finr and I obtain the correct T1 values at the wall.

Can someone help?

Thank you in advance,
Luca


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