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/)
-   -   epsilon groovyBC problem (http://www.cfd-online.com/Forums/openfoam-solving/88451-epsilon-groovybc-problem.html)

Thom May 17, 2011 17:48

epsilon groovyBC problem
 
Hi everyone,

I am trying to create an epsilon inlet using groovyBC but am having a couple of problems. It is probably something very simple but I am hoping you can point me in the right direction!

here's my epsilon inlet condition:

Code:

inlet
    {
        type            groovyBC;
        variables      "uStar=0.005;z0=0.05;K=0.41;epsilon=pow(uStar,3)/K(pos().z+z0)";
        valueExpression "epsilon";
    value uniform 0;
        }

As I said sorry if this is probably very trivial but I am still very much an foam novice.

Thanks for your help and time
Thomas

gschaider May 18, 2011 03:23

Quote:

Originally Posted by Thom (Post 308043)
Hi everyone,

I am trying to create an epsilon inlet using groovyBC but am having a couple of problems. It is probably something very simple but I am hoping you can point me in the right direction!

here's my epsilon inlet condition:

Code:

inlet
    {
        type            groovyBC;
        variables      "uStar=0.005;z0=0.05;K=0.41;epsilon=pow(uStar,3)/K(pos().z+z0)";
        valueExpression "epsilon";
    value uniform 0;
        }

As I said sorry if this is probably very trivial but I am still very much an foam novice.

Thanks for your help and time
Thomas

It would be easier to point you in the right direction if you said HOW the problem manifests itself.

Is your problem a syntax error? Because you're using K like a function.

Apart from that: Having a variable with the same name as the field might lead to weird behaviour (the variable should shadow the field value and your case should be alright anyway)

And one last thing: Never ever (not even for fun and not even in the "value"-field that is probably never going to be used) set epsilon to zero

Thom May 18, 2011 05:15

Quote:

Originally Posted by gschaider (Post 308084)
It would be easier to point you in the right direction if you said HOW the problem manifests itself.

Is your problem a syntax error? Because you're using K like a function.

Apart from that: Having a variable with the same name as the field might lead to weird behaviour (the variable should shadow the field value and your case should be alright anyway)

And one last thing: Never ever (not even for fun and not even in the "value"-field that is probably never going to be used) set epsilon to zero


Hi Bernhard,

It was a floating point exception which led me to believe I was doing something mathematically incorrect. Thanks for pointing me in the right direction as the K was providing the problem. I appreciate your advice on the other issues too especially the epsilon value. I just realised how novice an error that was.

Thanks again for all your help,it seems to be working correctly now (hopefully!)

Thomas

gschaider May 18, 2011 11:29

Quote:

Originally Posted by Thom (Post 308102)
Hi Bernhard,

It was a floating point exception which led me to believe I was doing something mathematically incorrect. Thanks for pointing me in the right direction as the K was providing the problem. I appreciate your advice on the other issues too especially the epsilon value. I just realised how novice an error that was.

Thanks again for all your help,it seems to be working correctly now (hopefully!)

Thomas

Interesting: you didn't get a syntax-error but a floating point exception? Strange

gregjunqua October 25, 2012 22:53

Hi did you solve your problem?
I am using this equation too as :

inlet
{
type groovyBC
variables "u_f=0.521;z0=0.001;z_f=pos().y;K=0.4;epsi = pow(u_f,3)/(K(z_f+z0))";
valueExpression "epsi";

}

i also got the following error :

From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(c onst fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
in file groovyBCFvPatchField.C at line 119
No value defined for epsilon on inlet therefore using 100{0}

I try many solution and none is working ... :mad:
is there something i had miss? because i do it for my wind condition and it work well ...
i guess because it's not a vector but i don't know how to solve this problem

gschaider October 26, 2012 05:16

Quote:

Originally Posted by gregjunqua (Post 388593)
Hi did you solve your problem?
I am using this equation too as :

inlet
{
type groovyBC
variables "u_f=0.521;z0=0.001;z_f=pos().y;K=0.4;epsi = pow(u_f,3)/(K(z_f+z0))";
valueExpression "epsi";

}

i also got the following error :

From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(c onst fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
in file groovyBCFvPatchField.C at line 119
No value defined for epsilon on inlet therefore using 100{0}

I try many solution and none is working ... :mad:
is there something i had miss? because i do it for my wind condition and it work well ...
i guess because it's not a vector but i don't know how to solve this problem

What this warning (it is not an error because the simulation continues to run .... at that point) means is that during construction the valueExpression is not evaluated (that would lead to all kinds of circular dependencies in the cases with fields that are not yet constructed/loaded). So the constructor assumes that you define something like "value uniform 1e-2;" or so, which it uses only until all fields are being loaded. If you didn't define that groovyBC decides to play it nice and "fill in a value for you". The value that fits most situation which is 0. Problem is that 0 is not a very good choice for epsilon.

So declare an approximate 'value' for epsilon. It will only be used until all other fields are loaded. After that your valueExpression will be used


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