CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   patchExpression with alpha in OF 2.2.0 - calculate heat flux (http://www.cfd-online.com/Forums/openfoam-solving/116429-patchexpression-alpha-2-2-0-calculate-heat-flux.html)

RMF April 18, 2013 16:31

patchExpression with alpha in OF 2.2.0 - calculate heat flux
 
Hello,

I used the patchExpression "alpha)*area()*snGrad(h)" with swak4Foam to monitor the heat flux on a patch in OF 2.1.x. This worked very well. Since I have updated to OF 2.2.0 I get an error "Parser Error for driver PatchValueExpressionDriver at "1.2-3" :"field alpha not existing or of wrong type.

Has anybody an idea how to acces the thermal diffusivity in OF 2.2.0 in a patchExpression? Or does anybody know another way to monitor the wallHeatFlux.

Thanks

RMF

gschaider April 22, 2013 17:36

Quote:

Originally Posted by RMF (Post 421625)
Hello,

I used the patchExpression "alpha)*area()*snGrad(h)" with swak4Foam to monitor the heat flux on a patch in OF 2.1.x. This worked very well. Since I have updated to OF 2.2.0 I get an error "Parser Error for driver PatchValueExpressionDriver at "1.2-3" :"field alpha not existing or of wrong type.

Has anybody an idea how to acces the thermal diffusivity in OF 2.2.0 in a patchExpression? Or does anybody know another way to monitor the wallHeatFlux.

Thanks

RMF

Seems you became a victim of the improvement of the thermodynimc classes. Didn't have much time to look at it, but when looking at the part where alpha is declared I see
Code:


alpha_
    (
        IOobject
        (
            phasePropertyName("thermo:alpha"),
            mesh.time().timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),

Guess that means that it is now called thermo:alpha with the name of the phase in front. The bad thing is not that I don't know which phaseName should be prefixed in your case, the bad thing is that I don't think that swak accepts ":" as a valid part of a field name and this will need some work on the parser to make him accept it (because currently it is part of the ?:-operator)

Will look at this as soon as I find the time. Bug report might speed it up

RMF April 24, 2013 08:11

This is what I found out as well in the meantime: alpha is called thermo:alpha (I used the "bananas"-trick with a wirteRegisteredObject). But as you've assumed, swak4Foam does not accept the ":" in thermo:alpha.

For those, who have a similar problem:
As a workaround I modified the solver and registered an additional field alpha, which is updated at the end of each timestep with the values from thermo:alpha. This is probably inefficient, but it is working for the moment. If there are any better ideas, I'd be glad to hear them.

I will report a bug and hope you will find the time to modify swak4Foam in the near future. Anyway, thank you for your answer.

Bye RMF

gschaider April 24, 2013 20:19

Quote:

Originally Posted by RMF (Post 422833)
This is what I found out as well in the meantime: alpha is called thermo:alpha (I used the "bananas"-trick with a wirteRegisteredObject). But as you've assumed, swak4Foam does not accept the ":" in thermo:alpha.

For those, who have a similar problem:
As a workaround I modified the solver and registered an additional field alpha, which is updated at the end of each timestep with the values from thermo:alpha. This is probably inefficient, but it is working for the moment. If there are any better ideas, I'd be glad to hear them.

I will report a bug and hope you will find the time to modify swak4Foam in the near future. Anyway, thank you for your answer.

I added a feature to swak where you can define aliases for such "unusual" field names like this
Code:

aliases {
  alpha thermo:alpha;
}

With that you can say "alpha" in your expression and "thermo:alpha" will be used. I'll push that to the public development-repository in the next days (just have to check it doesn't break anything) and of course it will be in the next release

gschaider April 28, 2013 19:03

Quote:

Originally Posted by gschaider (Post 422961)
I added a feature to swak where you can define aliases for such "unusual" field names like this
Code:

aliases {
  alpha thermo:alpha;
}

With that you can say "alpha" in your expression and "thermo:alpha" will be used. I'll push that to the public development-repository in the next days (just have to check it doesn't break anything) and of course it will be in the next release

OK. It is pushed to the mercurial repository

RMF May 2, 2013 03:49

Thank you very much. You were really quick. But it's still not working for me (maybe it's my fault):

I changed my function to

HeatLoss
{

type patchExpression;
patches (CAVITYIN CAVITYBACK);
verbose true;
aliases {
alpha thermo:alpha
}
expression"(alpha+alphat)*area()*snGrad(h)";
accumulations (sum);
}

but now I get the error message:

No field of type scalar with the name alpha found

Fields of type: volScalarField
17
(
thermo:mu
...


Something changed, but it's still not working...

Did I use the aliases wrong? The other variation I tested led to the old error message.

Bye RMF

gschaider May 4, 2013 06:23

Quote:

Originally Posted by RMF (Post 424571)
Thank you very much. You were really quick. But it's still not working for me (maybe it's my fault):

I changed my function to

HeatLoss
{

type patchExpression;
patches (CAVITYIN CAVITYBACK);
verbose true;
aliases {
alpha thermo:alpha
}
expression"(alpha+alphat)*area()*snGrad(h)";
accumulations (sum);
}

but now I get the error message:

No field of type scalar with the name alpha found

Fields of type: volScalarField
17
(
thermo:mu
...


Something changed, but it's still not working...

Did I use the aliases wrong? The other variation I tested led to the old error message.

Bye RMF

No that looks alright. Must check. Which solver which version are you using?

RMF May 4, 2013 08:05

I am using the buoyantSimpleFoam solver of OF 2.2.0
Thanks
Bye RMF

gschaider May 4, 2013 17:46

Quote:

Originally Posted by RMF (Post 425169)
I am using the buoyantSimpleFoam solver of OF 2.2.0
Thanks
Bye RMF

Seems like the aliasing wasn't added to ALL relevant functions. A fix is now pushed to the development repository on sourceforge

RMF May 15, 2013 12:50

Sorry for the late reply: I was busy last week...but I now I had some time to test your modification. It's working now. Thank you very much!


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