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

How to extract the data of all cells in the domain

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

Like Tree3Likes
  • 3 Post By zhangyan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2020, 15:06
Default How to extract the data of all cells in the domain
  #1
New Member
 
Bssam
Join Date: Nov 2019
Posts: 14
Rep Power: 2
openfoamer93 is on a distinguished road
Hi

It is a simple question. Suppose that we have a 2D domain
That consists of 9 cells for example (imagine a square of 9 cells)

Then I want to extract the data of the temperature field at each cell and the corresponding data of another field (say mixture fraction Z) in that way I have the full data of each cell in terms of (Tcell,Zcell)


How to do this?
openfoamer93 is offline   Reply With Quote

Old   May 7, 2020, 18:36
Default
  #2
HPE
Senior Member
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 658
Rep Power: 8
HPE is on a distinguished road
I am not sure if I understood your question, so my apologies.

Information within a numerical domain can be interrogated by many means in OpenFOAM: e.g. sample, and probe utilities. Please do search them.
HPE is offline   Reply With Quote

Old   May 7, 2020, 20:59
Default
  #3
New Member
 
Bssam
Join Date: Nov 2019
Posts: 14
Rep Power: 2
openfoamer93 is on a distinguished road
Amazing that really worked. To extract the whole information of the field in a mesh: select > filter > data analysis > probe location > press ok whatever the settings are > then chang the tab "showing" and select your mesh. Finally, save in a csv file.

All the best
openfoamer93 is offline   Reply With Quote

Old   May 8, 2020, 04:44
Default
  #4
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 114
Rep Power: 8
zhangyan is on a distinguished road
If I correctly understand your demand, there is a utility to deal with such things in my GitHub:
https://github.com/ZhangYanTJU/foam2Columns
It supports any number of fields and transforms them to this format:
Code:
L1: x y z var1 var2 ...
L2: x y z var1 var2 ...
.
.
.
Ln: x y z var1 var2 ...
where n is the cell number, and var1(p), var2(T) are the input variables:
Code:
foam2Columns -fields "(p T)"
HPE, openfoamer93 and Tobermory like this.
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Old   May 8, 2020, 23:08
Default
  #5
New Member
 
Bssam
Join Date: Nov 2019
Posts: 14
Rep Power: 2
openfoamer93 is on a distinguished road
Quote:
Originally Posted by zhangyan View Post
If I correctly understand your demand, there is a utility to deal with such things in my GitHub:
https://github.com/ZhangYanTJU/foam2Columns
It supports any number of fields and transforms them to this format:
Code:
L1: x y z var1 var2 ...
L2: x y z var1 var2 ...
.
.
.
Ln: x y z var1 var2 ...
where n is the cell number, and var1(p), var2(T) are the input variables:
Code:
foam2Columns -fields "(p T)"

What an elegant function is this! That exactly what I meant. Also, this function does more than I need which it also specifies the location x y z. The method I mentioned in my comment also works but it is not as easy as this function! So awesome, I will give it a try for sure 👌🏻
openfoamer93 is offline   Reply With Quote

Old   May 8, 2020, 23:10
Default
  #6
New Member
 
Bssam
Join Date: Nov 2019
Posts: 14
Rep Power: 2
openfoamer93 is on a distinguished road
That is why I like OpenFOAM. The room for improvement is endless! And collaboration is very effective in the scientific community 🙏
openfoamer93 is offline   Reply With Quote

Old   May 13, 2020, 14:08
Default How to extract the data of all cells in the domain
  #7
Member
 
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 71
Rep Power: 12
kerim is on a distinguished road
Dear zhangyan,
I downloaded foam2Columns into home/run folder. After unzipping and compiling I used it for dambreak case. Using the foam2Columns -fields "(p_rgh)" gives me all info that was proposed. But the execution of the foam2Columns -fields "(alfa.water)" gives nothing.
In another words everything is fine for p_rgh? not for alfa.water. I am using openfoam 7 on ubuntu 16.04 LTS
Any kind of help is highly appreciated.
Kerim
kerim is offline   Reply With Quote

