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

Correct way to fix reverse flow at outlet

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes
  • 1 Post By Dreoasteh
  • 5 Post By piu58
  • 1 Post By Dreoasteh
  • 1 Post By randolph

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 22, 2018, 04:25
Post Correct way to fix reverse flow at outlet
  #1
Member
 
Marc
Join Date: May 2017
Posts: 42
Rep Power: 9
Dreoasteh is on a distinguished road
Hello everyone,

I'm running a low Re LES case, you can see the geometry in the attached image.

After 4s I started to have backflow from the outlet patch into my domain which made my case unstable. I was using zeroGradient for U and fixedValue 0 for p at the outlet.

I have been searching for a solution and I have found the following:

  1. Change boundary conditions at outlet. Here I found two options:
    • inletOutlet for U and fixedValue 0 for p.
    • pressureInletOutletVelocity for U and totalPressure 0 for p.

    If there is reverse flow both options change behaviour from zeroGradient for U to not allow flow to enter the domain from the outlet. I have generally read that the second option is preferred although I don't understand the reason why.
  2. Modify the solver (pimpleFoam) to have a constant K multiplying the viscosity in the whole domain. Then use setFields to define K=1 in the whole domain except for a layer of cells (~5-10) at the outlet where K=100. This way no reverse flow will be carried upstream.
So my question is, which is the correct approach? Do any of you have experience with either one to solve the issue of reverse flow from the outlet into the domain?

Thank you!
Attached Images
File Type: png geometry.png (7.0 KB, 266 views)
lpz456 likes this.
Dreoasteh is offline   Reply With Quote

Old   May 22, 2018, 05:11
Default
  #2
Senior Member
 
piu58's Avatar
 
Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 15
piu58 is on a distinguished road
This is a typical problem which occurs with zeroGradient at output - if there is no zero Gradient in reality. The output is much to close to the input and the turbulent area to establish this. If you force the simulation to have it, you get false backflow.

This problem is not easy to resolve. You may consider setting a fixed velocity, and hoping that the symmetry works and the flow through both arms i equal. This fail if there are instability / vorticity near the output. It may also give problems with conservation of mass.

Or you ensure that the flwo at the output HAS nearly zeroGradient in U. The easiest way is to extend the arms to a length which is sufficient for level out U.
oswald, granzer, Fouch and 2 others like this.
__________________
Uwe Pilz
--
Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950)
piu58 is offline   Reply With Quote

Old   May 22, 2018, 06:35
Default
  #3
Member
 
Marc
Join Date: May 2017
Posts: 42
Rep Power: 9
Dreoasteh is on a distinguished road
So in your view, none of the solutions I proposed is valid. Could you elaborate on why?

The problem with extending the distance to the outlet is that the number of mesh elements would increase and make my simulation run for even longer. I suppose I can try if there is no other viable option, but I'd rather not.
Dreoasteh is offline   Reply With Quote

Old   December 7, 2019, 21:22
Default
  #4
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 6
Bodo1993 is on a distinguished road
Hi, I am wondering if you got a solution to your problem as I am encountering the same one. Thanks.
Bodo1993 is offline   Reply With Quote

Old   December 8, 2019, 03:43
Default
  #5
Member
 
Marc
Join Date: May 2017
Posts: 42
Rep Power: 9
Dreoasteh is on a distinguished road
Hi Bodo,

I solved the porblem without extending the outlet which would mean more cells and more computational time.

I would try a couple of things, in this order:

1) Use pressureInletOutletVelocity for U and totalPressure 0 for p in the outlet

2) If you don't care about the results in the outlet but you would like stability of your simulation use the outlet buffer zone region with an added constant multiplying the turbulent term in the momentum equation. For this you will need to modify the U equation and createFields file and recompile your solver. Then I recommend you to use funkysetfields in swak4foam to establish this constant as 1 in the whole domain and linearly or quadratically vary from 1 to say 100 in a region near the outlet. If you have little experience with OpenFOAM and not know how to do this, I could upload the solver.

3) If either of them (or doing both at the same time) fail, try with an advective outflow condition

If all of this fails, which I believe is unlikely you will need to extend the outlet.

Hope this helps!
lpz456 likes this.
Dreoasteh is offline   Reply With Quote

Old   December 8, 2019, 15:08
Default
  #6
Senior Member
 
Reviewer #2
Join Date: Jul 2015
Location: Knoxville, TN
Posts: 141
Rep Power: 10
randolph is on a distinguished road
Hi,

Personally, I would use the fvOption to introduce some artificial acceleration at the last outflow boundary cell to ensure all the characteristics are going outward.

Thanks,
Rdf
allanZHONG likes this.
randolph is offline   Reply With Quote

Old   December 8, 2019, 16:02
Default
  #7
