CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Pre-Processing

Parabolic velocity profile Booundary condition

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By openfoam_user

Reply
 
LinkBack Thread Tools Display Modes
Old   April 16, 2013, 17:30
Default Parabolic velocity profile Booundary condition
  #1
New Member
 
Elisa
Join Date: Mar 2013
Posts: 11
Rep Power: 4
Guenda is on a distinguished road
Hi!

I'd like to impose parabolic profile of velocity at inlet of my 3D Y-pipes shape because I'm simulating poiseuille flow.
As the flow is driven by velocity I leave 'free' P at inlet, outlet and wall (zeroGradient). the internalField is uniform (0).

I write the following 0/U file:
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type codedFixedValue;
value $internalField;
redirectType ramp;
code
#{
scalar U_0=(0 0 0.049954); //mean U.This isn't the max velocity of the profile.
scalar r=0.02; //mean Radius. in the 3 pipes radius are different.
fixedValueFvPatchVectorField myPatch(*this);
forAll(this->patch().Cf(),i)
{
myPatch[i]=vector(2*U_0*(1-Foam:Pow(this->patch().Cf()[i].x(),2)/pow(r,2)),0,0);
}
operator==(myPatch);
#};
}
outlet
{
type zeroGradient;

}
Walls
{
type fixedValue;
value uniform (0 0 0);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * //

There should be something wrong because I have and error runing icoFoam...
Can you help me?????

thank you so much.
Guenda is offline   Reply With Quote

Old   April 17, 2013, 02:02
Default
  #2
Member
 
Akshay Kumar
Join Date: Aug 2010
Posts: 67
Rep Power: 6
Akshay is on a distinguished road
Hey Elisa
Could you post the error message?

Akshay
Akshay is offline   Reply With Quote

Old   April 17, 2013, 10:14
Default
  #3
New Member
 
Elisa
Join Date: Mar 2013
Posts: 11
Rep Power: 4
Guenda is on a distinguished road
This is the error I have:

--> FOAM FATAL IO ERROR:
Loading a shared library using case-supplied code is not enabled by default
because of security issues. If you trust the code you can enable this
facility be adding to the InfoSwitches setting in the system controlDict:

allowSystemOperations 1

The system controlDict is either

~/.OpenFOAM/$WM_PROJECT_VERSION/controlDict

or

$WM_PROJECT_DIR/etc/controlDict



file: /home/cosine/OpenFOAM/cosine-2.2.0/run/config1/0/U.boundaryField.inlet from line 35 to line 39.

From function codedBase::updateLibrary()
in file db/dynamicLibrary/dynamicCode/dynamicCode.C at line 81.

FOAM exiting

Any suggestion?
Guenda is offline   Reply With Quote

Old   April 17, 2013, 10:19
Default
  #4
Member
 
Akshay Kumar
Join Date: Aug 2010
Posts: 67
Rep Power: 6
Akshay is on a distinguished road
Hey Elisa
You need to enable the 'allowSystemOperations' switch if you want to use codestream. You should find this in the /etc/controlDict file as the error log suggests. It'll be in the InfoSwitches block. Just make it '1'.
Try this and let me know if it's working.
Cheers!
Akshay
Akshay is offline   Reply With Quote

Old   April 17, 2013, 11:38
Default
  #5
New Member
 
Elisa
Join Date: Mar 2013
Posts: 11
Rep Power: 4
Guenda is on a distinguished road
Yes, it seems working!
But I still have the problem in 0/U.boundaryField.inlet folder. Do you know the meaning of it?
The error is the following:

--> FOAM FATAL IO ERROR:
Failed wmake "dynamicCode/ramp/platforms/linux64GccDPOpt/lib/libramp_4339e3a808a66e5078fd653aa8a6180bb899c643.s o"


file: /home/cosine/OpenFOAM/cosine-2.2.0/run/config1/0/U.boundaryField.inlet from line 35 to line 39.

From function codedBase::createLibrary(..)
in file db/dynamicLibrary/codedBase/codedBase.C at line 202.

FOAM exiting

Thank you!!!
Guenda is offline   Reply With Quote

Old   April 17, 2013, 11:49
Default
  #6
Member
 
Akshay Kumar
Join Date: Aug 2010
Posts: 67
Rep Power: 6
Akshay is on a distinguished road
............
Akshay is offline   Reply With Quote

Old   April 17, 2013, 14:58
Default
  #7
New Member
 
Elisa
Join Date: Mar 2013
Posts: 11
Rep Power: 4
Guenda is on a distinguished road
Does it mean that you don't have any idea?
Guenda is offline   Reply With Quote

Old   April 17, 2013, 23:29
Thumbs up
  #8
Member
 
Akshay Kumar
Join Date: Aug 2010
Posts: 67
Rep Power: 6
Akshay is on a distinguished road
Hey
Just a few small changes here. Works for me.

#{
scalar U_0=0.049954; //mean U.This isn't the max velocity of the profile.
scalar r=0.02; //mean Radius. in the 3 pipes radius are different.
fixedValueFvPatchVectorField myPatch(*this);
forAll(this->patch().Cf(),i)
{
myPatch[i]=vector(2*U_0*(1-Foam : : pow(this->patch().Cf()[i].x(),2)/Foam : : pow(r,2)),0,0);
}
operator==(myPatch);
#};

I've intentionally given spaces between the Foam : : pow otherwise the smiley appears

Cheers!
Ak
Akshay is offline   Reply With Quote

Old   April 23, 2013, 10:52
Default
  #9
New Member
 
Elisa
Join Date: Mar 2013
Posts: 11
Rep Power: 4
Guenda is on a distinguished road
Thank you so much!

Actually I'm really confused: now I have this kind of error:

--> FOAM FATAL ERROR:
Unknown functionEntry '' in "C:/Users/Administrator/Desktop/OpenFOAM/USRNAME-1.
.0/Y/0/U" near line 48

Valid functionEntries are :

4
(
include
includeIfPresent
inputMode
remove
)


From function functionEntry::execute(const word& functionName, dictionary&
arentDict, Istream&)
in file db/dictionary/functionEntries/functionEntry/functionEntry.C at line
83.

FOAM exiting

what is the meaning of this error?? how can I try to fix it?
Sorry for all my questions!!!!

Last edited by Guenda; April 23, 2013 at 11:58.
Guenda is offline   Reply With Quote

Old   April 23, 2013, 12:26
Default
  #10
New Member
 
Elisa
Join Date: Mar 2013
Posts: 11
Rep Power: 4
Guenda is on a distinguished road
I forgot to write that as soon as the simulation starts this warning appears:

--> FOAM Warning :
From function IOstream::compressionEnum(const word&)
in file db/IOstreams/IOstreams/IOstream.C at line 74
bad compression specifier 'off', using 'uncompressed'
Create mesh for time = 0
Guenda is offline   Reply With Quote

Old   April 24, 2013, 10:03
Default
  #11
Member
 
Akshay Kumar
Join Date: Aug 2010
Posts: 67
Rep Power: 6
Akshay is on a distinguished road
well well well...i'll need to look at your U file. send it across..and also your controlDict.
Akshay is offline   Reply With Quote

Old   April 24, 2013, 11:50
Default
  #12
New Member
 
Elisa
Join Date: Mar 2013
Posts: 11
Rep Power: 4
Guenda is on a distinguished road
I should have fixed the 'warning' changing in controlDict 'writeCompression off;' in 'uncompressed;'. I don't have that warning but I still have the error.

My 0/U file is:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
inlet
{
//type zeroGradient; //for simpleFOAM

//type freestream;
//freestreamValue uniform (0 0 0 4.94745);

//uniche condizioni x cui si ha qlc:
//type fixedValue; //pressureInletVelocity;
//value uniform (0 0 0.049954); //codice matlab 1/3

//Profilo parabolico
type codedFixedValue;
value $internalField;
redirectType ramp;
code
#{
scalar U_0=0.049954; //Umean
scalar r=11.75; //radius
fixedValueFvPatchVectorField myPatch(*this);
forAll (this->patch().Cf(),i)
{
myPatch[i]=vector(2*U_0*(1-Foam:: pow(this->patch(),Cf()[i].x(),2)/Foam:: pow(r,2)),0,0);
}
operator==(myPatch);
#};
}

outlet
{
type zeroGradient; //freestream;

//freestreamValue uniform (0 0 1.44048);

//type fixedValue;
//value uniform (0 0 0.0716);
}

wall
{
//type zeroGradient;

type fixedValue;
value uniform (0 0 0);
}

//defaultFaces
//{
// type zeroGradient;
// }
}

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