Old   May 14, 2020, 06:17
Default
  #8
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 114
Rep Power: 8
zhangyan is on a distinguished road
Quote:
Originally Posted by kerim View Post
Dear zhangyan,
I downloaded foam2Columns into home/run folder. After unzipping and compiling I used it for dambreak case. Using the foam2Columns -fields "(p_rgh)" gives me all info that was proposed. But the execution of the foam2Columns -fields "(alfa.water)" gives nothing.
In another words everything is fine for p_rgh? not for alfa.water. I am using openfoam 7 on ubuntu 16.04 LTS
Any kind of help is highly appreciated.
Kerim
Dear Kerim,
1. Did you type it right? Isn't it alpha.water?
2. Now the foam2Cloumns tool only supports for volScalarField. Is alpha.water a volScalarField?
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Old   May 14, 2020, 11:54
Default
  #9
Member
 
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 71
Rep Power: 12
kerim is on a distinguished road
Quote:
Originally Posted by zhangyan View Post
Dear Kerim,
1. Did you type it right? Isn't it alpha.water?
2. Now the foam2Cloumns tool only supports for volScalarField. Is alpha.water a volScalarField?
Dear zhangyan,
1. Yes I did it right.

2. alfa.water is volScalarField.

By the way, after execution of the command

foam2Columns -fields "(alfa.water)" in the terminal I got a file alphaPhi0.water. But it is not that file I am looking for. Frakly speaking I don't understand what kind of file I got.

Please see attachments for more information.
Kerim

alfa.water.jpg

alfa.water1.jpg

alfa.water2.jpg

alphaPhi0.water.jpg

p_rgh.jpg
kerim is offline   Reply With Quote

Old   May 14, 2020, 12:23
Default
  #10
Member
 
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 71
Rep Power: 12
kerim is on a distinguished road
Dear zhangyan,


I just used foam2Cloumns tool for bouyantCavity case which uses buoyantSimpleFoam solver. Direct application of foam2Cloumns tool gives an error
keyword PIMPLE is undefined in dictionary "/home/kerim/run/buoyantCavity/system/fvSolution".


As you know buoyantSimpleFoam solver use only SIMPLE, not PIMPLE.

After changing SIMPLE to PIMPLE I got foam2Columns_p_T file. That is what I was looking for.
Could you explain me why do I have above mentioned error?
Kerim
bouyantCavity-1.jpg

bouyanCavity-2.jpg
kerim is offline   Reply With Quote

Old   May 14, 2020, 18:53
Default
  #11
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 114
Rep Power: 8
zhangyan is on a distinguished road
Quote:
Originally Posted by kerim View Post
Dear zhangyan,
1. Yes I did it right.

2. alfa.water is volScalarField.

By the way, after execution of the command

foam2Columns -fields "(alfa.water)" in the terminal I got a file alphaPhi0.water. But it is not that file I am looking for. Frakly speaking I don't understand what kind of file I got.

Please see attachments for more information.
Kerim

Attachment 77624

Attachment 77625

Attachment 77626

Attachment 77627

Attachment 77628
In the first picture, you inout alfa.water
But I found it from the last picture, at 0.5 s, you only got alpha.water.
I don't know why you want to try alfa.water.
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Old   May 14, 2020, 18:54
Default
  #12
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 114
Rep Power: 8
zhangyan is on a distinguished road
Quote:
Originally Posted by kerim View Post
Dear zhangyan,


I just used foam2Cloumns tool for bouyantCavity case which uses buoyantSimpleFoam solver. Direct application of foam2Cloumns tool gives an error
keyword PIMPLE is undefined in dictionary "/home/kerim/run/buoyantCavity/system/fvSolution".


As you know buoyantSimpleFoam solver use only SIMPLE, not PIMPLE.

After changing SIMPLE to PIMPLE I got foam2Columns_p_T file. That is what I was looking for.
Could you explain me why do I have above mentioned error?
Kerim
Attachment 77629

Attachment 77630
Thank you for pointing this out.
It will give me a chance to improve this tool.
I'll check it soon.
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Old   May 14, 2020, 19:57
Default
  #13
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 1,009
Rep Power: 27
olesen will become famous soon enougholesen will become famous soon enough
Quote:
Originally Posted by zhangyan View Post
If I correctly understand your demand, there is a utility to deal with such things in my GitHub:
https://github.com/ZhangYanTJU/foam2Columns
It supports any number of fields and transforms them to this format:
[CODE]
L1: x y z var1 var2 ...
L2: x y z var1 var2 ...
Looks nice. Dealing with the proper sorting (in parallel) tends to be a bit of a memory hog. If you are interested, you might take a look at the cellCentreSet. It should do something similar with run-time selectable output format.

https://www.openfoam.com/documentati...t.html#details
olesen is offline   Reply With Quote

