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

[swak4Foam] VariableHeightFlowRateInletFlowVelocity altered using GroovyBC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 18, 2016, 08:31
Default VariableHeightFlowRateInletFlowVelocity altered using GroovyBC
  #1
New Member
 
Kate Bradbrook
Join Date: Nov 2015
Posts: 12
Rep Power: 10
KateBradbrook is on a distinguished road
The code for VariableHeightFlowRateInletFlowVelocity is:

scalar avgU = -flowRate_/gSum(patch().magSf()*alphap);
vectorField n(patch().nf());
operator==(n*avgU*alphap);

I cannot understand why avgU is multiplied by alphap.....

I have a function object to track the inflow (and also one for outflow to see when they have equalised):
volFlowIn
{
type swakExpression;
valueType patch;
patchName inlet;

verbose true;
aliases {
alphaWater alpha.water;
}
expression "alphaWater*U&normal()";
accumulations (integrate);
outputControl timeStep;
outputInterval 20;
}

And, predictably, this is always slighlty less than the flow rate I specify in boundary as the mass flow I calculate in any cell is effectively avgU*alphaWater^2 which is wrong in any cells where alphaWater<1.

I therefore made a GroovyBC to implement it as:
inlet
{
type groovyBC;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
valueFraction uniform 1;
value uniform (0 0 0);
valueExpression "-vel1*normal()";
gradientExpression "vector(0,0,0)";
fractionExpression "1";
evaluateDuringConstruction 0;
variables
3
(
"area1=sum(alphaWater*mag(Sf()));"
"flowRate1=650;"
"vel1= (alphaWater>1e-3) ? (flowRate1/area1) : 0;" //the threshold is arbitrary - need to check implications
);
timelines (
);
lookuptables (
);
aliases {
alphaWater alpha.water;
}
}

I would be very grateful for confirmation of my interpretation from experienced users to reassure me in what I have done, or an explanation as to why the code in VariableHeightFlowRateInletFlowVelocity is correct and my function object flow calc wrong!

Last edited by KateBradbrook; April 18, 2016 at 12:07.
KateBradbrook is offline   Reply With Quote

Old   April 26, 2016, 16:31
Default
  #2
New Member
 
Kate Bradbrook
Join Date: Nov 2015
Posts: 12
Rep Power: 10
KateBradbrook is on a distinguished road
OK. So I wrote: "I cannot understand why avgU is multiplied by alphap..... " I think it is for stability - my GroovyBC above introduces instabilities. So instead, I just adjust the velocities to account for the alphap^2 effect, so my variables become:

"area1=sum(alphaWater*alphaWater*mag(Sf()));"
"flowRate1=$inletFlowRate;"
"vel1= (flowRate1/area1)*alphaWater;"

So far, so good, but I'll post again if I need to revise further!
KateBradbrook 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] groovyBC for oscillatory flow liybzd OpenFOAM Community Contributions 5 November 12, 2018 07:53
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC zanilu70 OpenFOAM Community Contributions 4 December 13, 2016 06:46
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam dani2702 OpenFOAM Community Contributions 0 November 17, 2016 03:30
[swak4Foam] groovyBC issue - k and epsilon sagnikmazumdar OpenFOAM Community Contributions 24 March 1, 2015 07:16
[swak4Foam] groovyBC and Eqn.setReference() benk OpenFOAM Community Contributions 3 June 2, 2011 08:49


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