Trying to implement interpolation in openFOAM
1 Attachment(s)
Can someone please give me some feedback? I am trying to figure this out and running out of ideas as to how to solve it: Please look at the attached jpg file. During run time, how can I acquire quantities at points V and N via interpolation, with P being the cell centered node?
|
It seems there is no one here on the forum that has a clue about this, and I do find that hard to believe.
For the interpolated quantities at point N, I thought of two things: 1)Is there a function available in OpenFOAM that would allow me to gain access to these faces OR 2) Perhaps I can calculate the normal wall distance from the wall to the face, and subsequently get hold of all the faces at this distance from the wall. I have being digging through the forum and haven't found anything on this. There has to be a way or maybe I might have to code this, and some feedback on this will be extremely helpful. |
all faces or a specific one
hi deji
do you have a specific point in your mesh where you want to know the temperature? Then you could use a probe. If you want the temperatures on each face of the cells you could interpolate your volScalarField onto the faces gaining a surfaceScalarField. Hope this is what you meant. Regards Fabian |
Hi Fabian. Well, if you look at the diagram, I would like to know quantities at point V, and it is at y*=10.8. So I suppose I could use a probe at run time, is that correct? So I can do this at this height for the entire 3D field?
Also, I know how to compute the surface quantities, I just do not know how to access those particular faces near the wall, point N in the picture attached. Thanks much Fabian for your feedback, I really appreciate it. Cheers, Deji |
It seems I ought to be able to use probe* to compute quantities at v, so I just have to figure out how to implement that for my entire domain.
|
After thinking about this, I do not think I can use probe to get the quantities at point V. I will have to interpolate for those quantities at run time. Still trying to figure it out!!!
|
Hello Foamers. Okay, so I think I've figured out how to get the interpolated surface quantities at point N. This is my thought and would greatly appreciate if someone can help comment or give me some feedback.
1) Acquire boundary faces 2) Get all internal faces 3) Perform dot product of unit face normals & axis direction of interest (say X), check magnitude, and select those magnitude is one. 4) Get cell height near wall using nearWallDist, and multiply value by 2 for cell height 5) Check the X location of the faces chosen from (3) and if it is the distance calculated from 4 away from the wall, it is the face whose quantities I pick to use..... Now I just have to code this, any feedback from the experts here on the forum??:confused::confused: |
Hi deji
I started into weekend after my last post and didn't check your replays. I think you’re on the right trip. I wanted to suggest the same thing: Identify the cells with boundary faces and select the face with a normal vector pointing away from the boundary face. This gets even simpler when using a hex mesh. Regards Fabian |
Thanks for the feedbacks. I am working on the coding and trying to find a decent way of getting a list of just the internal faces. I am get a list of all the faces, patch faces, but not the internal faces alone. How would I go about to get that list?
|
Hello to the OpenFOAM forum. Problem fixed, if anyone has a similar issue, I can post the section of the code that covers this topic!!!
:) |
Would be nice
Hi deji
Congratulations. Would be interesting to see your solution. Thanks for posting. Regards Fabian |
just discovered this thread :)
probe will do the trick if you know the position at start, but if you want a variable position, calculated at runtime, I dont know if probe can do this. Althought with the recent improvement with formulas it might be possible. Still, what you want is something like this Code:
dictionary interpolationDict = mesh.solutionDict().subDict("interpolationSchemes"); So you need to add the type of interpolation to fvSolution, like below. Code:
interpolationSchemes N |
Hey Fabian. Sure, I will post the code that I implemented.
Hey Niklas. I do know the points that I would like to probe, and it is many that I would need for a wall function. Hence, in this code: dictionary interpolationDict = mesh.solutionDict().subDict("interpolationSchemes" ); autoPtr<interpolation<vector> > Uinterp = interpolation<vector>::New(interpolationDict, U); vector pos(0,0,0); label cellI = mesh.findCell(pos); vector Ui = Uinterp->interpolate(pos, cellI); So that means I would have multiple vector positions, perhaps I can loop through all the vectors, what do you think? |
you just change it to
Code:
vectorList positions = ..something; since the findCell operation is quite time-consuming, you'd want to do that as little as possible. Code:
// outside the loop in the beginning |
but if you have positions known at the start, why dont you just just probes.
Here's how it would look like for 2 probes. (Just stick it in the controlDict) Code:
functions |
Thanks much Niklas. I actually know where I want to get the quantities, but not the exact points at runtime. Therefore, I will not be able to prescribe the points as probes in controlDict. Thanks again, I will try it...
Cheers, Deji |
Quote:
|
Hi.
Any idea how you would achieve an interpolation like this Quote:
I tried something like: Before simulation start Code:
for ( int i=0 ; i <= npts ; i++) Code:
Code:
cellsI[i] = globalCells_.toLocal(cellLists_[i]); PS. I want to use the interpolated values for some run-time calculations after I have retrieved them which is why I'm not simply using probes. |
As always, the minute after I posted, I figured out what was wrong. I got rid of the reduce(cellsI)-command and the toGlobal and then it works since everything is kept local without the masters interference : ) .
|
Quote:
Quote:
Solved: #include interpolation.H did the job Regards, Ilya |
All times are GMT -4. The time now is 17:13. |