Member
 
Marc
Join Date: May 2017
Posts: 42
Rep Power: 9
Dreoasteh is on a distinguished road
Hi Randolph,

Thanks for your input, I've never hear of that method. Can you elaborate? Maybe share an example of how to set up the fvOptions?
Dreoasteh is offline   Reply With Quote

Old   December 8, 2019, 18:49
Default
  #8
Senior Member
 
Reviewer #2
Join Date: Jul 2015
Location: Knoxville, TN
Posts: 141
Rep Power: 10
randolph is on a distinguished road
Hi,

This is not a new method. It is quite popular in DNS/LES community. I remember there is an fvOption in the newest version of OpenFOAM to apply local acceration. You can just add a source in your momentum equation at the outlet boundary cells.

Thanks,
Rdf
randolph is offline   Reply With Quote

Old   December 8, 2019, 19:35
Default
  #9
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 6
Bodo1993 is on a distinguished road
Quote:
Originally Posted by Dreoasteh View Post
Hi Bodo,

I solved the porblem without extending the outlet which would mean more cells and more computational time.

I would try a couple of things, in this order:

1) Use pressureInletOutletVelocity for U and totalPressure 0 for p in the outlet

2) If you don't care about the results in the outlet but you would like stability of your simulation use the outlet buffer zone region with an added constant multiplying the turbulent term in the momentum equation. For this you will need to modify the U equation and createFields file and recompile your solver. Then I recommend you to use funkysetfields in swak4foam to establish this constant as 1 in the whole domain and linearly or quadratically vary from 1 to say 100 in a region near the outlet. If you have little experience with OpenFOAM and not know how to do this, I could upload the solver.

3) If either of them (or doing both at the same time) fail, try with an advective outflow condition

If all of this fails, which I believe is unlikely you will need to extend the outlet.

Hope this helps!
Dear Dreoasteh,

Thanks a lot for your reply. Unfortunately, I have a little experience with OpenFOAM, and I would greatly appreciate it if you can show me how to do the second point.

For your reference, I am using twoLiquidMixingFoam solver to simulate the mixing between two fluids. Please find attached document for some details on the problem (i.e. schematic and few screen shots of the outlet results).

Thanks for your time and I Looking forward to hearing from you.

Best Regards
Attached Files
File Type: pdf CFD_Online.pdf (72.6 KB, 77 views)
Bodo1993 is offline   Reply With Quote

Old   December 8, 2019, 19:42
Default
  #10
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 6
Bodo1993 is on a distinguished road
Quote:
Originally Posted by randolph View Post
Hi,

This is not a new method. It is quite popular in DNS/LES community. I remember there is an fvOption in the newest version of OpenFOAM to apply local acceration. You can just add a source in your momentum equation at the outlet boundary cells.

Thanks,
Rdf
Dear randolph,

Thank you. Would you please refer us to a place/website etc. where this method was applied so that we can try to mimic the methodology to our solvers? If you do not know any, would you please write some steps on how would we edit the fvOptions. I am using OpenFOAM 6.

I apologize if I am asking for a lot. Thanks again.
I look forward to hearing from you.

Best Regards
Bodo1993 is offline   Reply With Quote

Old   December 9, 2019, 04:16
Default
  #11
Member
 
Marc
Join Date: May 2017
Posts: 42
Rep Power: 9
Dreoasteh is on a distinguished road
Hi Bodo,

Sure, follow this drive link to the modified solver. As you can see I only added a new field (nuk) in createFields.H and then in UEqn.H multiplied the last term of the equation by this new field nuk.

This field will not be convected or diffused. It stays the way you set it up from the time at which your simulations starts. If it has a value of 1 it does not change the simulation. If it has a value greater than 1 it increases viscosity (which is what we want to avoid back-flow which leads to instability and case blow-up). You will need to set it up as any variable, in the 0 folder.

I don't know if you compiled your own solvers before so I'll give you a more detailed explanation.

So what you want to do is download the file, unzip, move it to wherever you like (run folder is a typical choice) and with openFOAM-6 environment active go inside the twoLiquidMixingNukFoam folder and execute
Code:
wmake
to compile.


This will create a solver application inside $FOAM_USER_APPBIN which you can execute as any other solver.

This will be equivalent to the original solver but, as mentioned you need to include a new file in the 0 folder to represent this new variable. A simple example (which will no impact your simulation) is also uploaded. (Note: I had to add a .txt format because this forum is old, but just remove the extension).

Then you can either use setFieldsDict to select the region you want and increase the value of nuk (generally 100 at the outler works fine) or use swak4foam.

To install swak4foam for OpenFOAM-6 follow Cyrille Bonamy's post reply. This should work fine but ask if you have any issues. This library enables you to apply mathematical expressions to openfoam utilities (i.e. set nuk varying linearly from 1 to 100 in a region defined by a box).