and controlDict:

application icoFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 0.5;

deltaT 0.067909;

writeControl timeStep;

writeInterval 1;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

thank you!
Guenda is offline   Reply With Quote

Old   May 14, 2013, 06:11
Default
  #13
New Member
 
Elisa
Join Date: Mar 2013
Posts: 11
Rep Power: 4
Guenda is on a distinguished road
Now I am thinking: could my error come from the old version of OpenFOAM that I'm using? I mean, is it possibile to create a parbolic profile in the openFOAM 1.7.0 version??

Thank you!!!
Guenda is offline   Reply With Quote

Old   May 15, 2013, 03:02
Default
  #14
Senior Member
 
stephane sanchi
Join Date: Mar 2009
Posts: 300
Rep Power: 9
openfoam_user is on a distinguished road
Hi Guenda,

I think it is easier if you use swak4foam capability.

Have a look at the following link (4.2.2 Swirl on inlet)
http://openfoamwiki.net/index.php/Contrib_groovyBC

Add following lines in your 0/U file:

INLET
{
type groovyBCFixedValue;
variables (
"velIn=0.05;" //velIn is the normal mean inlet velocity
"c=sum(pos()*mag(Sf()))/sum(mag(Sf()));" //c is the centre of the patch
"n=sum(normal())/mag(sum(normal()));" //n is the averaged patch normal
"pp=pos()-c;"
"r=mag(pp)+1.0e-10;"
"R=max(r);"
);
valueExpression "-velIn*normal()*(1-pow(r/R,2))";
value uniform (0.05 0 0);
}

