CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Volume flow rate boundary condition in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 4, 2013, 16:44
Default Volume flow rate boundary condition in OpenFOAM
  #1
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14
mayank.dce2k7 is on a distinguished road
Hi,

I am new to OpenFOAM and I facing problems in setting volume flow rate boundary conditions that varies with time.

I am doing a transient simulation on a single bifurcating tube. The inlet has time varying volume flow rate (velocity profile at inlet is time varying parabola). At one outlet I want the outgoing volume flow rate to be 0.52 times that of inlet and at the other outlet to be 0.48 times that of inlet at each time step. Also, velocity sometimes goes negative so it also encounters reverse flow.

Earlier I ran a steady state simulation using simpleFoam and groovyBC on the same geometry setting a steady parabolic velocity(not flow rate) profile at inlet. It ran with success. But when it comes to setting volume flow rate boundary condition using groovy I am facing trouble. Do I have to use "type" as "groovyBC" or change to "type" as "groovyFlowRateInletVelocity" for setting volume flow rate at inlet and outlet patches?
When I use "groovyFlowRateInletVelocity" it does not seem to recognize variable defined on remote patches like "yp@INLET=pos().y", now when I use 'yp' later to define expression on outlet it doesn't recognizes "yp" so how should I access variables from other patches in case using "groovyFlowRateInletVelocity"?

Can someone please tell me a way to go about in performing this kind of transient simulation?

P.S- I am not at all good with C++ so I am trying to implement BCs using groovy.

Regards,
Mayank
mayank.dce2k7 is offline   Reply With Quote

Old   July 4, 2013, 18:01
Default
  #2
Member
 
Daniel Pielmeier
Join Date: Apr 2012
Posts: 99
Rep Power: 14
billie is on a distinguished road
Quote:
Originally Posted by mayank.dce2k7 View Post
But when it comes to setting volume flow rate boundary condition using groovy I am facing trouble. Do I have to use "type" as "groovyBC" or change to "type" as "groovyFlowRateInletVelocity" for setting volume flow rate at inlet and outlet patches?
When I use "groovyFlowRateInletVelocity" it does not seem to recognize variable defined on remote patches like "yp@INLET=pos().y", now when I use 'yp' later to define expression on outlet it doesn't recognizes "yp" so how should I access variables from other patches in case using "groovyFlowRateInletVelocity"?
According to the http://openfoamwiki.net/index.php/Co...oam/README_2.x groovyFlowRateInletVelocity is discontinued.
As for the flow rate you can use type groovy and something like this:
Code:
velocity=flowRate/area()
Where flow rate is your desired flow rate and area() is the patch area. I don't know if there is a better way but something like this worked for me.

I have not used this feature myself but you should be able to access the other patches like you described above.
billie is offline   Reply With Quote

Old   July 5, 2013, 18:35
Default
  #3
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14
mayank.dce2k7 is on a distinguished road
So I guess I need to provide more details on my case so that people can help.

Below are my case file and also I have attached an image of the geometry. But this time I am trying a steady steady state simulation using simpleFoam.

0/U

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.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 (0 0 0);

boundaryField
{
    INLET
    {         
  
     type                            flowRateInletVelocity;
     flowRateExpression       "0";
     flowRate         swak { 
     expression "area()*0.3518"; // incoming volume flow rate from inlet based on mean   inlet velocity 
            valueType patch;
            patchName INLET;
        };
     value           uniform ( 0 0 0 );
 
    }

    OUTLET1
    {
       type            flowRateInletVelocity;
     
     flowRateExpression "0";
flowRate swak { 
variables "area1@INLET=area();";
            expression "-0.52*area1*0.3518"; // volume flow going out of domain from outlet 1
            valueType patch;
            patchName OUTLET1;
};
     value           uniform ( 0 0 0 );
    }
OUTLET2
    {
       type            flowRateInletVelocity;
    
     flowRateExpression "0";
flowRate swak { 
variables        "area2@INLET=area();"; // going out of domain from outlet 2
            expression "-0.42*area2*0.3518";
            valueType patch;
            patchName OUTLET2;
};
     value           uniform ( 0 0 0 );
    }

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

   
}

