|
[Sponsors] |
How to sample (with interpolation) at runtime |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 16, 2010, 15:06 |
How to sample (with interpolation) at runtime
|
#1 |
New Member
Join Date: Jan 2010
Posts: 4
Rep Power: 16 |
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 |
|
March 27, 2010, 09:18 |
|
#2 |
Member
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17 |
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. |
|
March 29, 2010, 07:33 |
|
#3 |
New Member
Sebastian Barthmes
Join Date: Mar 2010
Posts: 1
Rep Power: 0 |
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... ;-) |
|
November 3, 2010, 14:47 |
Volume to point interpolation (just one point - not a pointMesh)
|
#4 |
New Member
Deborah Edmund
Join Date: Aug 2009
Posts: 1
Rep Power: 0 |
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 |
|
December 14, 2010, 13:57 |
|
#5 |
Member
Nicolas Lussier Clément
Join Date: Apr 2009
Location: Montréal, Qc, Canada
Posts: 61
Rep Power: 17 |
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; 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 Last edited by nlc; December 14, 2010 at 17:53. |
|
Tags |
sampling |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
interpolation with a cuttingPlane for sample utility | lbordier | OpenFOAM | 1 | February 14, 2012 14:53 |
Surface interpolation schemes and parallelization | jutta | OpenFOAM Running, Solving & CFD | 0 | February 25, 2010 15:32 |
sample interpolation error in inflation layer | eelcovv | OpenFOAM Bugs | 2 | July 28, 2009 18:20 |
heat conducting in a solid domain | Rogerio Fernandes Brito | Fidelity CFD | 0 | March 18, 2008 18:24 |
heat conducting in a solid domain | Rogerio Fernandes Brito | Siemens | 0 | March 18, 2008 18:23 |