|
[Sponsors] |
May 1, 2015, 12:44 |
Accessing a quantity for representative cell
|
#1 |
Senior Member
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16 |
Dear Foamers;
In my problem, I have a few zones and cell zones. I need to select a cell located on center of a zone after problem solution. How can I access that cell ? Then, for example I want to access some values (quantities) such as temperature for that cell. How can I do these operations; Thx in advance for any answer and help. M.Asghari |
|
May 2, 2015, 15:06 |
|
#2 |
Senior Member
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16 |
Dear OF users,
For example, in Chtmultiregionfoam, I'd like to write T(nx/2, ny/2) for heater Zone in a .dat text file (nx, ny are x and y mesh numbers for heater zone,respectively ). Can anybody help me ? |
|
May 8, 2015, 12:53 |
|
#3 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19 |
You can get the label list of cells in the particular cellZone.
I hope my slide(p.7) will be of help: http://www.slideshare.net/fumiyanoza...ogramming-tips
__________________
[Personal]
|
|
May 9, 2015, 05:32 |
|
#4 |
Senior Member
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16 |
Hi Fumiya.
I don't have any username ,pass for slideshare.net. Can you send your slide my email address, please? My address is: badzohreh.h57@gmail.com Best Regards; |
|
May 9, 2015, 10:20 |
|
#5 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19 |
Hi,
This is an example: Code:
label cellZoneID = mesh.cellZones().findZoneID("your_cellZone_name"); const labelList& cellLabels = mesh.cellZones()[cellZoneID]; // Loop over the cells that are in the specified cellZone and output temperature forAll(cellLabels, i) { label cellI = cellLabels[i]; // label of a cell that is in your cellZone Info<< mesh.C()[cellI] << " " << T[cellI] << endl; // Write cell center coordinate and temperature } Fumiya
__________________
[Personal]
Last edited by fumiya; May 9, 2015 at 19:22. |
|
May 9, 2015, 14:50 |
|
#6 |
Senior Member
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16 |
Dear Fumiya;
Thanks for your suggested code. However, I don't know how to use ur suggested code. 1-Where should I use it in? 2-Really, I have geometrical coordinate of a point in a specified zone and I want to access its cell number and then I want to obtain temperature of that cell Id (lable), What's the relation between your suggested sub-code and my purpose? 3-What 's the meaning of Info command and its supplements in following your suggested sub-code? Code:
Info<< mesh.C()[cellI] << " " << T[cellI] << endl; // T: your variable name } |
|
May 9, 2015, 19:52 |
|
#7 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19 |
Hi,
My code in #5 outputs temperature in each cell that is in your cellZone. 1. What is your solver? 2. If you know the geometrical coordinate of a point in a specified zone, you can use findCell(const point & location) command to find the cell containing the point. Code:
vector probePoint(x,y,z); label probeCell = mesh.findCell(probePoint); 3. Info command output to the terminal. If you want to output to your text file, you can use OFstream. You might want to consult the following thread: http://www.cfd-online.com/Forums/ope...scii-file.html Hope this helps, Fumiya
__________________
[Personal]
|
|
May 10, 2015, 05:07 |
|
#8 |
Senior Member
Mehdi Asghari
Join Date: Feb 2010
Posts: 127
Rep Power: 16 |
Dear Fumiya;
Thanks for ur kindly helps. My solver is OpenFoam 2.3.1. I am not familiar with these commands & symbols and where they are written. Code:
vector probePoint(x,y,z); label probeCell = mesh.findCell(probePoint); How can I download OFstream? Is it a part of OF2.3.1? I'm reading ur suggested thread. It seems to be interesting & helpful. Best Regards. M.Asghari |
|
Tags |
cell selecting, centeroid cells, find value |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
FvMatrix coefficients | shrina | OpenFOAM Running, Solving & CFD | 10 | October 3, 2013 15:38 |
Accessing Cell Properties | arkangel | OpenFOAM | 0 | March 29, 2010 13:00 |
Dynamic Mesh.. Layering.. cell addition | kedarj14 | OpenFOAM Programming & Development | 0 | January 29, 2010 02:48 |
Accessing Neighbouring Cell info | Murali | Siemens | 1 | December 9, 2002 07:10 |