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

Continuity error with volume flow split boundary condition

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By mayank.dce2k7
  • 1 Post By musahossein

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 21, 2013, 05:06
Default Continuity error with volume flow split boundary condition
  #1
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 13
mayank.dce2k7 is on a distinguished road
Hi,

I am trying to simulate a case in which a tube with one inlet bifurcates in two outlets. I ran the case with simpleFoam solver by fixing volume flow rate at all outlets(because that is the condition to be satisfied) and got following errors:

--> 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.000719163
Specified mass inflow : 0.000400984
Specified mass outflow : 0.000400984
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


I ran potentialFoam and used the generated velocity field to run simulation and again encountered same error.

I don't understand when inflow rate is equal to outflow rate then why OpenFoam is giving continuity errors. Any suggestions on solving this problem?

Thanks,
Mayank
mayank.dce2k7 is offline   Reply With Quote

Old   July 21, 2013, 10:59
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Mayank,

What is the boundary condition on the inlet you are using?

I can't remember correctly what the total flux value should be, but clearly the values do not add up.
The total is not equal to the inlet+outlets, therefore you're not allowing enough fluid into the domain or you are extracting too much fluid.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   July 21, 2013, 15:13
Default
  #3
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 13
mayank.dce2k7 is on a distinguished road
Hi Bruno,

Thanks for the quick response.

The flow at the inlet is parabolic.

Basically, I want to divide the inlet flow into 0.52 times at one outlet and 0.48 times at the other outlet. Below are my 0/p and 0/U files:

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=sum(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;
flowRate    -0.000208512;        // Volumetric/mass flow rate 
value       uniform (0 0 0); 
    }

    OUTLET2
    {

       type        flowRateInletVelocity;
flowRate    -0.000192472;        // Volumetric/mass flow rate 
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;
    }

    
}

// ************************************************************************* //
Thanks,
Mayank

Last edited by mayank.dce2k7; July 21, 2013 at 18:07.
mayank.dce2k7 is offline   Reply With Quote

Old   July 21, 2013, 15:25
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Mayank,

What values do you get if you do not constrain the outlets to a fixed value?

And did you know that simply by defining a parabolic shaped inlet, it does not strictly mean that the mass-flow you were calculating for, is properly respected? Because the parabolic profile values will be placed inside discrete cells, for which the total mass-flow sum might not be exactly the same as the parabolic profile... here's an similar example of what I mean: http://ars.els-cdn.com/content/image...003428-gr1.gif

And then there's the really annoying part... OpenFOAM can be veeeery picky with errors of up to 1e-6 or something like that... so, even if it shows that the the values are virtually identical, they are probably not computationally identical


I vaguely remember seeing on this forum some discussions about splitting flow between patches... but I can't remember what it talked about in specific

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   July 21, 2013, 23:35
Default
  #5
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 13
mayank.dce2k7 is on a distinguished road
Ok, so this means I have to somehow access total volume flow rate field (say phi_inlet) at the inlet patch from within the simulation and define volume flow rate at outlet1=0.52*phi_inlet and outlet2=0.48*phi_inlet .....that can be done using swak4Foam.....I did that but it didn't work either.....it still gave errors.....

Below is 0/U file for what I have said:

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=sum(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}=sum(phi);"; 
            expression "-0.52*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}=sum(phi);"; 
            expression "-0.48*phi2"; // volume flow going out of domain from outlet 1 which 0.52 times that at inlet
            valueType patch;
            patchName OUTLET2;};

     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;
    }

    
}

// ************************************************************************* //
I got the following error:

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
smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 0.0952526, No Iterations 2
smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 0.0542153, No Iterations 3
smoothSolver: Solving for Uz, Initial residual = 1, Final residual = 0.060015, No Iterations 3


--> 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.000360325
Specified mass inflow : 0.000400984
Specified mass outflow : 0
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

When I ran potentialFoam and then used the velocity field for new simulation. I got the same error but with different values:

--> 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.0147875
Specified mass inflow : 0.000801967
Specified mass outflow : 0
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.
mayank.dce2k7 is offline   Reply With Quote

Old   July 26, 2013, 18:47
Default
  #6
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 13
mayank.dce2k7 is on a distinguished road
Is there any way I can reduce the tolerance for continuity errors in OpenFOAM?

Regards,
Mayank
mayank.dce2k7 is offline   Reply With Quote

Old   August 18, 2013, 16:45
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Mayank,

I see that you continued working on this and that the latest thread related to this topic is this one: http://www.cfd-online.com/Forums/ope...ting-b-cs.html