// ************************************************************************* //
0/p

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    INLET
    {
        type            zeroGradient;
    }

    OUTLET1
    {
      type            zeroGradient;
    }
   
    OUTLET2
    {
       type            zeroGradient;
    }  

    WALL
    {
        type            zeroGradient;
    }

    
}

// ************************************************************************* //
ContolDict

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

libs ( "libOpenFOAM.so" "libgroovyBC.so" "libgroovyStandardBCs.so" "libswak4FoamParsers.so") ;

application     simpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         100;

deltaT          0.005;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

functions {
    initSwak {
        // needed to allow DataEntry to work
        type initSwakFunctionObject;
        region region0;
    }
};


// ************************************************************************* //
When I run the case I am getting following error in terminal:

Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model laminar
No field sources present


SIMPLE: convergence criteria
field p tolerance 1e-05
field U tolerance 1e-05
field nuTilda tolerance 1e-05


Starting time loop

Time = 0.005

swak4Foam: Allocating new repository for sampledGlobalVariables
--> FOAM Warning :
From function ConcretePluginFunction<DriverType>::exists
in file lnInclude/ConcretePluginFunction.C at line 111
Constructor table of plugin functions for PatchValueExpressionDriver is not initialized


--> FOAM FATAL ERROR:
Parser Error for driver PatchValueExpressionDriver at "1.7-11" :"field area1 not existing or of wrong type"
"-0.52*area1*0.3518"
^^^^^
--------|

Context of the error:


- From dictionary:
Evaluating expression "-0.52*area1*0.3518"


From function parsingValue
in file lnInclude/CommonValueExpressionDriverI.H at line 1039.

FOAM exiting


I know I have done some insanely stupid things but please guys help me understand my mistakes......This is a real learning opportunity for me.
Attached Images
File Type: jpg bifurcation.jpg (11.0 KB, 269 views)
mayank.dce2k7 is offline   Reply With Quote

Old   July 6, 2013, 01:46
Default
  #4
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14
mayank.dce2k7 is on a distinguished road
ok, solved one problem the syntax in current version with swak4Foam has changed to <variable name> {<patch name>}=<expression> rather than <variable name>@<patch name>=<expression>
mayank.dce2k7 is offline   Reply With Quote

Old   July 6, 2013, 04:07
Default
  #5
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14
mayank.dce2k7 is on a distinguished road
So I went ahead and changed the syntax and got a converged steady state solution. But I am not getting satisfactory results.

now my 0/U file looks like below but rest of the files remain same as posted above:

0/U

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.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 (0 0 0);

boundaryField
{
    INLET
    {
                  
  
     type            flowRateInletVelocity;
     flowRateExpression "0";
flowRate         swak { 
            expression "0.3518*area()"; // incoming volume flow rate from inlet based on mean inlet velocity 
            valueType patch;
            patchName INLET;
        };
     value           uniform ( 0 0 0 );
 
    }

    OUTLET1
    {
       type            flowRateInletVelocity;
     flowRateExpression "0";
flowRate swak { 
            variables "area1{INLET}=area();"; 
            expression "-0.52*area1*0.3518"; // volume flow going out of domain from outlet 1
            valueType patch;
             patchName OUTLET1;
};
     value           uniform ( 0 0 0 );
    }
OUTLET2
    {
       type            flowRateInletVelocity;
     flowRateExpression "0";
flowRate swak { 
            variables        "area2{INLET}=area();"; 
            expression "-0.48*area2*0.3518";
            valueType patch;
            patchName OUTLET2;
};
     value           uniform ( 0 0 0 );
    }

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

   
}

// ************************************************************************* //
The terminal shows following:

Time = 0.39

