|
[Sponsors] |
April 9, 2020, 08:34 |
Interpolation within a cell
|
#1 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
Hello,
i have written an UDF to interpolate flow-values at a desired poisition inside the domain. First, the UDF searches for the cell in which the specified point is located. Then the value at the specified point is interpolated using the gradient and the distance to the cell center. Exampe for u-velocity yomponent: Code:
NV_VV(dy, =, coords_VOLUME[point], -, point_list_VOLUME[point].centroid); NV_V(grady, =, C_U_RG(c,t)); y0 = C_U(c,t); y = y0 + NV_DOT(grady, dy); Now I'm wondering if there is a built in marco for the interpolation purpose or if there is an UDF example of a more sophisticated approach (interpolation based on the nearest neighbours/trilinear interpolation?) Many thanks in advance! |
|
April 9, 2020, 10:51 |
Interpolation
|
#2 |
Senior Member
|
For zeroth order interpolation, you just need to report the values at the centers of the cells containing the points. In my view, you should report difference and the values at the cell centers and then check if the variation is significant enough to justify all this effort.
How is an iso-surface connected to your UDF?
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 9, 2020, 14:03 |
|
#3 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
When I generate an iso surface of the q-criterion based on the interpolated values of u, v, w (UDF) and compare it to the isosurface based on the original grid data in a .dat file, it is not as smooth as it should be.
|
|
April 9, 2020, 14:04 |
|
#4 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
I think that the interpolation method using the gradient is not accurate enough and I'm wondering if there is an in built macro for interpolation, which is more accurate?
|
|
April 9, 2020, 14:10 |
Udm
|
#5 |
Senior Member
|
I suppose you are saving values in a UDM and then using the UDM for creating iso-surface.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 9, 2020, 14:13 |
|
#6 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
I'm saving the interpolated values of u, v, w to a file at every nth time step and generate the isosurface in tecplot.
|
|
April 9, 2020, 14:45 |
Isosurface
|
#7 |
Senior Member
|
I am not sure how it is done in Tecplot, however, from the very fundamental concepts, it should be similar to what is being done in Fluent or any other tool. Iso-surface generation usually does interpolation to find points that have same value within a certain tolerance. You use interpolation to find values at certain points and then those are being used to generate iso-surface causing re-interpolation. If you want to generation iso-surface, I'd suggest using original data instead of interpolated one.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 9, 2020, 15:13 |
|
#8 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
Yes of course it would be better to use the original data, as interpolation allways brings some errors but when you have over 100m cells its not possible to save volume data at high sampling frequencies ... =|
|
|
April 9, 2020, 15:24 |
Big Mesh
|
#9 |
Senior Member
|
In that case, I suppose zeroth order might give you better results. Even better could be to report the coordinates of the cell centers and their values corresponding to the points you use. Then, use the reported cell centers and cell center based data in Tecplot.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 10, 2020, 03:01 |
|
#10 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
Hi vinerm,
Thanks for your reply. I also tried 0th order interpolation and this gives worse results than the gradient based interpolation as you can see in the attached pictures...I'm wondering which method fluent uses when you define a monitor point via the GUI and if this method is available through a UDF macro .... |
|
April 10, 2020, 04:08 |
Iso-surface
|
#11 |
Senior Member
|
Is the image on the left based on 0th order?
What if you directly generate iso-surface within Fluent? You may not have data at all times but for whichever time you have it available, it will be good to compare against that.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 10, 2020, 04:41 |
|
#12 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
Hi vinerm,
yes left is the contour of 0th order. I compared isosurfaces of q-criterion between fluent (original grid) and tecplot (interpolated data) and the fluent isosurface is much smoother. I really think that this is caused by the gradient interpolation. |
|
April 10, 2020, 04:43 |
|
#13 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
in CFX I have used the inbuilt interpolation for the same purpose and it gave me perfectly smooth isosurfaces...
|
|
April 10, 2020, 05:13 |
Interpolation
|
#14 |
Senior Member
|
For interpolation, I don't think Fluent uses first-order interpolation. It is most likely second order and centered. There is one way of using in-built interpolation. But you should try it with a small number of points first. What you need to do is create particles at the same locations where you have points. This can done using FILE injection. Each particle has its primary phase data structure attached to it. To determine particle Re number, Fluent uses interpolation to determine fluid velocity at the particle locations. Each particle's continuous phase member is defined by structure cphase. So, to access x-velocity at the location of the particle, you can do the following
cphase_state_t *cp; real xvelatp; cp = p->cphase; xvetatp = cp->V[0];
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 10, 2020, 05:18 |
|
#15 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
Hi vinerm,
thanks for this work around. I will give it a try tomorrow and will report if it gives better results! Greets |
|
April 10, 2020, 13:36 |
|
#16 |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
Okay, I just wanted to implement your suggestion but I'm stuck at the injection part.
As I have a loop over all the points where I want to get the velocity components, is it possible to only inject one particle inside this loop at the desired point? Greets |
|
April 10, 2020, 13:49 |
Injection
|
#17 |
Senior Member
|
You can setup a file injection where your monitor points can be used as coordinates of particles. So, you would not require a loop.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 11, 2020, 04:50 |
|
#18 | |
Member
Mohinder Suresh
Join Date: Dec 2014
Posts: 32
Rep Power: 11 |
Good morning,
I think fluent uses the same gradient based interpolation for the particle velocities as described in solution #2061258 Quote:
Nevertheless, I could find the reason for the wiggles in the q-criterion. It was caused by the central scheme momentum discretiszation. The CDS wiggles where only observable in the gradient fields and corrupted the interpolation procedure. With bounded CDS the wiggles are gone. Now I have one final question: Do you think it is better to use the reconstruction gradients for the interpolation? The difference compared to the regular gradients is only marginal. Greets |
||
April 11, 2020, 10:00 |
Gradient
|
#19 |
Senior Member
|
That's good that the wiggles are gone with bounded scheme.
Reconstruction and Gradients should be very close. For a deeply converged solution, both should be same within machine precision. With weak convergence, reconstruction gradients are better though non-conservative.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 19:57 |
Journal file error | magicalmarshmallow | FLUENT | 3 | April 4, 2014 13:25 |
[General] 2 datas on one plot | Akuji | ParaView | 46 | December 1, 2013 15:06 |
FvMatrix coefficients | shrina | OpenFOAM Running, Solving & CFD | 10 | October 3, 2013 15:38 |
Extracting cell centre values WITHOUT interpolation | dalaron | OpenFOAM Post-Processing | 1 | August 18, 2013 01:39 |