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

Getting cell ID from Patches

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

Like Tree2Likes
  • 1 Post By Anne Lincke
  • 1 Post By Anne Lincke

Reply
 
LinkBack Thread Tools Display Modes
Old   November 29, 2010, 10:04
Red face Getting cell ID from Patches
  #1
Senior Member
 
Anne Lincke
Join Date: Aug 2010
Location: Hamburg
Posts: 124
Rep Power: 4
Anne Lincke is on a distinguished road
Hey to all,

I need a little help.
I have written a little postProcessing Tool which works similar to WallShearStress, i.e. it computes a gradient at the wall.

Now I need to treat these gradients which are computed at each node of the boundary as a n-dimensional vector which has to me multiplied by a 3xn matrix (!) which I get from another program (ANSA).

I have not yet computed this matrix but I ask how shall I compute the vector with the matrix if I do not know how my vector is sorted.

So my question is:
How do I get the cellID for each value in order to be able to sort it?
Cell ID is just the first which came to my mind, any criteria how to sort this vector would help me because I need it to be sorted if I want to multiply it with the matrix.

Do you have any ideas?

Thank you very much in advance.

Anne
Anne Lincke is offline   Reply With Quote

Old   April 13, 2012, 11:46
Default
  #2
New Member
 
Darío López
Join Date: Oct 2011
Location: Vigo, Spain
Posts: 8
Rep Power: 3
darlopez is on a distinguished road
Hi Anne.

Have you resolved your problem??
I am interesting in find the cellID's from Patches in order to program a Simpson rule.
Do you have any suggestion?

Regards.
Darío.
darlopez is offline   Reply With Quote

Old   April 16, 2012, 05:44
Default
  #3
Senior Member
 
Anne Lincke
Join Date: Aug 2010
Location: Hamburg
Posts: 124
Rep Power: 4
Anne Lincke is on a distinguished road
Hey Dario,

I solved my problem by outputting the x-y-and z- coordinate of each cell.
Then I sorted the cells in the unix shell with sort -k1 -k2 -k3.
The result is a sorted vector, first sort criteria x-coordinate, second one y-coordinate and third one z-coordinate so that it is a clear order.

You can also look at the sample-utility of OpenFOAM, maybe this can help.
So far, I do not know another solution.
darlopez likes this.
Anne Lincke is offline   Reply With Quote

Old   November 16, 2012, 13:19
Default
  #4
Member
 
Jamal
Join Date: May 2012
Location: Freiburg
Posts: 41
Rep Power: 2
aujamal20 is on a distinguished road
Dear

I am a new user to OF. I am facing a problem to get Cell ID or cell coordinates so that i can get field values at prescribed locations.
I need to know what to use and where to use a code/file to get this.

Thanks

aujamal
aujamal20 is offline   Reply With Quote

Old   December 11, 2012, 05:30
Default
  #5
Senior Member
 
Anne Lincke
Join Date: Aug 2010
Location: Hamburg
Posts: 124
Rep Power: 4
Anne Lincke is on a distinguished road
Hey Aujamal,

you can output the data with Paraview.

For my result-analysis I did the following steps

1.) In time folder delete all properties which are not needed (k, epsilon, whatever)

2.) Run foamToVTK

3.) Open the VTK-folder with paraview.

4.) Extract the regions, which you would like to analyze, with slice/clip or other filter tools.

5.) Output the data with File -> Save Data -> Points as .csv - File.

6.) In the csv-File you will find the x,y and z-coorindates and the respective values for velocity, pressure

7.) You can now sort the data, plot it, analyze it, whatever.

I hope this helped?

Kind Regards
Anne
Anne Lincke is offline   Reply With Quote

Old   May 9, 2013, 09:30
Default
  #6
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 100
Rep Power: 3
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
Quote:
Originally Posted by Anne Lincke View Post
Hey Aujamal,

you can output the data with Paraview.

For my result-analysis I did the following steps ...
Dear Anne,

Hi, do you have any idea in how to get cell IDs of the cells (face cells) which are located in a specific region (which is extracted using slice/clip tools)?
I want to use these cell IDs to be able to use nonUniform BC.
for example I have a large domain. in a specific region of this domain I want x_value to be 0.1 and for the rest of the domain I want x_value to be 0.2.
Do you have any idea how can I achieve this? I am trying to know cell IDs of the specific region in order to assign these cells my desired values, later.