And add following lines in your system/controlDict file:

libs (
"libOpenFOAM.so"
"libgroovyBC.so"
"libgroovyStandardBCs.so"
"libsimpleFunctionObjects.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
) ;

Regards,
Stephane.
gregjunqua likes this.
openfoam_user is offline   Reply With Quote

Old   October 30, 2013, 07:14
Default
  #15
Member
 
sandy
Join Date: Mar 2013
Location: Cardiff, UK
Posts: 71
Rep Power: 4
sandy13 is on a distinguished road
Dear openfoam_user,
I had a look at your post no #14 in this thread. Because I need a 3D B.C parabolic for my inlet velocity, so I used your code for my solver interFoam with OF2.1.1. It works very well but I have a question about it. When I visualize the velicity profile with paraFoam, i do not get the parabolic profile for the time step 0, but once I start the simulation I get it directly for the first time step(after 0). Is this correct? should not we get it from the 0 time step we we visualize?
Thank you so much in advance..
Sandy13,
sandy13 is offline   Reply With Quote

Old   October 30, 2013, 07:21
Default
  #16
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by sandy13 View Post
Dear openfoam_user,
I had a look at your post no #14 in this thread. Because I need a 3D B.C parabolic for my inlet velocity, so I used your code for my solver interFoam with OF2.1.1. It works very well but I have a question about it. When I visualize the velicity profile with paraFoam, i do not get the parabolic profile for the time step 0, but once I start the simulation I get it directly for the first time step(after 0). Is this correct? should not we get it from the 0 time step we we visualize?
Thank you so much in advance..
Sandy13,
The problem is that the paraview reader does not "understand" complicated boundary conditions. It needs the value-field to be set. If it is fixed in time you can work around by copying it over from a later time-step with a text editor (just the value-entry)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   October 30, 2013, 07:54
Default
  #17
Senior Member
 
stephane sanchi
Join Date: Mar 2009
Posts: 300
Rep Power: 9
openfoam_user is on a distinguished road
Dear Sandy13,

I have checked one of my computations. You are right. At time step 0 sec you don't have the parabolic profile yet. Only the following velocity values are imposed (from my above example): value uniform (0.05 0 0).

Best regards,
Stephane.
openfoam_user is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
parabolic inlet velocity condition ofslcm OpenFOAM Programming & Development 12 February 5, 2014 01:30
velocity profile inlet boundary condition question Lcw FLUENT 3 August 3, 2012 05:53
2D air parabolic velocity profile ilker FLUENT 2 November 12, 2008 09:43
How to create a parabolic velocity profile Nelson FLUENT 0 July 7, 2005 02:49
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 02:13


All times are GMT -4. The time now is 14:20.