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

groovyFlowRateInletVelocity

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 30, 2011, 10:15
Default groovyFlowRateInletVelocity
  #1
Member
 
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 14
robbirobocop is on a distinguished road
Well, I finally "installed" swak4Foam including groovyBC.
And here is what I wanna do with it - the solver I use is interFoam.

I have two inlets and two outlets.
The inlet velocities are defined by:

type flowRateInletVelocity;
flowRate 1;
value uniform (0 0 0);

Of course the inlet pressures are thereby of type zeroGradient.

On one outlet I wanna define zeroGradient for the velocity and fixedValue , value uniform 0 for the pressure (this is my steam outlet).

On the second outlet I wanna define the massFlowRate that actually goes into the two inlets. Since incompressible flows usually use the "volume" flowRate for this boundary, the volume flow rate of the inlets should be multiplied by the inlet density and then be divided by the outlet density, so the massbalance is zero.

I tried to do this by:

type groovyFlowRateInletVelocity;
flowRate 0;
flowRateExpression -2/densityIN*(alpha1*densitywater+(1-alpha1)*densitysteam)
value uniform (0 0 0);
variables (....)

Of course, "densityIN" is given and constant and the densities of steam and water are defined in "variables". When I start the simulation it blows up after a few timesteps.
So what I basically want is the mass balance to be valid.
By the way, the steam that goes out of the first outlet is provided by a third inlet that does not have to be considered for the "groovyFlowRateInletVelocity".

Any hints?
Or would it be recommended to rather use a zeroGradient boundary condition for the second outlet instead of the groovyFlowRateInletVelocity? By the way, both outlets are not on the same "height"...

Any kind of help would be appreciated. And yes I already tried to find myself a solution by reading a ton of posts

Last edited by robbirobocop; November 30, 2011 at 10:16. Reason: something was wrong
robbirobocop is offline   Reply With Quote

Old   November 30, 2011, 10:24
Default
  #2
Member
 
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 14
robbirobocop is on a distinguished road
just to get it somehow cleared I added an image.
Attached Images
File Type: jpg groovy.JPG (22.4 KB, 125 views)
robbirobocop is offline   Reply With Quote

Old   November 30, 2011, 10:33
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 robbirobocop View Post
Well, I finally "installed" swak4Foam including groovyBC.
And here is what I wanna do with it - the solver I use is interFoam.

I have two inlets and two outlets.
The inlet velocities are defined by:

type flowRateInletVelocity;
flowRate 1;
value uniform (0 0 0);

Of course the inlet pressures are thereby of type zeroGradient.

On one outlet I wanna define zeroGradient for the velocity and fixedValue , value uniform 0 for the pressure (this is my steam outlet).

On the second outlet I wanna define the massFlowRate that actually goes into the two inlets. Since incompressible flows usually use the "volume" flowRate for this boundary, the volume flow rate of the inlets should be multiplied by the inlet density and then be divided by the outlet density, so the massbalance is zero.

I tried to do this by:

type groovyFlowRateInletVelocity;
flowRate 0;
flowRateExpression -2/densityIN*(alpha1*densitywater+(1-alpha1)*densitysteam)
value uniform (0 0 0);
variables (....)

Of course, "densityIN" is given and constant and the densities of steam and water are defined in "variables". When I start the simulation it blows up after a few timesteps.
So what I basically want is the mass balance to be valid.
By the way, the steam that goes out of the first outlet is provided by a third inlet that does not have to be considered for the "groovyFlowRateInletVelocity".

Any hints?
Or would it be recommended to rather use a zeroGradient boundary condition for the second outlet instead of the groovyFlowRateInletVelocity? By the way, both outlets are not on the same "height"...

Any kind of help would be appreciated. And yes I already tried to find myself a solution by reading a ton of posts
Don't think that this is groovy-specific, but this may be just wishful thinking on my side

