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

Extract velocity on-the-fly

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

Like Tree2Likes
  • 1 Post By akidess
  • 1 Post By gary7

Reply
 
LinkBack Thread Tools Display Modes
Old   March 13, 2012, 16:32
Default Extract velocity on-the-fly
  #1
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 42
Rep Power: 7
gary7 is on a distinguished road
Hi all,

I'm a newbie and I really appreciate any help...I want to extract velocities on a specific plane (specific position) every n*Dt and save them in a file, e.g. in the case of cavity flow I want to keep track of the velocities on the plane (3D) or line (2D) halfway the cavity and parallel to the moving plate, and I want to have them on the fly (during time stepping) and not to extract in postprocessing stage

Thanks.
gary7 is offline   Reply With Quote

Old   March 22, 2012, 00:47
Default
  #2
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 42
Rep Power: 7
gary7 is on a distinguished road
Any pointer is highly appreciated...which part of the solver has all the record of whole field variable and how can I extract a variable like Velocity at a specific location in the filed to written out to a file?
gary7 is offline   Reply With Quote

Old   March 22, 2012, 03:31
Default
  #3
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
The keywords you need are functionObjects and cuttingPlane: http://www.openfoam.com/features/run...processing.php
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   March 22, 2012, 16:31
Default
  #4
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 42
Rep Power: 7
gary7 is on a distinguished road
Thanks for the pointer Anton, well I searched for cuttingPlane and I'm trying to test it in my top solver I'll use it through function objects afterwards. For cuttingPlane there is a thread on that in this forum but it's for 2008 and I think cuttinPlane has had minor changes in recent version like OpenFOAM 2.1.0 that I'm using. Apparently you could use something like :
Code:
 cuttingPlane cutPl(mesh,pl1)
however such a thing in the recent version caused following Error:

Code:
icoFoam_cuttingPlane.C: In function ‘int main(int, char**)’:
icoFoam_cuttingPlane.C:109: error: no matching function for call to ‘Foam::cuttingPlane::cuttingPlane(Foam::fvMesh&, Foam::plane&)’
/home/kasra/packages/OpenFOAM/OpenFOAM-2.1.0/src/sampling/lnInclude/cuttingPlane.H:138: note: candidates are: Foam::cuttingPlane::cuttingPlane(const Foam::plane&, const Foam::primitiveMesh&, bool, const Foam::labelUList&)
/home/kasra/packages/OpenFOAM/OpenFOAM-2.1.0/src/sampling/lnInclude/cuttingPlane.H:117: note:                 Foam::cuttingPlane::cuttingPlane(const Foam::plane&)
/home/kasra/packages/OpenFOAM/OpenFOAM-2.1.0/src/sampling/lnInclude/cuttingPlane.H:65: note:                 Foam::cuttingPlane::cuttingPlane(const Foam::cuttingPlane&)
any clue how to use cuttingPlane in recent version?
gary7 is offline   Reply With Quote

Old   March 22, 2012, 18:18
Default
  #5
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
You don't need to modify any code. Have a look at the tutorial "incompressible/simpleFoam/motorBike/" in OF-2.1.0, it uses a cutting plane to sample data during run time.

If you grep -r "libsampling" . in the tutorials directory you will get a list of all tutorials that use run time sampling.

- Anton
mm.abdollahzadeh likes this.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   March 22, 2012, 20:29
Default
  #6
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 42
Rep Power: 7
gary7 is on a distinguished road
The problem is that I want to have those data to input to another simulation runs separately as a boundary condition and I want to pause the OpenFOAM simulation during the run time of the the other code, so I need to incorporate all these into the code I think, what's your opinion?
gary7 is offline   Reply With Quote

Old   March 23, 2012, 04:28
Default
  #7
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
If you're coupling is only one way, you still don't have to modify the code. Why would you pause the OpenFOAM simulation? Just let it run ahead, and let the program that's waiting for input do the work on synchronization.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   March 23, 2012, 11:41
Default
  #8
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 42
Rep Power: 7
gary7 is on a distinguished road
It's a two way coupling, the OpenFOAM simulation also receives boundary condition or better say updates it's boundary condition values...well basically by defining a plane ( Naming Splane) I managed to use
Code:
cuttingPlane    cutPlane(Splane,mesh,true);
and by creating a mesh subset for that (Naming subset1) I added following lines from a thread on cutting plane (Write cells and data intersecting a plane cuttingPlane
Code:
wordList scalarNames(1);
        scalarNames[0] = "p";
        PtrList<volScalarField> scalarFlds1(scalarNames.size()); 
        
        scalarFlds1.set(0, subset1.interpolate(p));
to sample out pressure on the defined cutting plane (I really don't quite understand the 2 last line, any clarification is appreciated)
Now I'm getting pressure output on that plane, however I don't know at which points on the plane the pressure are written out! are those at cell centers projection on the plane? Any idea on this way of implementation?
mm.abdollahzadeh likes this.
gary7 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
UDF error - parabolic velocity profile - 3D turbine Zaqie Fluent UDF and Scheme Programming 8 May 11, 2014 08:34
help with UDF for contact angle based on contact line velocity gandesk Fluent UDF and Scheme Programming 14 October 29, 2012 14:58
how to compute relative velocity from absolute? spk Main CFD Forum 3 July 9, 2010 08:42
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 02:15
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


All times are GMT -4. The time now is 04:26.