CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Parabolic inlet velocity profile (https://www.cfd-online.com/Forums/openfoam-solving/57793-parabolic-inlet-velocity-profile.html)

sega June 26, 2008 05:54

Hello davey david. I don't
 
Hello davey david.

I don't know why this problem is related to the parabolic inlet velocity?

I had a similar problem. I made a mistake with the pressure distribution. Do you have pdRefCell and pdRefValue entries in your fvSolution-file? Maybe these entries do not correspond to your mesh? You can try setting a reference value for the pressure directly at a boundary instead.

gschaider June 26, 2008 06:09

@sebastians question whether i
 
@sebastians question whether it is possible to use funkySetFields:
Yes. You can do something similar to http://openfoamwiki.net/index.php/Co...t-Room_Example (basically set a parabolic internal field, use that field on selected patches and afterwards clear the internal field and keep the values at the patches). Whether this is easier than programming a util is a matter of taste

Bernhard

suredross July 1, 2008 10:33

hello, i need to implement a
 
hello,
i need to implement a boundary condition on a patch(wall) and write out only those values.it is more of a slip condition enforced at the boundary(case is 2D).can the parabolic velocity boundary condition be modified to do this??any ideas and thoughts are welcome.

cheers
davey

sega July 1, 2008 13:24

Hello! So, I have worked a
 
Hello!

So, I have worked a little bit with the tool.
As a reminder I tried to change it so it would set the velocity components in y-direction instead of x.
It's compiling and looks like this:

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif setParabolicInlet.C

I would like to set the parabolic inflow to the boundary-patch inflow so I did this:

setParabolicInlet . . inflow 0.5305

Have a look at the output:

Exec : setParabolicInlet . . inflow 0.5305
Date : Jul 01 2008
Time : 19:13:59
Host : M1530
PID : 9011
Root : /home/sega/OpenFOAM/sega-1.4.1/run/nucleateBoiling
Case : .
Nprocs : 1
Create time

Create mesh for time = 0

Vector field U

Patching inlet
x [ 0 , 0 ] z [ -1.98553e-22 , 2.43404e-22 ]
=> x [ 0 , 0 ] z [ -1.98553e-22 , 4.41957e-22 ]
Writing modified field U

End

But it looks like the tool does nothing at all . Maybe beacuse of this strange x-interval?

I think I made some severe mistakes changing the directions. I hope you have some suggestions?

Thanks so far & Greetings from Germany.
Sebastian

gschaider July 1, 2008 13:53

Hi Sebastian! In your code
 
Hi Sebastian!

In your code the minX/maxX-line should now access component(0)

Bernhard

sega July 2, 2008 03:08

Yes, Thank you. I have changed
 
Yes, Thank you. I have changed it and now its working.

But I have some more problems setting the right parabolic inlet.

If I set
scalar vel=maxVel*(1-(x/1e-3)*(x/1e-3));
I get a parabolic profile, which is axi-symmetric (an arc). The length of the area I want so set up with the profile is 1mm, thus the 1e-3 in the denumerator. But the values are far too big (1e+6) and negative.

If I just set
scalar vel=maxVel*(1-x*x)
I get the "complete" parabolic profile, but with the right magnitude.

So, what I want is a half parabolic profile with the correct magnitude.

What may be wrong with the code?

gschaider July 2, 2008 03:48

The problem might be that the
 
The problem might be that the extent of the patch is calculated using the face centres, but in reality the face vertices should be used.

sega July 2, 2008 05:29

I dont know how and why this c
 
I dont know how and why this can effect the profile, but this sounds like a limitation.

As I just have 8 cells over the inflow-patch in x-direction I have written a small MATLAB-file which is calculating the values at the cellcenters an put them into a nonuniform List into the U-file by hand.

I'm not sure where this will lead, but I will get back to you.

gschaider July 3, 2008 05:13

Hi Sebastian! Well in your
 
Hi Sebastian!

Well in your case the utility thinks that the channel is 1/8th narrower than it actually is (misses half a cell on the left and on the right)

Bernhard

ivanyao July 8, 2008 21:26

hi, I have go through all the
 
hi,
I have go through all the messages.but I don't know how to compile the setParabolicInlet.I am doing a simulation about the compute wind engineering,I do the simulation in rhoturbFoam.my inlet velocity profile:U=U_0*(Z/Z_0)^0.25,"U_0","Z_0"are constants I provide."Z" is the height of the building.I am using OF1.4,and I have downloaded the parabolicVelocity_HJ_17Jan2007.tgz,but I don't know what I should do next.is there anyone help me step by step?that is very important to me.I would very very appreciate it.
thanks,Ivan

gschaider November 17, 2008 14:08

I have no idea. A debug-versio
 
I have no idea. A debug-version of OF would give us the line-number of the program at which this is occuring:
http://openfoamwiki.net/index.php/Main_FAQ#An_application_ends_with_a_segmentati on_fault._What_is_wrong.3F

Bernhard

rama0004 November 17, 2008 15:07

Thanks Bernhard I'll try.
 
Thanks Bernhard

I'll try.

carrie November 19, 2008 22:09

hi, I have compiled the lib
 
hi,
I have compiled the libs successfully,but when i type paraFoam <root> <case>,it show:
From function dlLibraryTable::open(const fileName& functionLibName)
in file db/dlLibraryTable/dlLibraryTable.C at line 79
could not load /home/ivan/OpenFOAM/ivan-1.4.1/lib/linuxGccDPOpt/libparabolicVelocity.so: undefined symbol: _ZN4Foam4word5debugE
what is problem?could anyone give me a hand?

markc December 16, 2008 07:03

Hello All, A question which
 
Hello All,

A question which is not exactly related to this thread but it looks like here are people who might be able to help me a bit further.
For some postprocessing utility I need to read in the value of the BC (fixedValue uniform) on some patch, usually U on Inlet patch.
So I ask the user to give the name of the inlet patch, the field to be read and than the utility should find in the times directory the correct value. E.g. if the the next BC for Inlet is given:
>>>
Inlet
{
type pressureInletVelocity;
value uniform (5 0 0);
}
>>>

the utility should return the vector (5 0 0);
Does anyone know how to perform this (simple) task?
Thanks in advance,

Brgds,

Mark

markc December 16, 2008 10:12

Radu, Thanks for your reply
 
Radu,

Thanks for your reply, very useful. I am getting closer, but still not there.
Now, if I imcorporate your snippet, during build I get the error message 'U' was not declared in this scope.

I also have a variable "fieldName", which is declared as const word. If I use this instead of U (to generalize the use of the final utility). In that case I get the error message that const class::Foam has no member named 'boundaryField'. Well, I understand the meaning of these messages but I do not know how to correct them.
Any advice here? Do I have to add some kind of createfield.H for U? This did not work so far as well.

Kind regards,

Mark

antonio_ing January 9, 2009 14:42

anyway i wave to write a B
 
anyway

i wave to write a BC that, taking a surface patch, each point with coordinates (x,y,z) must have a velocity omega*(-y,x,0). Can someone send me an example?

thanks again for all the help

hamsadhwani8 January 13, 2009 15:57

I have used the following piec
 
I have used the following piece of code as a InletVelocityProfile.H include file in my solver. The idea is to assign some section of the inlet a particular velocity and the rest something else. However, the 'for loop' does not seem to do anything! Can anyone comment on this?

InletVelocityProfile.H looks like this

label inletPatchID = mesh.boundaryMesh().findPatchID("inlet");

// Get reference to boundary value, patch centers
fvPatchVectorField& inletU = U.boundaryField()[inletPatchID];
const fvsPatchVectorField& inletFaceCentres = mesh.Cf().boundaryField()[inletPatchID];

scalarField y = inletFaceCentres.component(vector::Y);

forAll(inletU, faceI)
{
if (y >= 0.02)
{
inletU == 0.5*vector(1,0,0);
}
else
{
inletU == 0.0*vector(1,0,0);
}
}

hamsadhwani8 January 13, 2009 15:58

Ofcourse, I also have U.wr
 
Ofcourse, I also have

U.write() at the end of the include file.

Thanks
Sesha

santos January 14, 2009 10:13

Hi, It should work with:
 
Hi,

It should work with:

forAll(inletU, faceI)
{
if (y >= 0.02)
{
inletU[faceI] == 0.5*vector(1,0,0);
}
else
{
inletU[faceI] == 0.0*vector(1,0,0);
}
}

Regards,
Jose Santos

santos January 14, 2009 10:15

Also replace == with =.
 
Also replace == with =.

hamsadhwani8 January 22, 2009 15:58

Jose, Thanks for your sugge
 
Jose,

Thanks for your suggestion. It worked! I am now trying to see how to specify profiles at multiple inputs. I am using the following code but it does not compile. Any suggestions?

I am using this in the include file that I include in the solver.

Thanks,
Sesha

fvPatchVectorFieldField& Upatches = U.boundaryField();

forAll(Upatches, inletPatchID)
{
if
((typeid(Upatches[inletPatchID]) == mesh.boundaryMesh().findPatchID("inlet")))
{
// Get reference to boundary value, patch centers
fvPatchVectorField& inletU =U.boundaryField()[inletPatchID];
const fvsPatchVectorField& inletFaceCentres = mesh.Cf().boundaryField()[inletPatchID];

scalarField y = inletFaceCentres.component(vector::Y);
forAll(y, counter)
{
if(y[counter] >= 0.02)
{
inletU[counter] = 0.05*(y[counter]-0.02)*vector(1,0,0); //0.1*(y[counter]-0.02)*vector(1,0,0);
}
else
{
inletU[counter] = 0.0*vector(1,0,0); //0.1*y[counter]*vector(1,0,0);
}
}
U.write();
}
}

hamsadhwani8 January 23, 2009 09:00

Thanks for the tip Jose. I wil
 
Thanks for the tip Jose. I will let you know once I have tried it.

Thanks,
Sesha

hamsadhwani8 January 23, 2009 11:24

Ok, I have tried the sugestion
 
Ok, I have tried the sugestion above and it gives me the same error as before:
In file included from my_interFoam.C:61:
MultipleInletVelocityProfile.H: In function 'int main(int, char**)':
MultipleInletVelocityProfile.H:5: error: 'fvPatchVectorFieldField' was not declared in this scope
MultipleInletVelocityProfile.H:5: error: 'Upatches' was not declared in this scope
/Network/Servers/controller.cluster/Homedir/stsriniv/OpenFOAM/OpenFOAM-1.5/src/f initeVolume/lnInclude/readPISOControls.H:3: warning: unused variable 'nCorr'
make: *** [Make/darwinIntelDPOpt/my_interFoam.o] Error 1


My updated MultipleInletVelocity.H file for the first inlet is as below. I suppose something like this can be easily extended to multiple inlets with an or condition in the first if loop.

Thanks,
Sesha

fvPatchVectorFieldField& Upatches = U.boundaryField();

forAll(Upatches, inletPatchID)
{
if
( mesh.boundaryMesh()[inletPatchID].name() == "inlet1")
{


// Get reference to boundary value, patch centers
fvPatchVectorField& inletU = U.boundaryField()[inletPatchID];
const fvsPatchVectorField& inletFaceCentres = mesh.Cf().boundaryField()[inletPatchID];

scalarField y = inletFaceCentres.component(vector::Y);
forAll(y, counter)
{
if(y[counter] >= 0.02)
{
inletU[counter] = 0.05*(y[counter]-0.02)*vector(1,0,0);
}
else
{
inletU[counter] = 0.0*vector(1,0,0); //0.1*y[counter]*vector(1,0,0);
}
}
U.write();
}
}

santos January 23, 2009 11:37

Hi again. You need fvPatchF
 
Hi again.

You need fvPatchFieldFields.H. Please find it here: http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif fvPatchFieldFields.H

Then, add the line:

#include "fvPatchFieldFields.H"


Regards,
Jose Santos

hamsadhwani8 January 23, 2009 12:59

Hi Jose, Thanks for the pro
 
Hi Jose,

Thanks for the prompt reply. I did the following:

Copied the above .H file in the my_interFoam directory. Added the line '#include "fvPatchFieldFields.H"' in the MultipleInletVelocityProfile.H file.

A wmake after that gives me the following error. Am I missing something?

Thanks,
Sesha

In file included from MultipleInletVelocityProfile.H:1,
from my_interFoam.C:62:
fvPatchFieldFields.H: In function 'int main(int, char**)':
fvPatchFieldFields.H:40: error: expected primary-expression before 'namespace'
fvPatchFieldFields.H:40: error: expected `;' before 'namespace'
In file included from my_interFoam.C:62:
MultipleInletVelocityProfile.H:4: error: 'fvPatchVectorFieldField' was not declared in this scope
MultipleInletVelocityProfile.H:4: error: 'Upatches' was not declared in this scope
/Network/Servers/controller.cluster/Homedir/stsriniv/OpenFOAM/OpenFOAM-1.5/src/f initeVolume/lnInclude/readPISOControls.H:3: warning: unused variable 'nCorr'
make: *** [Make/darwinIntelDPOpt/my_interFoam.o] Error 1

santos January 23, 2009 17:06

Try to add the line: #inclu
 
Try to add the line:

#include "fvPatchFieldFields.H

in the beginning of the my_interFoam.C file instead (remove it from MultipleInletVelocityProfile.H).

Let me know if it works!

Regards,
Jose Santos

hamsadhwani8 January 26, 2009 09:03

Hi Jose, Thanks for that po
 
Hi Jose,

Thanks for that pointer. I seems to have compiled. I will try working with it later and see if something goes wrong at the time of execution.

Thanks again,
Sesha

mrj301988 January 27, 2009 00:57

hello, I am solving the case
 
hello,
I am solving the case for parabolic inlet velocity profile.I have downloaded the tar file and executed "wmake". an executable file has been prepared.Then I have used the the same default "uniform" type inlet B/C and then later go to the
case root and execute "setParabolicInlet . case_name".The case_name is parabolicinlet.I am getting the following error.
Plz do guide me

ms.wankhede@linux:~/OpenFOAM/ms.wankhede-1.5/mrj/parabolicinlet> setParabolicInlet . parabolicinlet
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.5 |
| \ / A nd | Web: http://www.OpenFOAM.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/
Exec : setParabolicInlet . parabolicinlet
Date : Jan 27 2009
Time : 11:34:16
Host : linux
PID : 7586
Case : /home/ms.wankhede/OpenFOAM/ms.wankhede-1.5/mrj/parabolicinlet
nProcs : 1

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/ms.wankhede/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::sigSegv::sigSegvHandler(int) in "/home/ms.wankhede/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 ?? in "/lib64/libc.so.6"
#3 main in "/home/ms.wankhede/OpenFOAM/ms.wankhede-1.5/applications/bin/linux64GccDPOpt/set ParabolicInlet"
#4 __libc_start_main in "/lib64/libc.so.6"
#5 Foam::regIOobject::readIfModified() in "/home/ms.wankhede/OpenFOAM/ms.wankhede-1.5/applications/bin/linux64GccDPOpt/set ParabolicInlet"
Segmentation fault

mrj301988 January 27, 2009 09:29

f u know then plz do tell me
 
f u know then plz do tell me how to correct the following error


ms.wankhede@linux:~/OpenFOAM/ms.wankhede-1.5/mrj/parabolicinlet> setParabolicInlet inlet1 0.01 -case parabolicinlet
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |

| \ / O peration | Version: 1.5 |
| \ / A nd | Web: http://www.OpenFOAM.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/
Exec : setParabolicInlet inlet1 0.01 -case parabolicinlet
Date : Jan 27 2009
Time : 18:53:23
Host : linux
PID : 13951
Case : ./parabolicinlet
nProcs : 1

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


setParabolicInlet: cannot open case directory "./parabolicinlet"


FOAM exiting


ms.wankhede@linux:~/OpenFOAM/ms.wankhede-1.5/mrj/parabolicinlet>

santos January 27, 2009 10:37

Hi, In OpenFOAM 1.5 you don
 
Hi,

In OpenFOAM 1.5 you dont need to specify your case if you are located inside your case directory.

Try:

setParabolicInlet inlet1 0.01

Regards,
Jose Santos

mrj301988 January 27, 2009 22:18

Hi,Jose Luis Santos. when i t
 
Hi,Jose Luis Santos.
when i tried this way following error is seen,
plz do help me to solve this case



ms.wankhede@linux:~/OpenFOAM/ms.wankhede-1.5/mrj/parabolicinlet> setParabolicInlet inlet1 0.01
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.5 |
| \ / A nd | Web: http://www.OpenFOAM.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/
Exec : setParabolicInlet inlet1 0.01
Date : Jan 28 2009
Time : 09:00:55
Host : linux
PID : 4916
Case : /home/ms.wankhede/OpenFOAM/ms.wankhede-1.5/mrj/parabolicinlet
nProcs : 1

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/ms.wankhede/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::sigSegv::sigSegvHandler(int) in "/home/ms.wankhede/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 ?? in "/lib64/libc.so.6"
#3 main in "/home/ms.wankhede/OpenFOAM/ms.wankhede-1.5/applications/bin/linux64GccDPOpt/set ParabolicInlet"
#4 __libc_start_main in "/lib64/libc.so.6"
#5 Foam::regIOobject::readIfModified() in "/home/ms.wankhede/OpenFOAM/ms.wankhede-1.5/applications/bin/linux64GccDPOpt/set ParabolicInlet"
Segmentation fault
ms.wankhede@linux:~/OpenFOAM/ms.wankhede-1.5/mrj/parabolicinlet>

mrj301988 January 28, 2009 04:03

this is in relation to above t
 
this is in relation to above two posts,
plz do tell me if anyone knows


gradientInternalCoeffs cannot be called for a genericFvPatchField (actual type setParabolicInput)
on patch inlet1 of field U in file "/home/ms.wankhede/OpenFOAM/ms.wankhede-1.5/mrj/parabolicVelocity/0/U"
You are probably trying to solve for a field with a generic boundary condition.

From function genericFvPatchField<type>::gradientInternalCoeffs( ) const
in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 692.

FOAM exiting

virginie_e February 18, 2009 07:27

Hello, I have compiled the
 
Hello,

I have compiled the setParabolicInlet.C given by Bernhard Gschaider. Everything seemed to compile fine. However, when I run the executable from my case file:
setParabolicInlet inlet 0.3
I get the following error:
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.5-dev |
| \ / A nd | Web: http://www.OpenFOAM.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/
Exec : setParabolicInlet inlet 0.3
Date : Feb 18 2009
Time : 13:20:25
Host : fire
PID : 4317
Case : /users/V1117324/OpenFOAM/v1117324-1.5-dev/run/planinclineprofile
nProcs : 1

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Memory fault

Does someone know what it means and how I could solve this? Thank you a lot.

Virginie

gschaider February 18, 2009 12:39

Hi Virgine! No idea. That s
 
Hi Virgine!

No idea. That stuff was written long ago (OF 1.2 or so) and never really maintained (I am amzed that it still compiles)
Have a look at
http://openfoamwiki.net/index.php/Main_FAQ#An_application_ends_with_a_segmentati on_fault._What_is_wrong.3F
and the links leading from that.

Something that wouldn't involve programming or recompiling OF would be to do something similar to
http://openfoamwiki.net/index.php/Co...t-Room_Example
using the -keepPatches-option

Bernhard

jerum March 1, 2009 11:46

Hey Bernhard I am trying to
 
Hey Bernhard

I am trying to use parabolic velocity inlet in my LES solver in a pipe flow in parallel. As far as I understood, setparabolic is not working in parallel. I tried to use Håkan parabolic inlet in wiki. It is working properly in parallel and I could get results from it. The problem is that it is not giving an axisymmetric inlet because it assumes y-coordinate as the parabola direction while z-coordinate is also needed to have its parabola.I suppose Håkan solution is not giving a axisymmetric pipe flow and designed for channel flow. Do you have any suggestion how can I modify it to make it work for pipe flow?

Thanks in advance for your kind helps and comments.

Jerum

ngj March 1, 2009 12:37

Hi Jerum I will precede Ber
 
Hi Jerum

I will precede Bernhard and give the answer:

Search the forum for "groovyBC" and apply it on your boundary. You will also find a nice wiki.

Best regard,

Niels

alki March 12, 2009 00:59

Dear OpenFoam users, I'm ne
 
Dear OpenFoam users,

I'm new with OpenFoam simulation and I'm deeply impressed about this Source but now I've a question about programing boundary conditions.

I try to implement a rotating cylinder boundary condition like a moving wall. I read a lot of possibilities to implement them into the solver icoFoam.C(Version 1.5) and I tried to do this but they didn't work. Is there anybody who can help me? Thanks a lot.

alki March 12, 2009 01:03

Dear OpenFoam users, I'm ne
 
Dear OpenFoam users,

I'm new with OpenFoam simulation and I'm deeply impressed about this Source but now I've a question about programing boundary conditions.

I try to implement a rotating cylinder boundary condition like a moving wall. I read a lot of possibilities to implement them into the solver icoFoam.C(Version 1.5) and I tried to do this but they didn't work. Is there anybody who can help me? Thanks a lot.

santos March 12, 2009 16:16

Hi Johannes, This is the co
 
Hi Johannes,

This is the code I eventually used after reading some posts here in the Discussion Board:

label patchID = mesh.boundaryMesh().findPatchID("cylinder_wall");
const polyPatch& cPatch = mesh.boundaryMesh()[patchID];
const vectorField& FaceCentres = cPatch.faceCentres();

point origin(0.5, 0.20, 0.5);
vector axis(0, 0, 1);
scalar radPerSecond(5);

const vectorField& tempRotation = radPerSecond * axis ^ (FaceCentres - origin);
U.boundaryField()[patchID] == tempRotation;


Info<< "End" << endl;
U.write();


See if it fits your needs.

Regards,
Jose Santos

alki March 13, 2009 00:41

Hi Jose, thanks a lot for y
 
Hi Jose,

thanks a lot for your answer. First I have to solve some small other problems then I will try your code. It looks good. I will let you know the result next week.

thanks again

Johannes


All times are GMT -4. The time now is 17:42.