CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] Inlet velocity profile for turbulent pipe flow using swak4Foam

Register Blogs Community New Posts Updated Threads Search

Like Tree10Likes
  • 10 Post By zordiack

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2014, 09:47
Default Inlet velocity profile for turbulent pipe flow using swak4Foam
  #1
Member
 
Pekka Pasanen
Join Date: Feb 2012
Location: Finland
Posts: 87
Rep Power: 14
zordiack is on a distinguished road
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
zordiack is offline   Reply With Quote

Old   April 7, 2014, 00:08
Default
  #2
New Member
 
IN
Join Date: Mar 2014
Posts: 9
Rep Power: 12
rohitpurdue is on a distinguished road
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
rohitpurdue is offline   Reply With Quote

Old   April 7, 2014, 04:18
Default
  #3
Member
 
Pekka Pasanen
Join Date: Feb 2012
Location: Finland
Posts: 87
Rep Power: 14
zordiack is on a distinguished road
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 08:02.
zordiack is offline   Reply With Quote

Old   October 1, 2015, 17:27
Default
  #4
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
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<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:?
#6  Foam::pow(Foam::UList<double> const&, Foam::UList<double> 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<Foam::exprString> const&, bool) at ??:?
#13  Foam::CommonValueExpressionDriver::clearVariables() at ??:?
#14  Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() at ??:?
#15  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::updateCoeffs() at ??:?
#16  Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<double>, 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
  <<Writing 100 under-determined cells to set underdeterminedCells
    ..............
Failed 1 mesh checks.

End
are those 100 cells giving me the error?

Thank you very much.

Last edited by student666; October 1, 2015 at 22:15.
student666 is offline   Reply With Quote

Old   February 21, 2016, 23:52
Default
  #5
New Member
 
Mitchell Baum
Join Date: Sep 2015
Location: Australia
Posts: 7
Rep Power: 11
Mitchell Baum is on a distinguished road
Hi student666,

I have just encountered the same error. Have you made any progress on this since your last post?

Regards,
Mitch
Mitchell Baum is offline   Reply With Quote

Old   February 23, 2016, 02:52
Default
  #6
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
Quote:
Originally Posted by Mitchell Baum View Post
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
student666 is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have spatially varying inlet velocity profile for a multiphase flow orjankv OpenFOAM Pre-Processing 3 October 5, 2017 10:16
UDF for 3d velocity inlet profile in channel flow Thejas4ansys Fluent UDF and Scheme Programming 0 April 1, 2016 16:09
How to define a fixed velocity for a given mass flow rate on inlet mqasimali FLUENT 2 April 12, 2013 18:24
How to apply an outlet velocity profile to another inlet? siw FLUENT 4 April 10, 2013 12:19
reversed flow at velocity inlet / mass flow inlet ib FLUENT 1 March 26, 2007 14:11


All times are GMT -4. The time now is 07:48.