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

How to read velocity fields to do mathematical operations

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2016, 11:10
Default How to read velocity fields to do mathematical operations
  #1
New Member
 
Saddam Hijazi
Join Date: May 2016
Posts: 17
Rep Power: 9
SaddamH is on a distinguished road
Hello all, I want to do some post processing stuff in openfoam where I am trying to write a routine in C language that reads a matrix and velocity fields written in openfoam format and what I need to do is just to multiply each velocity vectors of them by an element of the matrix which I read and then sum up all of them and write the result back in openfoam format, I have my velocity files and the matrix all in the 0 folder of the simulation, so could help me in giving directions in how to do that.
Thank you very much.
SaddamH is offline   Reply With Quote

Old   July 20, 2016, 04:14
Default
  #2
New Member
 
Join Date: May 2016
Posts: 28
Rep Power: 9
g.freeman is on a distinguished road
Quote:
Originally Posted by SaddamH View Post
Hello all, I want to do some post processing stuff in openfoam where I am trying to write a routine in C language that reads a matrix and velocity fields written in openfoam format and what I need to do is just to multiply each velocity vectors of them by an element of the matrix which I read and then sum up all of them and write the result back in openfoam format, I have my velocity files and the matrix all in the 0 folder of the simulation, so could help me in giving directions in how to do that.
Thank you very much.

Hello SaddamH,
I didn't undestand: is your problem related to how compute the operations you listed, or only to how write results in OpenFOAM format?

In the last case, you just need to copy the U file and put the values you find in the correct patch. e.g. if the data are related to inlet, type:

inlet
{
type fixedValue;
value nonUniform list <scalar>
(
*your data*
)
}
g.freeman is offline   Reply With Quote

Old   July 20, 2016, 06:01
Default
  #3
New Member
 
Saddam Hijazi
Join Date: May 2016
Posts: 17
Rep Power: 9
SaddamH is on a distinguished road
Quote:
Originally Posted by g.freeman View Post
Hello SaddamH,
I didn't undestand: is your problem related to how compute the operations you listed, or only to how write results in OpenFOAM format?

In the last case, you just need to copy the U file and put the values you find in the correct patch. e.g. if the data are related to inlet, type:

inlet
{
type fixedValue;
value nonUniform list <scalar>
(
*your data*
)
}

I wanted to import velocity files from Openfoam and then do some operations on them and then output them again in OF format
for the first thing, I have found this thread

http://www.cfd-online.com/Forums/ope...rocessing.html

in the archive in which it is written some matlab functions to import the fields needed from OF



but for the other way around I tried to make it on my own by writing the values in .txt format, I don't know whether this will work or not since I am interested at the end in visualizing the new fields using paraview

one thing important, I have many files to do this operation in both directions so it is not convenient to do it manually
SaddamH is offline   Reply With Quote

Old   July 20, 2016, 06:19
Default
  #4
New Member
 
Join Date: May 2016
Posts: 28
Rep Power: 9
g.freeman is on a distinguished road
Quote:
Originally Posted by SaddamH View Post
I wanted to import velocity files from Openfoam and then do some operations on them and then output them again in OF format
for the first thing, I have found this thread

http://www.cfd-online.com/Forums/ope...rocessing.html

in the archive in which it is written some matlab functions to import the fields needed from OF



but for the other way around I tried to make it on my own by writing the values in .txt format, I don't know whether this will work or not since I am interested at the end in visualizing the new fields using paraview

one thing important, I have many files to do this operation in both directions so it is not convenient to do it manually
Can you import your data from paraview using save data comand? It returns a .csv files with the value of all the variables, associated with points or cells.

For the second part, you have to modify the files in your 0 or latest time directory as I said in my first post and it will appear this quantity in paraview
g.freeman is offline   Reply With Quote

Old   June 7, 2019, 10:53
Default
  #5
New Member
 
Josh Williams
Join Date: Jun 2018
Location: Scotland
Posts: 8
Rep Power: 7
JoshWilliams1996 is on a distinguished road
Did anyone find a solution to this?
JoshWilliams1996 is offline   Reply With Quote

Old   June 19, 2019, 06:33
Default
  #6
Senior Member
 
Zander Meiring
Join Date: Jul 2018
Posts: 125
Rep Power: 7
yambanshee is on a distinguished road
depending on the opperation you want to perform, you can use the calculator filter in paraview
yambanshee is offline   Reply With Quote

Old   June 19, 2019, 08:57
Default
  #7
New Member
 
Josh Williams
Join Date: Jun 2018
Location: Scotland
Posts: 8
Rep Power: 7
JoshWilliams1996 is on a distinguished road
Quote:
Originally Posted by yambanshee View Post
depending on the opperation you want to perform, you can use the calculator filter in paraview
Thanks, I used the calculator filter in paraview to multiply velocity of a surface cut by the normal of that surface (input manually using iHat, jHat, kHat) - for anyone with this issue in future.
JoshWilliams1996 is offline   Reply With Quote

Reply


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
[swak4Foam] How to read in fields from previous time-steps in swak4foam Mehrez OpenFOAM Community Contributions 8 May 24, 2016 16:36
Question on Pressure and Velocity Fields with SIMPLE algorithm Phiper Main CFD Forum 0 November 18, 2010 18:29
UDF for space-filtering 3-D velocity fields Xianmin FLUENT 0 April 11, 2008 20:58
How to read a file with inlet velocity data? dorin CFX 13 July 20, 2007 02:16
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 05:13


All times are GMT -4. The time now is 12:07.