|
[Sponsors] |
November 30, 2011, 11:15 |
groovyFlowRateInletVelocity
|
#1 |
Member
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 15 |
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 11:16. Reason: something was wrong |
|
November 30, 2011, 11:24 |
|
#2 |
Member
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 15 |
just to get it somehow cleared I added an image.
|
|
November 30, 2011, 11:33 |
|
#3 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
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 |
||
November 30, 2011, 11:40 |
|
#4 |
Member
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 15 |
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! |
|
November 30, 2011, 15:01 |
|
#5 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
- 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] |
||
December 1, 2011, 04:08 |
|
#6 | |
Member
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 15 |
Quote:
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? |
||
December 2, 2011, 07:04 |
|
#7 | |||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Quote:
Quote:
(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) |
||||
December 2, 2011, 11:29 |
|
#8 |
Member
Rob
Join Date: Sep 2011
Posts: 55
Rep Power: 15 |
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... |
|
|
|