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

How to read velocity fields to do mathematical operations

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

Reply
 
LinkBack Thread Tools 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: 4
Rep Power: 2
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: 2
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: 4
Rep Power: 2
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: 2
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

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
How to read in fields from previous time-steps in swak4foam Mehrez OpenFOAM Post-Processing 8 May 24, 2016 16:36
Question on Pressure and Velocity Fields with SIMPLE algorithm Phiper Main CFD Forum 0 November 18, 2010 19: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 06:13


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