# How to sample velocity magnitudes at each time-step

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

 February 14, 2013, 15:11 How to sample velocity magnitudes at each time-step #1 Member   Join Date: Aug 2012 Posts: 74 Rep Power: 5 Hi, Could anyone please tell me how I can sample magnitudes of a velocity flow field which passes through a specified region of cells (rather than the patches) (e.g. an arbitrary cylinder shaped plane in the middle of the computational domain) during run-time and to write those at each time-step? Many thanks for any reply in advance.

 February 15, 2013, 04:00 #2 Senior Member   Nima Sam Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,123 Blog Entries: 1 Rep Power: 14 there are several options: 1- using post processing such as paraview: -create a mag (U) with calculator -extract the surface -integrateVariables for specified Time or all time steps 2-using sampleDict, i guess you can create your sample point 3- using swak4Foam there are lots of Options in that, which youy can extract plane, use a faceSet and so to derive what you want! __________________ Training Course on OpenFOAM at (http://www.isme.ir/) My Weblog (http://openfoam.blogfa.com/)

 February 15, 2013, 06:36 #3 Member   Join Date: Aug 2012 Posts: 74 Rep Power: 5 Thanks very much. When I tried to use the swak4Foam with faceSet, I receive the error below: Could you please tell me what it really means Code: ```libs ( "libOpenFOAM.so" "libsimpleSwakFunctionObjects.so" "libswakFunctionObjects.so" "libgroovyBC.so" ); functions ( averageVel { type swakExpression; valueType faceSet; setName f0; accumulations ( average ); expression "U"; verbose true; } );``` Code: ```--> FOAM FATAL ERROR: Could not find a field name "U" of type vector (neither surfaceVectorField nor volVectorField) autoInterpolate: 0 (try setting 'autoInterpolate' to 'true') From function SubsetValueExpressionDriver::getFieldInternalAndInterpolate(const string &name,const Subset &sub) in file SubsetValueExpressionDriverI.H at line 275.``` Edit: Also, with faceZone, I obtained exactly same error. Last edited by HakikiCanakkaleli; February 15, 2013 at 06:57.

 February 15, 2013, 08:00 #4 Senior Member   Nima Sam Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,123 Blog Entries: 1 Rep Power: 14 use phi which is U & mesh.Sf __________________ Training Course on OpenFOAM at (http://www.isme.ir/) My Weblog (http://openfoam.blogfa.com/)

 February 15, 2013, 09:00 #5 Member   Join Date: Aug 2012 Posts: 74 Rep Power: 5 Thanks very much! Could you please tell me whether I can average the magnitudes of the velocity vector components (e.g. Ux) or not as well?

 February 15, 2013, 09:14 #6 Senior Member   Nima Sam Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,123 Blog Entries: 1 Rep Power: 14 Code: ``` surfacePlane { type swakExpression; valueType surface; surfaceName testPlane; surface { type plane; basePoint (0 0 0); normalVector (1 0 0); interpolate true; //false } verbose true; expression "U"; accumulations ( min max average ); }``` __________________ Training Course on OpenFOAM at (http://www.isme.ir/) My Weblog (http://openfoam.blogfa.com/)

February 15, 2013, 09:15
#7
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
Quote:
 Originally Posted by HakikiCanakkaleli Code: ```--> FOAM FATAL ERROR: Could not find a field name "U" of type vector (neither surfaceVectorField nor volVectorField) autoInterpolate: 0 (try setting 'autoInterpolate' to 'true') From function SubsetValueExpressionDriver::getFieldInternalAndInterpolate(const string &name,const Subset &sub) in file SubsetValueExpressionDriverI.H at line 275.``` Edit: Also, with faceZone, I obtained exactly same error.
Could you tell me how I can improve that error message? I was hoping all the relevant information is there.

swak offers for these parsers the possibility to automatically interpolate fields that are defined on cells to the faces ... but you've got to ask it to: I don't believe in forcing extra work on the machine without the user asking for it.

Code:
`autoInterpolate true;`
to the function object and it should be fine
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

February 15, 2013, 09:16
#8
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
Quote:
 Originally Posted by HakikiCanakkaleli Thanks very much! Could you please tell me whether I can average the magnitudes of the velocity vector components (e.g. Ux) or not as well?
Together with the autoInterpolate described in the other post this should be easy ("mag(U.x)" or so)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

February 17, 2013, 17:05
#9
Member

Join Date: Aug 2012
Posts: 74
Rep Power: 5
Thanks very much for this information to both of you.

Quote:
 Could you tell me how I can improve that error message? I was hoping all the relevant information is there.
With the below:

Quote:
 (try setting 'autoInterpolate' to 'true')
Personally, as a novice, I have thought to myself that I have to change 'autoInterpolate' from 'false' to 'true'; but, I couldn't find wherein I can do it.

Instead, if you would like to change the error message, my unpretencious suggestion would only be, by citing your words:
Code:
`simply add a line: autoInterpolate true;`
By the way, I made things work with 'cellSet' instead of 'faceSet'. I could not see any fundamental difference between two to extract the velocity magnitudes. If there is some, any additional suggestions would be highly appreciated. Thanks!

 April 5, 2013, 15:48 #10 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,205 Rep Power: 17 what a nice thread! I have a question now.whats difference between faceSet and faceZone? rafa13 likes this.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Alan OpenFOAM Running, Solving & CFD 10 April 6, 2012 14:02 Artex85 OpenFOAM Running, Solving & CFD 9 January 3, 2012 09:06 jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 05:24 Lord Kelvin OpenFOAM 6 April 12, 2011 11:24 spatialtime CFX 3 September 9, 2009 18:30

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