--> FOAM Warning :
From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 324
The minimum value 1.37739e-05 and the maximum 5.99827e-05 differ. I will use the average 3.66384e-05
--> FOAM Warning :
From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 324
The minimum value 1.37739e-05 and the maximum 5.99827e-05 differ. I will use the average 3.66384e-05
smoothSolver: Solving for Ux, Initial residual = 1.16172e-06, Final residual = 4.74177e-08, No Iterations 4
smoothSolver: Solving for Uy, Initial residual = 1.43494e-06, Final residual = 6.6445e-08, No Iterations 4
smoothSolver: Solving for Uz, Initial residual = 2.8996e-06, Final residual = 6.96369e-08, No Iterations 4
GAMG: Solving for p, Initial residual = 9.54405e-06, Final residual = 4.09708e-07, No Iterations 2
time step continuity errors : sum local = 8.50625e-10, global = 4.95172e-20, cumulative = 5.0987e-18
--> FOAM Warning :
From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 324
The minimum value 1.37739e-05 and the maximum 5.99827e-05 differ. I will use the average 3.66384e-05
--> FOAM Warning :
From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 324
The minimum value 1.37739e-05 and the maximum 5.99827e-05 differ. I will use the average 3.66384e-05
ExecutionTime = 2.16 s ClockTime = 2 s


SIMPLE solution converged in 0.39 iterations


Can somebody please explain me the meaning of these warnings, how they affect the solution and how to remove them?
mayank.dce2k7 is offline   Reply With Quote

Old   July 6, 2013, 14:20
Default
  #6
Member
 
Daniel Pielmeier
Join Date: Apr 2012
Posts: 99
Rep Power: 14
billie is on a distinguished road
I don't think you need to use area () when you use the flowRateInletVelocity boundary condition as the value you specify is already the flow rate. So for this case you probably wont need the swak expression at all and you can use plain flowRateInletVelocity.
billie is offline   Reply With Quote

Old   July 6, 2013, 23:47
Default
  #7
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14
mayank.dce2k7 is on a distinguished road
Hi Daniel,

First of all, thanks for your replies.

Yes, I can do it just by placing values. But my real aim is to perform transient simulation in which inlet flow field depends both on time and space coordinates of inlet patch. I find groovy/swak4Foam a good tool as it provides freedom of inputting flow fields in the form of expression which is generally required. It gave me good results in first place when I specified a parabolic inlet velocity profile at inlet but I don't know whats wrong with flowRateInletVelocity. Basically what I am trying to do is that I am imposing Poiseuille flow (2*Uavg*(R^2-r^2)/R^2))) at the inlet and imposing volume flow rate condition at outlet i.e on one outlet volume flow rate is 0.52 times that on inlet and on the other outlet it is 0.48 time the inlet. I modified 0/U a little:

0/U

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.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 (0 0 0);

boundaryField
{
    INLET
    {
       type            groovyBC;
     variables "r2=(pow(pos().x,2)+pow(pos().z,2));R2=area()/pi;para=-((R2-r2)/R2)*normal();";
     valueExpression "2*0.351*para"; //where 0.351 is the average velocity
     value        uniform (0 0 0);           
    }

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

    OUTLET1
    {
       type            flowRateInletVelocity;
     flowRateExpression "0";
flowRate swak { 
            variables "area1{INLET}=area();flow1= -0.52*area1*0.351;"; 
            expression "flow1"; // volume flow going out of domain from outlet 1 which 0.52 times that at inlet
            valueType patch;
            patchName OUTLET1;
};
     value           uniform ( 0 0 0 );
    }

    OUTLET2
    {
       type            flowRateInletVelocity;
     flowRateExpression "0";
flowRate swak { 
            variables "area2{INLET}=area();flow2= -0.48*area2*0.351;"; // volume flow going out of domain from outlet 2 which 0.48 times that at inlet
            expression "flow2";
            valueType patch;
            patchName OUTLET2;
};
     value           uniform ( 0 0 0 );
    }


    

   
}

// ************************************************************************* //
My 0/p file remains unchanged:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    INLET
    {
        type            zeroGradient;
    }

    OUTLET1
    {
      type            zeroGradient;
    }
   
    OUTLET2
    {
       type            zeroGradient;
    }  

    WALL
    {
        type            zeroGradient;
    }

    
}

// ************************************************************************* //
I am getting following error and warnings:

Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model laminar
No field sources present


SIMPLE: convergence criteria
field p tolerance 1e-05
field U tolerance 1e-05
field nuTilda tolerance 1e-05


Starting time loop

Time = 0.005

