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

[swak4Foam] Power law inlet velocity using groovyBC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 11, 2013, 23:34
Default Power law inlet velocity using groovyBC
  #1
New Member
 
NF
Join Date: Jul 2013
Posts: 2
Rep Power: 0
aviator is on a distinguished road
Hi all,

I am using OpenFOAM 2.2.1 and have installed swak4Foam 0.2.4

I need to use a power law as an inlet velocity, and the outlet wind profile is set same as the inlet wind profile.

This is my 0/U
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.2.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform (6.751 0 0);

boundaryField
{
    upper
    {
        type            fixedValue;
        value           uniform (6.751 0 0);
    }

    front
    {
      type    groovyBC;
      value   uniform (0 0 0);
      variables (
    "Umet=6.751;"
    "height=pos().y;"
    "quo=height/60;"
      );
       
       valueExpression
             "-Umet*pow(quo,0.2)*normal()";
    }
    back
    {
      type    groovyBC;
      value   uniform (0 0 0);
      variables (
    "Umet=6.751;"
    "height=pos().y;"
    "quo=height/60;"
      );

       valueExpression
             "-Umet*pow(quo,0.2)*normal()";
    }

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

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


    right
    {
        type            symmetryPlane;
    }
    left
    {
        type            symmetryPlane;
    }
}

// ************************************************************************* //
But I got the following error.

Code:
swak4Foam: Allocating new repository for sampledGlobalVariables
#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2   in "/lib/x86_64-linux-gnu/libc.so.6"
#3   in "/lib/x86_64-linux-gnu/libm.so.6"
#4  Foam::pow(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#5  Foam::pow(Foam::UList<double> const&, Foam::UList<double> const&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#6  parserPatch::PatchValueExpressionParser::parse() in "/home/openfoam/OpenFOAM/openfoam-2.2.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#7  Foam::PatchValueExpressionDriver::parseInternal(int) in "/home/openfoam/OpenFOAM/openfoam-2.2.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#8  Foam::CommonValueExpressionDriver::parse(std::string const&, Foam::word const&) in "/home/openfoam/OpenFOAM/openfoam-2.2.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#9  Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() in "/home/openfoam/OpenFOAM/openfoam-2.2.1/platforms/linux64GccDPOpt/lib/libgroovyBC.so"
#10   at gaussLaplacianSchemes.C:0
#11  Foam::fv::gaussLaplacianScheme<Foam::Vector<double>, double>::fvmLaplacianUncorrected(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#12  Foam::fv::gaussLaplacianScheme<Foam::Vector<double>, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#13  Foam::fv::laplacianScheme<Foam::Vector<double>, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#14  Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libincompressibleTurbulenceModel.so"
#15  Foam::incompressible::RASModels::kOmegaSST::divDevReff(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) const in "/opt/openfoam221/platforms/linux64GccDPOpt/lib/libincompressibleRASModels.so"
#16  
 in "/opt/openfoam221/platforms/linux64GccDPOpt/bin/pisoFoam"
#17  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#18  
 in "/opt/openfoam221/platforms/linux64GccDPOpt/bin/pisoFoam"
Floating point exception (core dumped)
Can someone please clarify this. I am fairly new to OpenFOAM and would appreciate your help. Thank you.
aviator is offline   Reply With Quote

Old   November 12, 2013, 10:53
Default
  #2
Member
 
Duong A. Hoang
Join Date: Apr 2009
Location: Delft, Netherlands
Posts: 93
Rep Power: 17
duongquaphim is on a distinguished road
Send a message via Yahoo to duongquaphim
First, do you have negative coordinate in y direction eg. pos().y < 0? If not, then try Foam:ow instead of pow only.
duongquaphim is offline   Reply With Quote

Old   November 12, 2013, 22:02
Default
  #3
New Member
 
NF
Join Date: Jul 2013
Posts: 2
Rep Power: 0
aviator is on a distinguished road
Thank you for pointing that out.

After reading your comment, I think that I made a mistake. I should've use the z-coordinate, which is the height, since the inlet velocity varies at different height. My z-coordinate is always positive. Then I changed the code into something like this.

Code:
    front
    {
      type    groovyBC;
      value   uniform (0 0 0);
      variables "Umet=6.751;height=pos().z;";
      valueExpression "Umet*pow((height/60),0.2)*normal()";
             
    }
And it's running.

I did this assuming that pos().z would give me a vector of z-coordinate though. And by assuming that multiplying the equation with normal() would give me the velocity in the x-direction. Please let me know if this is not correct.

Thank you.
aviator is offline   Reply With Quote

Old   November 13, 2013, 11:50
Default
  #4
Member
 
Duong A. Hoang
Join Date: Apr 2009
Location: Delft, Netherlands
Posts: 93
Rep Power: 17
duongquaphim is on a distinguished road
Send a message via Yahoo to duongquaphim
I think that's correct assuming your normal() is (1,0,0). What you can do to check is to visualize the velocity profile at the inlet at the next saved time step in paraview.

Cheers.
duongquaphim is offline   Reply With Quote

Reply

Tags
groovybc


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
Difficulty in calculating angular velocity of Savonius turbine simulation alfaruk CFX 14 March 17, 2017 07:08
[swak4Foam] Scale discrete inlet velocity profile with groovyBC cboss OpenFOAM Community Contributions 1 June 20, 2010 14:02
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 03:13
UDF problem : inlet velocity in cyl. coord. system Jongdae Kim FLUENT 0 June 15, 2004 12:21
UDF paraboloid velocity inlet Ronak Shah FLUENT 0 June 4, 2003 10:44


All times are GMT -4. The time now is 10:35.