The utility you want to use will be called funkySetFields. You will need a funkySetFieldsDict, which I uploaded. This is the exact file I used for my simulation for the geometry seen in my first post. (Again, remove the .txt extension after downloading).

I think the usage is understandable but I will walk you through what each thing does, just in case.

create_nuk will create the nuk variable in the time directory (just in case it is not present or has weird value). It will initialize it will 1 in the whole domain and no dimensions because it is not a physical variable. This ensures that nuk is not affecting you simulation outside your specified domain.

set_nuk_top will modify the file nuk that create_nuk just made and it will replace the previous value of 1 by an expression that makes nuk vary linear depending on the value of the x coordinate (nuk=m*x+c). At the start of a the region, nuk=1 and at the end of the region (closer to the outlet) nuk=100. With these two pairs of values (x0, nuk(x0) and x1, nuk(x1)) you can make your own linear expression. Then use "condition" to define the region for which "expression" will be applied. In my case this was the x smaller than the start of my region and y bigger than the value that delimits the "upper outlet".

set_nuk_bottom does the same but for the "lower outlet". If I would have not divided it into two parts for my geometry and made only one single set_nuk instead, some parts of the inlet (which is in between the "two outlets") will have nuk>1 which I did not want - obviously.

After setting the funkySetFieldsDict to you liking just execute:


Code:
funkySetFields

which will modify your nuk to avoid back-flow from your outlet which is what is making your case blow up.


I strongly recommend the swak4foam approach because it is a great tool to have in your openFOAM arsenal although it takes a bit longer to learn.

On a side note, I feel that you should add some more cells in the boundary layer, it seems under-resolved.


I hope this explanations helps you set up and solve your issues. Is you have any question feel free to ask, I'll be around.
Attached Files
File Type: txt nuk.txt (1.0 KB, 27 views)
File Type: txt funkySetFieldsDict.txt (758 Bytes, 31 views)
Dreoasteh is offline   Reply With Quote

Old   December 28, 2019, 07:29
Default
  #12
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 6
Bodo1993 is on a distinguished road
Quote:
Originally Posted by Dreoasteh View Post
Hi Bodo,

Sure, follow this drive link to the modified solver. As you can see I only added a new field (nuk) in createFields.H and then in UEqn.H multiplied the last term of the equation by this new field nuk.

This field will not be convected or diffused. It stays the way you set it up from the time at which your simulations starts. If it has a value of 1 it does not change the simulation. If it has a value greater than 1 it increases viscosity (which is what we want to avoid back-flow which leads to instability and case blow-up). You will need to set it up as any variable, in the 0 folder.

I don't know if you compiled your own solvers before so I'll give you a more detailed explanation.

So what you want to do is download the file, unzip, move it to wherever you like (run folder is a typical choice) and with openFOAM-6 environment active go inside the twoLiquidMixingNukFoam folder and execute
Code:
wmake
to compile.


This will create a solver application inside $FOAM_USER_APPBIN which you can execute as any other solver.

This will be equivalent to the original solver but, as mentioned you need to include a new file in the 0 folder to represent this new variable. A simple example (which will no impact your simulation) is also uploaded. (Note: I had to add a .txt format because this forum is old, but just remove the extension).

Then you can either use setFieldsDict to select the region you want and increase the value of nuk (generally 100 at the outler works fine) or use swak4foam.

To install swak4foam for OpenFOAM-6 follow Cyrille Bonamy's post reply. This should work fine but ask if you have any issues. This library enables you to apply mathematical expressions to openfoam utilities (i.e. set nuk varying linearly from 1 to 100 in a region defined by a box).

The utility you want to use will be called funkySetFields. You will need a funkySetFieldsDict, which I uploaded. This is the exact file I used for my simulation for the geometry seen in my first post. (Again, remove the .txt extension after downloading).

I think the usage is understandable but I will walk you through what each thing does, just in case.

create_nuk will create the nuk variable in the time directory (just in case it is not present or has weird value). It will initialize it will 1 in the whole domain and no dimensions because it is not a physical variable. This ensures that nuk is not affecting you simulation outside your specified domain.

set_nuk_top will modify the file nuk that create_nuk just made and it will replace the previous value of 1 by an expression that makes nuk vary linear depending on the value of the x coordinate (nuk=m*x+c). At the start of a the region, nuk=1 and at the end of the region (closer to the outlet) nuk=100. With these two pairs of values (x0, nuk(x0) and x1, nuk(x1)) you can make your own linear expression. Then use "condition" to define the region for which "expression" will be applied. In my case this was the x smaller than the start of my region and y bigger than the value that delimits the "upper outlet".

