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

Continuity Error for Temperature Dependent Density

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Bloerb

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 26, 2018, 09:15
Question Continuity Error for Temperature Dependent Density
  #1
Member
 
Tomas Denk
Join Date: May 2017
Posts: 30
Rep Power: 9
TomasDenk is on a distinguished road
Dear Foamers,

Can someone help me modifiy the set up so that I get rid of the error? Is it possible that the error is caused by a bug in the code?

I have set up simple model to demostrate the issue - available for download at the bottom. As long as the fluid properties are constant, it runs just fine. When I change the equation of state in thermophysicalProperties of the fluid (Glass) to look like this:

Code:
equationOfState
    {
        rhoCoeffs<8>    (2500 -0.0001 0 0 0 0 0 0);
    }
I get the following error:

Code:
--> 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              : 162372
Specified mass inflow   : 1
Specified mass outflow  : 0.998114
Adjustable mass outflow : 0
Example to download:

Available until May 10th, 2018 (max. 30 downloads):
http://www.uschovna.cz/zasilka/YGVFBUHH3X6W34CD-6I5/

Unlimited, but sometimes does not work without logging into Google:
https://drive.google.com/open?id=1f9...Nrh7zlOJMSe2a-
TomasDenk is offline   Reply With Quote

Old   June 4, 2018, 12:53
Default
  #2
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 21
Bloerb will become famous soon enough
The problem is the boundary conditions set up. You are trying to solve a flow with mass conservation. Yet you specify the total inflow AND outflow. This is bad practice. One reason is that you do not have a pressure level for these boundary conditions. You have basically zeroGradient for pressure everywhere, but no fixed level. If in and outflow is fixed you force mass conservation by the boundary conditions not by adjusting it via the solution. This is quite tricky to get right. With varying density due to your polynomials it gets quite impossible. Hence you'd be better of specifying the inflow (or outflow) and couple that with a fixed pressure boundary condition. Like:



Velocity conditions

  • Inlet flowRateInletVelocity
  • Outlet zeroGradient (if backflow is possible pressureInletOutletVelocity)
pressure conditions
  • inlet zeroGradient
  • outlet fixedValue or some kind of total pressure Condition
  • walls fixedFluxPressure
Bloerb is offline   Reply With Quote

Old   June 5, 2018, 12:00
Default Challenge
  #3
Member
 
Tomas Denk
Join Date: May 2017
Posts: 30
Rep Power: 9
TomasDenk is on a distinguished road
Hi Bloerb,


Thank you for taking a look at my case and giving me those recommendations. I have followed them and my case reached convergence. However, there are couple points where I dare to challenge your answer and more details on why it works this way would be greatly appreciated.


Quote:
Yet you specify the total inflow AND outflow. This is bad practice.
I understand that specifying fixed value for velocity or fixed volumetric flux on the inlet and outlet BC would be bad - with varying density, impossible to satisfy continuity. However, I specified total mass flux for both and they equal in magnitude. If everything works correctly, there should be no problem with continuity. I checked what happens on the outlet BC and the total mass flux truly is 1 kg/s (when applied) and average velocity is higher than on the inlet BC to compensate for decresed density. It is after corrections are applied (correctPhi in CorrectPhi.C) when it gets spoiled. Some time ago, I wrote a solver for fluid flow and conjugate heat transfer with temperature dependent properties. Prescribed mass flux BCs on both, inlet and outlet, worked just fine with it.


Quote:
pressure conditions
  • inlet zeroGradient
  • outlet fixedValue or some kind of total pressure Condition
  • walls fixedFluxPressure
Zero gradient on the inlet does not seem right. Usually, it represents cut through some sort of channel or pipe and to maintain steady flux, constant pressure gradient exists in reality. Model should respect that and be as close to reality as possible. I took the liberty to run simulation with fixedFluxPressure on the inlet and it converged easily. I did not have time to look in detail what difference it made near inlet.
I understand, why you want me to have fixed pressure point somewhere in the domain and I will bear that in mind in the future, thanks.
What truly puzzles me is fixedFluxPressure on walls. In reality, there is no gradient perpendicular to the wall, so I'd expect zeroGradient condition would be appropriate. However, I can change this BC only (starting from your recommended setup) and I get unphysical solution (temperature reaches 4000K and velocity field is quite spoiled). Can you explain what is wrong with zeroGradient condition for pressure on the walls?


