|
[Sponsors] |
Need help evaluating field by interpolation with a "lookup table" |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 24, 2011, 13:39 |
Need help evaluating field by interpolation with a "lookup table"
|
#1 |
New Member
John Hawk
Join Date: Jun 2011
Posts: 2
Rep Power: 0 |
I am attempting to create a solver which determines the internalField values of a certain scalar field (effectively a field of coefficients "C") based on interpolative evaluation of another scalar field's internal values.
Foe clarification, if I have a normally-generated (e.g. time-stepping, with boundary conditions, evaluated using .solve) scalar field "T," and a .csv file (or other format) of paired values "Cref" vs. "Tref" for the effective range of "T," I need to evaluate "C" at every cell where "T" is already available by interpolating the Cref/Tref data for every value of "T"s internal field, then storing the field "C" for the time step to later perform other calculations. I have already explored using both Foam::interpolateXY and Foam:interpolationTable to attempt this task, but I've encountered a unique problem with each: interpolateXY apparently operates only on "fields," whereas my data is in the form of "lists"; since the Cref/Tref data have no dependence (or information) regarding spatial position. As a result I believe I've failed to understand completely this function's intended use, and now suspect it has nothing to do with what I'm attempting. Using interpolationTable instead yields me a new problem, in which I can't seem to manage accessing and writing to the internalField lists of either "T" or "C" directly. For example, I would ideally have code similar to the following: Code:
interpolationTable lookup(filename); //initialize my interpolationTable with data from file (do other things) for (Tnum = 0; Tnum <= T.internalfield.size(); Tnum++) //for each value in T C.internalField[Tnum] = lookup(T.internalField[Tnum]); //evaluate C for this value of T Even the following simple test: Code:
info << T.internalField[1] error: invalid types ‘<unresolved overloaded function type>[int]’ for array subscript I would appreciate it if anyone could either alert me to my error, or suggest a better method for evaluating "C" using the interpolation data. (Thanks!) |
|
June 28, 2011, 12:30 |
|
#2 |
New Member
John Hawk
Join Date: Jun 2011
Posts: 2
Rep Power: 0 |
Additionally, I'm having some difficulty handling deconstruction of the "interpolationTable," but this is a secondary issue. Any help with the original problem would be greatly appreciated!
|
|
June 28, 2011, 13:27 |
|
#3 | |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34 |
Quote:
You need to put in brackets with no arguments to access the internal field function i.e. Code:
info << T.internalField()[1] Philip |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problems after decomposing for running | alessio.nz | OpenFOAM | 7 | March 5, 2021 04:49 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |
Field interpolation | AlmostSurelyRob | OpenFOAM | 0 | February 2, 2011 09:48 |
Field interpolation in mesh points code | jzlam | OpenFOAM Post-Processing | 2 | December 14, 2010 16:48 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 06:51 |