# Inlet velocity profile for turbulent pipe flow using swak4Foam

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

 March 21, 2014, 09:47 Inlet velocity profile for turbulent pipe flow using swak4Foam #1 Member   Pekka Pasanen Join Date: Feb 2012 Location: Finland Posts: 78 Rep Power: 7 Sponsored Links Hi, I wanted a fully developed inlet velocity profile for my 3D-case and I decided to implement it using swak4Foam since I couldn't figure out how to do it with native OpenFOAM tools. So, I thought I'd share my solution here since it took me a while to figure it out. Please note that in my case the inlet pipe centerline run along the y-axis, but it should by easy enough to modify for other cases too. Turbulent velocity profile is calculated using the power law formulation. Code: ``` pipe_inlet { type groovyBC; value uniform (0 0 0); variables ( "n=7;" //power law coefficient n "d=0.125;" //pipe diameter "volFlowRate=0.1;" //volumetric flow rate "Umean=volFlowRate/(pi*pow((d/2),2));" //calculate mean velocity "Umax=Umean*(((n+1)*(2*n+1))/(2*pow(n,2)));" //calculate max velocity "profile=Umax*pow(1-sqrt(pow(pos().x,2)+pow(pos().z,2))/(d/2),(1/n));" //calcucate power law velocity profile Umax*(1-r/R)^(1/n) ); valueExpression "normal()*-profile"; //apply to boundary, normal() is surface normal vector and minus is needed for inflow }``` I hope someone finds this useful PS: swak4Foam development version compiles for OpenFOAM-2.3.x and at least groovyBC is working fine philippose, nashiong, jherb and 5 others like this.

 April 6, 2014, 23:08 #2 New Member   IN Join Date: Mar 2014 Posts: 9 Rep Power: 5 Hi Zor, Do we have to make any other change in any other folder or the code which you have given is good enough to implement the fully-developed boundary condition? Thanks, Rohit

 April 7, 2014, 03:18 #3 Member   Pekka Pasanen Join Date: Feb 2012 Location: Finland Posts: 78 Rep Power: 7 You need to install swak4Foam according to instructions. Files that need to be mofidied are 0/U and system/controlDict (add swak4Foam libs, which is shown in the installation instructions). Last edited by zordiack; April 9, 2014 at 07:02.

 October 1, 2015, 16:27 #4 Senior Member   M. C. Join Date: May 2013 Location: Italy Posts: 225 Rep Power: 10 Hi, hope someone helps me as this thread is quite old... Anyway, I set the inlet profile for my pipe simulation according to the upper BC for inlet. When I set the power law coefficient as 1/n<1, simpleFoam crashes (floating point exception). For values 1/n>= 1, simpleFoam works fine, but my inlet profile isn't real. this is my error: Code: ```Time = 1 #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 in "/lib/x86_64-linux-gnu/libc.so.6" #3 in "/lib/x86_64-linux-gnu/libm.so.6" #4 pow in "/lib/x86_64-linux-gnu/libm.so.6" #5 Foam::pow(Foam::Field&, Foam::UList const&, Foam::UList const&) at ??:? #6 Foam::pow(Foam::UList const&, Foam::UList const&) at ??:? #7 parserPatch::PatchValueExpressionParser::parse() at ??:? #8 Foam::PatchValueExpressionDriver::parseInternal(int) at ??:? #9 Foam::CommonValueExpressionDriver::parse(Foam::exprString const&, Foam::word const&) at ??:? #10 Foam::CommonValueExpressionDriver::evaluateVariable(Foam::word const&, Foam::exprString const&) at ??:? #11 Foam::CommonValueExpressionDriver::addVariables(Foam::exprString const&, bool) at ??:? #12 Foam::CommonValueExpressionDriver::addVariables(Foam::List const&, bool) at ??:? #13 Foam::CommonValueExpressionDriver::clearVariables() at ??:? #14 Foam::groovyBCFvPatchField >::updateCoeffs() at ??:? #15 Foam::GeometricField, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::updateCoeffs() at ??:? #16 Foam::fvMatrix >::fvMatrix(Foam::GeometricField, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) at ??:? #17 at ??:? #18 at ??:? #19 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #20 at ??:? Floating point exception (core dumped)``` can't really uderstand why I have this error, can someone help me please? this is my check Mesh -allGeometry -allTopolgy log Code: ```............ ***Cells with small determinant (< 0.001) found, number of cells: 100 <

 February 21, 2016, 23:52 #5 New Member   Mitchell Baum Join Date: Sep 2015 Location: Australia Posts: 7 Rep Power: 3 Hi student666, I have just encountered the same error. Have you made any progress on this since your last post? Regards, Mitch

February 23, 2016, 02:52
#6
Senior Member

M. C.
Join Date: May 2013
Location: Italy
Posts: 225
Rep Power: 10
Quote:
 Originally Posted by Mitchell Baum Hi student666, I have just encountered the same error. Have you made any progress on this since your last post? Regards, Mitch
My issue was related to a very small cell size. I solevd it by meshing with dimension of the cells bigger. hope it can helps you. Cheers

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Sing FLUENT 11 October 24, 2016 04:49 mqasimali FLUENT 2 April 12, 2013 17:24 alinve OpenFOAM 2 April 3, 2012 00:25 ib FLUENT 1 March 26, 2007 13:11 Nelson Main CFD Forum 3 July 27, 2005 12:05