CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   How to add random velocity fluctuations using groovyBC (https://www.cfd-online.com/Forums/openfoam-solving/218136-how-add-random-velocity-fluctuations-using-groovybc.html)

a.shevchenko June 10, 2019 07:52

How to add random velocity fluctuations using groovyBC
 
2 Attachment(s)
Hello everyone!

I have been trying to add random velocity fluctuations to my 2D jet flow simulation.

First I used turbulentInlet BC – and it did what I wanted, but I find it quite restricting now, as it just gives me a flat velocity profile where i would like to set a parabolic profile for example, and I would also like to add various pulsations to my velocity – not just random noise. So I opted for groovyBC, as it seemed to be able to do a lot of things at once.

Anyway, the task seemed easy. What I did previously (constant velocity profile, fluctuations at 1% of initial velocity) with turbulentInlet looks like this:

inlet
{
type turbulentInlet;
referenceField uniform (6.0 0 0);
fluctuationScale (0.06 0 0);
value uniform (6.0 0 0);
}


so, the same thing with groovyBc would have to look like this:

inlet
{
type groovyBC;
variables
(
"u0=6;"
"noise=0.012*rand()-0.06;"

"u=u0+noise;"
);
valueExpression "vector(u,0,0)";
value uniform (0 0 0);
}


However, when I ran simulations side by side, the results came out to be very different. groovyBC certainly does something – the results are different from the simulations with no noise whatsoever, but the scale of random velocity pulses is nowhere near what I achieved with turbulentInlet (see attached screenshots of velocity profiles as measured near jet inlet)

I am quite certain that I am doing some dumb mistake or overlooking something obvious, but still...

Would be happy to hear any advice)

Anton.

a.shevchenko June 13, 2019 02:53

Well, if anyone is interested – it was a typo in expression

"noise=0.012*rand()-0.06;"
instead of
"noise=0.12*rand()-0.06;"
of course

which i somehow managed to overlook.... okay, at least I was right about "obvious dumb mistake"

There is the post about rand() in swak4foam:
https://www.cfd-online.com/Forums/op...setfields.html
and an example on openfoam wiki:
http://openfoamwiki.net/index.php/Co...RandomVelocity


All times are GMT -4. The time now is 15:13.