CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] Velocity gradient outlet BC penalisation using groovyBC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 3, 2014, 15:50
Default Velocity gradient outlet BC penalisation using groovyBC
  #1
Member
 
Join Date: Sep 2012
Posts: 51
Rep Power: 14
Hiroshiman is on a distinguished road
Hi,
I'm running OpenFOAM on cases with backflow occuring at outlets at some times ; it is a physiological flow and therefore cannot be avoided and I cannot change the geometry adding outlet extrusions.
On outlets the pressure is imposed (thanks Groovy) and the zeroGradient BC is used for velocity. When backflow occurs, OpenFOAM offers BCs like pressureNormalInletOutletVelocity but it's neither enough nor desirable to have a normal velocity entering the domain.

One idea and what I'm trying to do :
if flow leaves the domains
then zero traction
else substract a traction term depending on the normal component of the in-going velocity, local to the considered face.
The adding term is an outward traction pushing the flow in the outward normal direction.
In grooveBC, I tried something like :

Code:
type groovyBC;
variables"n=normal()/mag(normal());Unn=U&normal()*n;K=10;";
gradientExpression      "((phi>0) ? vector(0,0,0) : Unn)";
fractionExpression "0";
value uniform (0 0 0);
I tried for different values of K and always end up diverging (most of the time later than if I were using only zeroGradient). Does any of you have an idea on how to improve this ?

Best regard,
Florian

Last edited by Hiroshiman; April 6, 2014 at 18:37.
Hiroshiman is offline   Reply With Quote

Old   April 10, 2014, 14:25
Default
  #2
Member
 
Join Date: Sep 2012
Posts: 51
Rep Power: 14
Hiroshiman is on a distinguished road
Any swak users here have an idea on how to impose a custom traction BC ?
Hiroshiman is offline   Reply With Quote

Old   April 11, 2014, 09:29
Default
  #3
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Hiroshiman View Post
Hi,
I'm running OpenFOAM on cases with backflow occuring at outlets at some times ; it is a physiological flow and therefore cannot be avoided and I cannot change the geometry adding outlet extrusions.
On outlets the pressure is imposed (thanks Groovy) and the zeroGradient BC is used for velocity. When backflow occurs, OpenFOAM offers BCs like pressureNormalInletOutletVelocity but it's neither enough nor desirable to have a normal velocity entering the domain.

One idea and what I'm trying to do :
if flow leaves the domains
then zero traction
else substract a traction term depending on the normal component of the in-going velocity, local to the considered face.
The adding term is an outward traction pushing the flow in the outward normal direction.
In grooveBC, I tried something like :

Code:
type groovyBC;
variables"n=normal()/mag(normal());Unn=U&normal()*n;K=10;";
gradientExpression      "((phi>0) ? vector(0,0,0) : Unn)";
fractionExpression "0";
value uniform (0 0 0);
I tried for different values of K and always end up diverging (most of the time later than if I were using only zeroGradient). Does any of you have an idea on how to improve this ?
I feel a bit stupid when looking at the equation: I don't see where K is used so it doesn't surprise me that it has no effect.

I'm not sure whether an expression like this would help (gradients are really tricky and you give a zero-gradient in non-normal-direction which basically means "do what you want"). What might be better is giving some kind of dirichlet-condition where flow comes in (the way inletOutlet does)

BTW: normal() is already normalized
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 11, 2014, 17:42
Default
  #4
Member
 
Join Date: Sep 2012
Posts: 51
Rep Power: 14
Hiroshiman is on a distinguished road
Hi Gschaider,
OpenFOAM offers mixed boundary conditions like pressureNormalInletOutletVelocity but I wanted to add some kid of gradient penalisation on the backflow; Dirichlet conditions seem a bit too invasive for that. The term is to be backflow velocity dependant.
I'll switch to a Dirichlet condition in case of backflow, I'm doing some tests constraining the the profile to be parabolic when entering the domain with groovyBC.
And yes I forgot to multiply the corrective term by "K", my bad.
Thank you for your answers and groovyBC that makes it easy to create unnatural conditions.
Regards.

Last edited by Hiroshiman; April 11, 2014 at 22:08.
Hiroshiman is offline   Reply With Quote

Old   April 13, 2014, 08:56
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Hiroshiman View Post
Hi Gschaider,
OpenFOAM offers mixed boundary conditions like pressureNormalInletOutletVelocity but I wanted to add some kid of gradient penalisation on the backflow; Dirichlet conditions seem a bit too invasive for that. The term is to be backflow velocity dependant.
I'll switch to a Dirichlet condition in case of backflow, I'm doing some tests constraining the the profile to be parabolic when entering the domain with groovyBC.
And yes I forgot to multiply the corrective term by "K", my bad.
Thank you for your answers and groovyBC that makes it easy to create unnatural conditions.
Regards.
OK. Did the K improve things?

Anyway. It is quite hard to do stabilisation stuff "over the net" (usually the way how it diverges gives an idea how to stabilize it) so you're on your own here. Just one idea: Have a look at storedVariables. What you could do is store the penalisation (Dirichlet or Neuman) from the last time-step and when you calculate a new one use this to "underrelax" it (basically mix old and new one). That might improve things as the correction won't "overreact" (which might lead to oscillations that might diverge)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 21, 2014, 11:50
Default
  #6
Member
 
Join Date: Sep 2012
Posts: 51
Rep Power: 14
Hiroshiman is on a distinguished road
Hi,
I ran some tests with various values of K and now the solution is pretty stable, even on a complex case (artery with one inlet and 8 outlets) with an important backflow.
I think I should make K a function of the normal to the wall velocity of the fluid incoming to give a more proportional correction.
I haven't noticed any oscillation yet but I keep with me the idea of using storedVariable for underrelaxing the solution, thank you for the idea.