Thank you,
Mojtaba
Mojtaba.a is offline   Reply With Quote

Old   May 10, 2013, 07:53
Default
  #7
Member
 
Jamal
Join Date: May 2012
Location: Freiburg
Posts: 41
Rep Power: 2
aujamal20 is on a distinguished road
Hello Mojtaba,
I am not sure what you really want to do, but the utility setFieldsDict might help you in this regard to set the particular values of the field variable at different locations/(set of cells) within the domain.

Please let me know if find any alternate.
Thanks
aujamal20 is offline   Reply With Quote

Old   May 10, 2013, 13:21
Default
  #8
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 100
Rep Power: 3
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
Quote:
Originally Posted by aujamal20 View Post
Hello Mojtaba,
I am not sure what you really want to do, but the utility setFieldsDict might help you in this regard to set the particular values of the field variable at different locations/(set of cells) within the domain.

Please let me know if find any alternate.
Thanks
Dear Jamal, thanks for your reply.
Well I am trying to define a nonUniform boundary condition. as you know nonUniform boundary condition has a form like this:

value nonuniform List<scalar>
'No.ofOverallCells'
(
//data entered here
);

Unfortunately In OF I couldn't find any order for numbering of the cells and thus I don't know how to write the list. For instance I have a nonUniform boundary like this:

value nonuniform List<scalar>
5
(
1
2
3
4
5
);

How can I know that which cell in boundary has the value of '1' or any other values? actually I have found the solution to this particular issue, and that's by using paraview, but it is not applicable for boundaries with large number of cells. Do you have any idea how I can set value for each cell in a boundary?

In addition I haven't used setFields utility yet, I don't know if it is capable of selecting my desired group of cells. my cell region is not a common shape like rectangular or circle to define it easily. Therefor I don't know how to define it using setFields.

Thank you,
Mojtaba
Mojtaba.a is offline   Reply With Quote

Old   Today, 03:23
Default
  #9
Senior Member
 
Anne Lincke
Join Date: Aug 2010
Location: Hamburg
Posts: 124
Rep Power: 4
Anne Lincke is on a distinguished road
Hey Mojtaba,

I set the values with setFieldsDict concerning the internal Field. So far I have not used a non-uniform condition on the boundary itself.
I got the numbers of the cells with paraview as I wrote before....
why doesn't this work in your case?

Here is an example of a setFieldsDict. It sets alpha equal to 200 on the cellSet face_hole_1 and zero elsewhere.
You can generate the cellSet from a cellZone in polyMesh/cellZones where you define it with the numbers obtained from paraview.

I hope this helps....


Kind Regards
Anne
HTML Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  1.7.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues
(
    volScalarFieldValue alpha 0
)
    ;

regions

(





cellToCell
{
set face_hole_1;

fieldValues
(
volScalarFieldValue alpha 200
);

}

)
Mojtaba.a likes this.
Anne Lincke is offline   Reply With Quote

Old   Today, 12:09
Default
  #10
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 100
Rep Power: 3
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
Quote:
Originally Posted by Anne Lincke View Post
Hey Mojtaba,

I set the values with setFieldsDict concerning the internal Field. So far I have not used a non-uniform condition on the boundary itself.
I got the numbers of the cells with paraview as I wrote before....
why doesn't this work in your case?
Thank you Anne,
Well this really helped. My problem is a little bit different.
Here is the boundary I am trying to define in nut boundary condition file.

ground
{
type nutkAtmRoughWallFunction;
z0 $z0;
value uniform 0.0;
}

I have different z0 values for different cellSets. As far as z0 is not directly a field (correct me if I am wrong about this), I can not use setFields utility to set values for it. Therefore I am trying to use nonUniform BC which I got to know cell positions.
As you mentioned I can find cell numbers in paraview, but I need to sort the list manually for nonUniform BC.
Do you have any idea that how can I set this?
Mojtaba.a 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
Cells with t below lower limit Purushothama CD-adapco 2 May 31, 2010 21:58
How to determine the direction of cell face vectors on processor patches sebastian_vogl OpenFOAM Running, Solving & CFD 0 October 27, 2009 09:47
How to determine the direction of cell face vectors on processor patches sebastian_vogl OpenFOAM Programming & Development 0 October 26, 2009 13:10
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15
Warning 097- AB CD-adapco 6 November 15, 2004 04:41


All times are GMT -4. The time now is 20:38.