Thank you for your effort to help me. I try to pay back to the community and I react to threads where I think I can help.
TomasDenk is offline   Reply With Quote

Old   June 5, 2018, 13:58
Default
  #4
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 21
Bloerb will become famous soon enough
Yes that is correct. Specifying the massflux for in and outflow isn't inherently flawed. My remarks where more aimed at something else. If some numerical error is present in your solution (which is naturally always the case) your solver can adjust for that by adjusting the outflow. With your setup errors can't "be flushed out". Which next to the missing pressure reference does not aid convergence.


Regarding the fixedFluxPressure and zeroGradient problem. You should be able to set both. FixedFluxPressure is however known to have better convergence and used in the cht tutoral cases. fixedFluxPressure sets the pressure gradient to something like (phi-phi*)/something. On a wall, this difference tends to zero and so the boundary condition turns to zeroGradient. It shouldn't drastically effect your results.
TomasDenk likes this.
Bloerb is offline   Reply With Quote

Old   June 6, 2018, 04:49
Default
  #5
Member
 
Tomas Denk
Join Date: May 2017
Posts: 30
Rep Power: 9
TomasDenk is on a distinguished road
Thank you for your explanation. Besides "how", it is important to know "why", for me.


Have a nice day.
TomasDenk is offline   Reply With Quote

Old   January 30, 2020, 19:53
Default
  #6
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 7
Bodo1993 is on a distinguished road
Quote:
Originally Posted by Bloerb View Post
The problem is the boundary conditions set up. You are trying to solve a flow with mass conservation. Yet you specify the total inflow AND outflow. This is bad practice. One reason is that you do not have a pressure level for these boundary conditions. You have basically zeroGradient for pressure everywhere, but no fixed level. If in and outflow is fixed you force mass conservation by the boundary conditions not by adjusting it via the solution. This is quite tricky to get right. With varying density due to your polynomials it gets quite impossible. Hence you'd be better of specifying the inflow (or outflow) and couple that with a fixed pressure boundary condition. Like:



Velocity conditions

  • Inlet flowRateInletVelocity
  • Outlet zeroGradient (if backflow is possible pressureInletOutletVelocity)
pressure conditions
  • inlet zeroGradient
  • outlet fixedValue or some kind of total pressure Condition
  • walls fixedFluxPressure

Hi Bloerb,

I use twoLiquidMixingFoam multiphase solver, this solver allows for mass transport (varying density). I always get issue at the outlet when I use fixedValue for the pressure. In a simple 2D channel flow, if I turn off the gravity, the fluids exit the channel with no problems. However, when the gravity is on, then, I get issues at the outlet (i.e. backflow and other weird behavior).

If I set a kind of gradient boundary at the outlet for both velocity and pressure, then, I have to define a reference cell for pressure in the fvSolution. No matter what cell value I use I get the error of continuity:
--> 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 : 3.99328e-17
Specified mass inflow : 0
Specified mass outflow : 7.25226e-19
Adjustable mass outflow : 0

I am wondering what would be the solution in this case.

Thank you in advance and I look forward to hearing from you.
Bodo1993 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
Current density visualisation (PEM fuel cell add-on module) pchoopanya FLUENT 10 August 21, 2023 15:33
(incompressible) interFoam - where is the density in the k, epsilon and continuity eq idefix OpenFOAM 0 December 22, 2015 15:40
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 08:47
buoyantPimpleFoam, icoPoly8ThermoPhysics and temperature dependent density jherb OpenFOAM Running, Solving & CFD 0 March 11, 2013 06:02
Warning 097- AB Siemens 6 November 15, 2004 05:41


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