swak4Foam: Allocating new repository for sampledGlobalVariables
--> FOAM Warning :
From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 324
The minimum value 3.51015e-06 and the maximum 1.85231e-05 differ. I will use the average 1.09453e-05
--> FOAM Warning :
From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 324
The minimum value 3.51015e-06 and the maximum 1.85231e-05 differ. I will use the average 1.09453e-05
smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 0.0267623, No Iterations 4
smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 0.022866, No Iterations 4
smoothSolver: Solving for Uz, Initial residual = 1, Final residual = 0.0548532, No Iterations 2


--> FOAM FATAL ERROR:
Continuity error cannot be removed by adjusting the outflow.
Please check the velocity boundary conditions and/or run potentialFoam to initialise the outflow.
Total flux : 0.035612
Specified mass inflow : 0.0439753
Specified mass outflow : 1.32494e-05
Adjustable mass outflow : 0


From function adjustPhi(surfaceScalarField& phi, const volVectorField& U,const volScalarField& p
in file cfdTools/general/adjustPhi/adjustPhi.C at line 118.

FOAM exiting

First of all why is it referring 'mass inflow' since simpleFoam is a incompressible solver I am inputting volume flow rate and not mass flow rate. Second why there is a difference in inlet and total outlet flow rates.

Can somebody help me resolve it?
mayank.dce2k7 is offline   Reply With Quote

Old   July 7, 2013, 04:54
Default
  #8
Member
 
Daniel Pielmeier
Join Date: Apr 2012
Posts: 99
Rep Power: 14
billie is on a distinguished road
Okay I did not read carefully your previous posts and there were some misunderstanding on my side.

I have to take a closer look at this but currently don't have the time. Maybe someone else can help you in the meantime.

Last edited by billie; July 7, 2013 at 05:05. Reason: Nonsense
billie is offline   Reply With Quote

Old   July 8, 2013, 12:47
Default
  #9
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14
mayank.dce2k7 is on a distinguished road
I am trying to make my 0/U file as compact as possible. A new version is below:

Code:
0/U

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.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 (0 0 0);

boundaryField
{
    INLET
    {

       type            groovyBC;
       variables "r2=(pow(pos().x,2)+pow(pos().z,2));R2=area()/pi;para=-((R2-r2)/R2)*normal();";
       valueExpression "2*0.351*para"; //where 0.351 is the average velocity
       value        uniform (0 0 0);      
     
    }

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

    OUTLET1
    {

        type            flowRateInletVelocity;
        flowRateExpression "0";
        flowRate swak { 
            variables "phi1{INLET}=-0.52*phi;"; 
            expression "phi1"; // volume flow going out of domain from outlet 1 which 0.52 times that at inlet
            valueType patch;
            patchName OUTLET1;};

     value           uniform ( 0 0 0 );
    }

    OUTLET2
    {

       type            flowRateInletVelocity;
        flowRateExpression "0";
        flowRate swak { 
            variables "phi2{INLET}=-0.48*phi;"; 
            expression "phi2"; // volume flow going out of domain from outlet 1 which 0.52 times that at inlet
            valueType patch;
            patchName OUTLET1;};

     value           uniform ( 0 0 0 );
    }


    

   
}

// ************************************************************************* //
My 0/p file and controlDict remains same as in numerous previous post

I am applying simple math:

Flow rate @ inlet= 0.52*Flow rate @ inlet on the patch outlet 1 + 0.48 times* Flow rate @ inlet on the patch outlet 2..........i dunno why its not working. Help please!

Mayank.
mayank.dce2k7 is offline   Reply With Quote

Old   February 21, 2014, 11:32
Default outflow u: flowRateInletVelocity (with negative value) p: zeroGradient ??
  #10
New Member
 
RB
Join Date: Aug 2013
Posts: 5
Rep Power: 13
rbaud is on a distinguished road
Hi,

Sorry to dig up this thread, but have you been any further in your understanding of your problem?

I won't be really helpful, but I will ask you more questions:
I'm trying to figure out how to set properly an outflow with flowRateInletVelocity.

Are you sure of the boundary combination for "multiple" outflow (pointing out of the domain), knowing the inlet has been set with u: flowRateInletVelocity, p: zeroGradient):

Outflow:
u: flowRateInletVelocity (with a negative value, as the flow leave the domain).
p: zeroGradient?

