CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Extract Velocity Profile

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 25, 2016, 18:12
Arrow Extract Velocity Profile
  #1
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
Hello to all,
i want to extract the velocity profile at the outlet of my channel for using it as initial condition in another simulation.
My question is: how can i extract it?

The only way i found till now is the "readFields" tool but i don't know how to adapt it for the profile over a boundary. Can someone explain me how to modify it?

Code:
readFields1
{
    type        readFields;
    functionObjectLibs ("libfieldFunctionObjects.so");
    ...
    fields      (U p);
}
If there was another way to do what i need it would be fantastic in the same manner.

Thank for help and your time.

Roberto
FlyBob91 is offline   Reply With Quote

Old   October 26, 2016, 04:45
Default
  #2
New Member
 
danielbanos10's Avatar
 
Join Date: Jun 2016
Location: Malaga, Spain
Posts: 15
Rep Power: 9
danielbanos10 is on a distinguished road
There is a tool, that seems that is what you are searching for, MapFields
https://openfoamwiki.net/index.php/MapFields
danielbanos10 is offline   Reply With Quote

Old   October 26, 2016, 12:13
Default
  #3
Senior Member
 
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14
tiam is on a distinguished road
Quote:
Originally Posted by FlyBob91 View Post
Hello to all,
i want to extract the velocity profile at the outlet of my channel for using it as initial condition in another simulation.
My question is: how can i extract it?

The only way i found till now is the "readFields" tool but i don't know how to adapt it for the profile over a boundary. Can someone explain me how to modify it?

Code:
readFields1
{
    type        readFields;
    functionObjectLibs ("libfieldFunctionObjects.so");
    ...
    fields      (U p);
}
If there was another way to do what i need it would be fantastic in the same manner.

Thank for help and your time.

Roberto
Hi!
What do you mean by "profile"? If it is a surface of a line -- use the sample utility.
tiam is offline   Reply With Quote

Old   October 27, 2016, 09:05
Default
  #4
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
Quote:
Originally Posted by tiam View Post
Hi!
What do you mean by "profile"? If it is a surface of a line -- use the sample utility.
hello tiam, thank you for your reply.
For profile i mean the value of the velocity field for every cells at the output.

Regards,
Roberto
FlyBob91 is offline   Reply With Quote

Old   October 27, 2016, 09:25
Default
  #5
Senior Member
 
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14
tiam is on a distinguished road
Quote:
Originally Posted by FlyBob91 View Post
hello tiam, thank you for your reply.
For profile i mean the value of the velocity field for every cells at the output.

Regards,
Roberto
Hi Roberto,
If you can live with using face-values at the outlet instead, use the sample utility for surface-sampling.

If you really need the cell values, you might have to code your self.
It is possible to grab the cell-center value associated with the patch-face, so it be doable. Explor the fvPatchField classes and ralated things for that.

Best,
Timofey
tiam is offline   Reply With Quote

Old   October 27, 2016, 23:18
Default
  #6
Member
 
Ping Chang
Join Date: Feb 2016
Location: Perth
Posts: 93
Rep Power: 10
chpjz0391 is on a distinguished road
Quote:
Originally Posted by FlyBob91 View Post
hello tiam, thank you for your reply.
For profile i mean the value of the velocity field for every cells at the output.

Regards,
Roberto
Hi Roberto,
I think you can achieve this by using ParaView. Using the "select cells on" function, then you can select the cells on the outlet. Then you can read the data on the cells which you chose and output the data on the cells.

Regards,
Ping
chpjz0391 is offline   Reply With Quote

Old   December 15, 2018, 11:18
Default Code snippet to write outlet velocity as an fixedValue boundary condition
  #7
New Member
 
Join Date: Nov 2016
Posts: 10
Rep Power: 9
victorious_BIG is on a distinguished road
This code snippet will extract the outlet velocity of a case on the patch named "outlet" and then write the output formatted as a fixedValue BC for a velocity inlet. Just copy and past the buffer output into your 0/U file.

Paste the following into the bottom of your solver and compile (wmake):

const label& patchID = mesh.boundaryMesh().findPatchID("outlet");
const fvPatch& outPatch = mesh.boundary()[patchID];
const fvPatchField<vector>& outU =
outPatch.lookupPatchField<volVectorField, vector>("U");

const vectorField outUvalues = outU.patchInternalField();

Info << " type fixedValue;" << endl;
Info << " value nonuniform List<vector>" << endl;
Info << " " << outUvalues.size() << endl;
Info << " (" << endl;
forAll(outUvalues,vecI)
{
Info << " (" << outUvalues[vecI][0] << " 0 0)" << endl;
}
Info << " );" << endl;

Last edited by victorious_BIG; December 15, 2018 at 11:19. Reason: typo
victorious_BIG is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[UDF] Relative coordinates in logarithmic velocity profile cfdworker Fluent UDF and Scheme Programming 25 July 13, 2017 03:44
3d velocity profile at velocity inlet swethaprakash FLUENT 3 September 1, 2015 02:10
[swak4Foam] groovyBC error: velocity profile (2D) >> what's wrong? vitorspadeto OpenFOAM Community Contributions 4 June 19, 2014 15:31
[boundary condition] logarithmic velocity profile cfdworker FLUENT 2 April 17, 2009 23:36
Prescribed inflow velocity profile - how to? Alan Main CFD Forum 10 October 28, 2005 12:14


All times are GMT -4. The time now is 13:28.