CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Creating an initial field with a random disturbance (https://www.cfd-online.com/Forums/openfoam-solving/68756-creating-initial-field-random-disturbance.html)

 mmahdinia September 30, 2009 17:46

Creating an initial field with a random disturbance

Hi everybody,

I am using the setFields utility to create an initial filed for a scalar. Is there a way to create a random disturbance with an specified amplitude (like 10 percent of the max value) in the initial scalar field mentioned above?

Your response would be of high value to me.

Thanks
Maani

 lakeat October 7, 2009 10:35

IC is transient and temporary, why do you care about it?

 mmahdinia October 7, 2009 10:53

Dear Daniel,

Generally that is true for steady state cases. But I was thinking about the modeling of the evolution of an unsteady case. I am aware that this unsteadiness will finally lead to a semi-steady case, but it is the beginning of the current that I am currently seeking about.

Maani

 lakeat October 7, 2009 22:50

Hi, you are welcome, There's a way for us in using channelOodles some years ago, which is now renamed as channelFoam, at that time Eugene gave us his perturbU utility, you can just download it and I think that's a good point for you to start.

 bjj October 11, 2009 08:38

You may also use the foamCalc utility. This includes a randomise function. In your case do: foamCalc randomise <pertubation> <field> -time 0. This will create a new field in your /0 dir with a random pertubation.

Regards,
Bjarne

 braennstroem October 12, 2009 08:27

Hi,

one way to get some kind of 'turbulence' as initial field is to use the velocity field from 'boxTurb'. From a dummy cube-mesh (which is bigger than your domain) you can map the velocity field to your case and/or add it to an existing solution.

Fabian

 mmmn036 February 22, 2014 18:32

foamCalc only randomise vector field?

Hello,

I need to randomise a scalar filed before i start running my simulation. foamCalc gives me error when I randomise the scalar field, but it disturbes U (vector) perfectly. The error is:

--> FOAM FATAL ERROR:
Unable to process D
No call to randomise for fields of type volScalarField

Any body can help?

Thanks
Manjura

 pvpnrao March 20, 2016 22:55

Manjura has fixed this problem.

Go to the file \$FOAM_SRC/postProcessing/foamCalcFunctions/field/randomise.C

and paste the following lines in the body of the function:
writeRandomField<scalar>
(
pertMag,
rand,
mesh,
processed
);

cd ../..

wmake libso

then the 'randomise' utility will work for scalar fields also.

 All times are GMT -4. The time now is 22:42.