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

How to sample (with interpolation) at runtime

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

Like Tree1Likes
  • 1 Post By nlc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 16, 2010, 14:06
Question How to sample (with interpolation) at runtime
  #1
ole
New Member
 
Join Date: Jan 2010
Posts: 4
Rep Power: 16
ole is on a distinguished road
I would like to sample my velocity field at evenly spaced points along a line. This is easily done with the sample utility for post-processing, however, I need to process the data in my application during run-time. I have looked at the source for the sample utility, but it is really hard to pick out which part to copy into my code. I have a feeling that this can be done in just a few lines of code. Does anyone know how to do this?

Thanks,
Ole
ole is offline   Reply With Quote

Old   March 27, 2010, 08:18
Default
  #2
Member
 
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17
r08n is on a distinguished road
http://openfoamwiki.net/index.php/Sn...value_at_point

If the field value in the cell is sufficient (without interpolation), it can be accessed as

U[mesh.findCell(point(x,y,z))], where x,y,z are the point coords.
r08n is offline   Reply With Quote

Old   March 29, 2010, 06:33
Default
  #3
New Member
 
Sebastian Barthmes
Join Date: Mar 2010
Posts: 1
Rep Power: 0
sbarthmes is on a distinguished road
I'm working on a similar problem and didn't come further yet. Sure I could try doing my own interpolation though this would be quite unefficient because I think there already are classes that do exactly what I want.
Unfortunatly I don't have enough knowledge about the application of openfoam-classes yet and don't know were to start solving this problem.
It's just that I wan't to get the interpolated values on a plane surface in the field during runtime to calculate the values for my boundary condition.
Any help or suggestions would be greatly appreciated!

I found some interesting classes but didn't understand them in detail:
src/sampling/meshToMeshInterpolation/meshToMesh/
Can these be used by a boundary condition?

How do you proceed if you are confronted with new code you don't know?
Sorry, I'm quite new to this level of programming... ;-)
sbarthmes is offline   Reply With Quote

Old   November 3, 2010, 13:47
Default Volume to point interpolation (just one point - not a pointMesh)
  #4
New Member
 
Deborah Edmund
Join Date: Aug 2009
Posts: 1
Rep Power: 0
doedmund is on a distinguished road
Hello,

I am also trying to sample the velocity at points in the field during runtime in order to update a boundary condition (in 1.6.x).

Basically, I want to define a point in the field, and give it to a function that will provide the interpolated value of the velocity at that point.

There seem to be a few unresolved posts about similar issues, so for the sake of putting them all in one place, here is a summary of what I have looked at or tried:

- Using U[mesh.findCell(pointCoordinates)] as suggested by r08n in this thread and listed on the wiki. This works, but just gives the cell value; I would like to implement interpolation (preferably using OpenFOAM, not writing my own interpolation scheme!).
- Using volPointInterpolation -- this looks like it should be able to do exactly what I need, but it needs a pointMesh where I just want to give it a point or list of points. (Any ideas on how to make it work on for a point?)
- fvc::interpolate -- This looks like it takes a scalar onto a surface, which is not exactly what I am going for... (http://www.cfd-online.com/Forums/ope...o-surface.html)
- using probes -- http://www.cfd-online.com/Forums/ope...ion-probe.html

I would really appreciate any thoughts on how one of the above could be made to work, or something else to try. (I am no expert at this, and could easily be missing something!)

Thank you,
Deborah
doedmund is offline   Reply With Quote

Old   December 14, 2010, 12:57
Thumbs down
  #5
nlc
Member
 
nlc's Avatar
 
Nicolas Lussier Clément
Join Date: Apr 2009
Location: Montréal, Qc, Canada
Posts: 61
Rep Power: 17
nlc is on a distinguished road
Hi Foamers,

The interpolation class are in src/finitVolume/interpolation
and there we find interpolationCell, interpolationCellPoint and interpolationCellPointFace as sample utility interpolation choice are "Cell", "CellPoint" and "CellPointFace" I think it is the right place to look !

I have tried to use the class but I'm slit learning C++. Here is something that work but its nothing great its give as interpolation the value at the center of the cell !!!

Code:
const interpolationCell<vector> UInterp(U);
point point(y,x,z);
Info << UInterp.interpolate(point,mesh.findCell(point)) << endl;
I was hoping to be able to do the same thing with interpolationCellPoint or interpolationCellPointFace but the class are not build the same way and create an instance of interpolationCellPoint is not permitted !!


Ideally I'd like to be eable to read from the dictionary the type of interpolation and chose it for my application.

If any one know how to do this. I'll be happy to learn!

By the way I try to make a post process utility that will do some computing on values interpolated on different disk in the domain.

Regards
Pagoda likes this.

Last edited by nlc; December 14, 2010 at 16:53.
nlc is offline   Reply With Quote

Reply

Tags
sampling

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
interpolation with a cuttingPlane for sample utility lbordier OpenFOAM 1 February 14, 2012 13:53
Surface interpolation schemes and parallelization jutta OpenFOAM Running, Solving & CFD 0 February 25, 2010 14:32
sample interpolation error in inflation layer eelcovv OpenFOAM Bugs 2 July 28, 2009 17:20
heat conducting in a solid domain Rogerio Fernandes Brito Fidelity CFD 0 March 18, 2008 17:24
heat conducting in a solid domain Rogerio Fernandes Brito Siemens 0 March 18, 2008 17:23


All times are GMT -4. The time now is 01:57.