|
[Sponsors] |
How to interpolate field value at any give point in a cell? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 25, 2021, 01:43 |
How to interpolate field value at any give point in a cell?
|
#1 | ||
Senior Member
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 14 |
Dear Foamers,
suppose I know the point cloud (point mass particles) positions in the CFD domain. I want to know the velocities at the point mass particle locations. Obvious we need to interpolate point field value in cell where the point particle is located. In my case, the U field is known, and the mesh is uniform. I could simply code a Trilinear interpolation scheme (or inverse distance weighting), however I suppose these algorithms already exist in OpenFOAM. The thing is in OF, it is so complicated to fine-tune some functions, as the right low-level API is hard to find (most hated), and hard to use. what I did so far: Code:
#include "interpolationCellPoint.H" #include "interpolationCellPointFace.H" .... autoPtr <Foam::interpolation<vector>> U_interp; Uf_interp = Foam::interpolation<vector>::New("cellPoint", U); //Uf_interp.reset(Foam::interpolation<vector>::New("cellPoint", U).ptr()); Quote:
Quote:
Any suggestions would be appreciated! Update 1: tried a new method: Code:
const objectRegistry& db = mesh_.thisDb(); const IOdictionary& fvSchemes = db.lookupObject<IOdictionary>("fvSchemes"); dictionary interpolationSchemes = fvSchemes.subDict("interpolationSchemes"); Uf_interp = Foam::interpolationCellPoint<vector>::New(interpolationSchemes, coupling_world.UField()); ... vector Up = Uf_interp().interpolate(p, cell_i); Update 2: Can't believe so much time wasted on this simple issue (complexity-wise). Will implement Trilinear interpolation scheme for point field value at given position / cell-ID (uniform mesh), this might save my day! Last edited by keepfit; October 25, 2021 at 09:59. |
|||
October 25, 2021, 06:28 |
|
#2 |
Member
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 94
Rep Power: 15 |
Hi there, Can you try this one "U_interp().interpolate(p, cell_i)".
|
|
October 25, 2021, 07:12 |
|
#3 |
Member
Join Date: Aug 2017
Location: Algeria
Posts: 98
Rep Power: 9 |
Maybe it is useful to take a look to some function objects that use the interpolation, e.g.:
Code:
$FOAM_SRC/functionObjects/field/streamlines/streamlinesParticle.H Code:
$FOAM_SRC/functionObjects/field/streamlines/streamlines.C |
|
October 25, 2021, 08:22 |
|
#4 | |
Senior Member
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 14 |
Quote:
Code:
dictionary interpolationDict = mesh.solutionDict().subDict("interpolationSchemes"); Uf_interp = Foam::interpolationCellPoint<vector>::New(interpolationDict, coupling_world.UField()); Code:
Entry 'interpolationSchemes' not found in dictionary "... mycase/system/fvSolution" |
||
October 25, 2021, 08:31 |
|
#5 |
Senior Member
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 14 |
Thanks for the hint. Again, i have to deal with the " particle::trackingData" API. Seems in OF some simplest functionalities are buried so deeply so that u have go through A LOT of digging up. . All I need is to obtain interpolated field at position p within given cell-i.
|
|
October 25, 2021, 14:31 |
|
#6 | |
Member
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 94
Rep Power: 15 |
Quote:
|
||
October 26, 2021, 07:33 |
|
#7 | |||
Senior Member
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 14 |
Quote:
Quote:
Code:
interpolationSchemes { default linear; U cellPoint; } Update 1: Fluid velocity at point particle location seems not interpolated correctly by Quote:
Last edited by keepfit; October 26, 2021 at 12:08. |
||||
May 30, 2022, 14:32 |
How interpolate results in cell points (nodes)
|
#8 |
New Member
zurich
Join Date: Apr 2022
Posts: 3
Rep Power: 4 |
How interpolate results in cell points (nodes)
For instace, how interpolate scalareField (P,T) in cell points? |
|
Tags |
interpolate, point field |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swakExpression not writing to log | alexfells | OpenFOAM Community Contributions | 3 | March 16, 2020 19:19 |
How to get cell indices and manipulate field data | ch1 | OpenFOAM Programming & Development | 5 | September 25, 2019 12:17 |
fvc::interpolate(rAU) at boundary faces | Jesper_Roland | OpenFOAM Programming & Development | 5 | January 30, 2019 09:55 |
Get Velocity Field at a specific mesh point (centroid point) | benhamlaoui | OpenFOAM Programming & Development | 0 | March 26, 2018 10:00 |
OpenFOAM floating point Error | upuli | OpenFOAM Programming & Development | 5 | June 20, 2016 04:19 |