Old   May 15, 2020, 01:25
Default
  #14
Member
 
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 71
Rep Power: 12
kerim is on a distinguished road
Quote:
Originally Posted by zhangyan View Post
In the first picture, you inout alfa.water
But I found it from the last picture, at 0.5 s, you only got alpha.water.
I don't know why you want to try alfa.water.

Dear Zhangyan,


Alfa.water helps to determine the position of free surface between two fluids - water and air. The value of alfa.water=.05 represents free surface and that is why I need to extract from OpenFOAM alfa.water by using foam2Columns tool.
Kerim
kerim is offline   Reply With Quote

Old   May 15, 2020, 01:28
Default
  #15
Member
 
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 71
Rep Power: 12
kerim is on a distinguished road
Quote:
Originally Posted by zhangyan View Post
Thank you for pointing this out.
It will give me a chance to improve this tool.
I'll check it soon.
Dear Zangyan,


Thank you very much for your post.
I look forward to hear from you.
Kerim
kerim is offline   Reply With Quote

Old   May 15, 2020, 05:09
Default
  #16
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 114
Rep Power: 8
zhangyan is on a distinguished road
Quote:
Originally Posted by kerim View Post
Dear Zhangyan,


Alfa.water helps to determine the position of free surface between two fluids - water and air. The value of alfa.water=.05 represents free surface and that is why I need to extract from OpenFOAM alfa.water by using foam2Columns tool.
Kerim
Maybe you can try:
Code:
foam2Columns -fields "(alpha.water)
alpha instead of alfa
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Old   May 15, 2020, 06:47
Default
  #17
Member
 
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 71
Rep Power: 12
kerim is on a distinguished road
Quote:
Originally Posted by zhangyan View Post
Maybe you can try:
Code:
foam2Columns -fields "(alpha.water)
alpha instead of alfa

Dear Zhangyan,


Right now I have reinstalled ubuntu 16.04.6 LTS 64 bit, OpenFoam 7 and foam2Columns. Than I copied alpha.water from 0 folder and pasted in terminal. After execution of the command foam2Columns -fields "(alpha.water)" I got foam2Columns_alpha.water file I was looking for.

Frankly speaking I don't understand of the reason of my previous mistakes.

Now everything is OK with foam2Columns tool. Please see the attached figures.

Thanks a lot to you. Your help is highly appreciated.
It will be great to expand foam2Columns for volVectorField quantity like velocity.
Kerim

alpha.water-1.jpg

alpha.water-2.jpg

alpha.water-3.jpg

alpha.water-4.jpg

picture-wmake.jpg
kerim is offline   Reply With Quote

Old   September 8, 2020, 13:47
Default
  #18
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 114
Rep Power: 8
zhangyan is on a distinguished road
Hi,
Now it supports for volVectorField!
https://github.com/ZhangYanTJU/foam2Columns

Quote:
Originally Posted by kerim View Post
Dear Zhangyan,


Right now I have reinstalled ubuntu 16.04.6 LTS 64 bit, OpenFoam 7 and foam2Columns. Than I copied alpha.water from 0 folder and pasted in terminal. After execution of the command foam2Columns -fields "(alpha.water)" I got foam2Columns_alpha.water file I was looking for.

Frankly speaking I don't understand of the reason of my previous mistakes.

Now everything is OK with foam2Columns tool. Please see the attached figures.

Thanks a lot to you. Your help is highly appreciated.
It will be great to expand foam2Columns for volVectorField quantity like velocity.
Kerim

Attachment 77658

Attachment 77659

Attachment 77660

Attachment 77661

Attachment 77662
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Old   September 9, 2020, 02:23
Default
  #19
Member
 
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 71
Rep Power: 12
kerim is on a distinguished road
Quote:
Originally Posted by zhangyan View Post
Hi,
Now it supports for volVectorField!
https://github.com/ZhangYanTJU/foam2Columns
Dear zhangyan

Thanks a lot to you. Your help will be highly appreciated bythe OpenFOAM community.
kerim 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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 90 October 3, 2019 08:01
[snappyHexMesh] snappyHexMesh sticking point natty_king OpenFOAM Meshing & Mesh Conversion 10 August 5, 2019 20:18
cellZone not taking all the cells inside rahulksoni OpenFOAM Running, Solving & CFD 6 January 25, 2019 01:11
[ICEM] Error in mesh writing helios ANSYS Meshing & Geometry 19 January 8, 2019 11:56
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 20:43


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