Contrib/swak4Foam/Example initRandomVelocity

From OpenFOAMWiki
< Contrib‎ | swak4Foam
Revision as of 13:04, 10 January 2013 by Andrea1984 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To initialize a random velocity field with components in the range [0,1) using funkySetFields, add this in funkySetFieldsDict

 
 
U
   {
       field U;
       expression "vector (rand(N1), rand(N2), rand(N3))";
   }
 

where N1, N2, N3 are three arbitrary integers used as seeds to generate three different random scalar fields.

To obtain velocity components in a different range:

 
 
U
   {
       field U;
       expression "vector (0.01*rand(N1)-0.005, 0.01*rand(N2)-0.005, 0.01*rand(N3)-0.005)";
   }
 

transforms the range from [0,1) to [-0.005,0.005).