CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to access to field point data

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Arnoldinho

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 9, 2012, 10:40
Default How to access to field point data
  #1
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
Dear foamers,

I can have access to coordinate of point by:
mesh.points(), and field cell data by U.mesh().C()[].

But now my problem is that how to access and change the corresponding field point data if I choose some interested coordinate?

Many thanks,
Jian
zxj160 is offline   Reply With Quote

Old   August 10, 2012, 14:25
Default
  #2
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17
Arnoldinho is on a distinguished road
The values are always stored "in the cells" or at the boundaries, i.e. there is no value assignment for points. These only give the coordinates of the cells.

If you are interested in manipulating the (cell) values at a location x,y,z of interest, you could e.g. have a look at mesh.findCell(), http://www.cfd-online.com/Forums/ope...ordinates.html, which gives you the position in the field (cell index) you want to manipulate.

Greetings,
Arne
Arnoldinho is offline   Reply With Quote

Old   August 11, 2012, 06:35
Default
  #3
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
Quote:
Originally Posted by Arnoldinho View Post
The values are always stored "in the cells" or at the boundaries, i.e. there is no value assignment for points. These only give the coordinates of the cells.

If you are interested in manipulating the (cell) values at a location x,y,z of interest, you could e.g. have a look at mesh.findCell(), http://www.cfd-online.com/Forums/ope...ordinates.html, which gives you the position in the field (cell index) you want to manipulate.

Greetings,
Arne
Dear Arne,

Many thanks. After I have changed the field data of some cells (first layer of inlet as zero), the case can not run in parallel. Do you know how to solve the problem?

My best regards,
Jian
zxj160 is offline   Reply With Quote

Old   August 11, 2012, 07:11
Default
  #4
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17
Arnoldinho is on a distinguished road
You did not give the entire error you get from your run, so I'm not sure what's the problem.
But you have to keep in mind that if running in parallel, every single processor builds up its own mesh, i.e. face and point labels refer to the single processor meshes and are different from the global mesh labels!

Arne
Arnoldinho is offline   Reply With Quote

Old   August 11, 2012, 16:47
Default
  #5
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
Quote:
Originally Posted by Arnoldinho View Post
You did not give the entire error you get from your run, so I'm not sure what's the problem.
But you have to keep in mind that if running in parallel, every single processor builds up its own mesh, i.e. face and point labels refer to the single processor meshes and are different from the global mesh labels!

Arne
Dear Arne,

Actually, I first select the first layer cell IDs near the inlet and outlet after searching the whole cells. Then I modified the corresponding cell values. It can run directly in one cpu, but can not run in parallel. Do you have any code or documents about parallel running?

My best regards,
Jian
zxj160 is offline   Reply With Quote

Old   August 14, 2012, 03:32
Default
  #6
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17
Arnoldinho is on a distinguished road
Hi Jian,

I am still not sure what the problem is. Did you check whether you modified the right cells, e.g. by having a look at the specific processorX folders in ParaView and giving the cells e.g. large numbers?
I am afraid I have no further documents about parallel coding, but my field/cell modifications so far work in parallel with no problem.
One hint: if you are just modifying the boundary-next cells, you could use
Code:
const label patchi = mesh.boundaryMesh().findPatchID("inlet");
U.boundaryField()[patchi] == whatever you want
which saves you the time-consuming searching for single cells.

Greetings,
Arne
manijm likes this.
Arnoldinho is offline   Reply With Quote

Old   May 21, 2015, 05:35
Default
  #7
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 54
Rep Power: 12
Fanfei is on a distinguished road
Quote:
Originally Posted by Arnoldinho View Post
Hi Jian,

I am still not sure what the problem is. Did you check whether you modified the right cells, e.g. by having a look at the specific processorX folders in ParaView and giving the cells e.g. large numbers?
I am afraid I have no further documents about parallel coding, but my field/cell modifications so far work in parallel with no problem.
One hint: if you are just modifying the boundary-next cells, you could use
Code:
const label patchi = mesh.boundaryMesh().findPatchID("inlet");
U.boundaryField()[patchi] == whatever you want
which saves you the time-consuming searching for single cells.

Greetings,
Arne
Hi Arnoldinho:
I'm so sorry to trobule you and dig that old topic. I have a problem to access the points coorinadte of the assign face. for example i want to get the nodes coordinate of mesh.BoundaryField()[patchID][I], how i can do that? Thank you.
Greeting
Fan Fei
Fanfei 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
problem in toposet Ahmed Khattab OpenFOAM Pre-Processing 27 March 3, 2023 21:12
[ANSYS Meshing] Importing Cylinders by Point Data Input with Radii EphemeralMemory ANSYS Meshing & Geometry 2 May 31, 2012 13:34
matching variable data with grid point data anfho OpenFOAM Programming & Development 0 May 6, 2011 15:28
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 06:51
How to access acceleration of steady Euler field? winnie FLUENT 0 May 2, 2003 22:53


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