|
[Sponsors] |
[swak4Foam] Inlet velocity profile for turbulent pipe flow using swak4Foam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
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: 87
Rep Power: 14 |
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 } PS: swak4Foam development version compiles for OpenFOAM-2.3.x and at least groovyBC is working fine |
|
April 7, 2014, 00:08 |
|
#2 |
New Member
IN
Join Date: Mar 2014
Posts: 9
Rep Power: 12 |
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, 04:18 |
|
#3 |
Member
Pekka Pasanen
Join Date: Feb 2012
Location: Finland
Posts: 87
Rep Power: 14 |
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. |
|
October 1, 2015, 17:27 |
|
#4 |
Senior Member
|
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) 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 Thank you very much. Last edited by student666; October 1, 2015 at 22:15. |
|
February 21, 2016, 23:52 |
|
#5 |
New Member
Mitchell Baum
Join Date: Sep 2015
Location: Australia
Posts: 7
Rep Power: 11 |
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
|
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
|
|
|
|
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 |