Shouldn't at least one of the outflow be set with a fixedValue pressure / zeroGradient velocity?

Thanks for sharing your progress and experience,
Regards,
Remi
rbaud is offline   Reply With Quote

Old   March 31, 2014, 07:46
Default
  #11
Senior Member
 
sivakumar selvaraju
Join Date: Mar 2009
Location: India
Posts: 205
Rep Power: 18
sivakumar is on a distinguished road
Send a message via Skype™ to sivakumar
Hi,
I am not sure, how good i understood your question.


the standard setting is;

0/U :

inlet

type flowRateInletVelocity;
flowRate 2; // Volumetric/mass flow rate [m3/s or kg/s]
value uniform (0 0 0);

outlet

outlet
{
type zeroGradient;
}

For pressure:

inlet
{
type zeroGradient;
}

outlet
{
type fixedValue;
value uniform 0;
}

Thanks,
Sivakumar
sivakumar is offline   Reply With Quote

Old   April 29, 2014, 13:32
Default
  #12
New Member
 
IZUNNA DAVID
Join Date: Mar 2010
Location: NEWCASTLE
Posts: 2
Rep Power: 0
Izunna is on a distinguished road
Quote:
Originally Posted by mayank.dce2k7 View Post
Hi Daniel,

First of all, thanks for your replies.

Yes, I can do it just by placing values. But my real aim is to perform transient simulation in which inlet flow field depends both on time and space coordinates of inlet patch. I find groovy/swak4Foam a good tool as it provides freedom of inputting flow fields in the form of expression which is generally required. It gave me good results in first place when I specified a parabolic inlet velocity profile at inlet but I don't know whats wrong with flowRateInletVelocity. Basically what I am trying to do is that I am imposing Poiseuille flow (2*Uavg*(R^2-r^2)/R^2))) at the inlet and imposing volume flow rate condition at outlet i.e on one outlet volume flow rate is 0.52 times that on inlet and on the other outlet it is 0.48 time the inlet. I modified 0/U a little:

0/U

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.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 (0 0 0);

boundaryField
{
    INLET
    {
       type            groovyBC;
     variables "r2=(pow(pos().x,2)+pow(pos().z,2));R2=area()/pi;para=-((R2-r2)/R2)*normal();";
     valueExpression "2*0.351*para"; //where 0.351 is the average velocity
     value        uniform (0 0 0);           
    }

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

    OUTLET1
    {
       type            flowRateInletVelocity;
     flowRateExpression "0";
flowRate swak { 
            variables "area1{INLET}=area();flow1= -0.52*area1*0.351;"; 
            expression "flow1"; // volume flow going out of domain from outlet 1 which 0.52 times that at inlet
            valueType patch;
            patchName OUTLET1;
};
     value           uniform ( 0 0 0 );
    }

    OUTLET2
    {
       type            flowRateInletVelocity;
     flowRateExpression "0";
flowRate swak { 
            variables "area2{INLET}=area();flow2= -0.48*area2*0.351;"; // volume flow going out of domain from outlet 2 which 0.48 times that at inlet
            expression "flow2";
            valueType patch;
            patchName OUTLET2;
};
     value           uniform ( 0 0 0 );
    }


    

   
}

// ************************************************************************* //
My 0/p file remains unchanged:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    INLET
    {
        type            zeroGradient;
    }

    OUTLET1
    {
      type            zeroGradient;
    }
   
    OUTLET2
    {
       type            zeroGradient;
    }  

    WALL
    {
        type            zeroGradient;
    }

    
}

// ************************************************************************* //
I am getting following error and warnings:

Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model laminar
No field sources present


SIMPLE: convergence criteria
field p tolerance 1e-05
field U tolerance 1e-05
field nuTilda tolerance 1e-05


Starting time loop

Time = 0.005

swak4Foam: Allocating new repository for sampledGlobalVariables
--> FOAM Warning :
From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 324
The minimum value 3.51015e-06 and the maximum 1.85231e-05 differ. I will use the average 1.09453e-05
--> FOAM Warning :
From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
in file ExpressionResult/ExpressionResultI.H at line 324
The minimum value 3.51015e-06 and the maximum 1.85231e-05 differ. I will use the average 1.09453e-05
smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 0.0267623, No Iterations 4
smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 0.022866, No Iterations 4
smoothSolver: Solving for Uz, Initial residual = 1, Final residual = 0.0548532, No Iterations 2


