lookup non included scalars from a list
Hi,
I need to lookup a list from a dictionary composed such as follows: c_vs_w 100 ( ( 0 0.001) ( 0.01 0.001) ( 0.02 0.001) ( 0.03 0.001) . . . ) I want to access to second values of above list by looking up the first values. During the run, it should be looked up non-included scalar from the list (finding corresponding value of 0.015 ,for instance). Can someone suggest me how to do it? I study different utility and application such as interpolateXY, interpolationTable , etc. Thank you in advance, Moha |
Quote:
Your post is not really sufficient for you to get help. I suggest you give more details: http://www.cfd-online.com/Forums/ope...-get-help.html I think you can take a look at: Code:
tmp<Field<Type> > timeVaryingMappedFixedValueFvPatchField<Type>::interpolate) Regards Hisham |
Dear Hisham,
Thanks for reply. Indeed, in my simulation, I obtain a passive scalar (b) by solving a transport equation in a field with a certain U and P. Then I need to interpolate scalars from a table as a source term (W) by the value of "b" and send it to a solver. This lookup table consists of lists such as 100 ( (b1 w1) (b2 w2) (b3 w3) (b4 w4) . . . ) . I need to reach a "W" which is corresponding with a "b". My question is "How can this procedure be done?". I studied timeVaryingMappedFixedValueFvPatchField but I don't know how to use it. I think this function in used for boundary condition. But I should find the source term in my entire field. Best Regards Hossein |
Dear Hossein,
I do not really know if such a possibility is actually available in OpenFOAM. I am sure someone must have implemented it before. The available interpolations are time interpolations or space interpolations over the mesh. Nevertheless, introducing interpolation to the code in your case should not be difficult. I think it may be interesting to take a look at other libraries for interpolation (to link to your solver): gsl: http://www.gnu.org/software/gsl/ http://www.gnu.org/software/gsl/manu...rpolation.html CGAL: http://www.cgal.org/Manual/latest/do...:Interpolation A more careful search can yield better (more convenient) options. Regards Hisham |
Hi Hossein
You should be able to do something in the following way, where I assume you have the b and w coefficients as two scalarFields (the code below has not been tested). Code:
// scalarField B = <KNOWN> Furthermore, remember to include the following in your files: Code:
#include "interpolateXY.H" Kind regards, Niels |
Thanks Niels,
It seems that I can implement it my code. I test it asp. Code:
// scalarField B = <KNOWN> Best Regards, Hossein |
Hey,
are the lists of the same size as your mesh? Best Kathrin |
Hello Kathrin,
Not necessarily. In my code, it has 100 members. Sincerely yours, Hossein |
Dears,
You should be able to do something in the following way, where I assume you have the b and w coefficients as two scalarFields (the code below has not been tested). I read some other posts such as: http://www.cfd-online.com/Forums/ope...tml#post308408 But I do not know the format of input files (X,Y,Xi in above code) to the code? and how can I read them through the code? Thank you in advance, Hossein |
Solved
Dears,
Finally we find the solution:D. We Used the following for reeding scalars from two lists in a dictionary. Code:
IOobject dictHdr |
All times are GMT -4. The time now is 21:05. |