Interpolation using interpolationLookUpTable or interpolationTable classes
I’d like to perform an interpolation on a volScalarField using a lookup table of values, interpolating linearly between defined points. For example if I have points (x & y, as shown in the table below and volScalarField X, I want to make a volScalarField Y corresponding to column y.
x | y ------ 0 | 0 1 | 2 X=[0.2 0.4 0.5 0.6] i.e. Y would equal Y=[0.4 0.8 1.0 1.2 Based on the table . My first question is what class would be the best for this type of interpolation (Note that in the end it will not be a linear as shown above). After reading through the doxygen guide it looks like there are two classes to start with, "interpolationLookUpTable" and "interpolationTable". I'm not sure of the distinction between the two. I found a previous post regarding interpolationTable so I started there and I wrote a short program to figure out how to use it . Code:
#include "fvCFD.H" crap3.C: In function âint main(int, char**)â: crap3.C:40: error: expected primary-expression before â{â token crap3.C:41: error: no match for call to â(Foam::interpolationTable<Foam::List<Foam::Tuple2 <double, double> > >) (Foam::volScalarField&)â I think the error in line 40 has something to do with the boundsHandling argument. The constructor for this class is: Code:
interpolationTable Thanks |
Hello Scott,
did you find a solution for implementing lookup tabels and the difference between mentioned classes? Regards, Ilya |
It's been so long I can't remember specifically what I was asking but I do remember the solution. I just went ahead and wrote a function to do look ups for scalar fields, see below.
Code:
volScalarField SHlibInterp::Interp1(List<scalar> X, List<scalar> Y,volScalarField& Xi,volScalarField& Yi) |
Thank you!
|
Reading Scalars from dictionaries
Quote:
I have a similar problem. It seems that your function is suitable for interpolating between scalars. So I want to use your function. But I should read X, Y and Xi from dictionaries. Do you have any idea to do this? Sincerely yours, Hossein |
Hello,
It is solved. |
All times are GMT -4. The time now is 06:49. |