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

Read Field Value at known (x,y,z) coordinate

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 11, 2019, 00:47
Default Read Field Value at known (x,y,z) coordinate
  #1
New Member
 
Chris
Join Date: Sep 2019
Posts: 2
Rep Power: 0
ctaylor97 is on a distinguished road
Hey all,


As the title suggests I want to access pressure at a specific point of my internal field, (x,y,z). I know you can use a probe to read these values and it works well, however, I am creating a coded boundary condition and I need to use the values of pressure in the internal field to calculate velocity for my boundary condition.


In simple I want to do:
P1 = pressure(x1,y1,z1);
P2 = pressure(x2,y2,z2);
Velocity = f(P1,P2);


Is there a simple way I can do this?
Thanks in advance.
ctaylor97 is offline   Reply With Quote

Old   September 19, 2019, 13:42
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
You should be able to use findCell. Something like :

Code:
point p1 = vector(x1,y1,z1);
label c1 = mesh.findCell(p1);
scalar pressure1 = p[c1];
You'll need to make sure p is accessible.

Caelan
clapointe is offline   Reply With Quote

Reply

Tags
internal field


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 91 December 21, 2022 04:50
problems after decomposing for running alessio.nz OpenFOAM 7 March 5, 2021 04:49
how to set initial velocity field expressed with cylindrical coordinate lujianfang OpenFOAM 0 November 14, 2013 01:09
How to setup a simple OpenFOAM cluster? TommiPLaiho OpenFOAM Installation 3 October 27, 2013 15:15
[blockMesh] how to get the (x,y,z) coordinate of the cells created by blockMesh sophie_l OpenFOAM Meshing & Mesh Conversion 2 April 20, 2013 06:19


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