Unfortunately I don't have the time to look further into this, specially since it looks like it'll require some heavy duty work.

Nonetheless, regarding the last question you made: I haven't found where the setting for the mass flow balance is configurable.

Good luck! Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   August 18, 2013, 23:30
Default
  #8
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 13
mayank.dce2k7 is on a distinguished road
Thanks Bruno for your concern but the problem is now solved. Thanks to the forum.

Regards,
Mayank.
mayank.dce2k7 is offline   Reply With Quote

Old   August 19, 2013, 01:07
Default
  #9
Member
 
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 13
hrushi.397 is on a distinguished road
Hi Mayank,

How did you solve it?

Thanks,

Hrushi
hrushi.397 is offline   Reply With Quote

Old   August 19, 2013, 11:41
Default
  #10
Member
 
India
Join Date: Oct 2012
Posts: 84
Rep Power: 13
mayank.dce2k7 is on a distinguished road
I didn't set velocity boundary conditions at all patches. One usually runs into trouble with stupid "continuity errors". The tolerance for continuity error is 10e-8 (refer source code for adjustPhi.C). You should define pressure boundary condition on atleast one patch then everything goes fine.

Do not use the expression "sum(phi)" for setting massflow/volumeflow boundary conditions conditions with swak4FOAM or any other place because at t=0 there is no field as "phi" ,although velocity and pressure fields exist, hence OpenFOAM returns a zero value and continuity errors start showing up.

Regards,
Mayank.
wyldckat likes this.
mayank.dce2k7 is offline   Reply With Quote

Old   November 16, 2014, 04:16
Default Continuity error in sloshingtank2d
  #11
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Mayank,

What values do you get if you do not constrain the outlets to a fixed value?

And did you know that simply by defining a parabolic shaped inlet, it does not strictly mean that the mass-flow you were calculating for, is properly respected? Because the parabolic profile values will be placed inside discrete cells, for which the total mass-flow sum might not be exactly the same as the parabolic profile... here's an similar example of what I mean: http://ars.els-cdn.com/content/image...003428-gr1.gif

And then there's the really annoying part... OpenFOAM can be veeeery picky with errors of up to 1e-6 or something like that... so, even if it shows that the the values are virtually identical, they are probably not computationally identical


I vaguely remember seeing on this forum some discussions about splitting flow between patches... but I can't remember what it talked about in specific

Best regards,
Bruno
Hi Bruno:
I get continuity errors in sloshingtank2D -- no inlets or outlets, which is strange.The error message is as follows:
[0] --> FOAM FATAL ERROR:
[0] 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 : 5.50768e-18
Specified mass inflow : 1.0222e-17
Specified mass outflow : 4.16554e-17
Adjustable mass outflow : 0
[0]
[0]
[0] From function adjustPhi(surfaceScalarField& phi, const volVectorField& U,const volScalarField& p
[0] in file cfdTools/general/adjustPhi/adjustPhi.C at line 118.
[0]
FOAM parallel run exiting
[0]


I ckecked the adjustPhi.C code and noted the small threshold that triggers this message and causes analysis to stop. Would you have any suggestions as to what might be causing this? I have a small 2D tank -- width 1 m, height 1 m. Water depth is 0.4 m. I am applying discrete oscillations in the range of 0.0002 to 0.006 m. However, the displacements are not in the form of a list, but rather computed by another program and then sent to OpenFoam for computing pressures on the tank walls. So for example, a time time t=0, the displacements are 0; then at time =0.02, the displacement may be 0.003, so OpenFoam will be asked to return the pressure values for the following range:
time displacement
0 0
0.02 0.003

and so on. At each call to OpenFoam, a pair of start/stop time and associated displacement will be sent to OpenFoam. So OpenFoam will be starting and stopping as the program that generates these displacements runs. I realize that the coupling is not an issue, but just thought it may be helpful to give a brief background on the circumstance under which OpenFoam is being run. Thankyou. I look forward to your reply -- or that of anyone in the Forum who might come across this post.
musahossein is offline   Reply With Quote

Old   November 18, 2014, 21:03
Default
  #12
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Sorry for the false alarm. I was generating displacement in the x axis which in the case of the 2D tank, does not have any dimension. In the 2D case there can only be movement in the Y and Z direction, and I was trying to push the tank in the +-X direction.
wyldckat likes this.
musahossein 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
Wind turbine simulation Saturn CFX 58 July 3, 2020 01:13
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 05:21
Problem of simulating of small droplet with radius of 2mm liguifan OpenFOAM Running, Solving & CFD 5 June 3, 2014 02:53
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 07:47
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56


All times are GMT -4. The time now is 12:00.