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/)
-   -   Velocity profile (https://www.cfd-online.com/Forums/openfoam-pre-processing/62129-velocity-profile.html)

anja March 23, 2006 05:54

Hi, basic question: How do
 
Hi,

basic question:
How do you implement a velocity profile on an area for an inlet?

Anja

hjasak March 23, 2006 06:45

Have a look at the documentati
 
Have a look at the documentation - we used to have a little tool that would take a graph and interpolate the data onto the inlet patch for the purpose you describe. The class used for it is called interpolateXY and lives in src/sampling/interpolateXY/interpolateXY.H but I cannot dig out the actual utility code at the moment. Anyway, with this class is is pretty easy to write it yourself.

Enjoy,

Hrv

braennstroem March 23, 2006 06:57

Hi, take a look at the disc
 
Hi,

take a look at the discussion:

http://www.cfd-online.com/OpenFOAM_D...tml?1142952871

with this I could write a nonuniform profile for my inlet. I attached my directory

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif simpleFoam.tar.gz

Hope this helps!
Fabian

anja March 24, 2006 08:47

Hi Fabian, more basic quest
 
Hi Fabian,

more basic questions:
your folder "SimpleFoam" is a new application?
It contains the profile for your inlet.

How do you actually use this application?
I mean when you create a new case with OpenFoam, you get the three folders "0", "constant", "system". My question is how to implement the velocity profile/the new application in "0".

Thanks again
Anja

braennstroem March 24, 2006 09:28

Hi, I have this folder in t
 
Hi,

I have this folder in the tutorial directory. Run 'wmake' in it; afterwards you should be able to use ssimpleFoam.

Usage: ssimpleFoam <root> <case> [-parallel]

Which changes the entries for the inlet in file 0/U.

Greetings!
Fabian

francois March 24, 2006 10:20

Hi Fabian, I've just try to
 
Hi Fabian,

I've just try to develop the same utility.
I've download your ssimpleFoam code but notice one difference from my own utility.

To get the coordinates for cell centre of inletPatchID you used:

const fvPatchVectorField& centre = mesh.C().boundaryField()[inletPatchID];

I was using this statement:

const fvPatchVectorField& centre = mesh.Cf().boundaryField()[inletPatchID];

I don't now which one is best or correct.
For me centre is a surfaceVectorField so according to fvMesh.H we should use mesh.Cf().boundaryField()[inletPatchID] no ?

In fact fvMesh.H it says:
*//- Return cell centres as volVectorField
*const volVectorField& C() const;

//- Return face centres as surfaceVectorField
*const surfaceVectorField& Cf() const;

I'm wrong ?
François

hjasak March 24, 2006 10:36

Heya (sorry to butt in), Yo
 
Heya (sorry to butt in),

You'll get the same data from all of those. When you're using mesh.C() you are relying on the fact that the boundary field of the cell centre volVectorField gives face centres.

You can also do

mesh.boundary()[patchI].Cf();

and a few others - it's just the wrapping of the same data.

Hrv

francois March 24, 2006 10:57

Thank you Hrvoje for this pre
 
Thank you Hrvoje for this precision !

I will try to make a utility that reads a file with an inlet velocity profile in it and interpolate it on the mesh.

In your previous mail you mentioned a class that can do interpolation for profiles:

src/sampling/interpolateXY/interpolateXY.H

I will try to use it for my utility.

Thank's for taking some of your time to answer questions from newbies !

Francois

anja March 27, 2006 07:44

Hi Fabian, for what do you
 
Hi Fabian,

for what do you need the following line
scalarField y = centre.component(vector::Y); ??


Thanks again, again
Anja

francois March 28, 2006 03:18

Hi anja, with this line you
 
Hi anja,

with this line you get the y component of the fvPatchVectorField centre to have your ordinate of the cells centre at the inlet:

// Get x and y coordinates for cell centre
const fvPatchVectorField& centre = mesh.Cf().boundaryField()[inletPatchID];
scalarField y = centre.component(vector::Y);

anja March 28, 2006 04:32

Hi Francois, that means for
 
Hi Francois,

that means for a 3D inlet I have to write that line with x, y and z?

braennstroem March 28, 2006 06:15

Hi Anja, I am not sure, but
 
Hi Anja,

I am not sure, but I think you do not have to, because you refer to the 'inletPatchID'!?

Greetings!
Fabian

anja March 28, 2006 07:19

Hi Fabian, what is that com
 
Hi Fabian,

what is that comment for:
//VectorField& centresb = centres.boundaryField()[inletPatchID];

(It's in your ssimpleFoam.C)

braennstroem March 28, 2006 09:02

Hi Anja, sorry, I did not c
 
Hi Anja,

sorry, I did not clean the code. I wrote this using 'trial&error' method with code snips from the board...

//VectorField& centresb = centres.boundaryField()[inletPatchID];
//scalarField yb = centresb.component(vector::Y);

I think it is just another way to get


const fvPatchVectorField& centre = mesh.C().boundaryField()[inletPatchID];
scalarField y = centre.component(vector::Y);

but I am not sure.

Fabian

anja March 28, 2006 09:17

Hi again, okay. My velocit
 
Hi again,

okay.
My velocity profile for the inlet is a 3D parabolic shape. That's why I want to refer all points of my inlet patch to the centre of the inlet, for defining the velocity value.

Does someone know how to do that?

braennstroem March 28, 2006 09:43

Hi, I assume that can be do
 
Hi,

I assume that can be done using the 'vector(x,x,x)', like in:

INLET == 10 * pow(y*0.1,0.17) * vector (1,0,0);

This example writes just the u velocity.

anja March 28, 2006 09:57

Well, I mean I need Ux and Uy
 
Well, I mean I need Ux and Uy (as Uz=0), but the value of the velocity for each point of the inlet depends on the distance to the centre of the inlet, as it is parabolic.

The question is how to find the centre of the inlet. Maybe there is a special command I could use.
Or can I just use the coordinates from my gambit mesh. But that would mean that the point of origin for my coordinate system is still the same.

niklas March 28, 2006 10:13

To find the centre for any pat
 
To find the centre for any patch you need to do something like this.

(Cp is the Centre of the patch.)

forAll( faces )
{
Cp += centers[facei]*magSf[facei]);
area += magSf[facei]);
}
Cp /= area;

please do not copy/paste since this is just a schematic coding, but hopefully instructive.

I'm leaving the details to you.

anja March 29, 2006 03:31

Do I have to declare Cp before
 
Do I have to declare Cp before?
If so, where and how?

Thanks
Anja

eugene March 29, 2006 05:39

You need to declare both Cp an
 
You need to declare both Cp and area before the forAll loop.

vector Cp = vector::zero;
scalar area = 0;


All times are GMT -4. The time now is 02:30.