Best regards,
Florian
Hiroshiman is offline   Reply With Quote

Old   May 27, 2014, 00:53
Default
  #7
Member
 
Nadish Saini
Join Date: Feb 2014
Location: Raleigh, North Carolina
Posts: 39
Rep Power: 12
90nash is on a distinguished road
Greetings Hiroshiman,

I am trying to simulate flow in a simple lung bifurcation (one inlet and two outlet with outlets of equal radii) with a parabolic velocity type profile at the inlet (fluctuating with a Womersley number of 4.3). I am using pressureNormalInletOutletVelocity BC at both the outlets. However the solution seems to diverge everytime (no matter what i use in the fvSchemes dictionary or even on employing relaxation factors). The solution diverges after the flow reverses at the outlets i.e. after time period of T/2.

I have been stuck on this problem for over a month and was playing around with different schemes. However your post has given me hope. Can you please explain the boundary condition that you have used and why using pressureNormalInletOutletVelocity does not work. I dont quite understand it. It seems using this BC seems to get you to a converged solution. I would really appreciate your help on the matter.

Many Thanks in Advance.
Best,
Nadish
90nash is offline   Reply With Quote

Old   June 9, 2014, 18:16
Default
  #8
Member
 
Join Date: Sep 2012
Posts: 51
Rep Power: 14
Hiroshiman is on a distinguished road
Hi 90nash,
sorry for the late reply.
First, pressureNormalInletOutletVelocity bc works quite well as long as the flow reversal happens where the flow isn't too perturbed. Typically adding extrusions at your outlets will make the simulation stable most of the time.
If for some reason you do not want to use extrusion, there are few solutions. They are the least thing to do but can help. Read this article:
A comparison of outlet boundary treatments for prevention of backflow divergence with relevance to blood flow simulations DOI: 10.1007/s00466-011-0599-0
The proposed condition is derived from an article from Bazilevs and conceived from and for finite-element but I tried to adapt the idea here in OpenFOAM.
The concept is to use groovyBC to apply a zeroGradient bc whenever the flow exit the domain and a Neumann bc when it enters the domain. The idea it to give convective "information" to the entering flow, the gradient value being a function of the incoming velocity normal to the cell. It is local to every boundary faces.
This is not complex but a personal interpretation of the article, use at your own risk.
Florian
Hiroshiman is offline   Reply With Quote

Old   June 11, 2014, 17:43
Default
  #9
Member
 
Nadish Saini
Join Date: Feb 2014
Location: Raleigh, North Carolina
Posts: 39
Rep Power: 12
90nash is on a distinguished road
Hello Hiroshiman,

Thank you for your reply. The article that you provided is highly illuminating! Apparently divergence due to backflow is quite a common problem. I am trying to set up a case by employing stabilization at the outlet as you did. I will share the results soon.

Meanwhile i had created a mesh with extended outlets.Using pressureNormalInletOutletVelocity at the extended outlets did solve my problem. The only problem that i am facing now is at the inlet. After the flow reversal (exhalation phase, time period > 0.5) near the inlet i am getting bizarre velocity vectors. Similar to what i was getting at outlets before extending the geometry. Please see attached contour plot in which you can notice a "kink" near the inlet patch. I have also attached an image of how vectors look like. This region is far from my area of study (near bifurcation) so i may ignore this as long as it does not affect the result.

Can you guess what might be causing this "kink" at inlet and how to get rid of this?
Will extending the inlet further help remove this "kink"?

I am attaching the inlet velocity BC's i used:
Code:
    INLET
    {
        type            groovyBC;
        variables       "Uavg=0.343440945;yp=pos().y;zp=pos().z;R=max(zp);a=2*Uavg/(R*R);vel=((2*Uavg)-(a*((yp*yp)+(zp*zp))))*sin(3.14159265359*time());";// Time period=3 sec
        valueExpression "vector(vel, 0, 0)";
    }

    WALL
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }

    OUTLET1                                            
    {
        type            pressureNormalInletOutletVelocity;
        phi             phi;
        rho             rho;
        value           uniform (0 0 0);
    }

    OUTLET2
    {
        type            pressureNormalInletOutletVelocity;
        phi             phi;
        rho             rho;
        value           uniform (0 0 0);
    }
Attached Images
File Type: jpg nearInletContours.jpg (20.7 KB, 32 views)
File Type: jpg nearInletVectors.jpg (33.6 KB, 34 views)
90nash is offline   Reply With Quote

Old   June 11, 2014, 17:50
Default
  #10
Member
 
Join Date: Sep 2012
Posts: 51
Rep Power: 14
Hiroshiman is on a distinguished road
Your inlet velocity is set on the direction x ? Shouldn't it be on z (or face normal) ?
Hiroshiman is offline   Reply With Quote

Old   June 11, 2014, 17:57
Default
  #11
Member
 
Nadish Saini
Join Date: Feb 2014
Location: Raleigh, North Carolina
Posts: 39
Rep Power: 12
90nash is on a distinguished road
The inlet patch lies in the y-z plane and velocity is in the +x. I guess the coordinate at the bottom of image is confusing because of orientation. But if you notice carefully the patch is indeed in y-z.
90nash 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
[swak4Foam] Engine-pressure BC and velocity field (groovy) Tobi OpenFOAM Community Contributions 3 October 15, 2018 15:09
negative input for velocity inlet to make an outlet? Sipher FLUENT 1 June 24, 2015 03:51
Inlet & Outlet Velocity BC issue naiter OpenFOAM 3 December 19, 2012 08:14
velocity gradient issue in cfx rystokes CFX 3 November 29, 2010 01:43
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 10:11


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