CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Ustar computation in atmBoundaryLayerInletVelocityFvPatchVectorField.C

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 18, 2014, 05:58
Default Ustar computation in atmBoundaryLayerInletVelocityFvPatchVectorField.C
  #1
New Member
 
Okke Bronkhorst
Join Date: Nov 2010
Posts: 2
Rep Power: 0
Okke79 is on a distinguished road
Hello,

My question concerns the computation of Ustar in atmBoundaryLayerInletVelocityFvPatchVectorField.C.

I do not understand why the forAll loop is taken over Ustar_ (in OF-2.2.x):

forAll (Ustar_, i){[I]Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_ , 0.001)));}

Is this in the case of different roughness lengths, z0, in the computational domain? If so, why is this loop then not taken over z0?

In previous versions of Openfoam (e.g. OF-2.0.x, no loop was applied at all).

Very much looking forward to an answer!

Kind regards,
Okke
Okke79 is offline   Reply With Quote

Old   August 19, 2014, 05:14
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
It doesn't matter which one you put into the forAll loop, just as long as it has the correct size. forAll(a, i) is short for: for(label i=0; i < a.size(); i++) so if Ustar and z0_ have the same size, it makes no difference. Since they are accessed by the same index, I'd say that's the case.

Why is it even in a forAll loop anyway? Looping over all the cells can be up to 10 times slower than using full field operations. The only reason I suspect they put it into a forAll is because of the function log((Href_ + z0_[i])/... the log(scalar + field) may not work.

Quick inspection shows this is not very good code anyway. They use max(z0_ , 0.001) within a loop, when this operation is itself a loop, and produces the same result all the time. The first thing I would do to improve this is to store the result ahead of time and use that in the loop.

My two cents. Share and enjoy!
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Starting pimpleFoam computation from simpleFoam result vinz OpenFOAM Running, Solving & CFD 9 March 17, 2014 13:35
Ustar and Atmospheric Boundary Layer vinz OpenFOAM Running, Solving & CFD 1 July 10, 2012 03:18
problem in the CFX12.1 parallel computation BalanceChen ANSYS 2 July 7, 2011 10:26
Discussion on the computation of the multi-stage axial compressor BalanceChen CFX 5 January 5, 2011 03:23
Cell face values computation un unstructured grids Sergio Rossi Main CFD Forum 2 May 28, 2006 10:04


All times are GMT -4. The time now is 09:21.