--> FOAM FATAL ERROR:
Continuity error cannot be removed by adjusting the outflow.
Please check the velocity boundary conditions and/or run potentialFoam to initialise the outflow.
Total flux : 0.035612
Specified mass inflow : 0.0439753
Specified mass outflow : 1.32494e-05
Adjustable mass outflow : 0


From function adjustPhi(surfaceScalarField& phi, const volVectorField& U,const volScalarField& p
in file cfdTools/general/adjustPhi/adjustPhi.C at line 118.

FOAM exiting

First of all why is it referring 'mass inflow' since simpleFoam is a incompressible solver I am inputting volume flow rate and not mass flow rate. Second why there is a difference in inlet and total outlet flow rates.

Can somebody help me resolve it?
Hi,

I am just wondering if you were able to sort out the problem about inlet condition depending on time and space coordinates. I am facing a similar problem in which the inlet expands with time.It is a typical case of LNG pool spreading and evaporation which starts with a small area (circular) and increase with time.

I have a code to calculate the area at every time step.Thus, I either need to use the area to work out the mass flow rate and implement this at the inlet boundary or use the area to work out the velocity and apply this velocity only within the area (velocity outside the area will then be zero).

I do not know how to implement any of the above.Any help from you will be highly appreciated.Thank you boss

DAVID
Izunna is offline   Reply With Quote

Old   April 29, 2014, 13:37
Default
  #13
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14
mayank.dce2k7 is on a distinguished road
Hi,

You can use codedFixedValue boundary condition or swak4Foam to give any expression or perform calculation based on time and space coordinates. Search codedFixedValue in the forum to look for syntax and all.

Regards,
Mayank
mayank.dce2k7 is offline   Reply With Quote

Old   August 11, 2014, 21:16
Default known inlet pressure and flow rate, how to set BC?
  #14
New Member
 
Kai
Join Date: Mar 2014
Posts: 5
Rep Power: 12
ssboss is on a distinguished road
Quote:
Originally Posted by sivakumar View Post
Hi,
I am not sure, how good i understood your question.


the standard setting is;

0/U :

inlet

type flowRateInletVelocity;
flowRate 2; // Volumetric/mass flow rate [m3/s or kg/s]
value uniform (0 0 0);

outlet

outlet
{
type zeroGradient;
}

For pressure:

inlet
{
type zeroGradient;
}

outlet
{
type fixedValue;
value uniform 0;
}

Thanks,
Sivakumar

Dear Sivakumar,

I need to do something like what you said, except my known BCs are:
-flowrate (mass or volume)
-inlet pressure

I basically need to find the resulting outlet pressure of flow going through different geometries, something like a nozzle, with a given inlet water pressure and volumetric flowrate. Currently, I am doing something like this:


0/U :

inlet

type fixedValue;
value uniform (3 0 0);

outlet
{
type flowRateInletVelocity;
volumetricFlowRate -1e-3 //(m^3/s)
}

0/p:

inlet
{
type fixedValue;
value uniform 830;
}

outlet
{
type zeroGradient;
}


In theory I know my inlet velocity as well, which is why i set it equal to that value. But I read somewhere the BC for pressure and velocity are supposedly coupled, and there are restrictions in specifying them together? I was thinking maybe I need to use something like pressureInletVelocityOutlet that sort of BC? Can someone kindly direct me further? Much thanks
ssboss 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
Setting mass flow rate boundary condition maysmech OpenFOAM 15 July 22, 2021 12:30
Boundary condition problem for open channel flow Andy CFX 9 June 11, 2016 08:20
Problem of simulating of small droplet with radius of 2mm liguifan OpenFOAM Running, Solving & CFD 5 June 3, 2014 03:53
Corrected (Referred) Mass Flow Rate Boundary Condition ermuir CFX 1 November 20, 2012 18:11
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 10:56


All times are GMT -4. The time now is 15:38.