What I usually do if the simulation "blows up after a few timesteps" is modify controlDict so that ALL timesteps are written (well, actually I don't. pyFoamRunner.py does that for me) and have a look at the catastrophe evolving.

groovyFlowRateInletVelocity writes the flow rate that is passes to its parent-class flowRateInletVelocity, so the first thing would be to check there whether that looks reasonable.

Another favourite with interFoam is alpha: once it becomes negative anywhere it goes downhill

And of course the Courant-number: if that becomes >1 well before the catastrophe, then try limiting the maximum allowable timestep
gschaider is offline   Reply With Quote

Old   November 30, 2011, 10:40
Default
  #4
Member
 
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 14
robbirobocop is on a distinguished road
Actually the simulation is stable 2D and 3D. But with the "groovyFlowRateInletVelocity" it isn't. The thing is that after a few seconds the area that is initialized with a water level via using setFields (half of the area consists of water the other half of steam) is water empty.

So I barely need a "good" groovyFlowRateInletVelocity BC. If you consider that only water goes out of this domain you can simply just multiply the two inlet volume flows with the inlet density and divide it through the outlet density. But the liquid volume fraction might change in the course of time and therefore has to be regarded as well. So I have to consider alpha1 in my flowRateExpression and I don't know how to do so!
robbirobocop is offline   Reply With Quote

Old   November 30, 2011, 14:01
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 robbirobocop View Post
Actually the simulation is stable 2D and 3D. But with the "groovyFlowRateInletVelocity" it isn't. The thing is that after a few seconds the area that is initialized with a water level via using setFields (half of the area consists of water the other half of steam) is water empty.

So I barely need a "good" groovyFlowRateInletVelocity BC. If you consider that only water goes out of this domain you can simply just multiply the two inlet volume flows with the inlet density and divide it through the outlet density. But the liquid volume fraction might change in the course of time and therefore has to be regarded as well. So I have to consider alpha1 in my flowRateExpression and I don't know how to do so!
So we agree that the problem is not on a technical level, but with your formula. Two points:
- flowRateInletVelocity needs (if I remember it correctly) an input of the dimension [m^3/s] (or [kg/s] depending on the solver) and distributes that over the patch. Small outlet -> high velocity. Your expression is of the dimension [1] (unless the 2 has a dimension)
- again: write the first few timesteps. Have a look at the calculated flowRate. Reset the BC to plain flowRateInletVelocity and see if that "sucks" everything out too

Basically what you need is the total massFlow going in [kg/s] divided (not multiplied) with the area-weighted average density on the outlet [kg/m^3]
gschaider is offline   Reply With Quote

Old   December 1, 2011, 03:08
Default
  #6
Member
 
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 14
robbirobocop is on a distinguished road
Quote:
Originally Posted by gschaider View Post
So we agree that the problem is not on a technical level, but with your formula. Two points:
- flowRateInletVelocity needs (if I remember it correctly) an input of the dimension [m^3/s] (or [kg/s] depending on the solver) and distributes that over the patch. Small outlet -> high velocity. Your expression is of the dimension [1] (unless the 2 has a dimension)
- again: write the first few timesteps. Have a look at the calculated flowRate. Reset the BC to plain flowRateInletVelocity and see if that "sucks" everything out too

Basically what you need is the total massFlow going in [kg/s] divided (not multiplied) with the area-weighted average density on the outlet [kg/m^3]
Yep, flowRateInletVelocity needs an input of [m3/s] for incompressible and [kg/s] for compressible fluids (as far as I know).

The expression [flowRateExpression -2/densityIN*(alpha1*densitywater+(1-alpha1)*densitysteam)] actually works fine. Your first hint with a "smaller" timestep worked well. By the way, I keep working with adjustTimeStep all the time and just started with a smaller timestep, so thanks for that one.

What I basically need, and I think groovyBC example "average-t-junction" might be a first hint, is a step function like ANSYS CFX has. This step function should contain my "flowRateExpression" for a timestep > 1. However for the first timestep I would need another expression. Could this be figured out analogical to the "p0vsTime" file in "average-t-junction"? Or needs this "step function" a more complex integration into OpenFOAM?
robbirobocop is offline   Reply With Quote

Old   December 2, 2011, 06:04
Default
  #7
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 robbirobocop View Post
Yep, flowRateInletVelocity needs an input of [m3/s] for incompressible and [kg/s] for compressible fluids (as far as I know).
Judging from the dimension of phi interFoam goes for [m3/s]. But you probably already found that out
Quote:
Originally Posted by robbirobocop View Post
The expression [flowRateExpression -2/densityIN*(alpha1*densitywater+(1-alpha1)*densitysteam)] actually works fine. Your first hint with a "smaller" timestep worked well. By the way, I keep working with adjustTimeStep all the time and just started with a smaller timestep, so thanks for that one.
I usually recommend using a fixed timestep until you're sure that you got the physics right. Then you can blame the variable time-step for all further problems
Quote:
Originally Posted by robbirobocop View Post
What I basically need, and I think groovyBC example "average-t-junction" might be a first hint, is a step function like ANSYS CFX has. This step function should contain my "flowRateExpression" for a timestep > 1. However for the first timestep I would need another expression. Could this be figured out analogical to the "p0vsTime" file in "average-t-junction"? Or needs this "step function" a more complex integration into OpenFOAM?
Easies step function would be (but I don't know th definition according to CFX)

(time()>1 ? 1 : 0)*some other epression

Having a different expression JUST FOR THE FIRST TIMESTEP is tricky.

Datafiles like p0vsTime are possible in groovyBC (they're called timelines. For an example see the wobbler-case)
gschaider is offline   Reply With Quote

Old   December 2, 2011, 10:29
Default
  #8
Member
 
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 14
robbirobocop is on a distinguished road
What would be even easier if one would know how it is figured out properly is to just "overwrite" one mass / volume flow from one patch over another.

So that whatever goes out of the outlet comes into the inlet.

So kind of a cyclic patch... I tried to do it like:

surfaceScalarField rhoPhi.boundaryField(INLET) = surfaceScalarField rhoPhi.boundaryField(OUTLET)

So the massflow that goes out of the outlet is assigned to the inlet for the next timestep.
(This line is added in the createFields.H)...
This "easy" way did not do the task that it was supposed to do...
robbirobocop 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



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