set_nuk_bottom does the same but for the "lower outlet". If I would have not divided it into two parts for my geometry and made only one single set_nuk instead, some parts of the inlet (which is in between the "two outlets") will have nuk>1 which I did not want - obviously.

After setting the funkySetFieldsDict to you liking just execute:


Code:
funkySetFields
which will modify your nuk to avoid back-flow from your outlet which is what is making your case blow up.


I strongly recommend the swak4foam approach because it is a great tool to have in your openFOAM arsenal although it takes a bit longer to learn.

On a side note, I feel that you should add some more cells in the boundary layer, it seems under-resolved.


I hope this explanations helps you set up and solve your issues. Is you have any question feel free to ask, I'll be around.

Hello Dreoasteh,



Thank you for the detailed response. I am working on it.

However, I have a quick question, how would this methodology be applicable if the flow is laminar?

Thanks again and I look forward to hearing from you.

Best Regards
Bodo1993 is offline   Reply With Quote

Old   December 29, 2019, 04:35
Default
  #13
Member
 
Marc
Join Date: May 2017
Posts: 42
Rep Power: 9
Dreoasteh is on a distinguished road
Hi Bodo,

I believe the method will be the same. You can apply this method whenever you encounter backflow and you can afford to lose physical accuracy in the outlet (i.e. you just want the outlet to extract the flow from the domain but you are not taking "measurements" there).

The only issue is that in a turbulent flow the appearance of eddies makes it more likely that you will encounter backflow than with a laminar flow. This implies that maybe your problem will not be solved by this method. Anyhow the test is simple: follow my comment and see what happens. At the very least you will learn about new things in the process.
Dreoasteh is offline   Reply With Quote

Old   December 30, 2019, 09:53
Default
  #14
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 6
Bodo1993 is on a distinguished road
Hi Dreoasteh,

Thanks for the reply.

I just realized something regarding my simulations.

For the alpha boundary conditions, I use zeroGradient or inletOutlet. Initially, it works fine since only single phase exists at the outlet boundary. However, when a mixed phase reaches the outlet boundary, I get some vortices (see attachment).
In the zero directory, I have three files only; p_rgh, U and alpha.phase1.

It seems that the vortices I get are due to inconsistent boundaries for alpha since it is only set for a single phase - alpha.phase1 (not the mixed phase).
I would appreciate your opinion about the above.
Attached Files
File Type: pdf Forum2.pdf (178.5 KB, 31 views)
Bodo1993 is offline   Reply With Quote

Old   August 15, 2023, 04:56
Default
  #15
Senior Member
 
Albrecht vBoetticher
Join Date: Aug 2010
Location: Zürich, Swizerland
Posts: 237
Rep Power: 16
vonboett is on a distinguished road
Quote:
Originally Posted by Bodo1993 View Post
Hi Dreoasteh,

Thanks for the reply.

I just realized something regarding my simulations.

For the alpha boundary conditions, I use zeroGradient or inletOutlet. Initially, it works fine since only single phase exists at the outlet boundary. However, when a mixed phase reaches the outlet boundary, I get some vortices (see attachment).
In the zero directory, I have three files only; p_rgh, U and alpha.phase1.

It seems that the vortices I get are due to inconsistent boundaries for alpha since it is only set for a single phase - alpha.phase1 (not the mixed phase).
I would appreciate your opinion about the above.

For those using inteerFoam or interMixingFoam: it is a common issue as soon as the phase with higher density touches your atmospheric boundary condition, as the pressure p_rgh is much higher within the phase of higher density and pressureInletOutletVelocity will increase U incredible here to reduce pressure to meet the totalPressure condition. In debrisInterMixing and interTempMixingFoam (both based on interMixingFoam) I apply turbulence->divDevRhoReff(rho*nuk, U) in UEqn and at the end of alphaEqns.H I do:



alpha.mixingPhase1 /= nuk;


alpha.mixingPhase2 /= nuk;


alpha.nonMixingPhase = 1.0 - alpha.mixingPhase1 - alpha.mixingPhase2;


(I do not care much about the non-mixing phase which is typically air in my mountain torrent applications, so I optimized alphaEqns.H in general to a good tradeoff between conservation of mass and bounding of concentrations to 0 < alpha < 1)
vonboett 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
Compressible Flow Pressure Outlet Back Flow okstatecheme OpenFOAM Running, Solving & CFD 1 March 21, 2018 08:11
Pressure Outlet Targeted Mass Flow Rate LuckyTran FLUENT 1 November 23, 2016 10:40
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Reverse flow on outlet face Seunkiels STAR-CCM+ 0 April 28, 2014 06:09
Reverse flow on a Presure outlet albertolot FLUENT 7 April 2, 2010 08:54


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