Parabolic velocity profile Booundary condition
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?????:confused: thank you so much. |
Hey Elisa
Could you post the error message? Akshay |
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? |
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 |
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!!! |
............
|
:eek: Does it mean that you don't have any idea?
|
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 :p Cheers! Ak |
Thank you so much!
Actually I'm really confused: now I have this kind of error: :mad: --> 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? :confused: Sorry for all my questions!!!! :( |
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 |
well well well...i'll need to look at your U file. send it across..and also your controlDict.
|
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! :) |
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?? :confused:
Thank you!!! |
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. |
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, |
Quote:
|
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. |
Parabolic velocity profile for rectangular ducts
Quote:
Hello Stephane, I am simulating flow through a T-junction (with one inlet & 2 outlets; with 2 inlets & 1 outlet as well). I need to implement fully developed condition at the inlet(s). I think the above code provided by you is for circular cross sections. But, the cross-section in my geometry is a square one. So, I request you to let me know how to provide the fully developed conditions at inlet for square cross-section pipes. Thanks & Regards, vidyadhar |
Quote:
|
All times are GMT -4. The time now is 23:35. |