
[Sponsors] 
July 21, 2013, 05:06 
Continuity error with volume flow split boundary condition

#1 
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 5 
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 

July 21, 2013, 10:59 

#2 
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,659
Blog Entries: 34
Rep Power: 87 
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
__________________


July 21, 2013, 15:13 

#3 
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 5 
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=((R2r2)/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); } } 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; } } // ************************************************************************* // Mayank Last edited by mayank.dce2k7; July 21, 2013 at 18:07. 

July 21, 2013, 15:25 

#4 
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,659
Blog Entries: 34
Rep Power: 87 
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 massflow you were calculating for, is properly respected? Because the parabolic profile values will be placed inside discrete cells, for which the total massflow sum might not be exactly the same as the parabolic profile... here's an similar example of what I mean: http://ars.elscdn.com/content/image...003428gr1.gif And then there's the really annoying part... OpenFOAM can be veeeery picky with errors of up to 1e6 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
__________________


July 21, 2013, 23:35 

#5 
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 5 
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=((R2r2)/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 ); } } 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; } } // ************************************************************************* // 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 1e05 field U tolerance 1e05 field nuTilda tolerance 1e05 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. 

July 26, 2013, 18:47 

#6 
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 5 
Is there any way I can reduce the tolerance for continuity errors in OpenFOAM?
Regards, Mayank 

August 18, 2013, 16:45 

#7 
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,659
Blog Entries: 34
Rep Power: 87 
Hi Mayank,
I see that you continued working on this and that the latest thread related to this topic is this one: swak4Foam and accessing flux on remote patches for setting B.C's 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
__________________


August 18, 2013, 23:30 

#8 
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 5 
Thanks Bruno for your concern but the problem is now solved. Thanks to the forum.
Regards, Mayank. 

August 19, 2013, 01:07 

#9 
Member
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 4 
Hi Mayank,
How did you solve it? Thanks, Hrushi 

August 19, 2013, 11:41 

#10 
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 5 
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 10e8 (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. 

November 16, 2014, 05:16 
Continuity error in sloshingtank2d

#11  
Senior Member
musaddeque hossein
Join Date: Mar 2009
Posts: 307
Rep Power: 9 
Quote:
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.50768e18 Specified mass inflow : 1.0222e17 Specified mass outflow : 4.16554e17 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. 

November 18, 2014, 22:03 

#12 
Senior Member
musaddeque hossein
Join Date: Mar 2009
Posts: 307
Rep Power: 9 
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.


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Wind turbine simulation  Saturn  CFX  34  October 16, 2014 05:27 
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 
error message with modeling a cube with a hold at the center  hsingtzu  OpenFOAM Native Meshers: blockMesh  2  March 14, 2012 10:56 
mass flow in is not equal to mass flow out  saii  CFX  2  September 18, 2009 08:07 