CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Volume flow rate boundary condition in OpenFOAM (https://www.cfd-online.com/Forums/openfoam-solving/120342-volume-flow-rate-boundary-condition-openfoam.html)

mayank.dce2k7 July 4, 2013 15:44

Volume flow rate boundary condition in OpenFOAM
 
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

billie July 4, 2013 17:01

Quote:

Originally Posted by mayank.dce2k7 (Post 437860)
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.

mayank.dce2k7 July 5, 2013 17:35

1 Attachment(s)
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.

mayank.dce2k7 July 6, 2013 00:46

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 July 6, 2013 03:07

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?

billie July 6, 2013 13:20

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.

mayank.dce2k7 July 6, 2013 22:47

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?

billie July 7, 2013 03:54

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.

mayank.dce2k7 July 8, 2013 11:47

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.

rbaud February 21, 2014 10:32

outflow u: flowRateInletVelocity (with negative value) p: zeroGradient ??
 
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

sivakumar March 31, 2014 06:46

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

Izunna April 29, 2014 12:32

Quote:

Originally Posted by mayank.dce2k7 (Post 438177)
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

mayank.dce2k7 April 29, 2014 12:37

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

ssboss August 11, 2014 20:16

known inlet pressure and flow rate, how to set BC?
 
Quote:

Originally Posted by sivakumar (Post 482986)
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


All times are GMT -4. The time now is 18:27.