CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   INTERPOLATEXY format entry for the Xold and Yold (https://www.cfd-online.com/Forums/openfoam-pre-processing/62114-interpolatexy-format-entry-xold-yold.html)

cedric_duprat July 2, 2007 10:18

Hi OF community, I'm trying t
 
Hi OF community,
I'm trying to interpolate data from experiments to a circular inlet. data are avaible on a radius so, I need to interpolate them on one radius and then put them on all the area.
my file look like this:

r_old [m] ur[m.s^-1] uz[m.s^-1] uteta[m.s^-1]

... ... ... ...



first 1 cut this file in 3 (i=1->3) files ui to get:

r_old[m] ui[m.s^-1]

... ...




to keep the same notation, xNew =xmesh, xOld=xexperiments
then, this is the main idea of my "code":

//definition of xnew which correspond to r_grid

(same definition as anne dejoan)
scalarField rnew=sqrt(pow(ybc,2)+pow(zbc.2));

//reading experimental data then creation of the graphs
// i velocity[m s^-1]
IFstream myui("Ui"); //Ui in the current directory
graph expe
(
"ui"
"rold" //radius from experiments in Ui files
"i_velocity"
myui
)

//interpolation procedure for all parameters
scalarField Ui=interpolateXY
(
rnew,
exp.rold(),
exp.ui()
)

then, I do the same for ur, uteta,uz to get at the end :
Uinlet=vector(Ur, Uteta, Uz);}
I used the upper piece of code from anne to start and then I "tried" to use the Hrvoje explications but, I don't really get where I can compile the code to check if it works correctly or not ?
Do you see any mistake(s), I'm not a real C++ programer http://www.cfd-online.com/OpenFOAM_D...part/happy.gif?
With this, I (should) get the interpolation only on one radius, Have you got an idea to extend it to all radius ?
using ux=fct(ur,uteta) and uy=fct(ur,uteta) ...I can get ux and uy but then ...
Thanks for helping...

cedric_duprat August 21, 2007 08:40

Hi all, sorry for this evid
 
Hi all,

sorry for this evident C++ question but, I've some problem with this.

I tried tips which are in upper messages to get an inlet from experimental data :

# include "interpolateXY.H"
# include "graph.H"

IFstream fichierProfil(runTime.constant()/"U-25.dat");
Info << "Reading file U-25.dat " << endl;

graph expeGraph
(
"expe_profil",
"r",
"Uaxial",
fichierProfil
);

scalarField Uxexpe = interpolateXY
(
rbc2,
expeGraph.x(),
expeGraph.y()
);
where rbc2 is well defined.

this are the mistake :
error: 'IFstream' was not declared in this scope
error: expected `;' before 'fichierProfil'
error: 'graph' was not declared in this scope
error: expected `;' before 'expeGraph'
error: 'expeGraph' was not declared in this scope
error: 'interpolateXY' was not declared in this scope

Maybe I forgot to declare something but, interpolate.H and Graph.H are already declared ...

I need some help in this regard, even if it is quite evident for most of you.

Regards,

Cedric

cedric_duprat August 22, 2007 03:28

Hi all, I won't be long, I
 
Hi all,

I won't be long, I have fixed the problem .... shame on me :-)

just add #include "IFstream.H" and #include "OFstream.H" .... and It compile, so # include "interpolateXY.H" and # include "graph.H" are not enought ...

that's all, sorry for such stupid question

Regards,

Cedric

cedric_duprat August 28, 2007 05:26

Hello, It's again me. my int
 
Hello,
It's again me.
my interpolation is running well, profiles are the same ...

However I still have a question more, I would like to use the interpolation to get an inlet profile as anne dejoan in the upper message:

I understand how to do with a fixed direction (like inlet normal direction) but, I've got a pipe and one of my interpolate field is orthoradial velocity so, the direction is changing for each "teta" angle.

this is my code where I used the interpolate fields (Uxexpe and Utetaexpe) to write my inlet velocity wUe:
forAll(wUe, faceI)
{
const vector& c = faceCentrese[patchIDe];
vector OM = c - center;
vector ur = OM - (OM & ux)*ux;
scalar rad = mag(ur);
ur /= rad + VSMALL;
vector uteta = ux^ur;
scalar rad2 = mag(uteta);
uteta /= rad2 + VSMALL;
wUe = Uxexpe*ux + Utetaexpe*uteta;
}
where patchIDe is my inlet.

so my question is can I do something like that because, Utetaexpe is define for all my patch
so I'm afraid that the result field (wUe) won't be the right one ...
I'm afraid to get only the last loop with just one uteta ...

Well, I'm not sure to be clear but, ... can someone give his/her point of vue on that and if something is wrong give me some hint ...

Thank you,

Cedric


All times are GMT -4. The time now is 09:48.